I have been working on adding custom options on product category listing page. w.r.t here.

My code for display options list.phtml

<div class="actions">
<form action="<?php echo $this->getAddToCartUrl($_product); ?>" method="post" id="product_addtocart_form" <?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
    <?php if ($_product->isConfigurable()): ?>
        <?php echo $this->getLayout()->createBlock('catalog/product_view_type_configurable', array('template'=> 'catalog/product/view/type/configurable_category.phtml'))->toHtml(); ?>
    <?php endif; ?>

I am getting error like.

Fatal error: Call to a member function toHtml() on null in app/design/frontend/mytheme/default/template/catalog/product/list.phtml on line 154

where i am creating a mistake please correct me why the configurable_category.phtml template file is not loading.

please help


1 Answer 1


Use below syntex

<?php echo $this->getLayout()->createBlock('catalog/product_view_type_configurable')->setTemplate('catalog/product/view/type/configurable_category.phtml')->toHtml(); ?>
  • Hello Jaimin i used your syntax but i am getting another error like Call to a member function getTypeInstance() on null in Aug 4, 2016 at 10:04

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.