0

我需要通过自定义表单上的结帐传递项目 ID。这是项目添加

<div class="simpleCart_shelfItem">
  <div class="ju_cntr" style="width:350px">
    <input type="hidden" class="item_id" name='tratata' value="asfd2">
    <div class="juice_hd item_name" style="width:350px">
       test2
    </div>
    <div class="juice_pic" style="width:350px">
      <img class="item_thumb item_image item_add" src="/images/upload/9174.jpg"/>
    </div>
    <div class="juice_txt">
      <span class="item_price">$123.00</span><input type="text" value="1" class="item_Quantity"><a class="item_add" href="javascript:;"> Add to Cart </a>
    </div>
  </div>
</div>

和结帐结果

Array
(
    [currency] => USD
    [shipping] => 0
    [tax] => 0
    [taxRate] => 0
    [itemCount] => 2
    [item_name_1] => 
                                            123                                     
    [item_quantity_1] => 7
    [item_price_1] => 123
    [item_options_1] => 
    [item_name_2] => 
                                            test2                                       
    [item_quantity_2] => 6
    [item_price_2] => 123
    [item_options_2] => 
)

有人知道我该怎么做吗?谢谢!

这是文档http://simplecartjs.org/documentation/

4

1 回答 1

1

实际上,附加项目数据是在 item_options_n 元素内传递的。

所以在你的情况下应该是:

[item_name_1] => 
                                        123                                     
[item_quantity_1] => 7
[item_price_1] => 123
[item_options_1] => 
[item_name_2] => id: <your_id_here>
                                        test2                                       
[item_quantity_2] => 6
[item_price_2] => 123
[item_options_2] => id: <your_id_here>

如果没有,可能是它没有从表单元素中获取值。在这种情况下,您将不得不手动获取它们。

于 2012-11-30T20:29:10.147 回答