Bonjour,
Je souhaite mettre en place ceci :
1. Si le client commande le produit A : méthode d'expédition = tarif lettre de La Poste
2. Si le client commande le produit B : méthode d'expédition = Colissimo
3. Si le client commande le produit A ET le produit B : méthode d'expédition = Colissimo
Les 2 premiers points se font facilement avec un contrib. C'est le 3e point que me pose problème...
Une idée ?
Merci d'avance !
j utilise exactement cette methode sur mon site .. voila les demarche que j ai faite:
Ajout d une colonne : Produit_encombrant dans la table product (afin d identifier les produits qui doivent etre envoye par colis et non pas lettre.
Il faut tout d abord ajouter une fonction dans shopping_cart.php afin de pouvoir compter les articles encombrants dans le panier:
CODE |
function calculate() { $this->total_virtual = 0; // ICW Gift Voucher System $this->total = 0; $this->weight = 0; // AJOUT ENCOMBRANT $this->oversized = 0; // AJOUT ENCOMBRANT if (!is_array($this->contents)) return 0; reset($this->contents); while (list($products_id, ) = each($this->contents)) { $qty = $this->contents[$products_id]['qty']; // products price // AJOUT ENCOMBRANT // $product_query = tep_db_query("select products_id, products_price, products_cost, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); $product_query = tep_db_query("select products_id, products_price, products_cost, products_tax_class_id, products_weight, products_oversize from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); // AJOUT ENCOMBRANT if ($product = tep_db_fetch_array($product_query)) { // ICW ORDER TOTAL CREDIT CLASS Start Amendment $no_count = 1; $gv_query = tep_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); $gv_result = tep_db_fetch_array($gv_query); if (ereg('^GIFT', $gv_result['products_model'])) { $no_count = 0; } // ICW ORDER TOTAL CREDIT CLASS End Amendment $prid = $product['products_id']; $products_tax = tep_get_tax_rate($product['products_tax_class_id']); $products_price = $product['products_price']; $products_cost = $product['products_cost']; $products_weight = $product['products_weight']; // AJOUT ENCOMBRANT $products_oversize = $product['products_oversize']; // AJOUT ENCOMBRANT $special_price = tep_get_products_special_price($prid); if ($special_price) { $products_price = $special_price; } $this->total_virtual += tep_add_tax($products_price, $products_tax) * $qty * $no_count;// ICW CREDIT CLASS; $this->weight_virtual += ($qty * $products_weight) * $no_count;// ICW CREDIT CLASS; $this->total += tep_add_tax($products_price, $products_tax) * $qty; $this->weight += ($qty * $products_weight); // AJOUT ENCOMBRANT $this->oversized += $products_oversize; // AJOUT ENCOMBRANT } // attributes price if (isset($this->contents[$products_id]['attributes'])) { reset($this->contents[$products_id]['attributes']); while (list($option, $value) = each($this->contents[$products_id]['attributes'])) { $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$prid . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'"); $attribute_price = tep_db_fetch_array($attribute_price_query); if ($attribute_price['price_prefix'] == '+') { $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax); } else { $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax); } } } } } // AJOUT ENCOMBRANT function show_oversized() { $this->calculate(); return $this->oversized; } // AJOUT ENCOMBRANT |
CODE |
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 ('Enable Oversized', 'MODULE_SHIPPING_FRL_OVERSIZE', 'True', 'Does this method handle oversized items', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); |
CODE |
$this->oversized_module = ((MODULE_SHIPPING_FRL_OVERSIZE == 'True') ? true : false); |
CODE |
if (is_object($cart)) {$OversizedProducts = $cart->show_oversized();} if ($this->oversized_module == true) { if ( $OversizedProducts == 0 ) {$this->enabled = false;} } else { if ( $OversizedProducts > 0 ) {$this->enabled = false;} } |
Ta méthode m'interesserait Phocea mais pourrais tu détaillé un peu plus la démarche parce que dit comme ça j'ai aboutit à un rien hormis des erreurs
Merci
QUOTE (E-Micky @ 22 aoû 2005, 05:15) |
Ta méthode m'interesserait Phocea mais pourrais tu détaillé un peu plus la démarche parce que dit comme ça j'ai aboutit à un rien hormis des erreurs Merci |
Bon je reprend de 0.
Etape 1: Ajout d'un parametre sur les produits:
Ce parametre sert a decider si un produits donné est encombrant ou pas (ie. si il doit etre expedie en mode colis)
QUOTE |
ALTER TABLE products ADD products_oversize INT DEFAULT 0 NOT NULL; |
CODE |
$sql_data_array = array('products_quantity' => tep_db_prepare_input($HTTP_POST_VARS['products_quantity']), 'products_model' => tep_db_prepare_input($HTTP_POST_VARS['products_model']), 'products_price' => tep_db_prepare_input($HTTP_POST_VARS['products_price']), 'products_date_available' => $products_date_available, 'products_weight' => tep_db_prepare_input($HTTP_POST_VARS['products_weight']), 'products_status' => tep_db_prepare_input($HTTP_POST_VARS['products_status']), 'products_tax_class_id' => tep_db_prepare_input($HTTP_POST_VARS['products_tax_class_id']), 'manufacturers_id' => tep_db_prepare_input($HTTP_POST_VARS['manufacturers_id'])); |
QUOTE |
$sql_data_array = array('products_quantity' => tep_db_prepare_input($HTTP_POST_VARS['products_quantity']), 'products_model' => tep_db_prepare_input($HTTP_POST_VARS['products_model']), 'products_price' => tep_db_prepare_input($HTTP_POST_VARS['products_price']), 'products_cost' => tep_db_prepare_input($HTTP_POST_VARS['products_cost']), 'products_date_available' => $products_date_available, 'products_weight' => tep_db_prepare_input($HTTP_POST_VARS['products_weight']), 'products_oversize' => tep_db_prepare_input($HTTP_POST_VARS['products_oversize']), 'products_status' => tep_db_prepare_input($HTTP_POST_VARS['products_status']), 'products_tax_class_id' => tep_db_prepare_input($HTTP_POST_VARS['products_tax_class_id']), 'manufacturers_id' => tep_db_prepare_input($HTTP_POST_VARS['manufacturers_id'])); |
CODE |
// BOF MaxiDVD: Modified For Ultimate Images Pack! $product_query = tep_db_query("select products_quantity, products_model, products_image, products_image_med, products_image_lrg, products_image_sm_1, products_image_xl_1, products_image_sm_2, products_image_xl_2, products_image_sm_3, products_image_xl_3, products_image_sm_4, products_image_xl_4, products_image_sm_5, products_image_xl_5, products_image_sm_6, products_image_xl_6, products_price, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); $product = tep_db_fetch_array($product_query); tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model, products_image, products_image_med, products_image_lrg, products_image_sm_1, products_image_xl_1, products_image_sm_2, products_image_xl_2, products_image_sm_3, products_image_xl_3, products_image_sm_4, products_image_xl_4, products_image_sm_5, products_image_xl_5, products_image_sm_6, products_image_xl_6, products_price, products_date_added, products_date_available, products_weight, products_oversize, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_image_med']) . "', '" . tep_db_input($product['products_image_lrg']) . "', '" . tep_db_input($product['products_image_sm_1']) . "', '" . tep_db_input($product['products_image_xl_1']) . "', '" . tep_db_input($product['products_image_sm_2']) . "', '" . tep_db_input($product['products_image_xl_2']) . "', '" . tep_db_input($product['products_image_sm_3']) . "', '" . tep_db_input($product['products_image_xl_3']) . "', '" . tep_db_input($product['products_image_sm_4']) . "', '" . tep_db_input($product['products_image_xl_4']) . "', '" . tep_db_input($product['products_image_sm_5']) . "', '" . tep_db_input($product['products_image_xl_5']) . "', '" . tep_db_input($product['products_image_sm_6']) . "', '" . tep_db_input($product['products_image_xl_6']) . "', '" . tep_db_input($product['products_price']) . "', '" . tep_db_input($product['products_cost']) . "', now(), '" . tep_db_input($product['products_date_available']) . "', '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')"); // BOF MaxiDVD: Modified For Ultimate Images Pack! |
CODE |
// BOF MaxiDVD: Modified For Ultimate Images Pack! $product_query = tep_db_query("select products_quantity, products_model, products_image, products_image_med, products_image_lrg, products_image_sm_1, products_image_xl_1, products_image_sm_2, products_image_xl_2, products_image_sm_3, products_image_xl_3, products_image_sm_4, products_image_xl_4, products_image_sm_5, products_image_xl_5, products_image_sm_6, products_image_xl_6, products_price, products_date_available, products_weight, products_oversize, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); $product = tep_db_fetch_array($product_query); tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model, products_image, products_image_med, products_image_lrg, products_image_sm_1, products_image_xl_1, products_image_sm_2, products_image_xl_2, products_image_sm_3, products_image_xl_3, products_image_sm_4, products_image_xl_4, products_image_sm_5, products_image_xl_5, products_image_sm_6, products_image_xl_6, products_price, products_date_added, products_date_available, products_weight, products_oversize, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_image_med']) . "', '" . tep_db_input($product['products_image_lrg']) . "', '" . tep_db_input($product['products_image_sm_1']) . "', '" . tep_db_input($product['products_image_xl_1']) . "', '" . tep_db_input($product['products_image_sm_2']) . "', '" . tep_db_input($product['products_image_xl_2']) . "', '" . tep_db_input($product['products_image_sm_3']) . "', '" . tep_db_input($product['products_image_xl_3']) . "', '" . tep_db_input($product['products_image_sm_4']) . "', '" . tep_db_input($product['products_image_xl_4']) . "', '" . tep_db_input($product['products_image_sm_5']) . "', '" . tep_db_input($product['products_image_xl_5']) . "', '" . tep_db_input($product['products_image_sm_6']) . "', '" . tep_db_input($product['products_image_xl_6']) . "', '" . tep_db_input($product['products_price']) . "', '" . tep_db_input($product['products_cost']) . "', now(), '" . tep_db_input($product['products_date_available']) . "', '" . tep_db_input($product['products_weight']) . "', '" . tep_db_input($product['products_oversize']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')"); // BOF MaxiDVD: Modified For Ultimate Images Pack! |
CODE |
<tr> <td class="main"><?php echo TEXT_PRODUCTS_WEIGHT; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_weight', $pInfo->products_weight); ?></td> </tr> |
CODE |
<tr> <td class="main"><?php echo TEXT_PRODUCTS_OVERSIZE; ?></td> <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_oversize', $pInfo->products_oversize); ?></td> </tr> |
CODE |
} else { // BOF MaxiDVD: Modified For Ultimate Images Pack! $product_query = tep_db_query("select p.products_id, pd.language_id, pd.products_name, pd.products_description, pd.products_head_title_tag, pd.products_head_desc_tag, pd.products_head_keywords_tag, pd.products_url, p.products_quantity, p.products_model, p.products_image, p.products_image_med, p.products_image_lrg, p.products_image_sm_1, p.products_image_xl_1, p.products_image_sm_2, p.products_image_xl_2, p.products_image_sm_3, p.products_image_xl_3, p.products_image_sm_4, p.products_image_xl_4, p.products_image_sm_5, p.products_image_xl_5, p.products_image_sm_6, p.products_image_xl_6, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "'"); // EOF MaxiDVD: Modified For Ultimate Images Pack! $product = tep_db_fetch_array($product_query); |
CODE |
} else { // BOF MaxiDVD: Modified For Ultimate Images Pack! $product_query = tep_db_query("select p.products_id, pd.language_id, pd.products_name, pd.products_description, pd.products_head_title_tag, pd.products_head_desc_tag, pd.products_head_keywords_tag, pd.products_url, p.products_quantity, p.products_model, p.products_image, p.products_image_med, p.products_image_lrg, p.products_image_sm_1, p.products_image_xl_1, p.products_image_sm_2, p.products_image_xl_2, p.products_image_sm_3, p.products_image_xl_3, p.products_image_sm_4, p.products_image_xl_4, p.products_image_sm_5, p.products_image_xl_5, p.products_image_sm_6, p.products_image_xl_6, p.products_price, p.products_weight, p.products_oversize, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "'"); // EOF MaxiDVD: Modified For Ultimate Images Pack! $product = tep_db_fetch_array($product_query); |
CODE |
define('TEXT_PRODUCTS_OVERSIZE', 'Produit Encombrant:'); |
LA suite ...
Etape 2: Ajout d'une fonction dans la classe shopping_cart qui verifie si une commande contient des produits encombrants ou pas.
Dans catalogue/includes/classes/shopping_cart.php
Dans la fonction function calculate() {
Trouver
CODE |
$this->weight = 0; |
CODE |
$this->oversized = 0; |
CODE |
$product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); |
CODE |
$product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight, products_oversize from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); |
CODE |
$products_weight = $product['products_weight']; |
CODE |
$products_oversize = $product['products_oversize']; |
CODE |
$this->weight += ($qty * $products_weight); |
CODE |
$this->oversized += $products_oversize; |
CODE |
function show_oversized() { $this->calculate(); return $this->oversized; } |
Etape 3: On ajoute les module shipping eux meme
Creer unb fichier colis.php comme suit:
CODE |
<?php /* $Id: colis.php,v 1.00 2005/03/07 10:37:00 Phocea $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 - 2003 osCommerce Released under the GNU General Public License */ /******************************************************************** * Copyright (C) 2001 - 2003 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 colis { var $code, $title, $description, $icon, $enabled, $num_frc, $types; // class constructor function colis() { global $order, $cart; $this->code = 'colis'; $this->title = MODULE_SHIPPING_FRC_TEXT_TITLE; $this->description = MODULE_SHIPPING_FRC_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_FRC_SORT_ORDER; $this->icon = DIR_WS_ICONS . 'shipping_frc.gif'; $this->tax_class = MODULE_SHIPPING_FRC_TAX_CLASS; $this->oversized_module = ((MODULE_SHIPPING_FRC_OVERSIZE == 'True') ? true : false); $this->enabled = ((MODULE_SHIPPING_FRC_STATUS == 'True') ? true : false); if (is_object($cart)) {$OversizedProducts = $cart->show_oversized();} if ($this->oversized_module == true) { if ( $OversizedProducts == 0 ) {$this->enabled = false;} } else { if ( $OversizedProducts > 0 ) {$this->enabled = false;} } if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FRC_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FRC_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } $this->types = array('ECO' => MODULE_SHIPPING_FRC_ECONOMY, 'INS' => MODULE_SHIPPING_FRC_INSURANCE, 'URG' => MODULE_SHIPPING_FRC_URGENT, 'URGINS' => MODULE_SHIPPING_FRC_URGENT_INSURANCE,); // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED $this->num_frc = 7; } // class methods function quote($method = '') { global $HTTP_POST_VARS, $order, $shipping_weight, $cart, $shipping_num_boxes; $dest_country = $order->delivery['country']['iso_code_2']; $dest_cp = substr( $order->delivery['postcode'], 0, 2 ); $dest_zone = 0; $error = false; if ( ($dest_country == 'FR') || ($dest_country == 'FX') ) {// Par défaut le destinataire est en France métropole // Par défaut le destinataire est en France métropole $dest_country = 'FR'; // Le code postal du destinataire est dans les DOM if ($dest_cp == '97') $dest_country = 'DOM'; // Le code postal du destinataire est dans les TOM if ($dest_cp == '98') $dest_country = 'TOM'; } elseif ( ($dest_country == 'YT') || ($dest_country == 'PM') || ($dest_country == 'GF') || ($dest_country == 'GP') || ($dest_country == 'MQ') || ($dest_country == 'RE')) { $dest_country = 'DOM'; } elseif ( ($dest_country == 'NC') || ($dest_country == 'PF') || ($dest_country == 'WF') || ($dest_country == 'TF')) { $dest_country = 'TOM'; } for ($j=1; $j<=$this->num_frc; $j++) { $countries_table = constant('MODULE_SHIPPING_FRC_COUNTRIES_' . $j); $country_zones = split("[,]", $countries_table); if (in_array($dest_country, $country_zones)) { $dest_zone = $j; break; } else { $dest_zone = 0; // Other destinations } } $OversizedProducts = $cart->show_oversized(); if (MODULE_SHIPPING_FRC_OVERSIZE == 'True') { if ( $OversizedProducts == 0 ) { if ( $shipping_weight <= 2) { $dest_zone = 0; } } } else { if ( $OversizedProducts > 0 ) { $dest_zone = 0; } } if ($dest_zone == 0) { $error = true; } else { $shipping = -1; $frc_cost_eco = @constant('MODULE_SHIPPING_FRC_COST_ECO_' . $j); $frc_cost_ins = @constant('MODULE_SHIPPING_FRC_COST_INS_' . $j); $frc_cost_urg = @constant('MODULE_SHIPPING_FRC_COST_URG_' . $j); $frc_cost_urg_ins = @constant('MODULE_SHIPPING_FRC_COST_URG_INS_' . $j); $methods = array(); if ($frc_cost_eco != '') { $frc_table_eco = split("[:,]" , $frc_cost_eco); for ($i=0; $i<sizeof($frc_table_eco); $i+=2) { if ($shipping_weight <= $frc_table_eco[$i]) { $shipping_eco = $frc_table_eco[$i+1]; break; } } if ($shipping_eco == -1) { $shipping_cost = 0; $shipping_method = MODULE_SHIPPING_FRC_UNDEFINED_RATE; } else { $shipping_cost_1 = ($shipping_eco + MODULE_SHIPPING_FRC_HANDLING); } if ($shipping_eco != 0) { $ship_cost = 0; $total_items = 0; $total_items = $cart->count_contents(); $ship_cost = ($shipping_cost_1 * $shipping_num_boxes); //- $total_items; if ($ship_cost < 0) { $ship_cost = 0; }; $methods[] = array('id' => 'ECO', 'title' => MODULE_SHIPPING_FRC_ECONOMY, 'cost' => $ship_cost); } } if ($frc_cost_ins != '') { $frc_table_ins = split("[:,]" , $frc_cost_ins); for ($i=0; $i<sizeof($frc_table_ins); $i+=2) { if ($shipping_weight <= $frc_table_ins[$i]) { $shipping_ins = $frc_table_ins[$i+1]; break; } } if ($shipping_ins == -1) { $shipping_cost = 0; $shipping_method = MODULE_SHIPPING_FRC_UNDEFINED_RATE; } else { $shipping_cost_2 = ($shipping_ins + MODULE_SHIPPING_FRC_HANDLING); } if ($shipping_ins != 0) { $ship_cost = 0; $total_items = 0; $total_items = $cart->count_contents(); $ship_cost = ($shipping_cost_2 * $shipping_num_boxes); //- $total_items; if ($ship_cost < 0) { $ship_cost = 0; }; $methods[] = array('id' => 'INS', 'title' => MODULE_SHIPPING_FRC_INSURANCE, 'cost' => $ship_cost); //$shipping_cost_2 * $shipping_num_boxes); } } if ($frc_cost_urg != '') { $frc_table_urg = split("[:,]" , $frc_cost_urg); for ($i=0; $i<sizeof($frc_table_urg); $i+=2) { if ($shipping_weight <= $frc_table_urg[$i]) { $shipping_urg = $frc_table_urg[$i+1]; break; } } if ($shipping_urg == -1) { $shipping_cost = 0; $shipping_method = MODULE_SHIPPING_FRC_UNDEFINED_RATE; } else { $shipping_cost_3 = ($shipping_urg + MODULE_SHIPPING_FRC_HANDLING); } if ($shipping_urg != 0) { $ship_cost = 0; $total_items = 0; $total_items = $cart->count_contents(); $ship_cost = ($shipping_cost_3 * $shipping_num_boxes); //- $total_items; if ($ship_cost < 0) { $ship_cost = 0; }; $methods[] = array('id' => 'URG', 'title' => MODULE_SHIPPING_FRC_URGENT, 'cost' => $ship_cost); //$shipping_cost_3 * $shipping_num_boxes); } } if ($frc_cost_urg_ins != '') { $frc_table_urg_ins = split("[:,]" , $frc_cost_urg_ins); for ($i=0; $i<sizeof($frc_table_urg_ins); $i+=2) { if ($shipping_weight <= $frc_table_urg_ins[$i]) { $shipping_urg_ins = $frc_table_urg_ins[$i+1]; break; } } if ($shipping_urg_ins == -1) { $shipping_cost = 0; $shipping_method = MODULE_SHIPPING_FRC_UNDEFINED_RATE; } else { $shipping_cost_3 = ($shipping_urg_ins + MODULE_SHIPPING_FRC_HANDLING); } if ($shipping_urg_ins != 0) { $ship_cost = 0; $total_items = 0; $total_items = $cart->count_contents(); $ship_cost = ($shipping_cost_3 * $shipping_num_boxes); //- $total_items; if ($ship_cost < 0) { $ship_cost = 0; }; $methods[] = array('id' => 'URGINS', 'title' => MODULE_SHIPPING_FRC_URGENT_INS, 'cost' => $ship_cost); //$shipping_cost_3 * $shipping_num_boxes); } } } $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . ' ' . MODULE_SHIPPING_FRC_TEXT_UNITS .')'); $this->quotes['methods'] = $methods; if ($this->tax_class > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title); if ($error == true) $this->quotes['error'] = MODULE_SHIPPING_FRC_INVALID_ZONE; if ( (tep_not_null($method)) && (isset($this->types[$method])) ) { for ($i=0; $i<sizeof($methods); $i++) { if ($method == $methods[$i]['id']) { $methodsc = array(); $methodsc[] = array('id' => $methods[$i]['id'], 'title' => $methods[$i]['title'], 'cost' => $methods[$i]['cost']); break; } } $this->quotes['methods'] = $methodsc; } return $this->quotes; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_FRC_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } 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 ('French PostOffice - Letter', 'MODULE_SHIPPING_FRC_STATUS', 'True', 'Do you want to offer the dispatch over the French post office for letters?', '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 ('Handling Fee', 'MODULE_SHIPPING_FRC_HANDLING', '0', 'Handling charge for this mode of shipment', '6', '0', 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', 'MODULE_SHIPPING_FRC_TAX_CLASS', '0', 'Select the VAT set for this mode of shipment.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', 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 ('Zone', 'MODULE_SHIPPING_FRC_ZONE', '0', 'If you select a zone, this mode of shipment is offered only in this zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', 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_SHIPPING_FRC_SORT_ORDER', '0', 'Lowest one is first indicated.', '6', '0', now())"); 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 ('Enable Oversized', 'MODULE_SHIPPING_FRC_OVERSIZE', 'True', 'Does this method handle oversized items', '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 ('Tarifs for France', 'MODULE_SHIPPING_FRC_COUNTRIES_1', 'FR', 'France', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone FR for Colieco', 'MODULE_SHIPPING_FRC_COST_ECO_1', '0.5:4.50,1:5.5,2:6.40,3:7.00,5:8.30,7:9.00,10:10.90,15:12.70,30:17.50', 'Tarif Table for the France Zone in <b>\'ECO\'</b> up to 3 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone FR for Colieco + Ins', 'MODULE_SHIPPING_FRC_COST_INS_1', '0.5:8.50,1:9.5,2:10.40,3:11.00,5:12.30,7:13.00,10:14.90,15:16.70,30:21.50', 'Tarif Table for the France Zone in <b>\'INS\'</b> up to 1 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone FR for Express Collissimo', 'MODULE_SHIPPING_FRC_COST_URG_1', '0.5:5.50,1:6.5,2:7.00,3:8.00,5:9.00,7:10.00,10:11.70,15:13.70,30:19.00', 'Tarif Table for the France Zone in <b>\'URG\'</b> up to 30 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone FR for Express Collissimo + Ins.', 'MODULE_SHIPPING_FRC_COST_URG_INS_1', '0.5:8.50,1:9.50,2:10.00,3:11.00,5:12.20,7:13.00,10:14.80,15:16.90,30:21.50', 'Tarif Table for the France Zone in <b>\'URGINS\'</b> up to 30 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for DOM', 'MODULE_SHIPPING_FRC_COUNTRIES_2', 'DOM', 'DOM', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for DOM for Colieco', 'MODULE_SHIPPING_FRC_COST_ECO_2', '0.5:7.60, 1:11.40, 2:15.70, 3:20.00', 'Tarif Table for the DOM Zone in <b>\'ECO\'</b> up to 3 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for DOM for Colieco Ins.', 'MODULE_SHIPPING_FRC_COST_INS_2', '0.5:10.70,1:12.60,2:13.10,3:14.10', 'Tarif Table for the DOM Zone in <b>\'INS\'</b> up to 3 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for TOM', 'MODULE_SHIPPING_FRC_COUNTRIES_3', 'TOM', 'TOM', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for TOM for Colieco', 'MODULE_SHIPPING_FRC_COST_ECO_3', '0.5:8.70, 1:13.90, 2:25.30, 3:36.70', 'Tarif Table for the TOM Zone in <b>\'ECO\'</b> up to 3 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for TOM for Colieco + Ins.', 'MODULE_SHIPPING_FRC_COST_INS_3', '0.5:11.80,1:18.00,2:28.40,3:39.80', 'Tarif Table for the TOM Zone in <b>\'INS\'</b> up to 3 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone A - Europe de l\'ouest et CEE, Gibraltar,SanMarin, Vatican', 'MODULE_SHIPPING_FRC_COUNTRIES_4', 'NO,MC,GB,DE,IE,ES,IT,BE,PT,NL,AT,AD,CY,DK,EE,FI,GI,GR,HU,LV,LT,LU,MT,VA,PL,CZ,SK,SI,SE,SM', 'Liste des pays faisant partie de la zone A', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone A for Colieco', 'MODULE_SHIPPING_FRC_COST_ECO_4', '1:14.80,2:16.30,3:19.30', 'Tarif Table for the Zone A in <b>\'ECO\'</b> up to 3 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone A for Colieco + Ins', 'MODULE_SHIPPING_FRC_COST_INS_4', '1:18.80,2:20.30,3:23.30', 'Tarif Table for the Zone A in <b>\'INS\'</b> up to 3 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone B - Pays Zone B - Europe de l\'Est, Maroc, Tunisie, Algérie', 'MODULE_SHIPPING_FRC_COUNTRIES_5', 'AL,AM,AZ,BY,BG,HR,YU,RU,GE,MD,MK,RO,TR,UA,DZ,MA,TN', 'Comma separated list of two character ISO country codes that are part of Zone B.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone C for Colieco', 'MODULE_SHIPPING_FRC_COST_ECO_5', '1:17.80,2:19.60,3:23.80', 'Tarif Table for Zone B, in <b>\'ECO\'</b> up to 3Kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone B for Colieco + Ins', 'MODULE_SHIPPING_FRC_COST_INS_5', '1:21.80,2:23.60,3:27.80', 'Tarif Table for Zone B, in <b>\'INS\'</b> up to 3Kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone C - Afrique,USA,Proche-Orient,Moyen-Orient', 'MODULE_SHIPPING_FRC_COUNTRIES_6', 'ZA,AO,BJ,BW,BF,BI,CM,CV,CF,KM,CG,CI,DJ,ET,GA,GM,GH,GN,GW,MU,KE,LS,LR,LY,MG,MW,MR,YT,MZ,NA,NE,NG,RW,EH,ST,SH,SC,SN,SL,SO,SD,SZ,TZ,TD,TG,ZR,ZM,ZW,US,CA,SA,BH,BN,EG,AE,ER,IQ,IR,IL,JO,KW,LB,OM,QA,SY,YE', 'Comma separated list of two character ISO country codes that are part of Zone C.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone C for Colieco', 'MODULE_SHIPPING_FRC_COST_ECO_6', '1:20.50,2:27.00,3:36.00', 'Tarif Table for Zone C, in <b>\'ECO\'</b> up to 3Kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone C for Colieco + Ins', 'MODULE_SHIPPING_FRC_COST_INS_6', '1:24.50,2:31.00,3:40.00', 'Tarif Table for Zone C, in <b>\'INS\'</b> up to 3Kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone D - Autres destinations', 'MODULE_SHIPPING_FRC_COUNTRIES_7', 'OT', 'Comma separated list of two character ISO country codes that are part of Zone C.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone D for Colieco', 'MODULE_SHIPPING_FRC_COST_ECO_7', '1:23.70,2:35.70,3:47.70', 'Tarif Table for Zone C, in <b>\'ECO\'</b> up to 3Kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone D for Colieco + Ins', 'MODULE_SHIPPING_FRC_COST_INS_7', '1:27.70,2:39.70,3:51.70', 'Tarif Table for Zone C, in <b>\'INS\'</b> up to 3Kg.', '6', '0', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { $keys = array('MODULE_SHIPPING_FRC_STATUS', 'MODULE_SHIPPING_FRC_HANDLING', 'MODULE_SHIPPING_FRC_TAX_CLASS', 'MODULE_SHIPPING_FRC_ZONE', 'MODULE_SHIPPING_FRC_SORT_ORDER', 'MODULE_SHIPPING_FRC_OVERSIZE'); for ($i=1; $i <= $this->num_frc; $i++) { $keys[count($keys)] = 'MODULE_SHIPPING_FRC_COUNTRIES_' . $i; $keys[count($keys)] = 'MODULE_SHIPPING_FRC_COST_ECO_' . $i; $keys[count($keys)] = 'MODULE_SHIPPING_FRC_COST_INS_' . $i; $keys[count($keys)] = 'MODULE_SHIPPING_FRC_COST_URG_' . $i; $keys[count($keys)] = 'MODULE_SHIPPING_FRC_COST_URG_INS_' . $i; } return $keys; } } ?> |
CODE |
<?php /* $Id: colis.php,v 1.01 2003/02/18 03:33:00 Phocea $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 - 2003 osCommerce Released under the GNU General Public License */ /******************************************************************** * Copyright (C) 2002 - 2003 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 * *********************************************************************/ define('MODULE_SHIPPING_FRC_TEXT_TITLE', 'Colis de La Poste (Large)'); define('MODULE_SHIPPING_FRC_TEXT_DESCRIPTION', 'Colis de La Poste (Large)'); define('MODULE_SHIPPING_FRC_TEXT_WAY', 'Délivrer a'); define('MODULE_SHIPPING_FRC_TEXT_UNITS', 'kg'); define('MODULE_SHIPPING_FRC_INVALID_ZONE', 'Malheureusement nous ne pouvons pas délivrer dans ce pays'); define('MODULE_SHIPPING_FRC_INVALID_TYPE', 'Cette méthode de livraison ne s\'applique pas pour votre commande'); define('MODULE_SHIPPING_FRC_UNDEFINED_RATE', 'Le cout de livraison ne peuvent pas etre calculer pour le moment'); define('MODULE_SHIPPING_FRC_ECONOMY', 'Colis économique, j+5 max'); define('MODULE_SHIPPING_FRC_INSURANCE', 'Colis économique avec Assurance, j+5 max'); define('MODULE_SHIPPING_FRC_URGENT', 'Colissimo, j+2 max'); define('MODULE_SHIPPING_FRC_URGENT_INS', 'Colissimo avec Assurance, j+2 max'); ?> |
Creer un fichier letter.php comme suit:
CODE |
<?php /* $Id: letter.php,v 1.00 2005/03/07 10:37:00 Phocea $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 - 2003 osCommerce Released under the GNU General Public License */ /******************************************************************** * Copyright (C) 2001 - 2003 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 letter { var $code, $title, $description, $icon, $enabled, $num_frl, $types; // class constructor function letter() { global $order, $cart; $this->code = 'letter'; $this->title = MODULE_SHIPPING_FRL_TEXT_TITLE; $this->description = MODULE_SHIPPING_FRL_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_FRL_SORT_ORDER; $this->icon = DIR_WS_ICONS . 'shipping_frl.gif'; $this->tax_class = MODULE_SHIPPING_FRL_TAX_CLASS; $this->oversized_module = ((MODULE_SHIPPING_FRL_OVERSIZE == 'True') ? true : false); $this->enabled = ((MODULE_SHIPPING_FRL_STATUS == 'True') ? true : false); if (is_object($cart)) {$OversizedProducts = $cart->show_oversized();} if ($this->oversized_module == true) { if ( $OversizedProducts == 0 ) {$this->enabled = false;} } else { if ( $OversizedProducts > 0 ) {$this->enabled = false;} } if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FRL_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FRL_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } $this->types = array('ECO' => MODULE_SHIPPING_FRL_ECONOMY, 'INS' => MODULE_SHIPPING_FRL_INSURANCE, 'URG' => MODULE_SHIPPING_FRL_URGENT, 'URGINS' => MODULE_SHIPPING_FRL_URGENT_INSURANCE,); // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED $this->num_frl = 7; } // class methods function quote($method = '') { global $HTTP_POST_VARS, $order, $shipping_weight, $cart, $shipping_num_boxes; $dest_country = $order->delivery['country']['iso_code_2']; $dest_cp = substr( $order->delivery['postcode'], 0, 2 ); $dest_zone = 0; $error = false; if ( ($dest_country == 'FR') || ($dest_country == 'FX') ) {// Par défaut le destinataire est en France métropole // Par défaut le destinataire est en France métropole $dest_country = 'FR'; // Le code postal du destinataire est dans les DOM if ($dest_cp == '97') $dest_country = 'DOM'; // Le code postal du destinataire est dans les TOM if ($dest_cp == '98') $dest_country = 'TOM'; } elseif ( ($dest_country == 'YT') || ($dest_country == 'PM') || ($dest_country == 'GF') || ($dest_country == 'GP') || ($dest_country == 'MQ') || ($dest_country == 'RE')) { $dest_country = 'DOM'; } elseif ( ($dest_country == 'NC') || ($dest_country == 'PF') || ($dest_country == 'WF') || ($dest_country == 'TF')) { $dest_country = 'TOM'; } $dest_zone = 7; // Other destinations for ($j=1; $j<=$this->num_frl; $j++) { $countries_table = constant('MODULE_SHIPPING_FRL_COUNTRIES_' . $j); $country_zones = split("[,]", $countries_table); if (in_array($dest_country, $country_zones)) { $dest_zone = $j; break; } else { $dest_zone = 0; // Other destinations } } $OversizedProducts = $cart->show_oversized(); if (MODULE_SHIPPING_FRL_OVERSIZE == 'True') { if ( $OversizedProducts == 0 ) { if ( $shipping_weight <= 2) { $dest_zone = 0; } } } else { if ( $OversizedProducts > 0 ) { $dest_zone = 0; } } if ($dest_zone == 0) { $error = true; } else { $shipping = -1; $frl_cost_eco = @constant('MODULE_SHIPPING_FRL_COST_ECO_' . $j); $frl_cost_ins = @constant('MODULE_SHIPPING_FRL_COST_INS_' . $j); $frl_cost_urg = @constant('MODULE_SHIPPING_FRL_COST_URG_' . $j); $frl_cost_urg_ins = @constant('MODULE_SHIPPING_FRL_COST_URG_INS_' . $j); $methods = array(); if ($frl_cost_eco != '') { $frl_table_eco = split("[:,]" , $frl_cost_eco); for ($i=0; $i<sizeof($frl_table_eco); $i+=2) { if ($shipping_weight <= $frl_table_eco[$i]) { $shipping_eco = $frl_table_eco[$i+1]; break; } } if ($shipping_eco == -1) { $shipping_cost = 0; $shipping_method = MODULE_SHIPPING_FRL_UNDEFINED_RATE; } else { $shipping_cost_1 = ($shipping_eco + MODULE_SHIPPING_FRL_HANDLING); } if ($shipping_eco != 0) { $ship_cost = 0; $total_items = 0; $total_items = $cart->count_contents(); $ship_cost = ($shipping_cost_1 * $shipping_num_boxes);// - $total_items; if ($ship_cost < 0) { $ship_cost = 0; }; $methods[] = array('id' => 'ECO', 'title' => MODULE_SHIPPING_FRL_ECONOMY, 'cost' => $ship_cost); //($shipping_cost_1 * $shipping_num_boxes) - $OversizedProducts * 2 ); } } if ($frl_cost_ins != '') { $frl_table_ins = split("[:,]" , $frl_cost_ins); for ($i=0; $i<sizeof($frl_table_ins); $i+=2) { if ($shipping_weight <= $frl_table_ins[$i]) { $shipping_ins = $frl_table_ins[$i+1]; break; } } if ($shipping_ins == -1) { $shipping_cost = 0; $shipping_method = MODULE_SHIPPING_FRL_UNDEFINED_RATE; } else { $shipping_cost_2 = ($shipping_ins + MODULE_SHIPPING_FRL_HANDLING); } if ($shipping_ins != 0) { $ship_cost = 0; $total_items = 0; $total_items = $cart->count_contents(); $ship_cost = ($shipping_cost_2 * $shipping_num_boxes);// - $total_items; if ($ship_cost < 0) { $ship_cost = 0; }; $methods[] = array('id' => 'INS', 'title' => MODULE_SHIPPING_FRL_INSURANCE, 'cost' => $ship_cost); //$shipping_cost_2 * $shipping_num_boxes); } } if ($frl_cost_urg != '') { $frl_table_urg = split("[:,]" , $frl_cost_urg); for ($i=0; $i<sizeof($frl_table_urg); $i+=2) { if ($shipping_weight <= $frl_table_urg[$i]) { $shipping_urg = $frl_table_urg[$i+1]; break; } } if ($shipping_urg == -1) { $shipping_cost = 0; $shipping_method = MODULE_SHIPPING_FRL_UNDEFINED_RATE; } else { $shipping_cost_3 = ($shipping_urg + MODULE_SHIPPING_FRL_HANDLING); } if ($shipping_urg != 0) { $ship_cost = 0; $total_items = 0; $total_items = $cart->count_contents(); $ship_cost = ($shipping_cost_3 * $shipping_num_boxes);// - $total_items; if ($ship_cost < 0) { $ship_cost = 0; }; $methods[] = array('id' => 'URG', 'title' => MODULE_SHIPPING_FRL_URGENT, 'cost' => $ship_cost); //$shipping_cost_3 * $shipping_num_boxes); } } if ($frl_cost_urg_ins != '') { $frl_table_urg_ins = split("[:,]" , $frl_cost_urg_ins); for ($i=0; $i<sizeof($frl_table_urg_ins); $i+=2) { if ($shipping_weight <= $frl_table_urg_ins[$i]) { $shipping_urg_ins = $frl_table_urg_ins[$i+1]; break; } } if ($shipping_urg_ins == -1) { $shipping_cost = 0; $shipping_method = MODULE_SHIPPING_FRL_UNDEFINED_RATE; } else { $shipping_cost_3 = ($shipping_urg_ins + MODULE_SHIPPING_FRL_HANDLING); } if ($shipping_urg_ins != 0) { $ship_cost = 0; $total_items = 0; $total_items = $cart->count_contents(); $ship_cost = ($shipping_cost_3 * $shipping_num_boxes);// - $total_items; if ($ship_cost < 0) { $ship_cost = 0; }; $methods[] = array('id' => 'URGINS', 'title' => MODULE_SHIPPING_FRL_URGENT_INS, 'cost' => $ship_cost); //$shipping_cost_3 * $shipping_num_boxes); } } } $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . ' ' . MODULE_SHIPPING_FRL_TEXT_UNITS .')'); $this->quotes['methods'] = $methods; if ($this->tax_class > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title); if ($error == true) $this->quotes['error'] = MODULE_SHIPPING_FRL_INVALID_ZONE; if ( (tep_not_null($method)) && (isset($this->types[$method])) ) { for ($i=0; $i<sizeof($methods); $i++) { if ($method == $methods[$i]['id']) { $methodsc = array(); $methodsc[] = array('id' => $methods[$i]['id'], 'title' => $methods[$i]['title'], 'cost' => $methods[$i]['cost']); break; } } $this->quotes['methods'] = $methodsc; } return $this->quotes; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_FRL_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } 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 ('French PostOffice - Letter', 'MODULE_SHIPPING_FRL_STATUS', 'True', 'Do you want to offer the dispatch over the French post office for letters?', '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 ('Handling Fee', 'MODULE_SHIPPING_FRL_HANDLING', '0', 'Handling charge for this mode of shipment', '6', '0', 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', 'MODULE_SHIPPING_FRL_TAX_CLASS', '0', 'Select the VAT set for this mode of shipment.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', 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 ('Zone', 'MODULE_SHIPPING_FRL_ZONE', '0', 'If you select a zone, this mode of shipment is offered only in this zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', 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_SHIPPING_FRL_SORT_ORDER', '0', 'Lowest one is first indicated.', '6', '0', now())"); 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 ('Enable Oversized', 'MODULE_SHIPPING_FRL_OVERSIZE', 'True', 'Does this method handle oversized items', '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 ('Tarifs for France', 'MODULE_SHIPPING_FRL_COUNTRIES_1', 'FR', 'France', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone FR for Free Shipping', 'MODULE_SHIPPING_FRL_COST_ECO_1', '3:1.00', 'Tarif Table for the France Zone in <b>\'ECO\'</b> up to 3 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone FR for Insurance', 'MODULE_SHIPPING_FRL_COST_INS_1', '0.02:3.10,0.05:4.00,0.1:4.50,0.25:5.10,0.5:5.90,1:6.80,2:8.00,3:8.80', 'Tarif Table for the France Zone in <b>\'INS\'</b> up to 1 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone FR for Express Collissimo', 'MODULE_SHIPPING_FRL_COST_URG_1', '0.5:5.50,1:6.5,2:7.00,3:8.00', 'Tarif Table for the France Zone in <b>\'URG\'</b> up to 3 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone FR for Express Collissimo + Ins.', 'MODULE_SHIPPING_FRL_COST_URG_INS_1', '0.5:8.50,1:9.50,2:10.00,3:11.00', 'Tarif Table for the France Zone in <b>\'URGINS\'</b> up to 3 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for DOM', 'MODULE_SHIPPING_FRL_COUNTRIES_2', 'DOM', 'DOM', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for DOM for Free Shipping', 'MODULE_SHIPPING_FRL_COST_ECO_2', '3:1.00', 'Tarif Table for the DOM Zone in <b>\'ECO\'</b> up to 3 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for DOM for Insurance', 'MODULE_SHIPPING_FRL_COST_INS_2', '0.02:3.30,0.05:4.20,0.1:4.60,0.25:5.30,0.5:6.10,1:7.00,2:8.20,3:9.00', 'Tarif Table for the DOM Zone in <b>\'INS\'</b> up to 1 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for DOM for Express Collissimo', 'MODULE_SHIPPING_FRL_COST_URG_2', '0.5:7.60, 1:11.40, 2:15.70, 3:20.00', 'Tarif Table for the DOM Zone in <b>\'URG\'</b> up to 3 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for DOM for Express Collissimo + Ins.', 'MODULE_SHIPPING_FRL_COST_URG_INS_2', '0.5:10.70,1:12.60,2:13.10,3:14.10', 'Tarif Table for the DOM Zone in <b>\'URGINS\'</b> up to 3 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for TOM', 'MODULE_SHIPPING_FRL_COUNTRIES_3', 'TOM', 'TOM', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for TOM for Free Shipping', 'MODULE_SHIPPING_FRL_COST_ECO_3', '3:1.00', 'Tarif Table for the TOM Zone in <b>\'ECO\'</b> up to 3 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for TOM for Insurance', 'MODULE_SHIPPING_FRL_COST_INS_3', '0.02:3.10,0.05:4.00,0.1:4.50,0.25:5.10,0.5:5.90,1:6.80,2:8.00,3:8.80', 'Tarif Table for the TOM Zone in <b>\'INS\'</b> up to 1 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for TOM for Express Collissimo', 'MODULE_SHIPPING_FRL_COST_URG_3', '0.5:8.70, 1:13.90, 2:25.30, 3:36.70', 'Tarif Table for the TOM Zone in <b>\'URG\'</b> up to 3 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for TOM for Express Collissimo + Ins.', 'MODULE_SHIPPING_FRL_COST_URG_INS_3', '0.5:11.80,1:18.00,2:28.40,3:39.80', 'Tarif Table for the TOM Zone in <b>\'URGINS\'</b> up to 3 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone A - Europe de l\'ouest et CEE, Gibraltar,SanMarin, Vatican', 'MODULE_SHIPPING_FRL_COUNTRIES_4', 'NO,MC,GB,DE,IE,ES,IT,BE,PT,NL,AT,AD,CY,DK,EE,FI,GI,GR,HU,LV,LT,LU,MT,VA,PL,CZ,SK,SI,SE,SM', 'Liste des pays faisant partie de la zone A', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone A for Free Shipping', 'MODULE_SHIPPING_FRL_COST_ECO_4', '2:1.00', 'Tarif Table for the Zone A in <b>\'ECO\'</b> up to 2 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone A for Insurance', 'MODULE_SHIPPING_FRL_COST_INS_4', '0.02:4.55,0.04:5.00,0.06:5.20,0.08:5.45,0.1:5.75,0.2:7.5,0.3:9.40,0.4:10.00,0.5:10.30,0.75:12.00,1:13.00,1.25:14.00,1.5:15.00,1.75:16.00,2:16.50', 'Tarif Table for the Zone A in <b>\'INS\'</b> up to 2 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone A for Express Collissimo', 'MODULE_SHIPPING_FRL_COST_URG_4', '1:14.80,2:16.30,3:19.30', 'Tarif Table for the Zone A in <b>\'URG\'</b> up to 3 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone A for Express Collissimo + Ins', 'MODULE_SHIPPING_FRL_COST_URG_INS_4', '1:18.80,2:20.30,3:23.30', 'Tarif Table for the Zone A in <b>\'URGINS\'</b> up to 3 kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone B - Pays Zone B - Europe de l\'Est, Maroc, Tunisie, Algérie', 'MODULE_SHIPPING_FRL_COUNTRIES_5', 'AL,AM,AZ,BY,BG,HR,YU,RU,GE,MD,MK,RO,TR,UA,DZ,MA,TN', 'Comma separated list of two character ISO country codes that are part of Zone B.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone B for Parcel ECO', 'MODULE_SHIPPING_FRL_COST_ECO_5', '0.02:0.75,0.04:1.60,0.06:1.95,0.08:2.15,0.1:2.40,0.2:4.1,0.3:5.80,0.4:6.40,0.5:6.80,0.75:8.50,1:10.00,1.25:11.00,1.5:12.00,1.75:13.00,2:14.00,2.5:20.00,3:26.00', 'Tarif Table for Zone B, in <b>\'ECO\'</b> up to 3Kg Letter.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone B for Parcel ECO + Ins', 'MODULE_SHIPPING_FRL_COST_INS_5', '0.02:4.75,0.04:5.60,0.06:5.95,0.08:6.15,0.1:6.40,0.2:8.1,0.3:9.80,0.4:10.40,0.5:10.80,0.75:12.50,1:14.00,1.25:15.00,1.5:16.00,1.75:17.00,2:18.00,2.5:24.00,3:30.00', 'Tarif Table for Zone B, in <b>\'INS\'</b> up to 3Kg Letter.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone B for Express Collissimo', 'MODULE_SHIPPING_FRL_COST_URG_5', '1:17.80,2:19.60,3:23.80', 'Tarif Table for Zone B, in <b>\'INS\'</b> up to 3Kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone B for Express Collissimo + Ins', 'MODULE_SHIPPING_FRL_COST_URG_INS_5', '1:21.80,2:23.60,3:27.80', 'Tarif Table for Zone B, in <b>\'URGINS\'</b> up to 3Kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone C - Afrique,USA,Proche-Orient,Moyen-Orient', 'MODULE_SHIPPING_FRL_COUNTRIES_6', 'ZA,AO,BJ,BW,BF,BI,CM,CV,CF,KM,CG,CI,DJ,ET,GA,GM,GH,GN,GW,MU,KE,LS,LR,LY,MG,MW,MR,YT,MZ,NA,NE,NG,RW,EH,ST,SH,SC,SN,SL,SO,SD,SZ,TZ,TD,TG,ZR,ZM,ZW,US,CA,SA,BH,BN,EG,AE,ER,IQ,IR,IL,JO,KW,LB,OM,QA,SY,YE', 'Comma separated list of two character ISO country codes that are part of Zone C.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone C for Parcel ECO', 'MODULE_SHIPPING_FRL_COST_ECO_6', '0.02:0.90,0.04:1.80,0.06:2.40,0.08:2.80,0.1:3.20,0.2:5.2,0.3:7.20,0.4:8.20,0.5:8.60,0.75:10.50,1:12.80,1.25:15.80,1.5:18.10,1.75:19.50,2:20.50', 'Tarif Table for Zone C, in <b>\'ECO\'</b> up to 3Kg Letter.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone C for Parcel ECO + Ins', 'MODULE_SHIPPING_FRL_COST_INS_6', '0.02:4.90,0.04:5.80,0.06:6.40,0.08:6.80,0.1:7.20,0.2:9.2,0.3:11.20,0.4:12.20,0.5:12.60,0.75:14.50,1:16.80,1.25:19.80,1.5:22.10,1.75:23.50,2:24.50', 'Tarif Table for Zone C, in <b>\'INS\'</b> up to 3Kg Letter.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone C for Express Collissimo', 'MODULE_SHIPPING_FRL_COST_URG_6', '1:20.50,2:27.00,3:36.00', 'Tarif Table for Zone C, in <b>\'INS\'</b> up to 3Kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone C for Express Collissimo + Ins', 'MODULE_SHIPPING_FRL_COST_URG_INS_6', '1:24.50,2:31.00,3:40.00', 'Tarif Table for Zone C, in <b>\'URGINS\'</b> up to 3Kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone D - Autres destinations', 'MODULE_SHIPPING_FRL_COUNTRIES_7', 'OTHERS', 'Comma separated list of two character ISO country codes that are part of Zone C.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone D for Parcel ECO', 'MODULE_SHIPPING_FRL_COST_ECO_7', '0.02:0.90,0.04:1.80,0.06:2.40,0.08:2.80,0.1:3.20,0.2:5.2,0.3:7.20,0.4:8.20,0.5:8.60,0.75:10.50,1:12.80,1.25:15.80,1.5:18.10,1.75:19.50,2:20.50', 'Tarif Table for Zone C, in <b>\'ECO\'</b> up to 3Kg Letter.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone D for Parcel ECO + Ins', 'MODULE_SHIPPING_FRL_COST_INS_7', '0.02:4.90,0.04:5.80,0.06:6.40,0.08:6.80,0.1:7.20,0.2:9.2,0.3:11.20,0.4:12.20,0.5:12.60,0.75:14.50,1:16.80,1.25:19.80,1.5:22.10,1.75:23.50,2:24.50', 'Tarif Table for Zone C, in <b>\'INS\'</b> up to 3Kg Letter.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone D for Express Collissimo', 'MODULE_SHIPPING_FRL_COST_URG_7', '1:23.70,2:35.70,3:47.70', 'Tarif Table for Zone C, in <b>\'INS\'</b> up to 3Kg.', '6', '0', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Tarifs for Zone D for Express Collissimo + Ins', 'MODULE_SHIPPING_FRL_COST_URG_INS_7', '1:27.70,2:39.70,3:51.70', 'Tarif Table for Zone C, in <b>\'URGINS\'</b> up to 3Kg.', '6', '0', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { $keys = array('MODULE_SHIPPING_FRL_STATUS', 'MODULE_SHIPPING_FRL_HANDLING', 'MODULE_SHIPPING_FRL_TAX_CLASS', 'MODULE_SHIPPING_FRL_ZONE', 'MODULE_SHIPPING_FRL_SORT_ORDER', 'MODULE_SHIPPING_FRL_OVERSIZE'); for ($i=1; $i <= $this->num_frl; $i++) { $keys[count($keys)] = 'MODULE_SHIPPING_FRL_COUNTRIES_' . $i; $keys[count($keys)] = 'MODULE_SHIPPING_FRL_COST_ECO_' . $i; $keys[count($keys)] = 'MODULE_SHIPPING_FRL_COST_INS_' . $i; $keys[count($keys)] = 'MODULE_SHIPPING_FRL_COST_URG_' . $i; $keys[count($keys)] = 'MODULE_SHIPPING_FRL_COST_URG_INS_' . $i; } return $keys; } } ?> |
CODE |
<?php /* $Id: letter.php,v 1.01 2003/02/18 03:33:00 Phocea $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2002 - 2003 osCommerce Released under the GNU General Public License */ /******************************************************************** * Copyright (C) 2002 - 2003 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 * *********************************************************************/ define('MODULE_SHIPPING_FRL_TEXT_TITLE', 'Colis de La Poste'); define('MODULE_SHIPPING_FRL_TEXT_DESCRIPTION', 'Colis de La Poste'); define('MODULE_SHIPPING_FRL_TEXT_WAY', 'Délivrer a'); define('MODULE_SHIPPING_FRL_TEXT_UNITS', 'kg'); define('MODULE_SHIPPING_FRL_INVALID_ZONE', 'Malheureusement nous ne pouvons pas délivrer dans ce pays'); define('MODULE_SHIPPING_FRL_INVALID_TYPE', 'Cette méthode de livraison ne s\'applique pas pour votre commande'); define('MODULE_SHIPPING_FRL_UNDEFINED_RATE', 'Le cout de livraison ne peuvent pas etre calculer pour le moment'); define('MODULE_SHIPPING_FRL_ECONOMY', 'Envoi économique, j+5 max'); define('MODULE_SHIPPING_FRL_INSURANCE', 'Envoi économique avec Assurance, j+5 max'); define('MODULE_SHIPPING_FRL_URGENT', 'Colissimo, j+3 max'); define('MODULE_SHIPPING_FRL_URGENT_INS', 'Colissimo avec Assurance, j+3 max'); ?> |
CODE |
$ship_cost = ($shipping_cost_3 * $shipping_num_boxes);// - $total_items; |
Dernieres recommendations, je ne pense pas que ceci soit une solution clef en main pour la plupart entre vous.
Mes modules ont ete assez personalise pour nos besoins specifique, il vous faudra surement jouer avec les clef de configration dans chaque module.
Par contre le mecanisme pour verifier si un produit doit utiliser l envoi par lettre ou colis reste le meme.
Sur notre boutique, le resultat est le suivant:
Pour une commande ou il n y a QUE des produits non encombrant, le client se voit offert les options suivantes:
Colis de La Poste (1 x 0.37 kg)
- Envoi économique, j+5 max 0.00€
- Envoi économique avec Assurance, j+5 max 4.90€
- Colissimo, j+3 max 4.50€
- Colissimo avec Assurance, j+3 max 7.50€
Pour une commande avec au moins 1 produit encombrant:
Colis de La Poste (Large) (1 x 0.72 kg)
- Colis économique, j+5 max 3.50€
- Colis économique avec Assurance, j+5 max 7.50€
- Colissimo, j+2 max 4.50€
- Colissimo avec Assurance, j+2 max 7.50€
Ce ci explique pourquoi le module lettre s'appelle Colis de La Poste dans l admin et sur les options, car j ai choisi d'offrir le tarif lettre aux clients, mais ils peuvent toutefois choisir une option plus couteuse ou plus rapide si ils le souhaitent.
Pour info, depuis l installation de cette contribution, environ 70% des commandes sont passés en colissimo, meme lorsque le port tarif lettre est offert ...
Salut,
J'ai encore une petite question :
Comment faire pour imposer le colis aux destinations hors France métropolitaine et DOM ?
En gros :
1. Destination France métropolitaine ou DOM :
Produit A : tarif lettre
Produit B : tarif colis
2. Destinations autres :
Produit A : tarif colis
Produit B : tarif colis
Merci !
Petit addendum a cette contrib.
Je me suis appercu que la tare que l on peut rentrer dans le menu de configuration n'etait pas tres apte a cohabite avec 2 methodes d'expedition, letter ou colis.
En effet, en mettant par exemple une tare de 0.350g, ceci correspond a peu pres au poid d'une boite pour un colis mais ne reflete pas vraiment le poid d'une enveloppe a bulle.
Il faut donc apporter les changements suivants:
Ajouter dans la base:
CODE |
INSERT INTO `configuration` ( `configuration_id` , `configuration_title` , `configuration_key` , `configuration_value` , `configuration_description` , `configuration_group_id` , `sort_order` , `last_modified` , `date_added` , `use_function` , `set_function` ) VALUES ( '', 'Letter Tare Weight', 'SHIPPING_LETTER_WEIGHT', '0.150', 'What is the weight of typical packaging for letter shipping', '7', '5', NULL , '0000-00-00 00:00:00', NULL , NULL ); |
CODE |
if (SHIPPING_BOX_WEIGHT >= $shipping_weight*SHIPPING_BOX_PADDING/100) { $shipping_weight = $shipping_weight+SHIPPING_BOX_WEIGHT; } else { $shipping_weight = $shipping_weight + ($shipping_weight*SHIPPING_BOX_PADDING/100); } |
CODE |
$OversizedProducts = $cart->show_oversized(); if ( $OversizedProducts == 0 ) { $shipping_tare_weight = SHIPPING_LETTER_WEIGHT; } else { $shipping_tare_weight = SHIPPING_BOX_WEIGHT; } if ($shipping_tare_weight >= $shipping_weight*SHIPPING_BOX_PADDING/100) { $shipping_weight = $shipping_weight+$shipping_tare_weight; } else { $shipping_weight = $shipping_weight + ($shipping_weight*SHIPPING_BOX_PADDING/100); } |
Merci Phocea pour ce boulot qui semble utile à plusieurs
j'ai fait un peu de nettoyage dans ce post pour n'en garder que la moëlle... désolé pour les autres
dernière remarque, pourquoi ne pas faire une contribution packagée et la mettre à disposition sur oscommerce.com??
http://www.oscommerce.com/community/contributions
Encore bravo pour tout ça
Parce que je suis un peu feignant et beaucoup deborde
Merci pour le nettyage c est vrai que ca devenait un peu le bordel
Je joins mes applaudissements à ceux de Xaglo
bonjour a tous,
je redeterre un vieux post mais j'ai des petits ennuis et j'ai du mal a trouver la solution, j'ai pourtant cherché partout et j'ai tout essayé
bon je m'explique, j'ai suivi la methode donnée au dessus, j'ai tout bien trouvé et ça avais l'air de fonctionner mais quand j'arrive a la page du paiement ça me mets ça
"Fatal error: Cannot redeclare unserialize() in /data/members/paid/b/a/babytrocs.fr/htdocs/www/includes/classes/shopping_cart.php on line 374"
et voila ma ligne 374 "function unserialize ($broken) {"
est-ce que quelqu'un pourrait m'aider sachant que je suis nulle en code
merci d'avance
isabelle
il te dit que c'est au moins la deuxième fois qu'il trouve cette définition de fonctions et que de ce fait, ne sachant pas choisir, il bug
tu n'as probablement pas afficher tout ton message d'erreur qui doit ce continuer de cette façon :
previously declared on line ***
Concrètement, fais une recherche dans ce même fichier des mots suivants et tu verras que ta fonction est en double
function unserialize
Il te faudra ensuite supprimer la bonne en reprenant ton fichier ligne par ligne
bonjour,
merci pour ta reponse,
j'ai fais comme tu m'as dis mais il ne le trouve qu'une seule fois
j'ai alors pris le parti de retirer la ligne de code, mais la il me trouve des erreurs partout :/
je crois que je vais tout retirer et chercher une autre methode pour rajouter un moyen de livraison par lettre et par colis
merci quand meme et bonne fin de week end
isabelle
Jai essayer dinstallercette contribution mais kan je souhaite ajoiuter un produit jai le message derreur suivant :
1054 - Champ 'products_cost' inconnu dans field list
insert into products (products_quantity, products_model, products_price, products_cost, products_date_available, products_weight, products_oversize, products_status, products_tax_class_id, manufacturers_id, products_date_added) values ('1', '', '56', '', null, '9,900', '1', '1', '0', '', now())
[TEP STOP]
je ne vois pas d'ou ca peu venir
Merci
C'est parce que la méthode ne s'applique pas sur une ms2 vierge, mais sur une ms2 déjà fournie de contribution. Là, la colonne prodcuts_cost est rajouté par cette contribution http://www.oscommerce.com/community/contributions,1594/category,all/search,products_cost.
Donc soit tu l'installes aussi, soit tu adaptes la méthode à ton cas.
c'est bon lerreur est parti.
cependant jai une seconde erreur quand je souhite ajouter un objet que je viens de creer juste apres s'etre logger.
Fatal error: Call to undefined function: show_oversized() in d:\www\*******.com\htdocs\figurine\catalog\includes\modules\shipping\colis.php on line 53
merci
Regarde le post du 28 aoû 2005, 08:52 : c'est l'étape 2
Je ne comprend pas ou lon doit mettre ces lignes de codes
____________________________________
Finalement ajouter avant ?>
CODE
function show_oversized() {
$this->calculate();
return $this->oversized;
}
_________________________________________
merci
dans catalogue/includes/classes/shopping_cart.php, jsute avant le ?> final.
je lai mis a la place ke tu as dit mais maintenant g cette erreur kan je ouvre ma boutique
Parse error: parse error in d:\www\*****.com\htdocs\figurine\catalog\includes\classes\shopping_cart.php on line 388
g du zapper kelkechose mais ca metonne
g bien tt verifier
Affiche nous le dernier fichier que tu viens de modifier....
je te le copie dans le message cest shopping cart dans includes classes de la parti catalog
<?php
/*
$Id: shopping_cart.php,v 1.35 2003/06/25 21:14:33 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright © 2003 osCommerce
Released under the GNU General Public License
*/
class shoppingCart {
var $contents, $total, $weight, $cartID, $content_type;
function shoppingCart() {
$this->reset();
}
function restore_contents() {
global $customer_id;
if (!tep_session_is_registered('customer_id')) return false;
// insert current cart contents in database
if (is_array($this->contents)) {
reset($this->contents);
while (list($products_id, ) = each($this->contents)) {
$qty = $this->contents[$products_id]['qty'];
$product_query = tep_db_query("select products_id from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
if (!tep_db_num_rows($product_query)) {
tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . $qty . "', '" . date('Ymd') . "')");
if (isset($this->contents[$products_id]['attributes'])) {
reset($this->contents[$products_id]['attributes']);
while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . (int)$option . "', '" . (int)$value . "')");
}
}
} else {
tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . $qty . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
}
}
}
// reset per-session cart contents, but not the database contents
$this->reset(false);
$products_query = tep_db_query("select products_id, customers_basket_quantity from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "'");
while ($products = tep_db_fetch_array($products_query)) {
$this->contents[$products['products_id']] = array('qty' => $products['customers_basket_quantity']);
// attributes
$attributes_query = tep_db_query("select products_options_id, products_options_value_id from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products['products_id']) . "'");
while ($attributes = tep_db_fetch_array($attributes_query)) {
$this->contents[$products['products_id']]['attributes'][$attributes['products_options_id']] = $attributes['products_options_value_id'];
}
}
$this->cleanup();
}
function reset($reset_database = false) {
global $customer_id;
$this->contents = array();
$this->total = 0;
$this->weight = 0;
$this->oversized = 0;
$this->content_type = false;
if (tep_session_is_registered('customer_id') && ($reset_database == true)) {
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "'");
}
unset($this->cartID);
if (tep_session_is_registered('cartID')) tep_session_unregister('cartID');
}
function add_cart($products_id, $qty = '1', $attributes = '', $notify = true) {
global $new_products_id_in_cart, $customer_id;
$products_id = tep_get_uprid($products_id, $attributes);
if ($notify == true) {
$new_products_id_in_cart = $products_id;
tep_session_register('new_products_id_in_cart');
}
if ($this->in_cart($products_id)) {
$this->update_quantity($products_id, $qty, $attributes);
} else {
$this->contents[] = array($products_id);
$this->contents[$products_id] = array('qty' => $qty);
// insert into database
if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . $qty . "', '" . date('Ymd') . "')");
if (is_array($attributes)) {
reset($attributes);
while (list($option, $value) = each($attributes)) {
$this->contents[$products_id]['attributes'][$option] = $value;
// insert into database
if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . (int)$option . "', '" . (int)$value . "')");
}
}
}
$this->cleanup();
// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
$this->cartID = $this->generate_cart_id();
}
function update_quantity($products_id, $quantity = '', $attributes = '') {
global $customer_id;
if (empty($quantity)) return true; // nothing needs to be updated if theres no quantity, so we return true..
$this->contents[$products_id] = array('qty' => $quantity);
// update database
if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . $quantity . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
if (is_array($attributes)) {
reset($attributes);
while (list($option, $value) = each($attributes)) {
$this->contents[$products_id]['attributes'][$option] = $value;
// update database
if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '" . (int)$value . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "' and products_options_id = '" . (int)$option . "'");
}
}
}
function cleanup() {
global $customer_id;
reset($this->contents);
while (list($key,) = each($this->contents)) {
if ($this->contents[$key]['qty'] < 1) {
unset($this->contents[$key]);
// remove from database
if (tep_session_is_registered('customer_id')) {
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($key) . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($key) . "'");
}
}
}
}
function count_contents() { // get total number of items in cart
$total_items = 0;
if (is_array($this->contents)) {
reset($this->contents);
while (list($products_id, ) = each($this->contents)) {
$total_items += $this->get_quantity($products_id);
}
}
return $total_items;
}
function get_quantity($products_id) {
if (isset($this->contents[$products_id])) {
return $this->contents[$products_id]['qty'];
} else {
return 0;
}
}
function in_cart($products_id) {
if (isset($this->contents[$products_id])) {
return true;
} else {
return false;
}
}
function remove($products_id) {
global $customer_id;
unset($this->contents[$products_id]);
// remove from database
if (tep_session_is_registered('customer_id')) {
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
}
// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
$this->cartID = $this->generate_cart_id();
}
function remove_all() {
$this->reset();
}
function get_product_id_list() {
$product_id_list = '';
if (is_array($this->contents)) {
reset($this->contents);
while (list($products_id, ) = each($this->contents)) {
$product_id_list .= ', ' . $products_id;
}
}
return substr($product_id_list, 2);
}
function calculate() {
$this->total = 0;
$this->weight = 0;
if (!is_array($this->contents)) return 0;
reset($this->contents);
while (list($products_id, ) = each($this->contents)) {
$qty = $this->contents[$products_id]['qty'];
// products price
$product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight, products_oversize from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
if ($product = tep_db_fetch_array($product_query)) {
$prid = $product['products_id'];
$products_tax = tep_get_tax_rate($product['products_tax_class_id']);
$products_price = $product['products_price'];
$products_weight = $product['products_weight'];
$products_oversize = $product['products_oversize'];
$specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");
if (tep_db_num_rows ($specials_query)) {
$specials = tep_db_fetch_array($specials_query);
$products_price = $specials['specials_new_products_price'];
}
$this->total += tep_add_tax($products_price, $products_tax) * $qty;
$this->weight += ($qty * $products_weight);
$this->oversized += $products_oversize;
}
}
// attributes price
if (isset($this->contents[$products_id]['attributes'])) {
reset($this->contents[$products_id]['attributes']);
while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
$attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$prid . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");
$attribute_price = tep_db_fetch_array($attribute_price_query);
if ($attribute_price['price_prefix'] == '+') {
$this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
} else {
$this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
}
}
}
}
}
function attributes_price($products_id) {
$attributes_price = 0;
if (isset($this->contents[$products_id]['attributes'])) {
reset($this->contents[$products_id]['attributes']);
while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
$attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");
$attribute_price = tep_db_fetch_array($attribute_price_query);
if ($attribute_price['price_prefix'] == '+') {
$attributes_price += $attribute_price['options_values_price'];
} else {
$attributes_price -= $attribute_price['options_values_price'];
}
}
}
return $attributes_price;
}
function get_products() {
global $languages_id;
if (!is_array($this->contents)) return false;
$products_array = array();
reset($this->contents);
while (list($products_id, ) = each($this->contents)) {
$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
if ($products = tep_db_fetch_array($products_query)) {
$prid = $products['products_id'];
$products_price = $products['products_price'];
$specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");
if (tep_db_num_rows($specials_query)) {
$specials = tep_db_fetch_array($specials_query);
$products_price = $specials['specials_new_products_price'];
}
$products_array[] = array('id' => $products_id,
'name' => $products['products_name'],
'model' => $products['products_model'],
'image' => $products['products_image'],
'price' => $products_price,
'quantity' => $this->contents[$products_id]['qty'],
'weight' => $products['products_weight'],
'final_price' => ($products_price + $this->attributes_price($products_id)),
'tax_class_id' => $products['products_tax_class_id'],
'attributes' => (isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''));
}
}
return $products_array;
}
function show_total() {
$this->calculate();
return $this->total;
}
function show_weight() {
$this->calculate();
return $this->weight;
}
function generate_cart_id($length = 5) {
return tep_create_random_value($length, 'digits');
}
function get_content_type() {
$this->content_type = false;
if ( (DOWNLOAD_ENABLED == 'true') && ($this->count_contents() > 0) ) {
reset($this->contents);
while (list($products_id, ) = each($this->contents)) {
if (isset($this->contents[$products_id]['attributes'])) {
reset($this->contents[$products_id]['attributes']);
while (list(, $value) = each($this->contents[$products_id]['attributes'])) {
$virtual_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad where pa.products_id = '" . (int)$products_id . "' and pa.options_values_id = '" . (int)$value . "' and pa.products_attributes_id = pad.products_attributes_id");
$virtual_check = tep_db_fetch_array($virtual_check_query);
if ($virtual_check['total'] > 0) {
switch ($this->content_type) {
case 'physical':
$this->content_type = 'mixed';
return $this->content_type;
break;
default:
$this->content_type = 'virtual';
break;
}
} else {
switch ($this->content_type) {
case 'virtual':
$this->content_type = 'mixed';
return $this->content_type;
break;
default:
$this->content_type = 'physical';
break;
}
}
}
} else {
switch ($this->content_type) {
case 'virtual':
$this->content_type = 'mixed';
return $this->content_type;
break;
default:
$this->content_type = 'physical';
break;
}
}
}
} else {
$this->content_type = 'physical';
}
return $this->content_type;
}
function unserialize($broken) {
for(reset($broken);$kv=each($broken) {
$key=$kv['key'];
if (gettype($this->$key)!="user function")
$this->$key=$kv['value'];
}
}
}
function show_oversized() {
$this->calculate();
return $this->oversized;
?>
Remplace à la fin :
CODE |
} function show_oversized() { $this->calculate(); return $this->oversized; |
CODE |
function show_oversized() { $this->calculate(); return $this->oversized; } |
g une erreur sur la ligne 380 maintenant
la fin du code est :
$this->content_type = 'physical';
}
return $this->content_type;
}
function unserialize($broken) { <----- ligne 380
for(reset($broken);$kv=each($broken) {
$key=$kv['key'];
if (gettype($this->$key)!="user function")
$this->$key=$kv['value'];
}
}
function show_oversized() {
$this->calculate();
return $this->oversized;
}
?>
bonjour
je nai plus lerreur pour shopping cart mais jai de nouveau cette erreur :
Fatal error: Call to undefined function: show_oversized() in d:\www\*******.com\htdocs\figurine\catalog\includes\modules\shipping\colis.php on line 53
desoler pour tous ces embetement
merci
ligne 53 :
if (is_object($cart)) {$OversizedProducts = $cart->show_oversized();}
if ($this->oversized_module == true) {
if ( $OversizedProducts == 0 ) {$this->enabled = false;}
} else {
if ( $OversizedProducts > 0 ) {$this->enabled = false;}
}
Peux tu nous montrer les 70 premières lignes de ce fichier colis.php
bonjour,
voici les 70 premiere ligne du fichier colis.php, ce sont les meme ke dans ce topic vu ke c'est juste un copier coller
CODE |
<?php /* $Id: colis.php,v 1.00 2005/03/07 10:37:00 Phocea $ osCommerce, Open Source E-Commerce Solutions [URL=http://www.oscommerce.com]http://www.oscommerce.com[/URL] Copyright © 2002 - 2003 osCommerce Released under the GNU General Public License */ /******************************************************************** * Copyright © 2001 - 2003 TheMedia, Dipl.-Ing Thomas Plänkers * [URL=http://www.themedia.at]http://www.themedia.at[/URL] & [URL=http://www.oscommerce.at]http://www.oscommerce.at[/URL] * * 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 colis { var $code, $title, $description, $icon, $enabled, $num_frc, $types; // class constructor function colis() { global $order, $cart; $this->code = 'colis'; $this->title = MODULE_SHIPPING_FRC_TEXT_TITLE; $this->description = MODULE_SHIPPING_FRC_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_FRC_SORT_ORDER; $this->icon = DIR_WS_ICONS . 'shipping_frc.gif'; $this->tax_class = MODULE_SHIPPING_FRC_TAX_CLASS; $this->oversized_module = ((MODULE_SHIPPING_FRC_OVERSIZE == 'True') ? true : false); $this->enabled = ((MODULE_SHIPPING_FRC_STATUS == 'True') ? true : false); if (is_object($cart)) {$OversizedProducts = $cart->show_oversized();} if ($this->oversized_module == true) { if ( $OversizedProducts == 0 ) {$this->enabled = false;} } else { if ( $OversizedProducts > 0 ) {$this->enabled = false;} } if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FRC_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FRC_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } $this->types = array('ECO' => MODULE_SHIPPING_FRC_ECONOMY, 'INS' => MODULE_SHIPPING_FRC_INSURANCE, 'URG' => MODULE_SHIPPING_FRC_URGENT, 'URGINS' => MODULE_SHIPPING_FRC_URGENT_INSURANCE,); // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED $this->num_frc = 7; } // class methods |
Bonsoir,
Moi aussi j'ai le même soucis que LOLO84, la ligne :
CODE |
function show_oversized() { $this->calculate(); return $this->oversized; } |
CODE |
Fatal error: Call to undefined function: show_oversized() in d:\easyphp\www\monsite.com\shop\includes\modules\shipping\colis.php on line 53 |
QUOTE (polo @ 12 jan 2006, 16:33) |
J'ai donc mis cette ligne au haut avec les autre function , j'ai plus de message d'erreur mais je me demande si la contrib fonctionne réelement dans ce cas la ??? |
CODE |
return $products_array; } function show_total() { $this->calculate(); return $this->total; } function show_weight() { $this->calculate(); return $this->weight; } function show_oversized() { $this->calculate(); return $this->oversized; } function generate_cart_id($length = 5) { return tep_create_random_value($length, 'digits'); } function get_content_type() { $this->content_type = false; if ( (DOWNLOAD_ENABLED == 'true') && ($this->count_contents() > 0) ) { reset($this->contents); while (list($products_id, ) = each($this->contents)) { if (isset($this->contents[$products_id]['attributes'])) { reset($this->contents[$products_id]['attributes']); while (list(, $value) = each($this->contents[$products_id]['attributes'])) { $virtual_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad where pa.products_id = '" . (int)$products_id . "' and pa.options_values_id = '" . (int)$value . "' and pa.products_attributes_id = pad.products_attributes_id"); $virtual_check = tep_db_fetch_array($virtual_check_query); if ($virtual_check['total'] > 0) { switch ($this->content_type) { case 'physical': $this->content_type = 'mixed'; return $this->content_type; break; default: $this->content_type = 'virtual'; break; } } else { switch ($this->content_type) { case 'virtual': $this->content_type = 'mixed'; return $this->content_type; break; default: $this->content_type = 'physical'; break; } } } } else { switch ($this->content_type) { case 'virtual': $this->content_type = 'mixed'; return $this->content_type; break; default: $this->content_type = 'physical'; break; } } } } else { $this->content_type = 'physical'; } return $this->content_type; } function unserialize($broken) { for(reset($broken);$kv=each($broken);) { $key=$kv['key']; if (gettype($this->$key)!="user function") $this->$key=$kv['value']; } } } ?> |
Ok je suis content que chez toi çà marche , par contre peut tu me dire comment tu configure ton admin (au niveau expedition, quel module tu as intégré et comment ils sont configuré) ? et ce que tu as mis sur ton produit ? si tu as mis un poids, qu'est ce que tu as mis dans "produits emcombrant" car chez moi cela ne fait strictement rien. que je mette "0" ou "100".. dans produit encombrant cela ne change rien...
Dans l'admin il faut mettre 1 si le produit est encombrant (envoyé par colis).
Quand tu dis "Cela ne fais strictement rien", que fais-tu pour le constater ?
Je te pose cette question parce que lorsque je rentre 1 dans le champs encombrant, que je valide et que ré-édite la fiche du produit, le 1 n'apparait plus. Mais il est bien présent dans la base.
Bah disons que j'ai toujours le même montant des frais de port et la même proposition de type d'envois:
Pour un produits avec 0 en poids et 1 en emcombrement j'ai ceci comme proposition:
Colis économique, j+5 max 7.00 €
Colis économique avec Assurance, j+5 max 11.00 €
Colissimo, j+2 max 8.00 €
Colissimo avec Assurance, j+2 max 11.00 €
Pour un produits avec 0 en poids et 0 en emcombrement j'ai ceci comme proposition:
Colis économique, j+5 max 7.00 €
Colis économique avec Assurance, j+5 max 11.00 €
Colissimo, j+2 max 8.00 €
Colissimo avec Assurance, j+2 max 11.00 €
Pour un produits avec 1 en poids et 0 en emcombrement j'ai ceci comme proposition:
Colis économique, j+5 max 8.30 €
Colis économique avec Assurance, j+5 max 12.30 €
Colissimo, j+2 max 9.00 €
Colissimo avec Assurance, j+2 max 12.20 €
Pour un produits avec 1 en poids et 0 en emcombrement j'ai ceci comme proposition:
Colis économique, j+5 max 8.30 €
Colis économique avec Assurance, j+5 max 12.30 €
Colissimo, j+2 max 9.00 €
Colissimo avec Assurance, j+2 max 12.20 €
Pour un produits avec 1 en poids et 1 en emcombrement j'ai ceci comme proposition:
Colis économique, j+5 max 8.30 €
Colis économique avec Assurance, j+5 max 12.30 €
Colissimo, j+2 max 9.00 €
Colissimo avec Assurance, j+2 max 12.20 €
Donc l'emcombrement n'a aucun effet pour moi sinon c'est soit une mauvaise intégration au niveau du fichier categorie.php, soit une mauvaise configuration au niveau de l'admin:
Pour les module d'expedition je n'ai mis que "Colis de La Poste (Large)" et "Colis de La Poste (normal lettre)":
Colis de La Poste (Large) :
French PostOffice - Letter -> True
Zone -> France
Enable Oversized -> True
Colis de La Poste (normal lettre):
French PostOffice - Letter -> True
Zone -> France
Enable Oversized -> False
Sinon moi la valeur "1" dans le champ produit emcombrant reste sauvé... bref sinon pourrait tu m'envoyer ton fichiers categorie.php en PV afin de voir si c'est bien un problème d'intégration..
Bon j'y suis arrivé il s'agissait de mon shopping_cart...
Si j'ai ben compris ce systeme et plutôt dépendant du poids, seulement voila j'aimerais pouvoir affecter un prix de frais de transport individuel pour chaque produits, je connais bien sur la contribution "Individual price" mais le seul Hic c'est que cette dernière au lieu de confondre la somme des frais de ports (dans le cas ou le client commande plusieurs produits encombrant..) , elle additionne tous les frais de ports, c'est assez embettant car imaginez la facture du client
Comment faire pour que seulement le prix individuel le plus haut soit pris en compte ?
Salut me revoilou ...
Bon desole pour les messages non repondu j'etais pas vraiment la, pb personnel mais ca s'arrange.
Merci a maxcdr pour faire le support ..d ailleurs pour ton probleme je pense que dans le code de categories.php de l admin tu as du inserer ce qu il fallait pour "updater" la base avec la nouvelle valeur mais je pense que tu as du oublier de rajouter la colonne au select de depart.
Ce qui explique pourquoi ca ne s'affiche pas.
Je dois reinstaller tout ca sur une base neuve, alors je vais faire du nettoyage au passage !!
Polo, cette contrib n'attribut pas une classe de frais de port en fonction du poid mais en fonction d'une categorie de produit. Ici on parle de produit encombrant ou pas et on utilise la valeur 0/1 mais tu pourrais tres bien etendre cette contrib en lui affectant plus de categorie a/b/c/d.
A la fin par contre, elle prend bien en compte le poids de tout les produits pour calculer les frais de port.
Dans ton cas tu devrais plutot mouliner sur individual shipping per product et change le code du module pour trouver la valeur la plus grande et s'en servir plutot que d'additionner
QUOTE |
d ailleurs pour ton probleme je pense que dans le code de categories.php de l admin tu as du inserer ce qu il fallait pour "updater" la base avec la nouvelle valeur mais je pense que tu as du oublier de rajouter la colonne au select de depart. Ce qui explique pourquoi ca ne s'affiche pas. |
Merci Phocea pour ta réponse et bon courage avec ta famille ;o)
Revenons à nos moutons, en fait pour "individual shipping per product ", je ne connais pas, j'ai installé "Individual Product Shipping Prices - v1.0", "individual product shipping price" et même "Multiple Individual Product Shipping Prices", cette dernière et la meilleur et plus simple à mettre en oeuvres, elles fonctionnent tous plus ou moin bien mais le problème c'est qu'elles additionnent tous les frais produits par produits..
Donc comme je suis un peu limité au niveau php je sais pas quel code je doit modifier pour "Multiple Individual Product Shipping Prices" afin de confondre les prix, je pense que ce module colerais mieu au tien , surtout dans le cas de gros transporteur, imagine un client qui achete 2 colis très encombrant, je ne le vois pas payer 2 fois les frias de port d'autant que ce sera dans le même camion.
C'est dans les fonctions de la classe shopping_cart.php
Dans la fonction calculate, c est la que la somme des pois total et autres attributs et faite selons ce qui est dans le panier. Ce poids est ensuite utilises dans n importe quel module de livraison, selon le poid le tarif est choisi
Dans cette fonction il y a une boucle sur chaque prouits du panier
CODE |
while (list($products_id, ) = each($this->contents)) { |
CODE |
$products_weight = $product['products_weight']; |
CODE |
this->weight += ($qty * $products_weight); |
CODE |
if ($products_weight > this->weight ){ this->weight = $products_weight; } |
CODE |
this->weight += ($qty * $products_weight); |
Ok ta methode fonctionne seul les frais sont confondu, j'ai couplé avec le module "multiple individuel shipping"
-------------------------------------
Donc j'ai essayé d'ajouter une clé comme tu dit pour ce module mais çà ne change rien, j'ai du me planter voici le code de multiple indicidual shipping que j'ai modifié:
CODE |
<?php class indvship2 { var $code, $title, $description, $icon, $enabled; // class constructor function indvship2() { global $order; // oversize $this->oversized_module = ((MODULE_SHIPPING_FRL_OVERSIZE == 'True') ? true : false); // oversize $this->code = 'indvship2'; $this->title = MODULE_SHIPPING_INDVSHIP2_TEXT_TITLE; $this->description = MODULE_SHIPPING_INDVSHIP2_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_INDVSHIP2_SORT_ORDER; $this->icon = ''; $this->tax_class = MODULE_SHIPPING_INDVSHIP2_TAX_CLASS; $this->enabled = ((MODULE_SHIPPING_INDVSHIP2_STATUS == 'True') ? true : false); // oversize if (is_object($cart)) {$OversizedProducts = $cart->show_oversized();} if ($this->oversized_module == true) { if ( $OversizedProducts == 0 ) {$this->enabled = false;} } else { if ( $OversizedProducts > 0 ) {$this->enabled = false;} } // oversize // Enable Individual Shipping Module $this->enabled = MODULE_SHIPPING_INDVSHIP2_STATUS; if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_INDVSHIP2_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_INDVSHIP2_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 2) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } // class methods function quote($method = '') { global $order, $cart; $shiptotal2 = $cart->get_shiptotal2(); $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_INDVSHIP2_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_INDVSHIP2_TEXT_WAY, 'cost' => $shiptotal2))); if ($this->tax_class > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title); return $this->quotes; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_INDVSHIP2_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } function install() { // oversize 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 ('Enable Oversized', 'MODULE_SHIPPING_FRL_OVERSIZE', 'True', 'Does this method handle oversized items', '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, set_function, date_added) values ('Enable Individual Shipping Prices 2', 'MODULE_SHIPPING_INDVSHIP2_STATUS', 'True', 'Do you want to offer individual shipping prices?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); // oversize 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_SHIPPING_INDVSHIP2_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', 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 ('Shipping Zone', 'MODULE_SHIPPING_INDVSHIP2_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', 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_SHIPPING_INDVSHIP2_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_SHIPPING_INDVSHIP2_STATUS', 'MODULE_SHIPPING_INDVSHIP2_TAX_CLASS', 'MODULE_SHIPPING_INDVSHIP2_ZONE', 'MODULE_SHIPPING_INDVSHIP2_SORT_ORDER'); } } ?> |
Tu t embetes pour rien je pense, recupere un module de shipping de base, pour les colieco ou autres et dans l'admin tu rentres juste tes tarifs par zone et poids.
En changeant la fonction calculate le calcul se fera toujours uniquement sur l article le plus lourd et basta.
Donc pas besoin e faire d autre changement ou d introduire la notion de produits encombrant (oversize)
Non mais çà marche l'oversize et c'est exactement ce qu'il me faut car certain produits sont très specifique et je doit gerer çà en therme de poids/volume et surtout pouvoir ajouter un prix specifique pour certain produits, donc c'est ok pour moi de ce coté la, par contre je n'arrive pas à intégrer le clé pour activer ou non mon module "multiple individual shipping" , comment faire ?
Bonjour,
Personne ne peux m'aider ?
car il faudrais juste mettre dans le code suivants la clé pour utiliser ou non oversize ?:
CODE |
<?php class indvship3 { var $code, $title, $description, $icon, $enabled; // class constructor function indvship3() { global $order; $this->code = 'indvship3'; $this->title = MODULE_SHIPPING_INDVSHIP3_TEXT_TITLE; $this->description = MODULE_SHIPPING_INDVSHIP3_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_INDVSHIP3_SORT_ORDER; $this->icon = ''; $this->tax_class = MODULE_SHIPPING_INDVSHIP3_TAX_CLASS; $this->enabled = ((MODULE_SHIPPING_INDVSHIP3_STATUS == 'True') ? true : false); // Enable Individual Shipping Module $this->enabled = MODULE_SHIPPING_INDVSHIP3_STATUS; if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_INDVSHIP3_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_INDVSHIP3_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 2) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } // class methods function quote($method = '') { global $order, $cart; $shiptotal3 = $cart->get_shiptotal3(); $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_INDVSHIP3_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_INDVSHIP3_TEXT_WAY, 'cost' => $shiptotal3))); if ($this->tax_class > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title); return $this->quotes; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_INDVSHIP3_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } 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 ('Enable Individual Shipping Prices 3', 'MODULE_SHIPPING_INDVSHIP3_STATUS', 'True', 'Do you want to offer individual shipping prices?', '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, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_INDVSHIP3_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', 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 ('Shipping Zone', 'MODULE_SHIPPING_INDVSHIP3_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', 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_SHIPPING_INDVSHIP3_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_SHIPPING_INDVSHIP3_STATUS', 'MODULE_SHIPPING_INDVSHIP3_TAX_CLASS', 'MODULE_SHIPPING_INDVSHIP3_ZONE', 'MODULE_SHIPPING_INDVSHIP3_SORT_ORDER'); } } ?> |
Relis bien le tuto de la 1ere page vca te dis tout ce qu il faut faire et la clef uniquement ca ne suffira pas il faut aussi faire les changements en debut de classe pour que ca active/desactive le module automatiquement selon le contenu du panier
Merci pour ta réponse Phocea
Oui je pense avoir correctement suivi tes annotations, pour la class c'est bien sur le fichier module qu'il faut faire les modifs ?, en fait c'est bien expliqué sur le 2ieme post au tous début.
Le module que je désire intégré est ici:
http://www.oscommerce.com/community/contributions,2918/category,all/search,multiple+shipping
voici le fichier module shipping une fois modifié:
CODE |
<?php class indvship2 { var $code, $title, $description, $icon, $enabled; // class constructor function indvship2() { global $order; $this->oversized_module = ((MODULE_SHIPPING_FRL_OVERSIZE == 'True') ? true : false); $this->code = 'indvship2'; $this->title = MODULE_SHIPPING_INDVSHIP2_TEXT_TITLE; $this->description = MODULE_SHIPPING_INDVSHIP2_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_INDVSHIP2_SORT_ORDER; // $this->icon = DIR_WS_ICONS . 'shipping_frc.gif'; $this->tax_class = MODULE_SHIPPING_INDVSHIP2_TAX_CLASS; $this->enabled = ((MODULE_SHIPPING_INDVSHIP2_STATUS == 'True') ? true : false); // Ici l'initialisation de Oversize if (is_object($cart)) {$OversizedProducts = $cart->show_oversized();} if ($this->oversized_module == true) { if ( $OversizedProducts == 0 ) {$this->enabled = false;} } else { if ( $OversizedProducts > 0 ) {$this->enabled = false;} } // FIN INIT // Enable Individual Shipping Module $this->enabled = MODULE_SHIPPING_INDVSHIP2_STATUS; if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_INDVSHIP2_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_INDVSHIP2_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 2) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } // class methods function quote($method = '') { global $order, $cart; $shiptotal2 = $cart->get_shiptotal2(); $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_INDVSHIP2_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_INDVSHIP2_TEXT_WAY, 'cost' => $shiptotal2))); if ($this->tax_class > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title); return $this->quotes; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_INDVSHIP2_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } function install() { // ajouter une cle de config dans chaque module de shipping 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 ('Enable Oversized', 'MODULE_SHIPPING_FRL_OVERSIZE', 'True', 'Does this method handle oversized items', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); // fin ajouter une cle de config dans chaque module de shipping 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 ('Transporteur Colis encombrant', 'MODULE_SHIPPING_FRC_STATUS', 'True', 'Désirez vous proposer cette solution ?', '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, set_function, date_added) values ('Enable Individual Shipping Prices 2', 'MODULE_SHIPPING_INDVSHIP2_STATUS', 'True', 'Do you want to offer individual shipping prices?', '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, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_INDVSHIP2_TAX_CLASS', '0', 'Utiliser la classe de taxe suivante sur les frais d\'expédition.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', 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 ('Shipping Zone', 'MODULE_SHIPPING_INDVSHIP2_ZONE', '0', 'Si une zone est selectionné seulement cette zone sera employé', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Ordre d\'affichage.', 'MODULE_SHIPPING_INDVSHIP2_SORT_ORDER', '0', 'Ordre d\'affichage.', '6', '0', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_SHIPPING_INDVSHIP2_STATUS', 'MODULE_SHIPPING_INDVSHIP2_TAX_CLASS', 'MODULE_SHIPPING_INDVSHIP2_ZONE', 'MODULE_SHIPPING_INDVSHIP2_SORT_ORDER'); } } ?> |
Montre nous l'ensemble de la fonction calculate, car sortie de son contexte, c'est dur dindiquer où est l'erreur.
Essaye plutot comme ca
Et la ligne 245 c est quoi ??
Essaye avec cette fonction
Je crois que tu aurais du commencer par lancer un nouveau sujet plutot que de te grefer sur un autre qui traite d un cas completement different au depart.
Si je comprend bien (à force) tu essayes de ne faire payer que le prix du shipping de l article le plus lourd dans le panier ??
Dans ce cas c'est clair qu'avec ca dans ta fonction ca calcule toujours pareil
Je viens de tout recommencer : CA MARCHE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
MERCI MILLE FOIS A TOI PHOCEA
Je vais faire un peu de menage dans ce post et mettre que la solution
Donc pour ceux qui souhaitent gérer l'envoi de colissimo et de colis + volumineux (par transporteur ou autre que la poste) . Cette solution est simple et fonctionnelle : Installer colissimo + individual shipping cart ( voir http://www.oscommerce-fr.info/forum/index.php?s=&showtopic=15038)
ensuite dans shopping_cart.php (includes / classes) :
Cherchez ca :
Ouf heureusement je commencais a en perdre mon latin
Pour info, en plus de la solution de copaero ilfaut egalement faire les modi de début de cette discussion dans les modules individuelles de shipping.
Mias bon vu que La Poste va apparement refusé les marchandises au tarif lettre je me demande si ce module va encore etre utile
il y a un bug dont je ne m'étais pas aperçu . Je ne sais pas pourquoi mais maintenant c'est le contraire de ce que je veux faire qui se produit. C'est la valeur d'individual shipping la plus basse qui est retenue
Pour rappel ( j'ai effacé le post qui expliquais ce que je voulais faire pensant que mon pb etait resolu ), je souhaite 3 propositions de frais :
A >> 10.52 pour la majorité des colis >> colissimo suivi LA POSTE [ s'active qd indivship = 0 et quand poids = vide ]
B >> 15 e pour les colissimo plus encombrant / lourds LA POSTE
C >> 23 e forfaitaire pour les colis volumineux >> transporteur
En faite je m'était mal expliqué, mais mon objectif est de confondre tout les frais et de ne facturer qu'une seule fois la valeur la plus chère:
Si A + B = 15 €
Si A + C = 23 €
Si B + C = 23 €
Ce n'est pas sur le poids mais uniquement sur le montant le plus élévé que le prix doit etre calculé .
J'ai eu beau tout essayé, installer pleins de contrib, faire pleins de modifs je suis vraiment coincé
Bonjour,
Lorsque je mets un "1" dans le champ "Produit Encombrant:" et que je valide mon produit, j'obtient ce message d'erreur :
Je viens de m'apercevoir qu'en faite le calcul se passe de la facon suivante :
Salut à tous!
Je me permet de relancer ce topic.
Je viens d'installer le module en suivant les instructions ci-dessus et en l'adaptant à mon site.
Dans la fiche produit de l'admin, j'indique:
Produit Encombrant: 1 ou 0
Je sauvegarde mais il ne garde pas le chiffre en mémoire.
Ensuite, lorsque j'essaie de passer une commande sur le site avec ce module, j'ai ce message d'erreur qui apparaît:
Bonjour,
voilà j'ai voulu bien faire pour commencer, mais je me trouve devant un soucis avant même de faire quelque chose.
Pourrait-on m'indiquer où le premier code doit-être mit, dans quel fichier ? Car sincèrement je suis pas encore très douée.
Voici le code :
Voilà j'ai toujours pas réussit à trouver ou mettre la phrase du post ci-dessus, mais j'ai fais toutes les autres modifications donnés, et voilà ce que ça me donne quand je vais dans le panier :
Merci Phocea pour cette information.
Mais je crois que je suis un peu neuneu !!! c'est pas possible autrement
Voilà, la ligne de code, si j'ai bien compris, il faut la placer dans la bdd sql dans la partie table products.
donc j'ai recherché ce bloc dont voici mes informations, j'espère que c'est le bon.
Merci pour ta réponse Phocea!
En fait, j'ai bien ajouté cette fonction dans shopping_cart.php (avant le dernier ?>)
personne ne peux m'aider ?
à quel endroit, dois-je mettre cette phrase ???
Dans la table 'products' de la BDD, tu ajoutes le champs:
ahhhhhhhhhhh !!!
c'était donc ça !!!!
si je m'y connaissait mieux j'aurais pu décortiquer la phrase !!!
Merci beaucoup Easybeau.
MERCIIIIIIIIIIIIIIIIIIIII
Bonjour, c'est encore moi !
cette fois j'ai un soucis par rapport à l'execution des différentes modifications apporté à partir de ce tuto.
Voilà, j'ai voulu créer une fiche produit et une fois tout renseigné j'arrive à une page qui m'indique ceci :
remplace par ce code si tu n as pas de colonne products_cost dans ta base:
insert into products (products_quantity, products_model, products_price, products_date_available, products_weight, products_oversize, products_status, products_tax_class_id, manufacturers_id, products_date_added) values ('', '', '', null, '', '', '1', '0', '', now())
[résolu]
Ok.. pour moi ça fonctionne si je place la function oversize comme ceci (et non à la fin!):
Bonjour Phocea,
merci pour ta réponse, j'ai laissé quelques temps cette histoire mais au final j'arrive au même résultat !
1054 - Champ 'products_cost' inconnu dans field list
update products set products_quantity = '0', products_model = 'Elsa', products_price = '20.4000', products_cost = '', products_date_available = null, products_weight = '0.10', products_oversize = '0', products_status = '1', products_tax_class_id = '0', manufacturers_id = '', products_image = 'elsa-string-beige3.png', products_last_modified = now() where products_id = '29'
[TEP STOP]
donc tu me dis que je n'ai pas de 'product_cost' dansmas BDD.
A quel niveau dois-je procéder à la modification ?
Et que dois-je metre cette fois-ci ?
Merci d'avance de ta réponse et en ce mois de Janvier j'en profite pour souhaiter une bonne année !
Bonjour,
c'est encoe moi !
J'ai réglé mon problème avec ceci :
Bonjour c'est encore moi ! lol
Je n'ai toujours pas résolu mon problème sur shipping.php
N'arrivant à rien j'ai laissé tombé !
Un jour peut être que je referais tout pour voir si cette fois je parvient à installer la contrib.
Merci pour ceux et celles qui m'ont répondu.
Bonjour,
Juste un petit mot pour dire que j'ai installer la "contrib" et que ça marche super bien, je cherchais ça depuis longtemps, merci Phocea.
Bonjour,
J'écris bien tard, mais j'ai un problème :
Fatal error: Call to a member function show_oversized() on a non-object in /web/sites/user/0/104/50816/public/www/boutik/includes/classes/shipping.php on line 94
J'ai fais :
Toutes les modifs de phocea, puis j'avais le probleme qu'a rencontré easybeau (changement du fichier shopping_cart avec la fonction show_oversized() qui ne fonctionnait pas quand elle était placée à la fin. Je l'ai mis à la même place qu'easybeau)
Après tout ces changements, j'ai aussi le problème que quand je met 1 sur produit encombrant, ça disparait après validation, mais surtout le fatal error vu au dessus.
Voici ma ligne 94 :
$OversizedProducts = $cart->show_oversized();
Merci !
Bon, j'y passe des nuits mais j'ai réussi à régler un des problemes, par contre maintenant quand j'essai d'acheter un produit encombrant, le site n'arrive plus à passer le checkout_shipping ... la page se réactialise à chaque fois sans résultat... ?
voici le site de production : www.france-specialites.eu/boutik/
Le seul produit encombrant pour le moment est la table bistrot que l'on voit dans la région toulonnais, zone artisanat.
Bonjour,
Quand je veux ajouter la fonction pour la tare des lettres dans /includes/classes/shipping.php
FIND
Tu as fait cette etape:
http://www.oscommerce-fr.info/forum/index.php?showtopic=23835&pid=126849&mode=threaded&start=#entry126849
Oui je viens de revérifier 2 fois, tout est fait.
Polo avait le meme soucis:
http://www.oscommerce-fr.info/forum/index.php?showtopic=23835&view=findpost&p=150532
Essaye pour voir ?
lui il avait cette erreur :
La ligne 54 c'est :
$OversizedProducts = $cart->show_oversized(); ??
Si c'et le cas tu as cette erreur car l'objet $cart n'existe pas.
En ahut de la finction quote il faut la rajouter comme globale
C'était ça ! merci
Mais alors j'ai une autre erreur que je n'avais pas vu avant ! Dans l'admin quand je veux soit créer soit éditer une commande je tombe sur une jolie erreur :
Fatal error: Call to undefined method: manualcart->show_oversized() in /home/damedesc/www/includes/modules/shipping/colis.php on line 53
je vois vaguement ce qu'il veut dire mais je ne sais le faire...
Tu peux mettre le code de ton colis.php stp ?
Je peux
ça y est c'est résolu ! En fait c'est la contrib order editor qu'il faut modifier. dans le fichier admin/order_editor/cart.php il faut faire exactement les même modif que dans include/classes/shopping_cart.php !
Merci Phocea de ton aide.
Ah bein voila, rien à faire
Bonjour, encore moi !
J'ai un petit souci, dans la fiche produit quand je met 1 dans la case oversize il met à jour la BDD mais il ne garde pas en mémoire dans la fiche produit. D'autre part et ça doit être le même problème, j'ai modifié le fichier quick update de façon à pouvoir modifier oversize sur plusieurs produits en même temps et pareil, il met à jour la base mais ne garde pas en mémoire, c'est gênant car je ne sais plus quel produits sont sur 1 ou sur 0 et dans le doute je refais tout.
http://www.archive-host2.com/membres/up/921668290/Katzelkraft/quick_updates.txt
j'ai indiqué les modif avec //BOF OVERSIZE
merci de m'aider si vous pouvez.
Propulsé par Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)