Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 10 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
要实现您的需求,只需添加“交叉销售”产品关系即可实现这一目标。
阅读:http://www.magentocommerce.com/knowledge-base/entry/how-do-i-set-up-product-relations/" rel="nofollow"> magentocommerce.com/knowledge-base/entry/how-do-i-set-up-product-relations/
To achieve what you require simply adding "Cross Sell" product relationships will achieve this.
Read: http://www.magentocommerce.com/knowledge-base/entry/how-do-i-set-up-product-relations/
如果您查看
Mage_Catalog_Block_Product_List_Related::_prepareData
方法,您会发现它使用以下代码以及一些内务处理:您可以创建自己的块来从购物车中获取产品,并且循环执行相同的代码。类似于:
您可能需要对集合进行重复数据删除(
toArray()
然后array_unique
),因为购物车中的商品可能具有相同的相关产品,但这应该可以帮助您至少在游戏中。哈特哈,
京东
If you look in the
Mage_Catalog_Block_Product_List_Related::_prepareData
method, you'll see that it is using the following code plus some house-keeping:You could create your own Block that grabs the products from the cart, and loops through the same code. Something like:
you might need to deduplicate the collection (
toArray()
thenarray_unique
) as it's possible that items in the cart have the same related products, but that should get you in the game at least.HTH,
JD