Magento 买一送一免费脚本策略

发布于 2024-09-13 02:18:15 字数 294 浏览 2 评论 0原文

我的目标是创建一个买 xyz 免费送 xyz 的产品,其中 x、y 和 z 是单独的产品。当购买 x、y 或 z 时,客户可以免费购买 x、y 或 z 产品之一。

我尝试在 Magento 的价格规则中创建此功能,但没有取得任何成功。我已经在互联网上阅读了几乎所有有关这些规则的内容,但一无所获。我正在考虑创建一个页面,允许用户按顺序选择他们想要购买的产品,然后使用该信息将捆绑的购物车项目添加到用户的购物车。不过,可能有一种更简单的方法,我想知道是否有人有任何见解。

请注意,所讨论的项目是具有两个属性集的可配置项目,只是为了让它变得有趣。

My objective is to create a buy xyz get xyz free, where x, y, and z are separate products. When purchasing EITHER x, y, or z, the customer can one of x, y, or z products for free.

I've tried to create this function within Magento's price rules, but I have not had any success whatsoever. I've read pretty much everything on the internet regarding these rules and have gotten nowhere. I'm thinking about creating a page that allows the user to select the products they would like to purchase in sequence, then using that information to add a bundled cart item to the user's cart. There may be a simpler way, though, and I'm wondering if anyone has any insight.

Please note that the items in question are configurable items with two attribute sets, just to make it interesting.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

〃安静 2024-09-20 02:18:15

为此,我将连接到购物车价格规则引擎。该系统旨在应用一组规则来改变购物车的价格。我

  1. 找出应用定价规则的位置

  2. 使用 Magento 内置的配置覆盖系统覆盖该方法

  3. 让覆盖方法首先调用其父级,以便应用所有原始定价规则

  4. 一旦完成后,在末尾包含自定义逻辑

下一步,与#4相关,创建新的模型对象来跟踪哪些产品是买一送一,并(可选)在管理员中创建一个 UI 来管理这些关系。这些是您在#4 中查看的模型以应用您的规则。

祝你好运。

I'd hook into the Shopping Cart price rules engine for this. The system is designed to apply a set of rules an alter the price of a cart. I'd

  1. Figure out where the pricing rules are applied

  2. Override that method using the config override system built into Magento

  3. Have the override method first call its parent, so that all original pricing rules are applied

  4. Once that's done, include you custom logic at the end

Next, and related to #4, create new model objects that keep track of which products are buy one/get one, and (optionally) create a UI in the admin to manage these relationships. These are the models you'd be looking at in #4 to apply your rules.

Good luck.

蓝眼泪 2024-09-20 02:18:15

因此,由于我无法获得时间资源来实现艾伦的答案,因此我通过向可配置产品添加自定义选项来解决此问题,这些产品是不同“bogo”产品的下拉列表。这是有缺陷的,因为它没有考虑库存,但在我的情况下,它暂时有效。

So since I was unable to acquire the time resource to implement Alan's answer, I got a workaround going for this by adding custom options to the configurable products, which were dropdowns of the different "bogo" products. This is flawed in that it does NOT account for stock, but in my situation, it worked in the time being.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文