why don’t my (Configurable Product) options/attributes show on product page?
Magento ver. 1.5.1.0
I have an attribute set “clothing”
There are two attributes in the set: “size” and “colour”
Size is required, colour is optional (i.e. 开发者_StackOverflownot all products have any colour options).
I have created some Simple Products where the Size is set but Colour just has the empty value.
On the product page for the relevant Configurable Product no option inputs are shown! And in the product view.phtml if I echo $this->hasOptions() it prints an empty string, ie False.
If I set the Colour to a non-empty value then both select boxes are shown on the product page and echo $this->hasOptions() prints 1, ie True.
This doesn’t make sense to me, not sure what is failing?
Im struggling with something similar and have noticed similar behavior to what you have described.
Check first if the product is actually properly configurable. this is taken from another post in SO and was meant to part of a controller. Drop this on the front end ../template/catalog/product/view.phtml just to check.
<?php
$_helper = $this->helper('catalog/output');
$_product = $this->getProduct();
?>
<?php
if ($_product->isConfigurable()) {
$configurable = $_product->getTypeInstance();
$attributes = $configurable->getConfigurableAttributes($_product);
foreach ($attributes as $attribute) {
print $attribute->getLabel();
print "<br />";
}
}
?>
so as an answer i think you are becoming confused between custom options and configurable products.
精彩评论