Magento 自定义字段定义产品

发布于 2024-10-03 00:11:17 字数 382 浏览 0 评论 0原文

我正在经营一家 Magento 商店,人们可以在那里购买印有自己名字的个性化商品。在产品下方,您会看到“姓名:”,其中有一个输入框,他们可以在其中填写自己的姓名。他们点击“添加到购物车”,它会做广告,我填写订单,每个人都很高兴。

但是,为了购买具有不同名称的另一种产品,他们必须从购物车返回到该产品。真是一团糟。

我希望“名称”字段下有一个按钮,显示“添加另一个”。单击后,它会下拉“名称:”的另一个字段。现在我们看到两个姓名字段,我在第一个和第二个字段中添加“John”和“Joe”,然后单击“添加到购物车”。

在我的购物车中,我现在看到添加了两种产品。一张写着约翰的名字,一张写着乔斯的名字。

非常感谢任何和所有的帮助。我是一个 Wordpress 人,试图弄清楚 Magento!

I am running a Magento store where someone can buy a personalized item with their name on it. Under the product, you see "Name:" with an input box where they can fill out their name. They click "Add to Cart", it ads it, I fill the order and everyone's happy.

But, in order to purchase another product with a different name, they have to go from the cart back to the product. Its a mess.

I'd like there to be a button under the "Name" field that says "Add Another". Upon click, it pulls down another field for "Name:". Now we see two name fields, I add "John" and "Joe" in the first and second fields, then click "Add to Cart".

In my cart, I now see two products added. One with Johns Name, and one with Joes.

Any and all help is greatly appreciated. I'm a Wordpress guy trying to figure out Magento!

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

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

发布评论

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

评论(1

不及他 2024-10-10 00:11:17

这实际上并不是一个简单的添加,但基本上您需要修改 app/code/core/Checkout/controllers/CartController.php 来为表单中的每个项目调用 addProduct。这实际上并不是一个微不足道的更改,因为您必须分解该方法才能使其按顺序加载产品。

另一种方法是使用事件(例如 checkout_cart_product_add_after)来跟踪添加项目的时间,并查看是否传递了额外的参数,并根据需要添加更多项目。

或者,您可以使用相关产品来完成此操作(因为它们也已添加到购物车中)。我还没有研究过如何处理这个问题,但可能值得一看。

希望有帮助!

谢谢,

This is not really a simple addition, but basically you'll need to modify app/code/core/Checkout/controllers/CartController.php to call addProduct for each of the items in the form. This isn't really a trivial change, as you'll have to rip apart that method to make it load the products in sequence.

Another approach would be to use an event (such as checkout_cart_product_add_after) to keep track of when an item is added and see if extra parameters were passed, adding more items as necessary.

Alternatively, you may be able to use related products to accomplish this (since they are added to the cart as well). I haven't looked at how to approach that one, but it may be worth a look.

Hope that helps!

Thanks,
Joe

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