首页 文章

为什么我的(可配置产品)选项/属性不显示在产品页面上?

提问于
浏览
0

Magento ver . 1.5.1.0

我有一个属性设置“服装”

集合中有两个属性:“大小”和“颜色”

尺寸是必需的,颜色是可选的(即并非所有产品都有任何颜色选项) .

我已经创建了一些设置了Size的Simple Products,但Color只有空值 .

在相关可配置产品的产品页面上,未显示任何选项输入!在产品view.phtml中,如果我回显$ this-> hasOptions(),它会打印一个空字符串,即False .

如果我将Color设置为非空值,则产品页面上将显示两个选择框,并且echo $ this-> hasOptions()将打印1,即True .

这对我来说没有意义,不知道什么是失败的?

1 回答

  • 3

    我正在与类似的东西挣扎,并注意到你所描述的类似行为 .

    首先检查产品是否可以正确配置 . 这是从SO中的另一篇文章中获取的,意味着是控制器的一部分 . 把它放在前端../template/catalog/product/view.phtml只是为了检查 .

    <?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 "
    "; } } ?>

    作为答案,我认为您在自定义选项和可配置产品之间变得混乱 .

相关问题