Oxidshop - Custom field on basket page

85 Views Asked by At

I am customising an instance of oxidshop installed on my local machine. I want to add a text field on first step of basket page. The field will save the value to a new column in oxorder page.

Any idea how to get this to work?

1

There are 1 best solutions below

3
On BEST ANSWER

since order object is created after step 4, you will need to store user input somewhere.

I suggest using session.
Therefore you will need to redirect the "continue to the next step" button on basket page to a new function (which stores user input in session) in user controller by adding "fnc=myfunction" request parameter to the form being submitted:

<input type="hidden" name="fnc" value="myfunction"/>

After this value is stored in session, you will need to extend oxOrderfunction _setUser() and after calling parent::_setUser() you can save your session variable in oxorder: protected function _setUser ($oUser) { parent::_setUser($oUser); $this->assign(['oxorder__myvalue' => oxRegistry::getSession()->getVariable('myvalue')]); }

you will also need to remove "checkout" button in minibasket flyout/popup, because it skips the basket page and jumps right into step 2.