Aiuto con Costo Contrassegno, urgente, vi prego!!! - Grazie.
Moderatore: mod Generali
Aiuto con Costo Contrassegno, urgente, vi prego!!! - Grazie.
Ciao A tutti, Ho istallato oscommerce 2.2, ho bisogno di una mano, ho il modulo di pagamento alla consegna e voglio assegnarli un costo fisso di €. 5, (già fatto), quello che non riesco a fare è che mi aggiunga il 2% su tutto il totalo solo in caso l'acquisto superi i 500, 00 €.
Aiutatemi passo a passo, sono nuovo e non capisco molto.
Grazie a Tutti
--------------------------------------------
Hola a todos, por favor nesecito ayuda, he instalado oscommerce 2.2 en el modulo contra rembolso le he dado un precio fijo de 5.00 euros, lo que no logro hacer es asignarle un 2% en base al total osea si uno hace una compra que supere los 500, €. nesecito asignarle el 2% mas.
Ayudenme paso a paso, soy nuevo y no entiendo mucho, muchas gracias.
------------------------------------------------
Hi guys sorry for my english i need help i've installed oscommerce 2.2 when i want sell inbring and pay mode i setup 5 fixed euros, but i need ad 2% if my client make a order over 500 Euros, every people can helpme pass to pass, because i not undestand about oscommerce, Thank In advance.
Aiutatemi passo a passo, sono nuovo e non capisco molto.
Grazie a Tutti
--------------------------------------------
Hola a todos, por favor nesecito ayuda, he instalado oscommerce 2.2 en el modulo contra rembolso le he dado un precio fijo de 5.00 euros, lo que no logro hacer es asignarle un 2% en base al total osea si uno hace una compra que supere los 500, €. nesecito asignarle el 2% mas.
Ayudenme paso a paso, soy nuevo y no entiendo mucho, muchas gracias.
------------------------------------------------
Hi guys sorry for my english i need help i've installed oscommerce 2.2 when i want sell inbring and pay mode i setup 5 fixed euros, but i need ad 2% if my client make a order over 500 Euros, every people can helpme pass to pass, because i not undestand about oscommerce, Thank In advance.
Ciao, Grazie per avermi risposto, ho fatto quello che mi hai detto, l'ho isallata, disistallando prima tutti gli order total e poi ristallandoli una volta uplodati i files, ma è una contribution che non fa al caso mio, nel senso che non fa quello che mi serve, a me serve una contrib. che mi aggiunga una percentuale es il 2% in più sulla spesa totale solo in caso il cliente scelga il contrassegno ed il costo totale sia uguale o superi i 500 Euro, sai mica se c'è una contribution del genere o se s'è un codice da editare su cod.php?, grazie mille a chi risponde, oggi è domenica ed è la quarta notte che non dormo su sto problema, vi prego fatemi dormire, grazie.
Jaki
Jaki
La cosa potrebbe interessare anche ad altri, ecco quindi il codice del modulo ot_cod_fee modificato velocemente per supportare anche l'aggiunta al fee fisso di un fee calcolato in base ad una percentuale del totale, se viene superato un certo limite.jaki ha scritto:Ciao, Grazie per avermi risposto, ho fatto quello che mi hai detto, l'ho isallata, disistallando prima tutti gli order total e poi ristallandoli una volta uplodati i files, ma è una contribution che non fa al caso mio, nel senso che non fa quello che mi serve, a me serve una contrib. che mi aggiunga una percentuale es il 2% in più sulla spesa totale solo in caso il cliente scelga il contrassegno ed il costo totale sia uguale o superi i 500 Euro, sai mica se c'è una contribution del genere o se s'è un codice da editare su cod.php?, grazie mille a chi risponde, oggi è domenica ed è la quarta notte che non dormo su sto problema, vi prego fatemi dormire, grazie.
Jaki
Il limite viene settato nella nuova casella Order total amount limit, nel pannello di controllo.
Vediamo un esempio.
Order total amount limit: 500,
COD Fee per postaprioritaria:IT:5|%2
In questo caso per spedizioni con posta prioritaria,
-se il totale ordine è maggiore od uguale di 500, ad es 1087,00, viene applicato un fee di: 5 + 1087 * 0.02 = 26.74
-se il totale ordine è minore di 500, ad es 1087,00, viene applicato un fee fisso di: 5.
Ho testato la modifica e funziona perfettamente, sotto trovi il codice del modulo modificato.
Codice: Seleziona tutto
<?php
/*
$Id: ot_cod_fee.php,v 1.00 2002/11/30 17:02:00 harley_vb Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2002 osCommerce
Released under the GNU General Public License
*/
/********************************************************************
* Copyright (C) 2006 osCommercedev, Dott. Marco Falcini alias Marcus
* http://www.oscommercedev.com
*
/********************************************************************
/********************************************************************
* Copyright (C) 2002 TheMedia, Dipl.-Ing Thomas Pl"nkers.
* http://www.themedia.at & http://www.oscommerce.at
*
* All rights reserved.
*
* This program is free software licensed under the GNU General Public License (GPL).
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
*********************************************************************/
class ot_cod_fee {
var $title, $output;
function ot_cod_fee() {
$this->code = 'ot_cod_fee';
$this->title = MODULE_ORDER_TOTAL_COD_TITLE;
$this->description = MODULE_ORDER_TOTAL_COD_DESCRIPTION;
$this->enabled = ((MODULE_ORDER_TOTAL_COD_STATUS == 'true') ? true : false);
$this->sort_order = MODULE_ORDER_TOTAL_COD_SORT_ORDER;
$this->order_total_limit = MODULE_ORDER_TOTAL_COD_FEE_LIMIT;
$this->output = array();
}
function process() {
global $order, $currencies, $cod_cost, $cod_country, $shipping;
if (MODULE_ORDER_TOTAL_COD_STATUS == 'true') {
$tax = tep_get_tax_rate(MODULE_ORDER_TOTAL_COD_TAX_CLASS);
//Will become true, if cod can be processed.
$cod_country = false;
//check if payment method is cod. If yes, check if cod is possible.
if ($GLOBALS['payment'] == 'cod') {
//process installed shipping modules
if (substr_count($shipping['id'], 'flat') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_FLAT);
if (substr_count($shipping['id'], 'item') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_ITEM);
if (substr_count($shipping['id'], 'table') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_TABLE);
if (substr_count($shipping['id'], 'ups') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_UPS);
if (substr_count($shipping['id'], 'usps') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_USPS);
if (substr_count($shipping['id'], 'fedex') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_FEDEX);
if (substr_count($shipping['id'], 'zones') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_ZONES);
if (substr_count($shipping['id'], 'ap') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_AP);
if (substr_count($shipping['id'], 'dp') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_DP);
if (substr_count($shipping['id'], 'corriere1') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_CORRIERE1);
if (substr_count($shipping['id'], 'postepaccocelere1') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOCELERE1);
if (substr_count($shipping['id'], 'postepaccocelere3') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOCELERE3);
if (substr_count($shipping['id'], 'postepaccoordinario') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOORDINARIO);
if (substr_count($shipping['id'], 'postepostaordinaria') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTAORDINARIA);
if (substr_count($shipping['id'], 'postepostaprioritaria') !=0) {
$cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTAPRIORITARIA);
}
if (substr_count($shipping['id'], 'postepostaraccomandata') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTARACCOMANDATA);
//satt inn av Pompel
if (substr_count($shipping['id'], 'servicepakke') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_SERVICEPAKKE);
for ($i = 0; $i < count($cod_zones); $i++) {
if ($cod_zones[$i] == $order->delivery['country']['iso_code_2']) {
list($cod_cost_base, $cod_cost_rate) = split("[|]", $cod_zones[$i + 1]);
if (ereg('^(%)[0-9]+', $cod_cost_rate, $match)) {
if ($order->info['total'] >= $this->order_total_limit) {
$cod_cost = $cod_cost_base + round($order->info['total'] * (substr($match[0], 1) / 100), 2);
} else {
$cod_cost = $cod_cost_base;
}
} else {
$cod_cost = $cod_cost_base;
}
$cod_country = true;
//print('match' . $i . ': ' . $cod_cost);
break;
} elseif ($cod_zones[$i] == '00') {
list($cod_cost_base, $cod_cost_rate) = split("[|]", $cod_zones[$i + 1]);
if (ereg('^(%)[0-9]+', $cod_cost_rate, $match)) {
if ($order->info['total'] >= $this->order_total_limit) {
$cod_cost = $cod_cost_base + round($order->info['total'] * (substr($match[0], 1) / 100), 2);
} else {
$cod_cost = $cod_cost_base;
}
} else {
$cod_cost = $cod_cost_base;
}
//print('match' . $i . ': ' . $cod_cost);
break;
} else {
//print('no match');
}
$i++;
}
} else {
//COD selected, but no shipping module which offers COD
}
if ($cod_country) {
$order->info['tax'] += tep_calculate_tax($cod_cost, $tax);
$order->info['tax_groups']["{$tax}"] += tep_calculate_tax($cod_cost, $tax);
$order->info['total'] += $cod_cost + tep_calculate_tax($cod_cost, $tax);
$this->output[] = array('title' => $this->title . ':',
'text' => $currencies->format(tep_add_tax($cod_cost, $tax), true, $order->info['currency'], $order->info['currency_value']),
'value' => tep_add_tax($cod_cost, $tax));
} else {
//Following code should be improved if we can't get the shipping modules disabled, who don't allow COD
// as well as countries who do not have cod
// $this->output[] = array('title' => $this->title . ':',
// 'text' => 'No COD for this module.',
// 'value' => '');
}
}
}
function check() {
if (!isset($this->_check)) {
$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_COD_STATUS'");
$this->_check = tep_db_num_rows($check_query);
}
return $this->_check;
}
//lagt tilk servicepakke her!!!!
function keys() {
return array('MODULE_ORDER_TOTAL_COD_STATUS', 'MODULE_ORDER_TOTAL_COD_SORT_ORDER', 'MODULE_ORDER_TOTAL_COD_FEE_LIMIT', 'MODULE_ORDER_TOTAL_COD_FEE_FLAT', 'MODULE_ORDER_TOTAL_COD_FEE_ITEM', 'MODULE_ORDER_TOTAL_COD_FEE_TABLE', 'MODULE_ORDER_TOTAL_COD_FEE_UPS', 'MODULE_ORDER_TOTAL_COD_FEE_USPS', 'MODULE_ORDER_TOTAL_COD_FEE_ZONES', 'MODULE_ORDER_TOTAL_COD_FEE_AP', 'MODULE_ORDER_TOTAL_COD_FEE_DP', 'MODULE_ORDER_TOTAL_COD_FEE_CORRIERE1','MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOCELERE1','MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOCELERE3','MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOORDINARIO', 'MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTAORDINARIA','MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTAPRIORITARIA', 'MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTARACCOMANDATA', 'MODULE_ORDER_TOTAL_COD_FEE_SERVICEPAKKE', 'MODULE_ORDER_TOTAL_COD_FEE_FEDEX', 'MODULE_ORDER_TOTAL_COD_TAX_CLASS');
}
function install() {
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display COD', 'MODULE_ORDER_TOTAL_COD_STATUS', 'true', 'Do you want this module to display?', '6', '0','tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_ORDER_TOTAL_COD_SORT_ORDER', '4', 'Sort order of display.', '6', '1', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for FLAT', 'MODULE_ORDER_TOTAL_COD_FEE_FLAT', 'AT:3.00,DE:3.58,00:9.99', 'FLAT: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '3', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for ITEM', 'MODULE_ORDER_TOTAL_COD_FEE_ITEM', 'AT:3.00,DE:3.58,00:9.99', 'ITEM: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '4', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for TABLE', 'MODULE_ORDER_TOTAL_COD_FEE_TABLE', 'AT:3.00,DE:3.58,00:9.99', 'TABLE: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '5', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for UPS', 'MODULE_ORDER_TOTAL_COD_FEE_UPS', 'CA:4.50,US:3.00,00:9.99', 'UPS: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '6', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for USPS', 'MODULE_ORDER_TOTAL_COD_FEE_USPS', 'CA:4.50,US:3.00,00:9.99', 'USPS: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '7', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for ZONES', 'MODULE_ORDER_TOTAL_COD_FEE_ZONES', 'CA:4.50,US:3.00,00:9.99', 'ZONES: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '8', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for Austrian Post', 'MODULE_ORDER_TOTAL_COD_FEE_AP', 'AT:3.63,00:9.99', 'Austrian Post: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '9', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for German Post', 'MODULE_ORDER_TOTAL_COD_FEE_DP', 'DE:3.58,00:9.99', 'German Post: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '10', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for CORRIERE1', 'MODULE_ORDER_TOTAL_COD_FEE_CORRIERE1', 'IT:5|%2,00:9.99', 'CORRIERE1: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '11', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for POSTEPACCOCELERE1', 'MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOCELERE1', 'IT:5|%2,00:9.99', 'POSTEPACCOCELERE1: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '12', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for POSTEPACCOCELERE3', 'MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOCELERE3', 'IT:5|%2,00:9.99', 'POSTEPACCOCELERE3: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '13', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for POSTEPACCOORDINARIO', 'MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOORDINARIO', 'IT:5|%2,00:9.99', 'POSTEPACCOORDINARIO: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '14', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for POSTEPOSTAORDINARIA', 'MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTAORDINARIA', 'IT:5|%2,00:9.99', 'POSTEPOSTAORDINARIA: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '15', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for POSTEPOSTAPRIORITARIA', 'MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTAPRIORITARIA', 'IT:5|%2,00:9.99', 'POSTEPOSTAPRIORITARIA: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '16', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for POSTEPOSTARACCOMANDATA', 'MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTARACCOMANDATA', 'IT:5|%2,00:9.99', 'POSTEPOSTARACCOMANADATA: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '17', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for Servicepakke', 'MODULE_ORDER_TOTAL_COD_FEE_SERVICEPAKKE', 'NO:69', 'Servicepakke: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '18', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for FedEx', 'MODULE_ORDER_TOTAL_COD_FEE_FEDEX', 'US:3.00', 'FedEx: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '19', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Order total amount limit', 'MODULE_ORDER_TOTAL_COD_FEE_LIMIT', '', 'Adds a code fee rate if order total amount is greater than order total amount limit.', '6', '2', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_ORDER_TOTAL_COD_TAX_CLASS', '0', 'Use the following tax class on the COD fee.', '6', '11', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");
}
function remove() {
$keys = '';
$keys_array = $this->keys();
$keys_size = sizeof($keys_array);
for ($i=0; $i<$keys_size; $i++) {
$keys .= "'" . $keys_array[$i] . "',";
}
$keys = substr($keys, 0, -1);
tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in (" . $keys . ")");
}
}
?>
Marcus
Nuovo pacchetto osCommercePRO (osCPRO) + Modulo Interfacciamento Gestionale Danea.
Visita la demo: http://oscpro.oscommercedev.com/index.php
Visita la demo: http://oscpro.oscommercedev.com/index.php
Ecco come dovrebbe contare, ti mando ques'esempo:
totale merce 1290 euro
spese di trasporto euro 11.50
contrassegno fino a 500 euro = euro 5
eccedenza per ordini superiori ai 500 euro:
1290+11.50+5=1306.50
1306.50 - 500.00 = 806.50 x 2% =16.13
totale di spesa 1306.50 + 16.13 = 1322.63
Riesci a modificarmi il codice??
Grazie mille.
totale merce 1290 euro
spese di trasporto euro 11.50
contrassegno fino a 500 euro = euro 5
eccedenza per ordini superiori ai 500 euro:
1290+11.50+5=1306.50
1306.50 - 500.00 = 806.50 x 2% =16.13
totale di spesa 1306.50 + 16.13 = 1322.63
Riesci a modificarmi il codice??
Grazie mille.
jaki ha scritto:Ecco come dovrebbe contare, ti mando ques'esempo:
totale merce 1290 euro
spese di trasporto euro 11.50
contrassegno fino a 500 euro = euro 5
eccedenza per ordini superiori ai 500 euro:
1290+11.50+5=1306.50
1306.50 - 500.00 = 806.50 x 2% =16.13
totale di spesa 1306.50 + 16.13 = 1322.63
Riesci a modificarmi il codice??
Grazie mille.
Questo è il codice modificato per calcolare la percentuale sull'eccedenza.
Codice: Seleziona tutto
<?php
/*
$Id: ot_cod_fee.php,v 1.00 2002/11/30 17:02:00 harley_vb Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2002 osCommerce
Released under the GNU General Public License
*/
/********************************************************************
* Copyright (C) 2006 osCommercedev, Dott. Marco Falcini alias Marcus
* http://www.oscommercedev.com
*
/********************************************************************
/********************************************************************
* Copyright (C) 2002 TheMedia, Dipl.-Ing Thomas Pl"nkers.
* http://www.themedia.at & http://www.oscommerce.at
*
* All rights reserved.
*
* This program is free software licensed under the GNU General Public License (GPL).
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
*********************************************************************/
class ot_cod_fee {
var $title, $output;
function ot_cod_fee() {
$this->code = 'ot_cod_fee';
$this->title = MODULE_ORDER_TOTAL_COD_TITLE;
$this->description = MODULE_ORDER_TOTAL_COD_DESCRIPTION;
$this->enabled = ((MODULE_ORDER_TOTAL_COD_STATUS == 'true') ? true : false);
$this->sort_order = MODULE_ORDER_TOTAL_COD_SORT_ORDER;
$this->order_total_limit = MODULE_ORDER_TOTAL_COD_FEE_LIMIT;
$this->output = array();
}
function process() {
global $order, $currencies, $cod_cost, $cod_country, $shipping;
if (MODULE_ORDER_TOTAL_COD_STATUS == 'true') {
$tax = tep_get_tax_rate(MODULE_ORDER_TOTAL_COD_TAX_CLASS);
//Will become true, if cod can be processed.
$cod_country = false;
//check if payment method is cod. If yes, check if cod is possible.
if ($GLOBALS['payment'] == 'cod') {
//process installed shipping modules
if (substr_count($shipping['id'], 'flat') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_FLAT);
if (substr_count($shipping['id'], 'item') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_ITEM);
if (substr_count($shipping['id'], 'table') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_TABLE);
if (substr_count($shipping['id'], 'ups') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_UPS);
if (substr_count($shipping['id'], 'usps') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_USPS);
if (substr_count($shipping['id'], 'fedex') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_FEDEX);
if (substr_count($shipping['id'], 'zones') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_ZONES);
if (substr_count($shipping['id'], 'ap') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_AP);
if (substr_count($shipping['id'], 'dp') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_DP);
if (substr_count($shipping['id'], 'corriere1') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_CORRIERE1);
if (substr_count($shipping['id'], 'postepaccocelere1') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOCELERE1);
if (substr_count($shipping['id'], 'postepaccocelere3') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOCELERE3);
if (substr_count($shipping['id'], 'postepaccoordinario') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOORDINARIO);
if (substr_count($shipping['id'], 'postepostaordinaria') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTAORDINARIA);
if (substr_count($shipping['id'], 'postepostaprioritaria') !=0) {
$cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTAPRIORITARIA);
}
if (substr_count($shipping['id'], 'postepostaraccomandata') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTARACCOMANDATA);
//satt inn av Pompel
if (substr_count($shipping['id'], 'servicepakke') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_SERVICEPAKKE);
for ($i = 0; $i < count($cod_zones); $i++) {
if ($cod_zones[$i] == $order->delivery['country']['iso_code_2']) {
list($cod_cost_base, $cod_cost_rate) = split("[|]", $cod_zones[$i + 1]);
if (ereg('^(%)[0-9]+', $cod_cost_rate, $match)) {
$order_amount_check = $order->info['total'] + $cod_cost_base;
if ( $order_amount_check > $this->order_total_limit) {
$cod_cost = $cod_cost_base + round( ($order_amount_check - $this->order_total_limit) * (substr($match[0], 1) / 100), 2);
} else {
$cod_cost = $cod_cost_base;
}
} else {
$cod_cost = $cod_cost_base;
}
$cod_country = true;
//print('match' . $i . ': ' . $cod_cost);
break;
} elseif ($cod_zones[$i] == '00') {
list($cod_cost_base, $cod_cost_rate) = split("[|]", $cod_zones[$i + 1]);
if (ereg('^(%)[0-9]+', $cod_cost_rate, $match)) {
$order_amount_check = $order->info['total'] + $cod_cost_base;
if ( $order_amount_check > $this->order_total_limit) {
$cod_cost = $cod_cost_base + round( ($order_amount_check - $this->order_total_limit) * (substr($match[0], 1) / 100), 2);
} else {
$cod_cost = $cod_cost_base;
}
} else {
$cod_cost = $cod_cost_base;
}
//print('match' . $i . ': ' . $cod_cost);
break;
} else {
//print('no match');
}
$i++;
}
} else {
//COD selected, but no shipping module which offers COD
}
if ($cod_country) {
$order->info['tax'] += tep_calculate_tax($cod_cost, $tax);
$order->info['tax_groups']["{$tax}"] += tep_calculate_tax($cod_cost, $tax);
$order->info['total'] += $cod_cost + tep_calculate_tax($cod_cost, $tax);
$this->output[] = array('title' => $this->title . ':',
'text' => $currencies->format(tep_add_tax($cod_cost, $tax), true, $order->info['currency'], $order->info['currency_value']),
'value' => tep_add_tax($cod_cost, $tax));
} else {
//Following code should be improved if we can't get the shipping modules disabled, who don't allow COD
// as well as countries who do not have cod
// $this->output[] = array('title' => $this->title . ':',
// 'text' => 'No COD for this module.',
// 'value' => '');
}
}
}
function check() {
if (!isset($this->_check)) {
$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_COD_STATUS'");
$this->_check = tep_db_num_rows($check_query);
}
return $this->_check;
}
//lagt tilk servicepakke her!!!!
function keys() {
return array('MODULE_ORDER_TOTAL_COD_STATUS', 'MODULE_ORDER_TOTAL_COD_SORT_ORDER', 'MODULE_ORDER_TOTAL_COD_FEE_LIMIT', 'MODULE_ORDER_TOTAL_COD_FEE_FLAT', 'MODULE_ORDER_TOTAL_COD_FEE_ITEM', 'MODULE_ORDER_TOTAL_COD_FEE_TABLE', 'MODULE_ORDER_TOTAL_COD_FEE_UPS', 'MODULE_ORDER_TOTAL_COD_FEE_USPS', 'MODULE_ORDER_TOTAL_COD_FEE_ZONES', 'MODULE_ORDER_TOTAL_COD_FEE_AP', 'MODULE_ORDER_TOTAL_COD_FEE_DP', 'MODULE_ORDER_TOTAL_COD_FEE_CORRIERE1','MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOCELERE1','MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOCELERE3','MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOORDINARIO', 'MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTAORDINARIA','MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTAPRIORITARIA', 'MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTARACCOMANDATA', 'MODULE_ORDER_TOTAL_COD_FEE_SERVICEPAKKE', 'MODULE_ORDER_TOTAL_COD_FEE_FEDEX', 'MODULE_ORDER_TOTAL_COD_TAX_CLASS');
}
function install() {
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display COD', 'MODULE_ORDER_TOTAL_COD_STATUS', 'true', 'Do you want this module to display?', '6', '0','tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_ORDER_TOTAL_COD_SORT_ORDER', '4', 'Sort order of display.', '6', '1', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for FLAT', 'MODULE_ORDER_TOTAL_COD_FEE_FLAT', 'AT:3.00,DE:3.58,00:9.99', 'FLAT: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '3', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for ITEM', 'MODULE_ORDER_TOTAL_COD_FEE_ITEM', 'AT:3.00,DE:3.58,00:9.99', 'ITEM: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '4', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for TABLE', 'MODULE_ORDER_TOTAL_COD_FEE_TABLE', 'AT:3.00,DE:3.58,00:9.99', 'TABLE: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '5', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for UPS', 'MODULE_ORDER_TOTAL_COD_FEE_UPS', 'CA:4.50,US:3.00,00:9.99', 'UPS: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '6', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for USPS', 'MODULE_ORDER_TOTAL_COD_FEE_USPS', 'CA:4.50,US:3.00,00:9.99', 'USPS: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '7', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for ZONES', 'MODULE_ORDER_TOTAL_COD_FEE_ZONES', 'CA:4.50,US:3.00,00:9.99', 'ZONES: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '8', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for Austrian Post', 'MODULE_ORDER_TOTAL_COD_FEE_AP', 'AT:3.63,00:9.99', 'Austrian Post: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '9', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for German Post', 'MODULE_ORDER_TOTAL_COD_FEE_DP', 'DE:3.58,00:9.99', 'German Post: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '10', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for CORRIERE1', 'MODULE_ORDER_TOTAL_COD_FEE_CORRIERE1', 'IT:5|%2,00:9.99', 'CORRIERE1: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '11', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for POSTEPACCOCELERE1', 'MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOCELERE1', 'IT:5|%2,00:9.99', 'POSTEPACCOCELERE1: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '12', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for POSTEPACCOCELERE3', 'MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOCELERE3', 'IT:5|%2,00:9.99', 'POSTEPACCOCELERE3: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '13', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for POSTEPACCOORDINARIO', 'MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOORDINARIO', 'IT:5|%2,00:9.99', 'POSTEPACCOORDINARIO: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '14', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for POSTEPOSTAORDINARIA', 'MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTAORDINARIA', 'IT:5|%2,00:9.99', 'POSTEPOSTAORDINARIA: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '15', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for POSTEPOSTAPRIORITARIA', 'MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTAPRIORITARIA', 'IT:5|%2,00:9.99', 'POSTEPOSTAPRIORITARIA: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '16', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for POSTEPOSTARACCOMANDATA', 'MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTARACCOMANDATA', 'IT:5|%2,00:9.99', 'POSTEPOSTARACCOMANADATA: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '17', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for Servicepakke', 'MODULE_ORDER_TOTAL_COD_FEE_SERVICEPAKKE', 'NO:69', 'Servicepakke: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '18', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for FedEx', 'MODULE_ORDER_TOTAL_COD_FEE_FEDEX', 'US:3.00', 'FedEx: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '19', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Order total amount limit', 'MODULE_ORDER_TOTAL_COD_FEE_LIMIT', '', 'Adds a code fee rate if order total amount is greater than order total amount limit.', '6', '2', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_ORDER_TOTAL_COD_TAX_CLASS', '0', 'Use the following tax class on the COD fee.', '6', '11', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");
}
function remove() {
$keys = '';
$keys_array = $this->keys();
$keys_size = sizeof($keys_array);
for ($i=0; $i<$keys_size; $i++) {
$keys .= "'" . $keys_array[$i] . "',";
}
$keys = substr($keys, 0, -1);
tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in (" . $keys . ")");
}
}
?>
Marcus
Nuovo pacchetto osCommercePRO (osCPRO) + Modulo Interfacciamento Gestionale Danea.
Visita la demo: http://oscpro.oscommercedev.com/index.php
Visita la demo: http://oscpro.oscommercedev.com/index.php
-
- membro Junior
- Messaggi: 6
- Iscritto il: 17/10/2006, 19:11
- Località: Seregno
- Contatta:
Non mi funziona
Ciao,
ho provato ad installare questa contribution,ma nel checkout process non viene mostrata la tassa.Cosa posso fare ?
ho provato ad installare questa contribution,ma nel checkout process non viene mostrata la tassa.Cosa posso fare ?
settaggio limiti
quote: "Il limite viene settato nella nuova casella Order total amount limit, nel pannello di controllo."
ciao a tutti.. ho provato a cambiare il file ot_cod_fee ma non riesco a capire dove devo cambiare i limiti.. qualcuno mi può aiutare?
grazie
paolo
ciao a tutti.. ho provato a cambiare il file ot_cod_fee ma non riesco a capire dove devo cambiare i limiti.. qualcuno mi può aiutare?
grazie
paolo
Re: settaggio limiti
paolino75 ha scritto:quote: "Il limite viene settato nella nuova casella Order total amount limit, nel pannello di controllo."
ciao a tutti.. ho provato a cambiare il file ot_cod_fee ma non riesco a capire dove devo cambiare i limiti.. qualcuno mi può aiutare?
grazie
paolo
Devi disintallare il modulo ot_cod_fee, modificarlo e reinstallarlo.
Il limite lo setti nella nuova casella Order total amount limit, nel pannello di controllo del modulo ot_cod_fee.
Saluti
Marcus
Nuovo pacchetto osCommercePRO (osCPRO) + Modulo Interfacciamento Gestionale Danea.
Visita la demo: http://oscpro.oscommercedev.com/index.php
Visita la demo: http://oscpro.oscommercedev.com/index.php
E' stato rilevato un bug nella modifica sopra, che genera un calcolo scorretto quando la percentuale sull'eccedenza non è intera.
Ecco la versione aggiornata e corretta del modulo ot_cod_fee.php.
modificato:
Saluti
Marcus
Ecco la versione aggiornata e corretta del modulo ot_cod_fee.php.
modificato:
Codice: Seleziona tutto
<?php
/*
$Id: ot_cod_fee.php,v 1.00 2002/11/30 17:02:00 harley_vb Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2002 osCommerce
Released under the GNU General Public License
*/
/********************************************************************
* Copyright (C) 2007 osCommercedev, Dott. Marco Falcini alias Marcus
* http://www.oscommercedev.com
*
/********************************************************************
/********************************************************************
* Copyright (C) 2002 TheMedia, Dipl.-Ing Thomas Pl"nkers.
* http://www.themedia.at & http://www.oscommerce.at
*
* All rights reserved.
*
* This program is free software licensed under the GNU General Public License (GPL).
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
*********************************************************************/
class ot_cod_fee {
var $title, $output;
function ot_cod_fee() {
$this->code = 'ot_cod_fee';
$this->title = MODULE_ORDER_TOTAL_COD_TITLE;
$this->description = MODULE_ORDER_TOTAL_COD_DESCRIPTION;
$this->enabled = ((MODULE_ORDER_TOTAL_COD_STATUS == 'true') ? true : false);
$this->sort_order = MODULE_ORDER_TOTAL_COD_SORT_ORDER;
$this->order_total_limit = MODULE_ORDER_TOTAL_COD_FEE_LIMIT;
$this->output = array();
}
function process() {
global $order, $currencies, $cod_cost, $cod_country, $shipping;
if (MODULE_ORDER_TOTAL_COD_STATUS == 'true') {
$tax = tep_get_tax_rate(MODULE_ORDER_TOTAL_COD_TAX_CLASS);
//Will become true, if cod can be processed.
$cod_country = false;
//check if payment method is cod. If yes, check if cod is possible.
if ($GLOBALS['payment'] == 'cod') {
//process installed shipping modules
if (substr_count($shipping['id'], 'flat') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_FLAT);
if (substr_count($shipping['id'], 'item') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_ITEM);
if (substr_count($shipping['id'], 'table') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_TABLE);
if (substr_count($shipping['id'], 'ups') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_UPS);
if (substr_count($shipping['id'], 'usps') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_USPS);
if (substr_count($shipping['id'], 'fedex') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_FEDEX);
if (substr_count($shipping['id'], 'zones') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_ZONES);
if (substr_count($shipping['id'], 'ap') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_AP);
if (substr_count($shipping['id'], 'dp') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_DP);
if (substr_count($shipping['id'], 'corriere1') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_CORRIERE1);
if (substr_count($shipping['id'], 'postepaccocelere1') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOCELERE1);
if (substr_count($shipping['id'], 'postepaccocelere3') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOCELERE3);
if (substr_count($shipping['id'], 'postepaccoordinario') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOORDINARIO);
if (substr_count($shipping['id'], 'postepostaordinaria') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTAORDINARIA);
if (substr_count($shipping['id'], 'postepostaprioritaria') !=0) {
$cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTAPRIORITARIA);
}
if (substr_count($shipping['id'], 'postepostaraccomandata') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTARACCOMANDATA);
//satt inn av Pompel
if (substr_count($shipping['id'], 'servicepakke') !=0) $cod_zones = split("[:,]", MODULE_ORDER_TOTAL_COD_FEE_SERVICEPAKKE);
for ($i = 0; $i < count($cod_zones); $i++) {
if ($cod_zones[$i] == $order->delivery['country']['iso_code_2']) {
list($cod_cost_base, $cod_cost_rate) = split("[|]", $cod_zones[$i + 1]);
if (ereg('^(%)([0-9]+)(\.[0-9]+)?$', $cod_cost_rate, $match)) {
$order_amount_check = $order->info['total'] + $cod_cost_base;
if ( $order_amount_check > $this->order_total_limit) {
$cod_cost = round($cod_cost_base + (($order_amount_check - $this->order_total_limit) * (substr($match[0], 1) / 100)), 2);
} else {
$cod_cost = $cod_cost_base;
}
} else {
$cod_cost = $cod_cost_base;
}
$cod_country = true;
//print('match' . $i . ': ' . $cod_cost);
break;
} elseif ($cod_zones[$i] == '00') {
list($cod_cost_base, $cod_cost_rate) = split("[|]", $cod_zones[$i + 1]);
if (ereg('^(%)([0-9]+)(\.[0-9]+)?$', $cod_cost_rate, $match)) {
$order_amount_check = $order->info['total'] + $cod_cost_base;
if ( $order_amount_check > $this->order_total_limit) {
$cod_cost = round($cod_cost_base + (($order_amount_check - $this->order_total_limit) * (substr($match[0], 1) / 100)), 2);
} else {
$cod_cost = $cod_cost_base;
}
} else {
$cod_cost = $cod_cost_base;
}
//print('match' . $i . ': ' . $cod_cost);
break;
} else {
//print('no match');
}
$i++;
}
} else {
//COD selected, but no shipping module which offers COD
}
if ($cod_country) {
$order->info['tax'] += tep_calculate_tax($cod_cost, $tax);
$order->info['tax_groups']["{$tax}"] += tep_calculate_tax($cod_cost, $tax);
$order->info['total'] += $cod_cost + tep_calculate_tax($cod_cost, $tax);
$this->output[] = array('title' => $this->title . ':',
'text' => $currencies->format(tep_add_tax($cod_cost, $tax), true, $order->info['currency'], $order->info['currency_value']),
'value' => tep_add_tax($cod_cost, $tax));
} else {
//Following code should be improved if we can't get the shipping modules disabled, who don't allow COD
// as well as countries who do not have cod
// $this->output[] = array('title' => $this->title . ':',
// 'text' => 'No COD for this module.',
// 'value' => '');
}
}
}
function check() {
if (!isset($this->_check)) {
$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_COD_STATUS'");
$this->_check = tep_db_num_rows($check_query);
}
return $this->_check;
}
//lagt tilk servicepakke her!!!!
function keys() {
return array('MODULE_ORDER_TOTAL_COD_STATUS', 'MODULE_ORDER_TOTAL_COD_SORT_ORDER', 'MODULE_ORDER_TOTAL_COD_FEE_LIMIT', 'MODULE_ORDER_TOTAL_COD_FEE_FLAT', 'MODULE_ORDER_TOTAL_COD_FEE_ITEM', 'MODULE_ORDER_TOTAL_COD_FEE_TABLE', 'MODULE_ORDER_TOTAL_COD_FEE_UPS', 'MODULE_ORDER_TOTAL_COD_FEE_USPS', 'MODULE_ORDER_TOTAL_COD_FEE_ZONES', 'MODULE_ORDER_TOTAL_COD_FEE_AP', 'MODULE_ORDER_TOTAL_COD_FEE_DP', 'MODULE_ORDER_TOTAL_COD_FEE_CORRIERE1','MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOCELERE1','MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOCELERE3','MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOORDINARIO', 'MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTAORDINARIA','MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTAPRIORITARIA', 'MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTARACCOMANDATA', 'MODULE_ORDER_TOTAL_COD_FEE_SERVICEPAKKE', 'MODULE_ORDER_TOTAL_COD_FEE_FEDEX', 'MODULE_ORDER_TOTAL_COD_TAX_CLASS');
}
function install() {
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display COD', 'MODULE_ORDER_TOTAL_COD_STATUS', 'true', 'Do you want this module to display?', '6', '0','tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_ORDER_TOTAL_COD_SORT_ORDER', '4', 'Sort order of display.', '6', '1', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for FLAT', 'MODULE_ORDER_TOTAL_COD_FEE_FLAT', 'AT:3.00,DE:3.58,00:9.99', 'FLAT: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '3', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for ITEM', 'MODULE_ORDER_TOTAL_COD_FEE_ITEM', 'AT:3.00,DE:3.58,00:9.99', 'ITEM: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '4', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for TABLE', 'MODULE_ORDER_TOTAL_COD_FEE_TABLE', 'AT:3.00,DE:3.58,00:9.99', 'TABLE: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '5', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for UPS', 'MODULE_ORDER_TOTAL_COD_FEE_UPS', 'CA:4.50,US:3.00,00:9.99', 'UPS: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '6', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for USPS', 'MODULE_ORDER_TOTAL_COD_FEE_USPS', 'CA:4.50,US:3.00,00:9.99', 'USPS: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '7', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for ZONES', 'MODULE_ORDER_TOTAL_COD_FEE_ZONES', 'CA:4.50,US:3.00,00:9.99', 'ZONES: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '8', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for Austrian Post', 'MODULE_ORDER_TOTAL_COD_FEE_AP', 'AT:3.63,00:9.99', 'Austrian Post: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '9', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for German Post', 'MODULE_ORDER_TOTAL_COD_FEE_DP', 'DE:3.58,00:9.99', 'German Post: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '10', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for CORRIERE1', 'MODULE_ORDER_TOTAL_COD_FEE_CORRIERE1', 'IT:5|%2,00:9.99', 'CORRIERE1: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '11', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for POSTEPACCOCELERE1', 'MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOCELERE1', 'IT:5|%2,00:9.99', 'POSTEPACCOCELERE1: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '12', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for POSTEPACCOCELERE3', 'MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOCELERE3', 'IT:5|%2,00:9.99', 'POSTEPACCOCELERE3: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '13', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for POSTEPACCOORDINARIO', 'MODULE_ORDER_TOTAL_COD_FEE_POSTEPACCOORDINARIO', 'IT:5|%2,00:9.99', 'POSTEPACCOORDINARIO: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '14', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for POSTEPOSTAORDINARIA', 'MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTAORDINARIA', 'IT:5|%2,00:9.99', 'POSTEPOSTAORDINARIA: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '15', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for POSTEPOSTAPRIORITARIA', 'MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTAPRIORITARIA', 'IT:5|%2,00:9.99', 'POSTEPOSTAPRIORITARIA: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '16', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for POSTEPOSTARACCOMANDATA', 'MODULE_ORDER_TOTAL_COD_FEE_POSTEPOSTARACCOMANDATA', 'IT:5|%2,00:9.99', 'POSTEPOSTARACCOMANADATA: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '17', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for Servicepakke', 'MODULE_ORDER_TOTAL_COD_FEE_SERVICEPAKKE', 'NO:69', 'Servicepakke: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '18', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('COD Fee for FedEx', 'MODULE_ORDER_TOTAL_COD_FEE_FEDEX', 'US:3.00', 'FedEx: <Country code>:<COD price>, .... 00 as country code applies for all countries. If country code is 00, it must be the last statement. If no 00:9.99 appears, COD shipping in foreign countries is not calculated (not possible)', '6', '19', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Order total amount limit', 'MODULE_ORDER_TOTAL_COD_FEE_LIMIT', '', 'Adds a code fee rate if order total amount is greater than order total amount limit.', '6', '2', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_ORDER_TOTAL_COD_TAX_CLASS', '0', 'Use the following tax class on the COD fee.', '6', '11', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");
}
function remove() {
$keys = '';
$keys_array = $this->keys();
$keys_size = sizeof($keys_array);
for ($i=0; $i<$keys_size; $i++) {
$keys .= "'" . $keys_array[$i] . "',";
}
$keys = substr($keys, 0, -1);
tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in (" . $keys . ")");
}
}
?>
Marcus
Nuovo pacchetto osCommercePRO (osCPRO) + Modulo Interfacciamento Gestionale Danea.
Visita la demo: http://oscpro.oscommercedev.com/index.php
Visita la demo: http://oscpro.oscommercedev.com/index.php
Re: Aiuto con Costo Contrassegno, urgente, vi prego!!! - Grazie.
Ciao Marcus,
ho provato ad apportare le modifiche da te sopra descritte, ma purtroppo nonostante le tue modifiche continua a restituire un risultato sbagliato sul conteggio della percentuale.
La percentuale non è mai fissa (ES:2%) ma varia al variare dell'importo ovviamente sempre al di sopra dei 516,00 €.
Come possiamo risolvere la cosa?
Aspetto con ansia...
ho provato ad apportare le modifiche da te sopra descritte, ma purtroppo nonostante le tue modifiche continua a restituire un risultato sbagliato sul conteggio della percentuale.
La percentuale non è mai fissa (ES:2%) ma varia al variare dell'importo ovviamente sempre al di sopra dei 516,00 €.
Come possiamo risolvere la cosa?
Aspetto con ansia...
Dr.Ock