ot_coupon y aurait pas comme un bug??? |
Bienvenue invité ( Connexion | Inscription )
ot_coupon y aurait pas comme un bug??? |
5 Mar 2012, 15:16
Message
#1
|
|
Ceinture orange+ OSC Groupe : Membres Messages : 475 Inscrit : 22-September 06 Lieu : Lons le saunier(39) Membre no 12229 |
voilà j'ai un soucis avec les restrictions par catégories dans la contribe Credit Class & Gift Voucher
j'arrive pas comprend d'où est où défini la variable $this->contents; je la trouve définie nul part est on essai de la parcourir... du coup le code ne sert à rien non? le bout du code qui m'intéresse: Code for ($i = 0; $i < count($cat_ids); $i++) { if (is_array($this->contents)) { reset($this->contents); while (list($products_id, ) = each($this->contents)) { $cat_query = tep_db_query("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . $products_id . "' and categories_id = '" . $cat_ids[$i] . "'"); if (tep_db_num_rows($cat_query) !=0 ) { $in_cat = true; $total_price += $this->get_product_price($products_id); } } } } la fonction complète Code function get_order_total() { global $order, $cart, $customer_id, $cc_id; //$cc_id = $_SESSION['cc_id']; //Fred commented out, do not use $_SESSION[] due to backward comp. Reference the global var instead. $order_total = $order->info['total']; // Check if gift voucher is in cart and adjust total $products = $cart->get_products(); for ($i=0; $i<sizeof($products); $i++) { $t_prid = tep_get_prid($products[$i]['id']); $gv_query = tep_db_query("select products_price, products_tax_class_id, products_model from " . TABLE_PRODUCTS . " where products_id = '" . $t_prid . "'"); $gv_result = tep_db_fetch_array($gv_query); if (preg_match('/^GIFT/', addslashes($gv_result['products_model']))) { $qty = $cart->get_quantity($t_prid); $products_tax = tep_get_tax_rate($gv_result['products_tax_class_id']); if ($this->include_tax =='false') { $gv_amount = $gv_result['products_price'] * $qty; } else { $gv_amount = ($gv_result['products_price'] + tep_calculate_tax($gv_result['products_price'],$products_tax)) * $qty; } $order_total=$order_total - $gv_amount; } } if ($this->include_tax == 'false') $order_total=$order_total-$order->info['tax']; if ($this->include_shipping == 'false') $order_total=$order_total-$order->info['shipping_cost']; // OK thats fine for global coupons but what about restricted coupons // where you can only redeem against certain products/categories. // and I though this was going to be easy !!! $coupon_query=tep_db_query("select coupon_code from " . TABLE_COUPONS . " where coupon_id='".$cc_id."'"); if (tep_db_num_rows($coupon_query) !=0) { $coupon_result=tep_db_fetch_array($coupon_query); $coupon_get=tep_db_query("select coupon_amount, coupon_minimum_order,restrict_to_products,restrict_to_categories, coupon_type from " . TABLE_COUPONS . " where coupon_code='".$coupon_result['coupon_code']."'"); $get_result=tep_db_fetch_array($coupon_get); $in_cat = true; if ($get_result['restrict_to_categories']) { $cat_ids = preg_split("/[,]/", $get_result['restrict_to_categories']); $in_cat=false; for ($i = 0; $i < count($cat_ids); $i++) { if (is_array($this->contents)) { reset($this->contents); while (list($products_id, ) = each($this->contents)) { $cat_query = tep_db_query("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . $products_id . "' and categories_id = '" . $cat_ids[$i] . "'"); if (tep_db_num_rows($cat_query) !=0 ) { $in_cat = true; $total_price += $this->get_product_price($products_id); } } } } } $in_cart = true; if ($get_result['restrict_to_products']) { $pr_ids = preg_split("/[,]/", $get_result['restrict_to_products']); $in_cart=false; $products_array = $cart->get_products(); for ($i = 0; $i < sizeof($pr_ids); $i++) { for ($ii = 1; $ii<=sizeof($products_array); $ii++) { if (tep_get_prid($products_array[$ii-1]['id']) == $pr_ids[$i]) { $in_cart=true; $total_price += $this->get_product_price($products_array[$ii-1]['id']); } } } $order_total = $total_price; } } return $order_total; } bizarre aussi ce codage avec la virgule, non? Code while (list($products_id, ) = each($this->contents)) {
Ce message a été modifié par paddybl - 5 Mar 2012, 15:35. -------------------- oscommerce version ms2fr-060817; contributions: AdminMS2fr_V2.3 - Easypopulate 2.76 - MS2-big_images 1.25 - 2.2-MS2 - BoxImageThemaMS2fr_V2.7 - BUY_TWO_MODULE-V21a - xsell_v2.3 - Your Recent History V3.0 - QTPro.v4.25 - Full-products_on_order1.2 - Ultimate_SEO_URLs 2.2.2 - .buy_now_link_to_button_v1.2c - Site Map MS2 - 2.3a-.robots1.1 - Dynamic Meta Tags - best sellers v1 - bestseller with admin - Review Approval System v1.3_1 - online_offline - SEO_Assistant_V_1.4 - Product Tabs 1.7-2 - avsearch - zones-french_Latin1 - new-faster-checkout - Anti Robot Registration Validation 2.4.01 - anti_spambot_contact_us_1.2 - anti_spambot_review_1_2 - colissimo_1.5.2 - ajax_contrib - GoogleFeeder103 - store feeds.v3.1 - categoriesFrontPage2-3d - Extra pages-info box w-admin 4_6 - PDF data-sheet v.1.7 compatible gif - CCGV5.18 - cvv2_version2 -Edit Order with ecotax- OrderCheck_v2.5.2 with Ecotax- orderlist4.0 - payment_atos_5_00-2.2.4 - payment_bluepaid-2 - Featured_Products_v1.5.8 - newsdesk_v_1.48.3 - .FAQDesk.v1.01.1 - French_Chronopost_Shipping - Popup Estimated Shipping v1.7b -optimize tax ver1.2-query debug 1.7-faster configuration cache 1.32- Print Order Receipt v1.4with ecotax- b2bsuite corrigé par moi ;o) ,
Ecotax v1.4.1 Plus Export, Paypal donation et Infinit'Images par moi même et d'autres à venir... |
|
5 Mar 2012, 17:30
Message
#2
|
|
Ceinture marron OSC Groupe : Membres Messages : 1665 Inscrit : 3-June 09 Membre no 25501 |
j'arrive pas comprend d'où est où défini la variable $this->contents; propriété de la classe shopping_cart. objet $cart appelé en global dans la fonction get_order_total() (ou méthode de classe ? -- car ton code est incomplet ) en aparté: cette fonction est très laide, j'aurai honte de poster un code pareil. |
|
6 Mar 2012, 11:46
Message
#3
|
|
Ceinture orange+ OSC Groupe : Membres Messages : 475 Inscrit : 22-September 06 Lieu : Lons le saunier(39) Membre no 12229 |
le $this-> ferrait référence a un élément de la classe or si tu regardes le fichier il est défini null part avant d'arriver comme ca.
et d'ailleur print_r($this->content) ne retourne rien. pour moi ca ne peu pas marcher et tout le mond à ce code?... -------------------- oscommerce version ms2fr-060817; contributions: AdminMS2fr_V2.3 - Easypopulate 2.76 - MS2-big_images 1.25 - 2.2-MS2 - BoxImageThemaMS2fr_V2.7 - BUY_TWO_MODULE-V21a - xsell_v2.3 - Your Recent History V3.0 - QTPro.v4.25 - Full-products_on_order1.2 - Ultimate_SEO_URLs 2.2.2 - .buy_now_link_to_button_v1.2c - Site Map MS2 - 2.3a-.robots1.1 - Dynamic Meta Tags - best sellers v1 - bestseller with admin - Review Approval System v1.3_1 - online_offline - SEO_Assistant_V_1.4 - Product Tabs 1.7-2 - avsearch - zones-french_Latin1 - new-faster-checkout - Anti Robot Registration Validation 2.4.01 - anti_spambot_contact_us_1.2 - anti_spambot_review_1_2 - colissimo_1.5.2 - ajax_contrib - GoogleFeeder103 - store feeds.v3.1 - categoriesFrontPage2-3d - Extra pages-info box w-admin 4_6 - PDF data-sheet v.1.7 compatible gif - CCGV5.18 - cvv2_version2 -Edit Order with ecotax- OrderCheck_v2.5.2 with Ecotax- orderlist4.0 - payment_atos_5_00-2.2.4 - payment_bluepaid-2 - Featured_Products_v1.5.8 - newsdesk_v_1.48.3 - .FAQDesk.v1.01.1 - French_Chronopost_Shipping - Popup Estimated Shipping v1.7b -optimize tax ver1.2-query debug 1.7-faster configuration cache 1.32- Print Order Receipt v1.4with ecotax- b2bsuite corrigé par moi ;o) ,
Ecotax v1.4.1 Plus Export, Paypal donation et Infinit'Images par moi même et d'autres à venir... |
|
6 Mar 2012, 12:17
Message
#4
|
|
Ceinture marron OSC Groupe : Membres Messages : 1665 Inscrit : 3-June 09 Membre no 25501 |
une fonction anonyme à mettre dans ton fichier index.php :
Code $in_cart = function () { global $cart; var_dump($cart->contents); }; $in_cart(); les contributions sont livrées en l'état, forcément non exemptées de bugs. |
|
6 Mar 2012, 14:51
Message
#5
|
|
Ceinture orange+ OSC Groupe : Membres Messages : 475 Inscrit : 22-September 06 Lieu : Lons le saunier(39) Membre no 12229 |
ben j'ai pas dit le contraire et c'est donc pour ca que je demande ce que vous en pensez.
perso j'ai remplacé par ca: Code if ($get_result['restrict_to_categories']) { $cat_ids = mb_split("[,]", $get_result['restrict_to_categories']); $in_cat=false; for ($i = 0; $i < count($cat_ids); $i++) { if (is_array($products)) { // reset($products); while (list(,$prod ) = each($products)) { $cat_query = tep_db_query("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . $prod['products_id'] . "' and categories_id = '" . $cat_ids[$i] . "'"); if (tep_db_num_rows($cat_query) !=0 ) { $in_cat = true; $total_price += $this->get_product_price($prod['products_id']); } } } } a savoir que j'ai le champ products_id de retourné dans le $cart -------------------- oscommerce version ms2fr-060817; contributions: AdminMS2fr_V2.3 - Easypopulate 2.76 - MS2-big_images 1.25 - 2.2-MS2 - BoxImageThemaMS2fr_V2.7 - BUY_TWO_MODULE-V21a - xsell_v2.3 - Your Recent History V3.0 - QTPro.v4.25 - Full-products_on_order1.2 - Ultimate_SEO_URLs 2.2.2 - .buy_now_link_to_button_v1.2c - Site Map MS2 - 2.3a-.robots1.1 - Dynamic Meta Tags - best sellers v1 - bestseller with admin - Review Approval System v1.3_1 - online_offline - SEO_Assistant_V_1.4 - Product Tabs 1.7-2 - avsearch - zones-french_Latin1 - new-faster-checkout - Anti Robot Registration Validation 2.4.01 - anti_spambot_contact_us_1.2 - anti_spambot_review_1_2 - colissimo_1.5.2 - ajax_contrib - GoogleFeeder103 - store feeds.v3.1 - categoriesFrontPage2-3d - Extra pages-info box w-admin 4_6 - PDF data-sheet v.1.7 compatible gif - CCGV5.18 - cvv2_version2 -Edit Order with ecotax- OrderCheck_v2.5.2 with Ecotax- orderlist4.0 - payment_atos_5_00-2.2.4 - payment_bluepaid-2 - Featured_Products_v1.5.8 - newsdesk_v_1.48.3 - .FAQDesk.v1.01.1 - French_Chronopost_Shipping - Popup Estimated Shipping v1.7b -optimize tax ver1.2-query debug 1.7-faster configuration cache 1.32- Print Order Receipt v1.4with ecotax- b2bsuite corrigé par moi ;o) ,
Ecotax v1.4.1 Plus Export, Paypal donation et Infinit'Images par moi même et d'autres à venir... |
|
Version bas débit | Nous sommes le : 28th March 2024 - 09:59 |
Ce site est déclaré auprès de la commision Nationale de l'Informatique et des Libertés (déclaration n°: 1043896) |