以下是我的可配置产品的屏幕截图,它具有两个简单的产品正确关联:

enter image description here

可见的产品是可见的(目录/搜索),并且简单产品单独可见。

当我去查看可配置的产品时,我发现我确实看到了一个“选择大小”选项,但由于某种原因没有内部的选项。

以下是屏幕截图:

enter image description here

有谁知道会导致这一点?

我没有编辑或覆盖任何核心文件,但我确实注意到这些选项是由foreach循环输入的。

代码如下:(前端/base/default/template/catalog/product/view/options/configurable.phtml)

<?php
$_product    = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
?>
<?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->__('Choose an Option...') ?></option>
                  </select>
              </div>
        </dd>
    <?php endforeach; ?>
    </dl>
    <script type="text/javascript">
        var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>);
    </script>
<?php endif;?>

更新:

我试图调试此问题,并注意到在具有自己的设计主题的另一个商店视图上,可配置的产品正常工作。我还注意到,在我的原始设计主题上,添加到购物车按钮不起作用。我认为也许一些JavaScript正在干扰,然后删除了我的local.xml文件,其中包括我所有的外部JS脚本,一切正常。现在...弄清楚什么是什么是导致错误。

有帮助吗?

解决方案

问题是我在没有将其置于任何冲突模式下添加了jQuery。

我的local.xml代码现在如下:

<reference name="head">
        <block type="core/text" name="jquery.cdn.google">
            <action method="setText">
                <text><![CDATA[<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>]]></text>
            </action>
        </block>
        <block type="core/text" name="google.jquery.noconflict" after="google.jquery">
            <action method="setText">
                <text><![CDATA[<script type="text/javascript">var $j = jQuery.noConflict(); </script>]]></text>
            </action>
        </block>

        .... 

希望这对某人有帮助!

许可以下: CC-BY-SA归因
scroll top