2015-12-25 59 views
0

我遇到了一些困難,創建一個直接添加到購物車鏈接Magento。我已經閱讀了類似問題上的其他問題,但無法找到我正在尋找的解決方案。Magento:查詢字符串直接添加到購物車鏈接

直接聯繫我相信我想用的是這個:

[site]/checkout/cart/add/product/[prod_id]/form_key/[key]/

不過,我將如何指定選項?上述鏈接將我重定向到產品頁面,並以「」提示我,請指定選項「(特別是product size)。我如何正確地將大小ID納入鏈接?我想知道我在鏈接中缺少的內容以指定此內容,因此該鏈接會將客戶直接發送到購物車中,而不僅僅是將其重定向到產品頁面。

回答

0

這個問題也被張貼在magento.stackexchange和用戶馬呂斯好心給我的解決方案...

This has worked for me on CE 1.7.0.2 (with sample data): 

/checkout/cart/add/product/126?super_attribute[525]=100&super_attribute[272]=22 
NOTE (this puzzles me a bit): 
There is a difference between calling: 

/checkout/cart/add/product/126?super_attribute[525]=100&super_attribute[272]=22 
and 

/checkout/cart/add/product/126?super_attribute[272]=22&super_attribute[525]=100 
I mean the order of the super_attribute parameters is important. After calling the 2 URLs above I ended up with 2 cart lines of the same product with the same options. one looked like this: 

Size Small Color Green 
and the other was 

Color Green Size Small 
I guess if you add the products to cart via URL you should keep the order of the attributes as shown in the product view page for consistency. 

按照他的建議,你可以建立使用該方法添加到購物車鏈接。

我希望這會幫助你。

相關問題