- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2022
10:46 PM
05-26-2022
10:46 PM
Order Email not showing itemized list - Magento 2.4.3-p2
Hi,
After upgrading mangeto to 2.4.3-p3 version all the order emails are not showing the items in the emails.
Does anyone have come across such an issue and had a solution?
I can see https://community.magento.com/t5/Magento-2-x-Technical-Issues/Order-Email-not-showing-itemized-list-... but that's for magento2.3.4 version and solutions on that tread does not help.
Thanks,
Labels:
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2022
01:38 AM
12-07-2022
01:38 AM
Re: Order Email not showing itemized list - Magento 2.4.3-p2
Hello,
were you able to fix this problem.. i am getting the same in 2.3.7-p5
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2022
03:28 AM
12-07-2022
03:28 AM
Re: Order Email not showing itemized list - Magento 2.4.3-p2
Hi,
We never end up getting any ideal solution at that time and ended up with
custom function to override the order template. Cannot share whole files
but do check the below code as a pointer on how to get the order items and
product information.
// Get the order items
$items = $order->getAllItems();
$productName = [];
$productOption = [];
// Creating table with items info
$product_grid = '
style="border: solid 1px lightblue;text-align: center;background:
#e4efff;"> Name Qty ';
foreach ($items as $i => $item) {
//$productName[$i] = $item->getData('name').' QTY: '.$item->getData('qty');
//$productName[$i] = json_encode($item); // for debug
$product = $this->_productRepositoryFactory->create()
->getById($item->getProductId());
$img_url = $this->_storeManager->getStore()->getBaseUrl().'
pub/media/catalog/product'.$product->getData('thumbnail');
// get product options
$productOption[$i] = $item->getProduct()->getTypeInstance(true)->
getOrderOptions($item->getProduct());
//$productName[$i] = $item->getData('name');
$productOptionlabel = [];
$productOptionvalue = [];
if ($productOption) {
foreach ($productOption as $k => $option) {
if (isset($option['options'])) {
$productOptionlabel[$k] = $option['options'][0]['label'];
$productOptionvalue[$k] = $option['options'][0]['value'];
}
}
}
$product_grid .= ' ';
$product_grid .= ' ';
$product_grid .= ' ';
$img_url = '';
}
$product_grid .= '
';
// now add this table to email template
I hope this helps.
Thanks,
We never end up getting any ideal solution at that time and ended up with
custom function to override the order template. Cannot share whole files
but do check the below code as a pointer on how to get the order items and
product information.
// Get the order items
$items = $order->getAllItems();
$productName = [];
$productOption = [];
// Creating table with items info
$product_grid = '
style="border: solid 1px lightblue;text-align: center;background:
#e4efff;"> Name Qty ';
foreach ($items as $i => $item) {
//$productName[$i] = $item->getData('name').' QTY: '.$item->getData('qty');
//$productName[$i] = json_encode($item); // for debug
$product = $this->_productRepositoryFactory->create()
->getById($item->getProductId());
$img_url = $this->_storeManager->getStore()->getBaseUrl().'
pub/media/catalog/product'.$product->getData('thumbnail');
// get product options
$productOption[$i] = $item->getProduct()->getTypeInstance(true)->
getOrderOptions($item->getProduct());
//$productName[$i] = $item->getData('name');
$productOptionlabel = [];
$productOptionvalue = [];
if ($productOption) {
foreach ($productOption as $k => $option) {
if (isset($option['options'])) {
$productOptionlabel[$k] = $option['options'][0]['label'];
$productOptionvalue[$k] = $option['options'][0]['value'];
}
}
}
$product_grid .= ' ';
$product_grid .= ' ';
$product_grid .= ' ';
$img_url = '';
}
$product_grid .= '
'.$item->getData('name').' SKU: '.$item->getSku(); if (!empty($productOptionvalue)) { $product_grid .= '
foreach ($productOptionvalue as $option) { $options = explode(',', $option); foreach ($options as $each_option) { $product_grid .= ' } } $product_grid .= ' } $product_grid .= ' | '.$item->getData('qty').' |
';
// now add this table to email template
I hope this helps.
Thanks,