dixxy Posted March 9, 2011 Share Posted March 9, 2011 Anyone know how to add a extra freight fee on the Cash On Delivery module?I have solved this temporarily by making a new carrier set up with freight including the COD-fee that our local postal service requires. The problem by this solution is that the customer have to select the freight called COD first, then select payment option COD. Some customers just select ordinary freight, and then select COD as payment afterwards. The store then don't collect the COD-fee that it supposed to.A third option for me would be a way of disabling all other payment options after the customer select the COD carrier/freight that i made.Hopefully someone knows how to add an extra freight fee on the COD module.. Link to comment Share on other sites More sharing options...
segfault Posted April 14, 2011 Share Posted April 14, 2011 I had your same problem. After trying some modules that I found here I realized that none was working fine on my PS 1.4. So, while waiting for updates for those modules, I found a workaround to add a fee on COD payments.First of all I've created a product called "COD fee" or something like, and put it in a hidden category.Next I've made few changes on PS code:in file modules/cashondelivery/validation.php right after if (!Validate::isLoadedObject($customer)) Tools::redirectLink(__PS_BASE_URI__.'order.php?step=1'); put (remembering to replace "put-here-your-hidden-product-ID" with the actual ID) Db::getInstance()->AutoExecute(_DB_PREFIX_.'cart_product', array('id_product' => put-here-your-hidden-product-ID, 'id_product_attribute' => 0, 'id_cart' => (int)($cart->id), 'quantity' => 1, 'date_add' => date('Y-m-d H:i:s')), 'INSERT'); $cart->update(true); in file controllers/OrderController.phpafter public function process() { parent::process(); add global $orderTotal; and after case 3: if(Tools::isSubmit('processCarrier')) $this->processCarrier(); $this->autoStep(); /* Bypass payment step if total is 0 */ if (($id_order = $this->_checkFreeOrder()) AND $id_order) { if (self::$cookie->is_guest) { $email = self::$cookie->email; self::$cookie->logout(); // If guest we clear the cookie for security reason Tools::redirect('guest-tracking.php?id_order='.(int)$id_order.'&email;='.urlencode($email)); } else Tools::redirect('history.php'); } put (remembering to replace "put-here-your-hidden-product-ID" with the actual ID) self::$cart->deleteProduct(put-here-your-hidden-product-ID, 0, 0); $orderTotal = self::$cart->getOrderTotal(); This will add the hidden product to the cart when user selects COD payment method and will remove it if he returns to payment selection step.Obviously this is only a workaround... Seems to work, try it carefully before going in production environment.Bye Link to comment Share on other sites More sharing options...
Recommended Posts