Zen Cart Logo

% in COD fee

Locked

Views: 1,331

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
13 Jan 2008, 8:02 PM
#1
rramirezb avatar

rramirezb

New Zenner

Join Date:
Oct 2007
Posts:
59
Plugin Contributions:
0

% 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.

13 Jan 2008, 9:46 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

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:

        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_cost, true,  $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 ...

14 Jan 2008, 10:29 PM
#3
rramirezb avatar

rramirezb

New Zenner

Join Date:
Oct 2007
Posts:
59
Plugin Contributions:
0

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?

7 Oct 2008, 5:00 PM
#4
danilovig avatar

danilovig

New Zenner

Join Date:
Nov 2007
Posts:
65
Plugin Contributions:
0

Re: % in COD fee

        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);
            }
          }