How can we add a border for the tbody of a specific product in the products table of order email template?

enter image description here


it depends on how you know a product is a "specific" product. If, for example, this product has a special sku special-sku, then you can achieve it by modifying your custom /email/order/items/order/default.phtml template (copy the file app/design/frontend/base/default/template/email/order/items/order/default.phtml in your theme).

In this template, you can get the product infos with $_product = $_item->getProduct();.

Then you can decide to add a border or whatever you want by testing with :

<?php if($_product->getSku() == 'special-sku'): ?>
// Add custom design here
<?php endif; ?>

You can do the same thing in a custom email/order/items.phtml template (here is the tbody declaration).

Edit : after writing this, I just saw that the Mage_Sales_Model_Order_Item has a getSku() method : so, you don't even have to get the product with the $_item->getProduct() call. You can just test with a if($_item->getSku() == 'special-sku'). I don't erase my first message because the $_item->getProduct() call could be usefull if you have to check if a product is a special product with any other specific attribute.

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.