custompresta Posted June 22, 2010 Share Posted June 22, 2010 Anybody know how to use hook extra carrier for add a custom shipping module to prestashop? 2 Link to comment Share on other sites More sharing options...
Ehinarr Posted July 18, 2010 Share Posted July 18, 2010 I also would like to know how to use that hook. lol Link to comment Share on other sites More sharing options...
Ehinarr Posted July 21, 2010 Share Posted July 21, 2010 I have implemented successfully an extra carrier through hook extracarrier. Everything works fine, but I wonder if there is any way to upgrade shipping cost without having to edit the order.php and Cart.php files after the carrier step. Link to comment Share on other sites More sharing options...
custompresta Posted July 21, 2010 Author Share Posted July 21, 2010 Can you share, how you have done that? Link to comment Share on other sites More sharing options...
Ehinarr Posted July 21, 2010 Share Posted July 21, 2010 The function that manages this hook is: hookextraCarrier ($ params). This hook should be registered when installing the module: OR! $ This-> registerHook ('extraCarrier') If you look at the file themes /prestashop/orde-carrier.tpl, you will see that the hook is positioned within a table. Then, you should create a .tpl file that fits this table. Link to comment Share on other sites More sharing options...
custompresta Posted July 22, 2010 Author Share Posted July 22, 2010 And is it possible to assign custom shipping fees with this module?What is the difference between the standard shipping method? Link to comment Share on other sites More sharing options...
Ehinarr Posted July 22, 2010 Share Posted July 22, 2010 Basically, the standard method uses tables of price range and weight range. A custom carrier module can make the calculation of the freight value via webservice directly on the website of the carrier company. Link to comment Share on other sites More sharing options...
custompresta Posted July 22, 2010 Author Share Posted July 22, 2010 Yes this is what i guess. But how would the custom shipping price applied to the order process without changing core files?Sorry that i ask so much, but the docu from prestashop is very bad. Link to comment Share on other sites More sharing options...
Ehinarr Posted July 22, 2010 Share Posted July 22, 2010 That is exactly what I want to discover. I have implemented successfully the carrier extra, but the module do not update the shopping cart with the value that was calculated. according to the modality of freight that was chosen by the customer. The hook cart may be the answer. But how to use it to do so I do not know yet. Link to comment Share on other sites More sharing options...
custompresta Posted July 22, 2010 Author Share Posted July 22, 2010 Yes this is exactly what i can not figure out too.Because the shipping is calculated in the "classes/Cart.php" from the standard shipping method.Maybe somebody from the prestashop team can help us a bit with this issue? Link to comment Share on other sites More sharing options...
Ehinarr Posted July 22, 2010 Share Posted July 22, 2010 That's true, I agree with you. For example, a carrier-type module do not need be registered in any zone of delivery, but the validation of prestashop takes into consideration this and the price and weight ranges to calculate shipping cost. Link to comment Share on other sites More sharing options...
Ehinarr Posted July 22, 2010 Share Posted July 22, 2010 I used the hook cart to retrieve the value of the delivery, via post, and I created a cookie to store this value. In Cart.php class, function getOrderShippingCost (), I replaced: // Start with shipping cost at 0 $shipping_cost = (0; To: global $cookie; // Start with shipping cost at 0 $shipping_cost = (!$cookie->__isset('shipping_cost') ? 0 : $cookie->__get('shipping_cost')); So far this has worked well. 1 Link to comment Share on other sites More sharing options...
custompresta Posted July 23, 2010 Author Share Posted July 23, 2010 This is a very good solution ;-)I don't understand why the prestashop team don't integrated such a solution into the software.Nice work! Link to comment Share on other sites More sharing options...
Ehinarr Posted July 23, 2010 Share Posted July 23, 2010 Maybe because nobody needed it yet. The Prestashop is a young program. It has a lot to evolve. Even to recover carriers from the ps_carrier table is difficult, the results do not include carriers connected to a module. The restrictions contained in the guide AdminPayment can not be applied in this way.I am collecting data to make some suggestions to the Presta ream, what do you think? Link to comment Share on other sites More sharing options...
custompresta Posted July 23, 2010 Author Share Posted July 23, 2010 Even to recover carriers from the ps_carrier table is difficult, the results do not include carriers connected to a module. The restrictions contained in the guide AdminPayment can not be applied in this way. How do you mean this exactly? You have an example? Link to comment Share on other sites More sharing options...
Ehinarr Posted July 23, 2010 Share Posted July 23, 2010 Maybe because nobody needed it yet. The Prestashop is a young program. It has a lot to evolve. Even to recover carriers from the ps_carrier table is difficult, the results do not include carriers connected to a module. The restrictions contained in the guide AdminPayment can not be applied in this way.I am collecting data to make some suggestions to the helpful, what do you think? Link to comment Share on other sites More sharing options...
custompresta Posted July 23, 2010 Author Share Posted July 23, 2010 The same answer from you 2 times?Collecting data is very useful, maybe the prestashop team can integrated some things into the next release.I'm doing this as well. Link to comment Share on other sites More sharing options...
array064 Posted July 31, 2010 Share Posted July 31, 2010 Hi, this is great discussion. Because, I'm thinking about shipping module (carrier module) too. Thank you. Link to comment Share on other sites More sharing options...
muktadir Posted March 7, 2011 Share Posted March 7, 2011 I used the hook cart to retrieve the value of the delivery, via post, and I created a cookie to store this value. In Cart.php class, function getOrderShippingCost (), I replaced:// Start with shipping cost at 0 $shipping_cost = (0; To: global $cookie; // Start with shipping cost at 0 $shipping_cost = (!$cookie->__isset('shipping_cost') ? 0 : $cookie->__get('shipping_cost')); So far this has worked well. What happens when validating orders! Is the cookie available all the times? What for paypal IPN? The IPN script will not have the cookie! So wrong amount of shipping will be entered there is no cookie coming from the paypal IPN host! Link to comment Share on other sites More sharing options...
Ehinarr Posted March 7, 2011 Share Posted March 7, 2011 What happens when validating orders! Is the cookie available all the times? What for paypal IPN? The IPN script will not have the cookie! So wrong amount of shipping will be entered there is no cookie coming from the paypal IPN host! You're right. The cookie is available for payments using the client's browser. IPN payment type - server to server - I copied the validation function into the payment module.My payment modules always create a database. So when the customer is directed to the payment page, paypal for example, the freight is stored in this table.When payment is completed and this information is sent to the store, the module retrieves this value from the database and use the validation function that was copied from class PaymentModule. private function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false, [b]$freight[/b]) And inside that function, the freight is set: $order->total_shipping = floatval(Tools::convertPrice(floatval(number_format($freight, 2, '.', '')), $currency)); You get the idea? Link to comment Share on other sites More sharing options...
muktadir Posted March 9, 2011 Share Posted March 9, 2011 What happens when validating orders! Is the cookie available all the times? What for paypal IPN? The IPN script will not have the cookie! So wrong amount of shipping will be entered there is no cookie coming from the paypal IPN host! You're right. The cookie is available for payments using the client's browser. IPN payment type - server to server - I copied the validation function into the payment module.My payment modules always create a database. So when the customer is directed to the payment page, paypal for example, the freight is stored in this table.When payment is completed and this information is sent to the store, the module retrieves this value from the database and use the validation function that was copied from class PaymentModule. private function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false, [b]$freight[/b]) And inside that function, the freight is set: $order->total_shipping = floatval(Tools::convertPrice(floatval(number_format($freight, 2, '.', '')), $currency)); You get the idea? hi! here goes a better and elegant way as you are already modifying the core:p<. step1. create a hook like 'shippingCost' in your modulep<. step2. Add this lines $shipping_cost=Module::hookExec('IcodeShipping',array('shippingCost',0)); return $shipping_cost; just after these lines in function 'getOrderShippingCost' in the class 'Cart.php' if ($this->isVirtualCart()) return 0; step3. Implement the hook 'shippingCost' in your module! You can use hookExtraCarrier to show extra messages. All the creativity in your module. That's all about it B-) Link to comment Share on other sites More sharing options...
c.harrison1988 Posted September 30, 2013 Share Posted September 30, 2013 You should just have written a module to perform a cron (every 10 minutes or so) to get all the shipping prices from the webservice and then update the carrier itself. Link to comment Share on other sites More sharing options...
geet_16 Posted May 1, 2017 Share Posted May 1, 2017 I am not getting the option of carrier??it is taking automatically delhivery(as a carrier) i have added one more carrier option i.e. Express deleivery but in front for customer it is not showing?how to do it?please help me out. 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