Lyconal Best Lyconal Best - 2 months ago 10
PHP Question

Magento: OnePage Checkout & Refresh without Loosing Information

I have a script that updates a session variable within the onepage checkout, that ultimately affects the total of the cart.

The value is set and saved into the session, but as the page hasn't been refreshed, the value isn't read into the rest of the underlying code on submit.

If I save the part of checkout that sets the session variable, and then refresh the page, the variable is taken into account and the checkout works as intended.

Is there a way to either:


  1. Save the session variable straight away so that it is used by the underlyinf code



OR


  1. Refresh the cart, back to its current position as this would pull the session variable into play for the logic


Answer

Adding:

$this->getOnepage()->getQuote()->collectTotals()->save();

To the save function worked a treat.