magento -- 可配置产品的选项如何默认选中第一项

 

How to make configurable options autoselected on configurable product view page

 

If you ever tried to do anything with Magento configurable products view page, most likely you needed changes in  /js/varien/product.js in case you wanted to manipulate dropdowns.

This will be one of the ways to do it.

Basically, what we need to do in order to make initial selection of a product is the following:

Open this file: /app/design/frontend/default/your_theme/template/catalog/product/view/type/options/configurable.phtml

Right below

 

 

 

add this JavaScript code:

 

 

 

That’s it. I hope you can find this usable, however don’t use it on production site without extensive testing.

As you can see, all prototype functions in Magento (and in general) can be added as new into already existing class.

Same way you could override existing methods in existing classes.

I have coded this feature for the purpose of this article and I’m not claiming that it is production ready. It is only for informative purposes.

 

原文链接地址:http://inchoo.net/ecommerce/magento/how-to-make-configurable-options-autoselected-on-configurable-product-view-page/

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值