如何在opencart中自动选择结帐选项?
在我正在开发的商店中,用户只有创建帐户才能查看价格并将产品添加到购物车。之后,他们可以将产品添加到购物车。选项“账单详细信息”和“账单详细信息”送货详细信息会自动填写用户的地址。送货方式免费,付款方式为“货到付款”。
我如何自动选择这些选项并隐藏它们,这样剩下的唯一一步就是确认订单?
我假设我需要更改的模板文件是catalog/view/theme/default/template/checkout/checkout.tpl,但它几乎有1k行长,并且使用了我不知道的ajax。 !
我已经尝试这样做了几个小时,因此我们将不胜感激
非常感谢!
In the shop I'm developing, users can only see prices and add products to cart only if they create an account. After that, they can add products to cart. The options Billing Details & Delivery Details are automatically filled in with the user's address. The delivery method is free and the payment method is "cash on delivery".
How can I automatically select these options and hide them so the only step left would be to Confirm the order?
I assume the template file I need to change is catalog/view/theme/default/template/checkout/checkout.tpl
but it's almost a 1k lines long and uses ajax which I don't know...
I've been trying to do this for a few hours so any help would be greatly appreciated!
Thank you very much!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果有人偶然发现这个问题,我在此处找到了答案。它适用于帐户选项、运输选项、付款选项,但不适用于步骤 2 计费选项(如果您尝试使用 jquery 单击步骤 2 中的继续按钮,它只会将其发送到无限循环)。
解决方案:您基本上可以使用 Jquery 单击“继续”按钮,然后使用 CSS (/catalog/view/theme/default/stylesheet/stylesheet.css) 隐藏相应的步骤:
以下内容来自 opencart 社区论坛:
要跳过帐户选项只需将此代码复制粘贴到目录/视图/主题/default/template/checkout/login.tpl的顶部:
请记住查看我所做的一些旧帖子自动选择登录选项。
要跳过送货选项,只需将此代码复制粘贴到目录/视图/主题/default/template/checkout/shipping.tpl的顶部:
要跳过付款选项只需复制粘贴此代码到catalog/view/theme/default/template/checkout/ payment.tpl的顶部:
在这种情况下,在opencart 1.5中,您还必须将此代码(第36行)更改
为:
记住仅当默认选项是您想要的(或者强制 opencart 自动选择一个具体选项)时,这些技巧才会起作用。
In case someone stumbles upon this question, I found the answer here. It works for account option, shipping option, payment option but it doesn't work for step2-billing option (if you try to click the continue button in step2 with jquery it just sends it into an infinite loop).
The solution: You basically click the Continue button with Jquery and then hide the respective step/steps with CSS (/catalog/view/theme/default/stylesheet/stylesheet.css):
The following is from the opencart community forum:
To skip the account option just copy paste this code on the top of the catalog/view/theme/default/template/checkout/login.tpl:
Remember to have a look to some older post I have done to autoselect login options.
To skip the shipping option just copy paste this code on the top of the catalog/view/theme/default/template/checkout/shipping.tpl:
To skip the payment option just copy paste this code on the top of the catalog/view/theme/default/template/checkout/payment.tpl:
In these case, in opencart 1.5 you also will have to change this code (line 36):
to this one:
Remember that these tricks will only work if the default option is the one you want (or if you force opencart to autoselect one concrete option).
在 Opencart 1.5.2.1 中,某些按钮名称可能已更改。
帐户按钮保持不变。
删除付款方式:
删除运输/交付方式:
检查每个按钮,看看提供的 Javascript 是否实际上正在调用所需按钮的 ID。
关联的 CSS 应如下所示:
In Opencart 1.5.2.1 some of the button names may have been changed.
The Account button stayed the same.
To remove payment method:
To remove shipping / delivery method:
Check each button to see if the Javascript provided is actually calling the id of the button desired.
The associated CSS should look like this: