osCommerce France : Accueil Forum Portail osCommerce France Réponses aux questions Foire aux contributions

Bienvenue invité ( Connexion | Inscription )

 
Reply to this topicStart new topic
> Modifier un module de livraison la poste
pbpictures
posté 10 May 2014, 19:34
Message #1


Ceinture blanche OSC
Icône de groupe

Groupe : Membres
Messages : 9
Inscrit : 2-October 12
Membre no 31582



Bonjour.

Mon site a totalement été remodelé par un informaticien qui n'exerce plus à ce jour.
J'ai besoin de modifier un module ou plutôt un fichier de gestion de livraison.
j'ai un module colissimo, relay, chronopost et envoi simple. (c'est ce dernier que je souhaite modifier)
Comment lui indiquer qu'en fonction du poids de l'article, le prix doit changer et en général dans quel fichier vais je trouver l'information.

<?php
/*
$Id$

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright © 2003 osCommerce

Released under the GNU General Public License
*/

class lettre {
var $code, $title, $description, $icon, $enabled;

// class constructor
function lettre() {
global $order;

$this->code = 'lettre';
$this->title = MODULE_SHIPPING_LETTRE_TEXT_TITLE;
$this->description = MODULE_SHIPPING_LETTRE_TEXT_DESCRIPTION;
$this->sort_order = MODULE_SHIPPING_LETTRE_SORT_ORDER;
$this->icon = '';
$this->tax_class = MODULE_SHIPPING_LETTRE_TAX_CLASS;
$this->enabled = ((MODULE_SHIPPING_LETTRE_STATUS == 'True') ? true : false);

if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_LETTRE_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_LETTRE_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;
}
}
}

// class methods
function quote($method = '') {
global $order;

$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_LETTRE_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_LETTRE_TEXT_WAY,
'cost' => MODULE_SHIPPING_LETTRE_COST)));

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_LETTRE_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 Magasin Shipping', 'MODULE_SHIPPING_LETTRE_STATUS', 'True', 'Do you want to offer flat rate shipping?', '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 ('Shipping Cost', 'MODULE_SHIPPING_LETTRE_COST', '5.00', 'The shipping cost for all orders using this shipping method.', '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 Class', 'MODULE_SHIPPING_LETTRE_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_LETTRE_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_LETTRE_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_LETTRE_STATUS', 'MODULE_SHIPPING_LETTRE_COST', 'MODULE_SHIPPING_LETTRE_TAX_CLASS', 'MODULE_SHIPPING_LETTRE_ZONE', 'MODULE_SHIPPING_LETTRE_SORT_ORDER');
}
}
?>
Go to the top of the page
 
chti_poupon
posté 10 May 2014, 20:12
Message #2


Ceinture noire OSC
Icône de groupe

Groupe : TechDev
Messages : 2757
Inscrit : 9-September 08
Lieu : Douai
Membre no 22915



Bonjour
Attention ce module est conçu pour donner un poids forfaitaire, indépendant du poids.
Il semble, à la lecture de code, que la facturation de se règle en remplissant le formulaire dans :
admin - modules - shipping - lettre.
Le prix est à donner HT: n'oublies pas de vérifier ce point par un essai.
Pour obtenir un prix selon le poids (ou prix selon prix), c'est le module table.php (fourni avec la version de base) qu'il faut activer.
Voir la FAQ pour les réglages
Bons essais !
Chti poupon
Go to the top of the page
 
pbpictures
posté 11 May 2014, 09:36
Message #3


Ceinture blanche OSC
Icône de groupe

Groupe : Membres
Messages : 9
Inscrit : 2-October 12
Membre no 31582



Merci chti poupon d'avoir répondu à un chti de la bassée.
J'ai dupliqué de ce fait mon module de livraison et voici le message d'erreur qui apparaît

array(3) { ["id"]=> string(9) "lettreeco" ["module"]=> string(36) "MODULE_SHIPPING_lettreeco_TEXT_TITLE" ["methods"]=> array(1) { [0]=> array(3) { ["id"]=> string(9) "lettreeco" ["title"]=> string(34) "MODULE_SHIPPING_lettreeco_TEXT_WAY" ["cost"]=> string(4) "5.00" } } }

Il affiche correctement le site mais avec cette erreur et comme je suis un bidouilleur du dimanche, je n'y comprends pas grand chose
Go to the top of the page
 
chti_poupon
posté 11 May 2014, 14:17
Message #4


Ceinture noire OSC
Icône de groupe

Groupe : TechDev
Messages : 2757
Inscrit : 9-September 08
Lieu : Douai
Membre no 22915



Bonjour
Peux tu préciser ce que tu as fait là:
Citation
J'ai dupliqué de ce fait mon module de livraison

J'avais simplement dit d'aller dans l'admin régler les frais de port fixes.

Ou bien d'utiliser le module "tables".

Ce que tu donnes est :
  • soit un message d'erreur incomplet (il manque "error .......in......line....)
  • Soit le résidu d'une commande var_dump ou print_r dans un code en sommeil jusqu'ici


Merci de préciser tout cela !

A te lire !!
Chti poupon
Go to the top of the page
 
pbpictures
posté 11 May 2014, 18:30
Message #5


Ceinture blanche OSC
Icône de groupe

Groupe : Membres
Messages : 9
Inscrit : 2-October 12
Membre no 31582



Comme je ne suis pas très doué, j'ai mis en place le module table. Suite à cette installation du module table, j'avais déjà un message d'erreur.
Du coup, comme j'avais un module basé sur le poids qui me convenait bien (un envoi en lettre simple), j'ai décidé de le copier en remplaçant bien sûr les différents liens.
Il s'est bien inséré mais avec le message d'erreur que j'ai transmis ce matin.
En résumé : j'ai un fichier qui s'appelle lettre.php et un second qui s'appelle lettreeco.php (copie du fichier ci-dessous)
Quand le panier du client s'affiche, il y a a bien l'option de livraison reprenant lettreco mais avec le message d'erreur envoyé ce matin.

<?php
/*
$Id$

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright © 2003 osCommerce

Released under the GNU General Public License
*/

class lettreeco {
var $code, $title, $description, $icon, $enabled;

// class constructor
function lettreeco() {
global $order;

$this->code = 'lettreeco';
$this->title = MODULE_SHIPPING_lettreeco_TEXT_TITLE;
$this->description = MODULE_SHIPPING_lettreeco_TEXT_DESCRIPTION;
$this->sort_order = MODULE_SHIPPING_lettreeco_SORT_ORDER;
$this->icon = '';
$this->tax_class = MODULE_SHIPPING_lettreeco_TAX_CLASS;
$this->enabled = ((MODULE_SHIPPING_lettreeco_STATUS == 'True') ? true : false);

if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_lettreeco_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_lettreeco_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;
}
}
}

// class methods
function quote($method = '') {
global $order;

$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_lettreeco_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_lettreeco_TEXT_WAY,
'cost' => MODULE_SHIPPING_lettreeco_COST)));

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_lettreeco_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 Magasin Shipping', 'MODULE_SHIPPING_lettreeco_STATUS', 'True', 'Do you want to offer flat rate shipping?', '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 ('Shipping Cost', 'MODULE_SHIPPING_lettreeco_COST', '5.00', 'The shipping cost for all orders using this shipping method.', '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 Class', 'MODULE_SHIPPING_lettreeco_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_lettreeco_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_lettreeco_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_lettreeco_STATUS', 'MODULE_SHIPPING_lettreeco_COST', 'MODULE_SHIPPING_lettreeco_TAX_CLASS', 'MODULE_SHIPPING_lettreeco_ZONE', 'MODULE_SHIPPING_lettreeco_SORT_ORDER');
}
}
?>
Go to the top of the page
 
chti_poupon
posté 12 May 2014, 08:24
Message #6


Ceinture noire OSC
Icône de groupe

Groupe : TechDev
Messages : 2757
Inscrit : 9-September 08
Lieu : Douai
Membre no 22915



Bonjour
Si je te rappelle que les commentaires d'un module d'expédition X sont dans un fichier catalog/includes/languages/french/module/shipping/X.php, ne te demanderais-tu pas si tu as omis de le copier ?
Belle journée !
Chti poupon
Go to the top of the page
 

Reply to this topicStart new topic
1 utilisateur(s) sur ce sujet (1 invité(s) et 0 utilisateur(s) anonyme(s))
0 membre(s) :

 



RSS Version bas débit Nous sommes le : 28th March 2024 - 09:26
Ce site est déclaré auprès de la commision Nationale
de l'Informatique et des Libertés (déclaration n°: 1043896)