0

I have made a custom wishlist extension, based on Mage_Wishlist (it's a copy of Mage_wishlist).

In checkout/cart.phtml and /checkout/cart/item/default.phtml, this piece of code creates my own custom wishlist column:

<?php if ($this->helper('favorieten')->isAllowInCart()) : ?>
            <col class="col-wish" width="1" />

        <?php endif ?>

It works perfectly when my custom extension is enabled, but it breaks the template when it's disabled.

How do I correctly add the column, so it doesn't break the template when the extension is turned off?

It is important to me so I can first add / replace the templates, and then finally activate the extension.

1
<?php if (Mage::helper('core')->isModuleEnabled('[Namespace]_[Module]')) :  ?>
    <?php if ($this->helper('favorieten')->isAllowInCart()) : ?>
        <col class="col-wish" width="1" />
    <?php endif ?>
<?php endif;?>
0

I don't know why the piece of code of Marius didn't work, somehow it kept looking for the helper (which wasn't activated yet). I ended up with this, which is very similar, but worked.

<?php $moduleName = 'Namespace_Module'; ?>
<?php if (Mage::helper('core')->isModuleEnabled($moduleName)) : ?>
<?php if ($this->helper('favorieten')->isAllow()) : ?>
<col class="col-wish" width="1" />
<?php endif; ?>
<?php endif; ?>

Thank you for pointing me in the right direction Marius. I also got some info from this website: http://blog.chapagain.com.np/magento-check-if-a-module-is-installed-enabled-or-active/

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.