如何使用选择或无线电选择的产品详细信息更新购物车

时间:2010-12-19 09:22:03

标签: php jquery

这是一个例子:

http://store.apple.com/us/configure/MC375LL/A?mco=MTc0Njg1NzE

每个单选按钮看起来像这样:

<input type="radio" value="065-0338" name="option.aperture" id="coherent_id_53">

当选择其中一个时,右边的价格会发生变化。

我不明白存储与此无线电选项相关的值的位置。我已经查看了消息来源,但无法解决。我该怎么做这样的事情?我试过在网上看,但我找不到任何东西。你知道我可以阅读的来源,或者你可以写一个快速的解释,我可以把它拼凑在一起吗?感谢

1 个答案:

答案 0 :(得分:1)

源代码末尾有JavaScript:

<script> 
// <![CDATA[
                    Event.onLoad(function onLoad() {
                        var configData = {"content":{"summary":{"overnightShipping":"Next business day delivery available","freeShipping":"Free Shipping","prices":{"total":"$1,499.00"},"part":"MC375LL/A","options":[{"isNone":false,"isUpgrade":false,"value":"065-9182","label":"2.66GHz Intel Core 2 Duo","metricsLabel":"2.66GHz Intel Core 2 Duo","option":"option.macbook_processor"},{"isNone":false,"isUpgrade":false,"value":"065-9184","label":"4GB 1066MHz DDR3 SDRAM - 2x2GB","metricsLabel":"4GB 1066MHz DDR3 SDRAM - 2x2GB","option":"option.macbookpro_memory"},{"isNone":false,"isUpgrade":false,"value":"065-9188","label":"320GB Serial ATA Drive @ 5400 rpm","metricsLabel":"320GB Serial ATA Drive @ 5400 rpm","option":"option.macbook_hard_drive_al"},{"isNone":false,"isUpgrade":false,"value":"065-9194","label":"SuperDrive 8x (DVD±R DL/DVD±RW/CD-RW)","metricsLabel":"SuperDrive 8x (DVD±R DL/DVD±RW/CD-RW)","option":"option.macbookpro_optical_drive"},{"isNone":true,"isUpgrade":false,"value":"none","label":"None","metricsLabel":"None","option":"option.apple_led_displays"},{"isNone":false,"isUpgrade":false,"value":"065-9208","label":"Backlit Keyboard (English) / User's Guide","metricsLabel":"Keyboard (Local) & User's Guide (Local)","option":"option.macbook_keyboard_al_and_os"},{"isNone":true,"isUpgrade":false,"value":"065-7672","label":"None","metricsLabel":"None","option":"option.iwork"},{"isNone":true,"isUpgrade":false,"value":"065-7673","label":"None","metricsLabel":"None","option":"option.aperture"},{"isNone":true,"isUpgrade":false,"value":"065-7674","label":"None","metricsLabel":"None","option":"option.final_cut_express"},{"isNone":true,"isUpgrade":false,"value":"065-7675","label":"None","metricsLabel":"None","option":"option.logic_express"},{"isNone":true,"isUpgrade":false,"value":"065-8307","label":"None","metricsLabel":"None","option":"option.filemaker"},{"isNone":true,"isUpgrade":false,"value":"065-8198","label":"None","metricsLabel":"None","option":"option.microsoft_office_consumer"},{"isNone":true,"isUpgrade":false,"value":"065-9198","label":"None","metricsLabel":"None","option":"option.dvi_adapter"},{"isNone":true,"isUpgrade":false,"value":"none","label":"None","metricsLabel":"None","option":"option.dual_link_dvi_adapter"},{"isNone":true,"isUpgrade":false,"value":"065-9200","label":"None","metricsLabel":"None","option":"option.vga_adapter"},{"isNone":true,"isUpgrade":false,"value":"none","label":"None","metricsLabel":"None","option":"option.magsafe_airline_adapter"},{"isNone":true,"isUpgrade":false,"value":"none","label":"None","metricsLabel":"None","option":"option.apple_remote"},{"isNone":true,"isUpgrade":false,"value":"none","label":"None","metricsLabel":"None","option":"option.macbook_applecare"},{"isNone":true,"isUpgrade":false,"value":"none","label":"None","metricsLabel":"None","option":"option.mobileme"},{"isNone":true,"isUpgrade":false,"value":"none","label":"None","metricsLabel":"None","option":"option.one_to_one"},{"isNone":true,"isUpgrade":false,"value":"none","label":"None","metricsLabel":"None","option":"option.printer_offers"}]},"priceDeltas":{"magsafe_airline_adapter":{"none":"","MB441Z/A":"[Add $49.00]"},"macbook_keyboard_al_and_os":{"FZ065-9208":"","E065-9208":"","065-9208":"","JZ065-9208":""},"apple_led_displays":{"MC007LL/A":"[Add $999.00]","none":""},"macbookpro_memory":{"065-9184":"","065-9185":"[Add $400.00]"},"final_cut_express":{"065-7674":"","065-7682":"[Add $199.00]"},"printer_offers":{"H2618LL/A":"[Add $199.95]","H2400LL/A":"[Add $299.95]","none":"","H1355LL/B":"[Add $99.95]"},"apple_remote":{"MC377LL/A":"[Add $19.00]","none":""},"iwork":{"065-9263":"[Add $69.00]","065-7672":"","065-9172":"[Add $49.00]"},"logic_express":{"065-7675":"","065-9171":"[Add $199.00]"},"aperture":{"065-0338":"[Add $199.00]","065-7673":""},"microsoft_office_consumer":{"065-0276":"[Add $119.95]","065-0278":"[Add $199.95]","065-8198":""},"dual_link_dvi_adapter":{"MB571Z/A":"[Add $99.00]","none":""},"dvi_adapter":{"065-9199":"[Add $29.00]","065-9198":""},"mobileme":{"BG140LL/A":"[Add $119.00]","none":"","BG139LL/A":"[Add $69.00]"},"vga_adapter":{"065-9200":"","065-9201":"[Add $29.00]"},"macbook_hard_drive_al":{"065-9192":"[Add $750.00]","065-9191":"[Add $300.00]","065-9188":"","065-9193":"[Add $1,400.00]","065-9189":"[Add $100.00]"},"one_to_one":{"D4213Z/A":"[Add $99.00]","none":""},"macbook_applecare":{"S3136LL/A":"[Add $249.00]","none":""},"filemaker":{"065-8307":"","065-9806":"[Add $299.95]","065-9373":"[Add $49.95]"}},"learnMoreUrl":"/us/configureLearnMore","creditMessage":"<a href=\"http://store.apple.com/us/instant_credit\">6 or 12 month special financing options<\/a>","nonCollapsibleCategories":["promotions"],"collapsibleCategories":["hardware","presoftware","service_and_support","accessories"]},"url":"/us/configUpdate"}
,
                            configController = new apple.cto.ConfigurationsViewController($('page'), {});
                            configController.configData.set(configData);
                    });


                    // new apple.widget.SlidingTrackView($('slider-track'), {cleanup: false});
                // ]]>
</script>