Work with the cart in the 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开发者_如何学JAVA seem to find how to do thathow can I change the cart from within an template?
Thanks,
JoeI 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.
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()
.
精彩评论