1

I call the block content like this:

{{block type='web4pro_abandonedcart/email_order_items' area='frontend' template='web4pro_abandonedcart/email/order/items.phtml' quote=$quote url}}

Here is what the content holds:

<?php
$_imageHelper = Mage::helper('catalog/image');
$_quote = $this->getQuote();
?>
<table cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;">
    <thead>
    <tr>
        <th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Item') ?></th>
        <th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Sku') ?></th>
        <th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Image') ?></th>
        <th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Qty') ?></th>
        <th align="right" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Subtotal') ?></th>
    </tr>
    </thead>
    <?php if (is_object($_quote)) :?>
        <?php $i=0; foreach ($_quote->getAllItems() as $_item):?>
            <?php if($_item->getParentItemId()) continue; else $i++; ?>
            <?php if($_item->getProductType() == 'configurable' || $_item->getProductType() == 'bundle') :
                $finalResult = array();
                $result = array();
                $options = $_item->getProduct()->getTypeInstance(true)->getOrderOptions($_item->getProduct());
                // Check for options
                if ($options) {
                    if (isset($options['options'])) {
                        $result = array_merge($result, $options['options']);
                    }
                    if (isset($options['additional_options'])) {
                        $result = array_merge($result, $options['additional_options']);
                    }
                    if (!empty($options['attributes_info'])) {
                        $result = array_merge($options['attributes_info'], $result);
                    }
                    if(isset($options['bundle_options'])) {


                        $bundled_product = new Mage_Catalog_Model_Product();
                        $bundled_product->load($_item->getProduct()->getId());
                        $selectionCollection = $bundled_product->getTypeInstance(true)->getSelectionsCollection(
                            $bundled_product->getTypeInstance(true)->getOptionsIds($bundled_product), $bundled_product
                        );

                        $bundled_items = array();
                        $label = '';
                        $qty = '';
                        foreach($selectionCollection as $option)
                        {
                            foreach($options['bundle_options'] as $bundle){
                                if($bundle['value'][0]['title'] == $option->getName()){
                                    $label = $bundle['label'];
                                    $qty = $bundle['value'][0]['qty'];
                                    $aux_options[] = array('label' => $label, 'value' => $qty .' x '. $option->getName() .' '. Mage::helper('checkout')->formatPrice($option->getPrice()), 'sku' => $option->getSku());
                                }

                            }
                        }

                        $result = array_merge($result, $aux_options);
                    }
                }
                $options = array_merge($finalResult, $result);
            endif; ?>
            <tbody<?php echo $i%2 ? ' bgcolor="#F6F6F6"' : '' ?>>
            <tr>
                <td valign="top" align="left" style="padding:3px 9px">
                    <?php echo $_item['name'];?>
                <?php if(isset($options) && is_array($options)) :?>
                    <?php foreach($options as $option) :?>
                        <br /><strong><em><?php echo $option['label'];?> </em></strong> <?php echo $option['value'];?>
                        <?php if(isset($option['sku'])) :?>
                            <?php echo ' ' . $option['sku'];?>
                        <?php endif; ?>
                    <?php endforeach; ?>
                    <?php $options = null; ?>
                <?php endif; ?>
                </td>
                <td valign="top" align="left" style="padding:3px 9px"><?php echo $_item['sku'];?></td>
                <td valign="top" align="left" style="padding:3px 9px">
                    <a href="{{var url}}"><img src="<?php echo $_imageHelper->init($_item->getProduct(), 'thumbnail');?>"/>
                    </a>
                </td>
                <td valign="top" align="center" style="padding:3px 9px"><?php echo $_item['qty'];?></td>
                <td valign="top" align="right" style="padding:3px 9px"><?php echo $this->getTax($_item);?></td>

            </tr>
            </tbody>
        <?php endforeach; ?>
    <?php endif;?>
</table>

After the update when we try to display the content via {{block type='web4pro_abandonedcart/email_order_items' area='frontend' template='web4pro_abandonedcart/email/order/items.phtml' quote=$quote url}} it's just not working.

Do you have any idea or suggestion ?

Thanks in advance!

0

1 Answer 1

2

Since 1.9.2.2 you need to allow blocks and variables to be used inside CMS pages or email templates.

You can do so by accessing System > Permissions > Blocks, click on Add a new block.

In the block input field you must type web4pro_abandonedcart/email_order_items and set the is allowed field to true.

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