jahyax Posted June 18, 2014 Share Posted June 18, 2014 I am trying to create a module that will allow the user to pick its delivery date and choose the available hour, I want to save the date selected and the hour selected, My problem is, I dont know where to post the data that it will be save into the cart and order here is the sample of my javascript code: <script type="text/javascript"> $('#hr-sel').on('change', function() { updateDelivery(); }); function updateDelivery(){ var delivery_date = $("#alternate").val(); var delivery_hour = $('#hr-sel :selected').text(); $.ajax({ type: 'POST', url: ../views/templates/hook/shippingdate.php, async: false, cache: false, datatype: 'json', data: 'delivery_date='+delivery_date+'&delivery_hour='+delivery_hour, success: function (jsonData){ console.log(jsonData); } }); } </script> and on my shippingdate.php I have function hookActionCarrierProcess($params) { $cart = $this->context->cart; $delivery_date = Tools::getValue('shipping_date'); $delivery_hour = Tools::getValue('alternate'); if (!empty($delivery_date)) { $cart->delivery_date = $delivery_date; if (!empty($delivery_hour)) { $cart->delivery_hour = $delivery_hour; } $cart->save(); } } please anyone any idea what I am missing or what I am doing wrong?? 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