MARK-APP.com Posted August 10, 2016 Share Posted August 10, 2016 Hi all, I'm trying to implement a dropdown box in the quick order page. The field is already there but i can't save the value of the box. Which hook can i use to get the posted value? Or do i have to do it with an override on the OrderOpcController (which function)? This is my template file: <form class="std checkout_form" id="ordered_in_store_form" method="post" action=""> <p class="select-store-title">{l s='Where did you buy?'}</p> <div class="requires form-group text"> <p> <label for="ordered_in_store" class="control-label required"> {l s='Where did you buy your product?'}</label> </p> <select name="ordered_in_store" id="ordered_in_store" data-placeholder="{l s='Choose your store...'}" style="width:100%;" class="select form-control"> <option value="">{l s='-- Choose store --'}</option> <option value="1">{l s='store 1'}</option> <option value="2">{l s='store 2'}</option> </select> </div> </form> This is my override of my Cart: class Cart extends CartCore { /** @var int Carrier ID */ public $id_store = 0; public static $definition = array( 'table' => 'cart', 'primary' => 'id_cart', 'fields' => array( 'id_shop_group' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_shop' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_address_delivery' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_address_invoice' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_carrier' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_currency' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'id_customer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_guest' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_lang' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'recyclable' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'gift' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'gift_message' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage'), 'mobile_theme' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'delivery_option' => array('type' => self::TYPE_STRING), 'secure_key' => array('type' => self::TYPE_STRING, 'size' => 32), 'allow_seperated_package' =>array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), 'id_store' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), ), ); } I tried to use this hook in my module class: public function hookActionCarrierProcess(Array $params) { $cart = $params['cart']; if (!($cart instanceof Cart)) return; $cart->id_store = Tools::getValue('ordered_in_store'); $where = array('id_cart' => $cart->id_cart); Db::getInstance()->autoExecute(_DB_PREFIX_.'cart', $where, 'UPDATE', 'id_store ='.(int)$data['cart']->id_store); } ThanksPeter Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now