I have tried each different combination of model that returns a quote to try to find the one that has the quote for the current customer's cart.
So far none of them works, and I can't understand why this could be.
Essentially, I am running an external script in the miscellaneous directory that sets a coupon code generated in the current cart, but none of the following sets the code correctly and I have to redirect to / checkout / cart / coupon / post or whatever Be the right url is for that.
These are the different models I've tried to get the session:
$session = Mage::getSingleton("customer/session"); $session = Mage::getSingleton('checkout/session'); $session = Mage::getSingleton('core/session'); $session = Mage::getSingleton("core/session", array("name"=>"frontend"));
And these are the different methods that I tried to execute in the appointment:
$quote->getShippingAddress()->setCollectShippingRates(true); $quote->setCartCouponCode($coupon); $quote->setCouponCode($coupon); $quote->collectTotals(); $quote->save();
They do not fail but they do not configure the code correctly.