Skip to main content
7 events
when toggle format what by license comment
Mar 18, 2019 at 16:22 comment added HaFiz Umer yes got it ! understand thank you
Mar 18, 2019 at 15:45 comment added HelgeB In the case of the invoice you need to add your code after register, because the register calls for each items are fired within the invoice register method. Therefore before the invoice register method your items do not have the current seller id. Just look at the code of Magento\Sales\Model\Order\Invoice::register() and you will understand why you need the after plugin in this case.
Mar 18, 2019 at 15:35 vote accept HaFiz Umer
Mar 18, 2019 at 15:35 comment added HaFiz Umer HelgeB ! it work fine . Thank you Dear. Actually i was use beforeRegister() plugin . i just use now afterRegister it work fine. in my last question you own say you can use before or after plugin thats why i replace after with before and get error. I don't why can you explain why we can't use beforeRegister plugin ? Thanks
Mar 18, 2019 at 15:08 comment added HelgeB I don't know hat happens in your code, the error you have posted is about the beforeRegister() method in the item not in a afterRegister method for the invoice as proposed in the answer. Also I wouldn't suggest to use afterGetAllItems() but afterRegister as posted in my answer.
Mar 18, 2019 at 15:02 comment added HaFiz Umer HelgeB ! i try this solution. in this plugin use $result->getAllItems(). Dear i use plugin of this method(getAllItems()) . public function afterGetAllItems(\Magento\Sales\Model\Order\Invoice $subject,$items) generate error in the method define line. Error is ` Uncaught ArgumentCountError: Too few arguments to function Codility\VendorOrder\Plugin\Item::beforeRegister(), 1 passed in /var/www/html/codility-magento-market-place/vendor/magento/framework/Interception/Interceptor.php on line 121 and exactly 2 expected `
Mar 18, 2019 at 13:48 history answered HelgeB CC BY-SA 4.0