0

I like to add static Text fields (output not user input) between simple product's custom options. After long research I could find a proper extension or a solution for this..

The text parts will be different for each product.

  • You mean you couldn't find a solution? Is the text different for every product or for every attribute? Or both? Please explain EXACTLY what do you want to achieve. – Fabian Blechschmidt Aug 18 '13 at 8:24
  • The answer by Sander is correct, but doesn't work. Reason for that is because it is missing a closing bracket. it should be: if (!is_null($block->getContent())) – user18600 Dec 19 '14 at 1:53
1

I'm not 100% sure what you are trying but if you want a static block per product per custom option you should use the file frontend/base/default/template/catalog/product/view/options.phtml, copy it to your custom template directory and then add the following code to the bottom (replacing the old code starting from around line 189

   <?php foreach($_options as $_option): ?>
<?php 
    $block_id = "custom_opt_{$_option->getData('product_id')}_{$_option->getData('option_id')}";
    $block = Mage::getModel('cms/block')->load($block_id);
    if (!is_null($block->getContent())
    {
        echo $block->getContent();
    }
?>
        <?php echo $this->getOptionHtml($_option) ?>
    <?php endforeach; ?>
    </dl>
<?php endif; ?>

Now you can add a static block in the backend with the identifier custom_opt_[product_id]_[custom option id] which will be displayed above the corresponding custom option

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.