0

The new order email template is rendering everything except the contents of the order. I've tested that I'm looking at the correct template by adding in dummy text so I'm definitely in the right place.

This is how the template was trying to call it by default, which doesn't work:

{{layout handle="sales_email_order_items" order=$order}}

I've tried a few other ways of calling the block also such as:

{{block type="sales_email_order_items" order=$order}}

{{block type="sales_email_order_items" order=$order}}

{{block type="sales/email_order_items" template="email/order/items.phtml"  order=$order}}

These clearly didn't work, or I wouldn't be posting here. Can anyone advise on what might be the problem.

3

The issue came down to a conflict. The {{layout handle="sales_email_order_items" order=$order}} wasn't working because the block it was trying to load - sales/order_email_items was being extended by a module that had been disabled.

I tested the sales_email_order_items handle by removing what was in it by default and adding a call to a file just containing static text, which worked. From here I realised that there must be a bug in the blocks it was trying to load and found that I needed to delete the configuration file completely rather than just disable the module of the offending module to stop the conflict.

1
  • I see that everything is working! Good luck – zhartaunik Apr 28 '15 at 14:56
0

If magento recommend use layout here, why don't you use it? There is only two places where magento uses {{block directive.

{{block type='core/template' area='frontend' template='email/order/shipment/track.phtml' shipment=$shipment order=$order}}

According to your solution the most relevant is

{{block type="sales/email_order_items" template="email/order/items.phtml"  order=$order}}

(you forgot '}' symbol)


Do you have such class in your magento? Sales/Block/Email/Order/Items.php ? I don't have.

Show us the result of the script:

<?php

require_once("app/Mage.php");
umask(0);
Mage::app();

error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
Mage::init();

$object1 = Mage::app()->getLayout()->createBlock('core/template');
$object2 = Mage::app()->getLayout()->createBlock('sales/email_order_items');

echo "Test Object: " . get_class($object1) . "<br />";
echo "Your Object: " . get_class($object2) . "<br />";
3
  • I don't understand your point, if magento recommends using layout here? Layout, combined with the block I've set, isn't working so I've tried a couple other methods without success. Why are you referencing email/order/shipment/track.phtml? None of these work. – develophper Apr 24 '15 at 14:36
  • Show us the result of the script from above – zhartaunik Apr 24 '15 at 14:43
  • you were correct that sales/email_order_items doesn't exist. The issue is that the default call in the template {{layout handle="sales_email_order_items" order=$order}} doesn't render anything. The bottom three block calls were just me testing. This - {{layout handle="sales_email_order_items" order=$order}} isn't custom. – develophper Apr 24 '15 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.