2012-06-27 35 views
1

請參閱:http://blog.4aal.nl/post/visualize-your-magento-attributes 我正在創建視覺屬性。創建視覺屬性時出現問題

我通過改變app/design/frontend/base/default/template/catalog/product/view/type/options/configurable.phtml

在configurable.phtml開始這個過程中,我代替:

<script type="text/javascript"> var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>); </script>

有:

<script type="text/javascript"> 
    jQuery("#attribute158").visualAttribute(); 
</script> 

在head標籤我包括: http://blog.4aal.nl/var/uploads/06/magento.visual.attribute.js

在我的前端進行了所有這些更改後,默認下拉選項被隱藏,但小框中的塊大小未顯示。我的頁面源只顯示<ul class="va_wrapper" id="va_wrapper_1" rel="attribute158"></ul>

唯一的問題是,它沒有顯示L1標籤....

我認爲問題是與放置在JScript文件的循環代碼。循環代碼如下所示:

//loop all stored options and create custom html 
     var pos = 0; 
     if (options.length) { 
      for (var index in options) { 
       if (!isNaN(index)) { 
        pos++; 
        var value = index; 
        var text = options[index].text; 
        options[index].position = pos; 
        if (!settings.useTitle) { 
         description = ''; 
        } 
        wrapper.append('<li title="' + description + '" class="opt_' + value + '"><a href="#' + value + '">' + text + '</a></li>'); 
       } 
      } 
     } 

我正在使用可配置產品。 請告訴我我的步驟有什麼問題。

回答

1

您不必更換configurable.phtml中的代碼。您只需在文件末尾添加以下代碼 。

<script type="text/javascript"> 
jQuery("#attribute<?php echo $_attribute->getAttributeId(); ?>").visualAttribute(); 
</script>