0

I'm new to magento. The problem that I have is that I want to modify the template of a transactional email.

It's basically a return that I want the customer to receive a different email if the return is "rejected" or "approved".

I tried to modify the code with an if but realize that it doesn't let me compare strings. Only it says if the variable is TRUE or FALSE

{{if order.delivery_time=="10"}} is not possible.

I can't touch the code because it has a comment that says that if the Magento version gets updated, the file will be completely overwritten.

So, I thought about creating a block, which I don't have a clear understanding on how to do it.

I think it is something like this...

{{block type="cms/block" block_id="this_block" template="cms/content.phtml"}}

But my question is.... What should I write in the template section? and what about the block id section?

I'm sorry but I'm a begginer. If you give me a hint, I'll be very grateful.

Thanks.

0

In your example:

{{block type="cms/block" block_id="this_block" template="cms/content.phtml"}}

Where type is the required attribute. cms/block, cms reffers to app/code/core/Mage/Cms/Block and block reffers to Block class. So for cms/block, actual class is app/code/core/Mage/Cms/Block/Block. template is the output phtml template location. block_id reffers to, you can access this value inside block class or corresponding phtml template class using

$this->getBlockId()

If you open following class:

app/code/core/Mage/Cms/Block/Block.php

Check following code snippet:

/**
 * Prepare Content HTML
 *
 * @return string
 */
protected function _toHtml()
{
    $blockId = $this->getBlockId();
    $html = '';
    if ($blockId) {
        $block = Mage::getModel('cms/block')
            ->setStoreId(Mage::app()->getStore()->getId())
            ->load($blockId);
        if ($block->getIsActive()) {
            /* @var $helper Mage_Cms_Helper_Data */
            $helper = Mage::helper('cms');
            $processor = $helper->getBlockTemplateProcessor();
            $html = $processor->filter($block->getContent());
            $this->addModelTags($block);
        }
    }
    return $html;
}

$blockId = $this->getBlockId(); take the block id and loaded cms block.

Now open following the corresponding template: app/design/frontend/base/default/template/cms/content.phtml

| improve this answer | |
  • THANK very much! I don't have my PC here, but I'll try tomorrow as soon as I can. As I said, I'm very new to the Magento world. Where should I write the code? Let's say that I want to add an IF statement, where should I put it? What file? what part? THANKS again!!! – dragon25 May 26 '19 at 11:42
  • I'm using Magento 1.9 I forgot to clarify – dragon25 May 26 '19 at 11:43

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.