Kiyro Posted October 11, 2013 Share Posted October 11, 2013 Hi everyone, I will add a tax for COD payment, can you help me? Thanks! Link to comment Share on other sites More sharing options...
NemoPS Posted October 11, 2013 Share Posted October 11, 2013 Do you want to add a fixed tax, a percentage of the order, or something else? Also, do you want to be able to change it from the back office? Link to comment Share on other sites More sharing options...
Kiyro Posted October 11, 2013 Author Share Posted October 11, 2013 I'll add a Fixed tax only for COD Payment I dont need to change it from backoffice Link to comment Share on other sites More sharing options...
NemoPS Posted October 11, 2013 Share Posted October 11, 2013 I would override the Cart::getOrderTotal method Grab the total by calling the original one (parent::getOrderTotal) Then, create something like a 'getFee' method. Inside this, run a debug backtrace $dlist=debug_backtrace(false); $dlist=array_reverse($dlist); foreach($dlist AS $trace){ if(isset($trace['file']) && stristr($trace['file'], 'modules')){ $name=explode(DIRECTORY_SEPARATOR, $trace['file']); $names[]=pSQL($name[array_search('modules', $name)+1]); } } If names[0] equals 'cashondelivery' then add the fee (return the total plus fee) Link to comment Share on other sites More sharing options...
Recommended Posts