magento2: Error While send Invoice with Grouped Products
Steps to reproduce
- Install Magento from
developbranch. - Add some Grouped Product to cart.
- Place an order with the grouped product.
- Go to admin.
- Go to Sales>Orders and open de current order with the grouped product.
- Go to Invoice and select the “Email Copy of Invoice” checkbox.
- Press “Submit Invoice”.
Expected result
- Invoice the order.
- Send the copy email to client.
Actual result
- Order is invoiced.
- An error occurs with the price and send email fails.
The error from report:
AH01071: Got error 'PHP message: PHP Fatal error: Uncaught TypeError: Argument 1 passed to Magento\\Sales\\Block\\Order\\Email\\Items\\Order\\DefaultOrder::getItemPrice() must be an instance of Magento\\Sales\\Model\\Order\\Item, instance of Magento\\Sales\\Model\\Order\\Invoice\\Item given, called in /var/www/vhosts/superpiensos.com/development/vendor/magento/module-sales/view/frontend/templates/email/items/invoice/default.phtml on line 34 and defined in /var/www/vhosts/superpiensos.com/development/vendor/magento/module-sales/Block/Order/Email/Items/Order/DefaultOrder.php:97\nStack trace:\n#0 /var/www/vhosts/superpiensos.com/development/vendor/magento/module-sales/view/frontend/templates/email/items/invoice/default.phtml(34): Magento\\Sales\\Block\\Order\\Email\\Items\\Order\\DefaultOrder->getItemPrice(Object(Magento\\Sales\\Model\\Order\\Invoice\\Item))\n#1 /var/www/vhosts/superpiensos.com/development/vendor/magento/framework/View/TemplateEngine/Php.php(59): include('/var/www/vhosts...')\n#2 /var/www/vhosts/superpiensos.com/development/vendor/magento/fr...\n', referer: http://magento.superpiensos.com/admin_superp/sales/order_invoice/new/order_id/92/key/a6d27d6abf43f83c88d6e6be59095107f13ef4b74420fb3697e35953217a52ac/
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 1
- Comments: 23 (11 by maintainers)
Commits related to this issue
- grouped product email problem https://github.com/magento/magento2/issues/5105 — committed to jaykobi/magento2 by deleted user 7 years ago
- MAGETWO-81340: Fix for issue #5105 - Error While send Invoice with Grouped Products #11297 - Merge Pull Request magento/magento2#11297 from michielgerritsen/magento2:5105_email_invoice - Merged com... — committed to magento/magento2 by deleted user 7 years ago
- MAGETWO-81340: Fix for issue #5105 - Error While send Invoice with Grouped Products #11297 — committed to magento/magento2 by deleted user 7 years ago
Same error 2.1.5
Fatal error: Uncaught TypeError: Argument 1 passed to Magento\Sales\Block\Order\Email\Items\Order\DefaultOrder::getItemPrice() must be an instance of Magento\Sales\Model\Order\Item, instance of Magento\Sales\Model\Order\Invoice\Item given, called in /var/www/html/vendor/magento/module-sales/view/frontend/templates/email/items/invoice/default.phtml on line 34 and defined in /var/www/html/vendor/magento/module-sales/Block/Order/Email/Items/Order/DefaultOrder.php:97 Stack trace: #0 /var/www/html/vendor/magento/module-sales/view/frontend/templates/email/items/invoice/default.phtml(34): Magento\Sales\Block\Order\Email\Items\Order\DefaultOrder->getItemPrice(Object(Magento\Sales\Model\Order\Invoice\Item)) #1 /var/www/html/vendor/magento/framework/View/TemplateEngine/Php.php(59): include(‘/var/www/html/v…’) #2 /var/www/html/vendor/magento/framework/View/Element/Template.php(255): Magento\Framework\View\TemplateEngine\Php->render(Object(Magento\GroupedProduct\Block\Order\Email\Items\Order\Grouped), ‘/var/www/html/v…’, Array) # in /var/www/html/vendor/magento/module-sales/Block/Order/Email/Items/Order/DefaultOrder.php on line 97
Hi,
Btw - The problem is the Magento\Sales\Block\Order\Email\Items\Order\DefaultOrder::getItemPrice() method.
If you take off the Type hint OrderItem $item for the argument and just have:
it works fine
Hi @srbarba , thank you for your video. Internal ticket MAGETWO-54633 was created.