2

I am trying to display configurable options in a custom product view page. I have added following code to page but I am getting an error:

Code:

 <?php $_attributes = Mage::helper('core')->decorateArray($_product->getTypeInstance(true)->getConfigurableAttributes($_product));?>
<?php if ($_product->isSaleable() && count($_attributes)):?>
<dl>
<?php foreach($_attributes as $_attribute): ?>
<dt><label class="required"><em>*</em><?php echo $_attribute->getLabel() ?></label></dt>
<dd<?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>>
<div class="input-box">
<select name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select">
<option><?php echo $this->__('Select...') ?></option>
</select>
 </div>
</dd>
<?php endforeach; ?>
</dl>
<script type="text/javascript">
var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>);
</script>
<?php endif;?>

Error: TypeError:
this.config is undefined

this.taxConfig = this.config.taxConfig;

I need help in solving this issue.

Thanks in advance.

  • You're missing Javascript. Compare the scripts loaded in the <head> on your custom page and on the default product page. – nachito Dec 16 '13 at 22:12
  • What is actually outputted by <?php echo $this->getJsonConfig() ?>, If you block is not of type or does not extend Mage_Catalog_Block_Product_View_Type_Configurable then you may find this information is missing. – David Manners May 20 '14 at 9:40
2

If you block is not of type Mage_Catalog_Block_Product_View_Type_Configurable then you could find that the function getJsonConfig is not being set-up correctly.

You should check your block type and also the return value of the function call.

| improve this answer | |

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.