带有添加字段的 Drupal Commerce Ajax 购物车

发布于 2025-01-02 12:24:22 字数 244 浏览 4 评论 0原文

很抱歉这个标题很糟糕,但不知道如何用 10 个词来描述我的问题。 我有 drupal commerce,并制作了一个在结账页面顶部显示购物车内容的视图。 数量是一个文本字段,因此它是可编辑的,并且我有一个更新按钮。不幸的是,当我按下更新按钮时,整个结帐页面自然会尝试提交。有没有办法拦截更新按钮并用ajax刷新购物车? 此外,如果我能做到这一点,我希望购物车下方出现多个文本字段(与输入的数量一样多),以便用户可以在每个字段上输入不同的值(每个字段指的是要购买的产品) )。

Sorry for the really bad title but wasn't sure how to describe my problem in 10 words.
I have drupal commerce and have made a view that displays the cart contents on top of the checkout page.
Quantity is a text field so it is editable and I have an update button. Unfortunately when I press the update button, naturally the whole checkout page tries to submit. Is there a way to intercept the update button and just refresh the cart with ajax?
Moreover, if I can do that, I want a number of text fields (as many as the quantity number entered) to appear underneath the cart so the user can enter different values on each of them (each referring to the products about to be bought).

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

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

发布评论

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

评论(2

空名 2025-01-09 12:24:22

Drupal Commerce Cart 就是这样做的 - 有点.. http://drupal.org/project/dc_cart_ajax

它有效在购物车页面上很好,尽管我也试图合并这些页面以减少“结账步骤”。虽然它与 /cart 页面具有相同的视图,并且我得到一个 ajax 刷新指示器,但它实际上并没有更新结帐页面上的购物车。

有一个与此相关的问题,您可以订阅:http://drupal.org/node/1443470

Drupal Commerce Cart does this - sort of.. http://drupal.org/project/dc_cart_ajax

It works fine on the cart page, though I too am trying to combine these pages to cut down on the 'checkout steps'. Though it is the same view as the /cart page and I get an ajax refresh indicator it doesn't actually update the cart on the checkout page.

There is a issue related to that, you can subscribe: http://drupal.org/node/1443470

送君千里 2025-01-09 12:24:22

您可以使用结帐设置禁用购物车内容。修改购物车视图以添加块显示,并通过使用 PHP 提供默认值来添加修改上下文过滤器:

if (arg(0) == 'checkout') return arg(1);
else return null;

仅在结帐页面上添加新的购物车块显示,然后就可以了。

You can disable the Shopping cart contents using the checkout settings. Modify the Shopping Cart View to add a block display and add modify the contextual filter by providing default value using PHP:

if (arg(0) == 'checkout') return arg(1);
else return null;

Add the new Shopping cart block dispplay only on the checkout page and here you go.

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