4

I try to get the full SKU for configurable products with custom options in transactional emails. By default this works great in the shopping cart.

For example, I have a configurable product with SKU 'Test product' and one custom option with the SKU 'CUSTOMOPT1'. The associated simple product has SKU 'Test product - Color 1.

In the shopping cart the SKU is ok: 'Test product - Color 1-CUSTOMOPT1'. Unfortunately, in the transactional emails the SKU is 'Test product - Color 1' (without the SKU of the selected custom option).

How I can get the full SKU (just like in shopping cart) in the transactional emails?

1 Answer 1

0

When Magento converts the quote object to the order object it does not save the configurable products SKU in the sales_flat_order_item table, so you can not get the configurable product SKU from there.

Whenever Magento saves configurable products into order objects, it saves two rows.

  1. One row:

    configurable product id / no parent product Item / child sku with custom option sku

  2. Another

    simple product id / parent product item / child product sku

When Magento sends mails, it calls the following code

 $_items=$_order->getItemsCollection();

<?php foreach ($_items as $_item): ?>
        <?php if ($_item->getParentItem()) continue; ?>

...

<?php endforeach; ?>
3
  • Thank you for your comment. So it is not possible to get the correct format in the transactional emails?
    – Michael
    Commented Oct 15, 2014 at 19:24
  • Try to load product by product id.....
    – Amit Bera
    Commented Oct 15, 2014 at 19:26
  • or you can get a product sku from the product id without a full load Commented Jan 23, 2015 at 17:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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