在 billing.phtml 中使用购物车

发布于 2024-09-29 10:07:46 字数 126 浏览 0 评论 0原文

在 checkout onepage billing.phtml 中,我必须进行多项检查,甚至删除或添加东西到购物车。
但我似乎没有找到如何做到这一点,

如何从模板内更改购物车?

谢谢,

inside the checkout onepage billing.phtml I have to do several checks and even remove or add stuff to the cart.
But I don't seem to find how to do that

how can I change the cart from within an template?

Thanks,
Joe

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

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

发布评论

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

评论(2

锦上情书 2024-10-06 10:07:46

我建议您不要在 phtml 中应用这些逻辑更改。您应该尝试通过扩展 Magento 的核心方法或编写自己的方法来使用“运输”或“付款”方法 PHP 代码。 Magento wiki 或其他博客上有大量关于如何实现此目的的教程。

通过直接编辑 phtml,当 Magento 发布补丁或升级时,您将面临崩溃的风险,并且通常这是不好的做法。

I would recommend that you don't apply these logic changes in the phtml. You should try to work with the Shipping or Payment method PHP code, either by extending Magento's core methods or writing your own. There are numerous tutorials on the Magento wiki or other blogs on how to achieve this.

By editing the phtml directly, you run the risk of breaking when Magento releases patches or upgrades, and it is bad practice in general.

鹿! 2024-10-06 10:07:46

从该文件中,您可以使用 $this->getQuote() 获取 Mage_Sales_Model_Quote 对象。您可能会发现对该对象有用的方法是 getAllItems()addItem()removeItem()

From that file you can use $this->getQuote() to get a Mage_Sales_Model_Quote object. Methods you might find useful on that object are getAllItems(), addItem() and removeItem().

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