Thread: % in COD fee

Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2007
    Posts
    59
    Plugin Contributions
    0

    Default % in COD fee

    Hello,
    I'm sure this question is very easy; but I've not been able to find documentation about it (neither the forum or the wiki).
    I want to use the option "COD fee", located in "Modules-- Order totals". There is possible to define a fee for the COD option. But I want a percentage of the order for that fee, not a fixed value.
    I've tried to just put x% or define a tax rate for the COD fee, but it doesn't work.

    Any idea? thanks.

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: % in COD fee

    You would need to customize the COD Fee ot_cod_fee Order Total module for that ...

    This section of code is calculating the charge:
    PHP Code:
            if ($cod_country) {
              
    $cod_tax_address zen_get_tax_locations();
              
    $tax zen_get_tax_rate(MODULE_ORDER_TOTAL_COD_TAX_CLASS$cod_tax_address['country_id'], $cod_tax_address['zone_id']);
              
    $order->info['total'] += $cod_cost;
              if (
    $tax 0) {
                
    $tax_description zen_get_tax_description(MODULE_ORDER_TOTAL_COD_TAX_CLASS$cod_tax_address['country_id'], $cod_tax_address['zone_id']);
                
    $order->info['tax'] += zen_calculate_tax($cod_cost$tax);
                
    $order->info['tax_groups'][$tax_description] += zen_calculate_tax($cod_cost$tax);
                
    $order->info['total'] += zen_calculate_tax($cod_cost$tax);
                if (
    DISPLAY_PRICE_WITH_TAX == 'true') {
                  
    $cod_cost += zen_calculate_tax($cod_cost$tax);
                }
              }

              
    $this->output[] = array('title' => $this->title ':',
                                      
    'text' => $currencies->format($cod_costtrue,  $order->info['currency'], $order->info['currency_value']),
                                      
    'value' => $cod_cost); 
    You would need to adapt that section to use the values set as a percentage of the Total ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Oct 2007
    Posts
    59
    Plugin Contributions
    0

    Default Re: % in COD fee

    Sorry Ajeh,
    But I don't know much about code and php. There isn't a way to do this in the Admin area?

  4. #4
    Join Date
    Nov 2007
    Posts
    64
    Plugin Contributions
    0

    Default Re: % in COD fee

    PHP Code:
            if ($cod_country) {
              
    $cod_tax_address zen_get_tax_locations();
              
    $tax zen_get_tax_rate(MODULE_ORDER_TOTAL_COD_TAX_CLASS$cod_tax_address['country_id'], $cod_tax_address['zone_id']);
              
    //Julian cortes porcentajes
               
    $posicion strpos($cod_cost,"%");
                 if (
    $posicion<>false){
                    
    $cod_cost = (($order->info["total"]*$cod_cost)/100);
                 }
              
    //

              
    $order->info['total'] += $cod_cost;
              if (
    $tax 0) {
                
    $tax_description zen_get_tax_description(MODULE_ORDER_TOTAL_COD_TAX_CLASS$cod_tax_address['country_id'], $cod_tax_address['zone_id']);
                
    $order->info['tax'] += zen_calculate_tax($cod_cost$tax);
                
    $order->info['tax_groups'][$tax_description] += zen_calculate_tax($cod_cost$tax);
                
    $order->info['total'] += zen_calculate_tax($cod_cost$tax);
                if (
    DISPLAY_PRICE_WITH_TAX == 'true') {
                  
    $cod_cost += zen_calculate_tax($cod_cost$tax);
                }
              } 

 

 

Similar Threads

  1. v150 Need some Help in COD. COD fee depending on order price
    By bratsangels in forum Built-in Shipping and Payment Modules
    Replies: 20
    Last Post: 16 Sep 2012, 12:53 PM
  2. COD Fee
    By fotofx in forum Addon Payment Modules
    Replies: 3
    Last Post: 18 Jun 2009, 08:10 PM
  3. COD Fee
    By Svanis in forum Basic Configuration
    Replies: 4
    Last Post: 23 Jun 2006, 02:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg