Wytas Posted June 16, 2016 Share Posted June 16, 2016 Hello, Can anybody tell me what file to edit so that cash on delivery would be seen only after choosing one specific shipping method and would not be available for all others. I saw similar thread about this where Rocky provided an answer but it was about prestashop 1.4. I am using 1.6.1.5 and can' seem to find a file mentioned there. Link to comment Share on other sites More sharing options...
NemoPS Posted June 16, 2016 Share Posted June 16, 2016 You can use the hook mentioned herehttp://nemops.com/prestashop-virtual-products-specific-payment/#.V2JltLv5jmgBut instead of looping through all products, it's enough to use $params['id_carrier']I am not sure id_carrier is the correct one, but in any case you have to get the carrier id there, and return false if it;s not the one you wantEdit: it's $params['cart']->id_carrier 1 Link to comment Share on other sites More sharing options...
NemoPS Posted June 16, 2016 Share Posted June 16, 2016 Just expanded with a tuthttp://nemops.com/prestashop-payment-methods-specific-carriers/#.V2Jy47v5jmg 1 Link to comment Share on other sites More sharing options...
Wytas Posted June 16, 2016 Author Share Posted June 16, 2016 Thanks man. I will try this. Looks difficult but I think I'll be able to follow your guide. Link to comment Share on other sites More sharing options...
Wytas Posted June 19, 2016 Author Share Posted June 19, 2016 (edited) Hey, Something went wrong when I followed your guide and tried to get carrier id reference. in override/modules/cashondelivery I created cashondelivery.php with following code: if (!defined('_CAN_LOAD_FILES_')) exit; class CashondeliveryOverride extends Cashondelivery { public function hookPayment($params) { $id_carrier = $params['cart']->id_carrier; $carrier = new Carrier($id_carrier); d($carrier); if (!$this->active) return ; global $smarty; // Check if cart has product download if ($this->hasProductDownload($params['cart'])) return false; $smarty->assign(array( 'this_path' => $this->_path, //keep for retro compat 'this_path_cod' => $this->_path, 'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/' )); return $this->display(__FILE__, 'payment.tpl'); } } And on top of the page I get exact same code. Like in the picture I attached. What I did wrong? Edited June 19, 2016 by Wytas (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted June 20, 2016 Share Posted June 20, 2016 Looks like the php file is not encoded properly, what editor did you use?Also did you open php tags? 1 Link to comment Share on other sites More sharing options...
Wytas Posted June 20, 2016 Author Share Posted June 20, 2016 Thanks. Since I know just html and css I didn't even know about php closing tags. It all works fine now. Thanks for the guide again. I use context editor. 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