0
因爲我發現在Magento選項框中默認值這裏:Magento的屬性選項框默認值
/app/design/frontend/default/mytheme/template/catalog/product/view/type/options/configurable.phtml
<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>
它顯示「選擇選項...」作爲默認值
我試試
<script>
$(function() {
$("#attribute525 option:first-child").attr("selected", true); //color
$("#attribute272 option:first-child").attr("selected", true); //size
});
</script>
使默認值每個屬性設置爲第一個每個屬性的選項,
但它不起作用。
您好,感謝您對配置的選項爲了答案,但它還是像以前一樣向我展示'選擇一個選項...',還有另一種方式,那就是不使用硬編碼?歡呼聲@Slimshadddyyy – user3558854
你可以在這裏看到http://inchoo.net/ecommerce/magento/how-to-make-configurable-options-autoselected-on-configurable-product-view-page/ – Slimshadddyyy