|
From: <os...@us...> - 2015-04-07 08:13:21
|
Revision: 5259
http://sourceforge.net/p/oscss/svn/5259
Author: oscim
Date: 2015-04-07 08:13:07 +0000 (Tue, 07 Apr 2015)
Log Message:
-----------
Fix
Add support composed product in cart
Modified Paths:
--------------
trunk/catalog/common/classes/FieldsDisplay.php
trunk/catalog/common/classes/addressUtility.php
trunk/catalog/common/classes/cart/CartListener.class.php
trunk/catalog/common/classes/cart/CartStockage.class.php
trunk/catalog/common/classes/cart/CartStockageCustomer.class.php
trunk/catalog/common/classes/datatype_drivers/Data_categorie.php
trunk/catalog/common/classes/datatype_drivers/Data_product.php
trunk/catalog/common/classes/formUtility.php
trunk/catalog/common/classes/order.php
trunk/catalog/common/classes/price.php
trunk/catalog/common/classes/shoppingCart.php
trunk/catalog/includes/application_top.php
trunk/catalog/includes/classes/ModPublicOneShipping.php
trunk/catalog/includes/classes/checkout_process.php
trunk/catalog/includes/classes/core_page/customer.php
trunk/catalog/includes/classes/core_page/listing.php
trunk/catalog/includes/classes/drivers/data/categorie.php
trunk/catalog/includes/classes/drivers/data/product.php
trunk/catalog/includes/classes/pad_base.php
trunk/catalog/includes/classes/shopping_cart_action.php
trunk/catalog/includes/functions/general.php
trunk/catalog/includes/languages/fr_FR/modules/shipping/mzmt.txt
trunk/catalog/includes/modules/account/history.php
trunk/catalog/includes/modules/listing_cat.php
trunk/catalog/includes/modules/listing_catchild_and_product.php
trunk/catalog/includes/modules/new_products.php
trunk/catalog/includes/modules/shipping/free.php
trunk/catalog/includes/modules/shipping/mzmt.php
trunk/catalog/templates/defaut/includes/boxes/whats_new.php
trunk/catalog/templates/defaut/includes/content/index_listing.php
trunk/catalog/templates/defaut/includes/content/product_info.php
trunk/catalog/templates/defaut/includes/gabarit/checkout/confirmation.gab
trunk/catalog/templates/defaut/includes/gabarit/checkout/shipping.method.gab
trunk/catalog/templates/defaut/includes/gabarit/pages/shopping_cart.gab
trunk/catalog/templates/defaut/includes/triggers/cart_line.inc
trunk/catalog/templates/defaut/includes/triggers/cart_line_delete.inc
Added Paths:
-----------
trunk/catalog/admin/includes/gabarit/categories/categories_extra/display_edit.edit.gab
trunk/catalog/admin/includes/languages/fr_FR/modules/categories/categories_extra.txt
trunk/catalog/admin/includes/languages/fr_FR/modules/shipping/mzmt.txt
trunk/catalog/templates/defaut/css/images/
trunk/catalog/templates/defaut/includes/gabarit/account/history_quotation/
Added: trunk/catalog/admin/includes/gabarit/categories/categories_extra/display_edit.edit.gab
===================================================================
--- trunk/catalog/admin/includes/gabarit/categories/categories_extra/display_edit.edit.gab (rev 0)
+++ trunk/catalog/admin/includes/gabarit/categories/categories_extra/display_edit.edit.gab 2015-04-07 08:13:07 UTC (rev 5259)
@@ -0,0 +1,21 @@
+<?php
+/**
+ @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
+ @portion code Copyright (c) 2002 osCommerce
+ @package osCSS-2 <www http://www.oscss.org>
+ @version 2.1.1
+ @date 28/02/2012, 18:12
+ @author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ @encode UTF-8
+*/
+global $languages_id;
+
+// var_dump(categories::$Id,$languages_id);
+?>
+
+<div class="block_input">
+ <fieldset class="block_field">
+<!-- <legend><?php //echo __('@products_extra category extra fields') ?></legend> -->
+ <?php echo categories_extra::get_extra_fields(categories::$Id,$languages_id) ?>
+ </fieldset>
+</div>
Added: trunk/catalog/admin/includes/languages/fr_FR/modules/categories/categories_extra.txt
===================================================================
--- trunk/catalog/admin/includes/languages/fr_FR/modules/categories/categories_extra.txt (rev 0)
+++ trunk/catalog/admin/includes/languages/fr_FR/modules/categories/categories_extra.txt 2015-04-07 08:13:07 UTC (rev 5259)
@@ -0,0 +1,13 @@
+<?php
+/**
+ @licence GPL 2005-2013 The osCSS developers - osCSS Open Source E-commerce
+ @portion code Copyright (c) 2002 osCommerce
+ @package osCSS-2 <www http://www.oscss.org>
+ @version 2.1.1
+ @date 21/06/2012, 23:13
+ @author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ @encode UTF-8
+ @sub-package desc_base
+*/
+$lang['@categories_extra edit tab']="Champs suppl" ;
+?>
\ No newline at end of file
Added: trunk/catalog/admin/includes/languages/fr_FR/modules/shipping/mzmt.txt
===================================================================
--- trunk/catalog/admin/includes/languages/fr_FR/modules/shipping/mzmt.txt (rev 0)
+++ trunk/catalog/admin/includes/languages/fr_FR/modules/shipping/mzmt.txt 2015-04-07 08:13:07 UTC (rev 5259)
@@ -0,0 +1,90 @@
+<?php
+/**
+ @licence GPL 2005-2014 The osCSS developers - osCSS Open Source E-commerce
+ @portion code Copyright (c) 2002 osCommerce
+ @package osCSS-2 <www http://www.oscss.org>
+ @version 2.2.0
+ @date 23/07/2010, 15:22
+ @author oscim <mail aur...@os...> <www http://www.oscim.fr>
+ @encode UTF-8
+ @file geozone.txt
+ @dir /includes/languages/fr_FR/shipping/
+*/
+
+
+$lang['module shipping text mzmt title']="MultiGeoZone MultiTable" ;
+$lang['module shipping mzmt text description']="Multiple geo zone shipping with multiple tables to each geo zone." ;
+
+/**
+ Ajouter autant d'entree que de zone et de table
+*/
+// titre transporteur zone 1
+$lang['module shipping mzmt geozone 1 text title']="MZMT zone 1 " ;
+ // detail table price
+ $lang['module shipping mzmt geozone 1 table 1 text way']="MZMT geozone 1 table 1 " ;
+ $lang['module shipping mzmt geozone 1 table 2 text way']="MZMT geozone 1 table 2 " ;
+ $lang['module shipping mzmt geozone 1 table 3 text way']="MZMT geozone 1 table 3" ;
+
+// titre transporteur zone 2
+$lang['module shipping mzmt geozone 2 text title']="MZMT zone 2 " ;
+ // detail table price
+ $lang['module shipping mzmt geozone 2 table 1 text way']="MZMT geozone 2 table 1 " ;
+ $lang['module shipping mzmt geozone 2 table 2 text way']="MZMT geozone 2 table 2 " ;
+ $lang['module shipping mzmt geozone 2 table 3 text way']="MZMT geozone 2 table 3" ;
+
+// titre transporteur zone 2
+$lang['module shipping mzmt geozone 3 text title']="MZMT zone 3 " ;
+ // detail table price
+ $lang['module shipping mzmt geozone 2 table 1 text way']="MZMT geozone 2 table 1 " ;
+ $lang['module shipping mzmt geozone 2 table 2 text way']="MZMT geozone 2 table 2 " ;
+ $lang['module shipping mzmt geozone 2 table 3 text way']="MZMT geozone 2 table 3" ;
+
+
+
+
+/** Specifique BO */
+$lang['tax class']="Appliquer une taxe" ;
+$lang['use the following tax class on the shipping fee.']="Appliquer une taxe lors de l'uitilisation de ce module" ;
+
+$lang['sort order']="Ordre de tri" ;
+$lang['sort order of display.']="Ordre de tri, si plusieur module" ;
+$lang['number geozones']="Nombre de zone de livraison" ;
+$lang['use the following tax class on the shipping fee.']="Nombre de zone de livraison à mettre en place, attention cette action reinitialise le module" ;
+
+
+
+
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_1_ID_S'] = "Zone (1) - Appliquer une taxe";
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_1_ID_L'] = "Appliquer une taxe lors de l'uitilisation de ce module.";
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_1_MODE_S'] = "Zone (1) - Mode de calcul";
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_1_MODE_L'] = "";
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_1_HANDLING_S'] = "Zone (1) - Frais Fixe";
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_1_HANDLING_L'] = "";
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_1_ICON_S'] = "Zone (1) - Icone";
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_1_ICON_L'] = "";
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_1_TABLE_1_S'] = "Zone (1) - Table de tarif (1)";
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_1_TABLE_1_L'] = "";
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_1_TABLE_2_S'] = "Zone (1) - Table de tarif (2)";
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_1_TABLE_2_L'] = "";
+
+
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_2_ID_S'] = "Zone (2) - Appliquer une taxe";
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_2_ID_L'] = "Appliquer une taxe lors de l'uitilisation de ce module.";
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_2_MODE_S'] = "Zone (2) - Mode de calcul";
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_2_MODE_L'] = "";
+
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_3_ID_S'] = "Zone (3) - Appliquer une taxe";
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_3_ID_L'] = "Appliquer une taxe lors de l'uitilisation de ce module.";
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_3_MODE_S'] = "Zone (3) - Mode de calcul";
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_3_MODE_L'] = "";
+
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_4_ID_S'] = "Zone (4) - Appliquer une taxe";
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_4_ID_L'] = "Appliquer une taxe lors de l'uitilisation de ce module.";
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_4_MODE_S'] = "Zone (4) - Mode de calcul";
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_4_MODE_L'] = "";
+
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_5_ID_S'] = "Zone (5) - Appliquer une taxe";
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_5_ID_L'] = "Appliquer une taxe lors de l'uitilisation de ce module.";
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_5_MODE_S'] = "Zone (5) - Mode de calcul";
+$lang['MODULE_SHIPPING_MZMT_GEOZONE_5_MODE_L'] = "";
+?>
\ No newline at end of file
Modified: trunk/catalog/common/classes/FieldsDisplay.php
===================================================================
--- trunk/catalog/common/classes/FieldsDisplay.php 2015-04-07 08:08:55 UTC (rev 5258)
+++ trunk/catalog/common/classes/FieldsDisplay.php 2015-04-07 08:13:07 UTC (rev 5259)
@@ -57,6 +57,8 @@
6 => 'select_multi',
7 => 'checkbox_multi',
// 8 => 'textarea_advanced',
+ 9 => 'local_file',
+ 10 => 'remote_file'
);
/**
@var label format
Modified: trunk/catalog/common/classes/addressUtility.php
===================================================================
--- trunk/catalog/common/classes/addressUtility.php 2015-04-07 08:08:55 UTC (rev 5258)
+++ trunk/catalog/common/classes/addressUtility.php 2015-04-07 08:13:07 UTC (rev 5259)
@@ -78,7 +78,7 @@
@param $boln
@param $eoln
*/
- function FormatAddress($address_format_id, $address, $html, $boln, $eoln) {
+ public static function FormatAddress($address_format_id, $address, $html, $boln, $eoln) {
if(!is_array($address) && !is_object($address) )
@@ -94,6 +94,9 @@
elseif(is_object($address))
$obj = $address;
+
+ $company = '';
+ $personnal ='';
if ($html) {
// HTML Mode
@@ -117,7 +120,7 @@
// print_r($obj);
if ( _cst_bool('ACCOUNT_COMPANY')){
$company = tep_output_string_protected($obj->company);
- if(isset($obj->extra ) ){
+ if(isset($obj->extra ) && is_array($obj->extra) ){
foreach($obj->extra as $row)
if($row->epf_class =='company')
$company .= $cr.tep_output_string_protected($row->value) ;
@@ -132,7 +135,7 @@
$personnal .= ( (isset($obj->firstname) && tep_not_null($obj->firstname) && isset($obj->lastname) && tep_not_null($obj->lastname)) ? ' ' : '' );
$personnal .= ( (isset($obj->lastname) && tep_not_null($obj->lastname)) ? tep_output_string_protected($obj->lastname) : '' );
}
- if(isset($obj->extra ) ){
+ if(isset($obj->extra ) && is_array($obj->extra) ){
foreach($obj->extra as $row)
if($row->epf_class =='personnal')
$personnal .= $cr.tep_output_string_protected($row->value) ;
@@ -142,7 +145,7 @@
$streets = tep_output_string_protected($obj->street_address);
$streets .=( (isset($obj->suburb) && tep_not_null($obj->suburb)) ? $cr.tep_output_string_protected($obj->suburb) : '' );
- if(isset($obj->extra ) ){
+ if(isset($obj->extra ) && is_array($obj->extra) ){
foreach($obj->extra as $row)
if($row->epf_class =='address')
$streets .= $cr.tep_output_string_protected($row->value) ;
@@ -170,11 +173,10 @@
if ($state != '') $statecomma = $state . ', ';
+
$fmt = $address_format['format'];
eval("\$string = \"$fmt\";");
-
-
return $string;
}
Modified: trunk/catalog/common/classes/cart/CartListener.class.php
===================================================================
--- trunk/catalog/common/classes/cart/CartListener.class.php 2015-04-07 08:08:55 UTC (rev 5258)
+++ trunk/catalog/common/classes/cart/CartListener.class.php 2015-04-07 08:13:07 UTC (rev 5259)
@@ -13,7 +13,7 @@
/**
@interface CartSession
- @brief structure for class stoackage session value cart
+ @brief structure for class stockage session value cart
*/
Class CartListener{
/**
Modified: trunk/catalog/common/classes/cart/CartStockage.class.php
===================================================================
--- trunk/catalog/common/classes/cart/CartStockage.class.php 2015-04-07 08:08:55 UTC (rev 5258)
+++ trunk/catalog/common/classes/cart/CartStockage.class.php 2015-04-07 08:13:07 UTC (rev 5259)
@@ -36,7 +36,9 @@
if (!isset($_SESSION[$this->_namespace])) {
$_SESSION[$this->_namespace] = array();
}
- $this->content = &$_SESSION[$this->_namespace];
+ $this->content = $_SESSION[$this->_namespace];
+
+// print_r($this->content); exit;
}
/**
@@ -45,6 +47,7 @@
@return no return
*/
private function FixSession(){
+
$_SESSION[$this->_namespace] = $this->content;
}
@@ -60,20 +63,66 @@
$args = func_get_args();
$list = $args[0];
+// $return = array();
+// print_r($list);
if( count($list) > 0 ) {
- $products_id_string = @$list[0];
- $option = @$list[1];
+ $_id_string = @$list[0];
+ $row_id = @$list[1];
$value = @$list[2];
- if($products_id_string && isset($this->content[$products_id_string])) {
- if( $option !=null ){
- if( isset($this->content[$products_id_string]['attributes'][$option]) )
- return $this->content[$products_id_string];
- else
+ if($_id_string){
+
+// $objPidFormat = new CartPidFormat();
+// $objPidFormat->SetIdString($_id_string);
+//
+// $pid = $objPidFormat->GetId();
+
+ preg_match('#^(.*)____#i', $_id_string, $match);
+
+ if(isset($match[1]))
+ $products_id_string = substr($_id_string, strlen($match[1]) + 4 );
+
+ if( isset($this->content[$_id_string]) ) {
+
+ if(isset($match[1]) && $this->content[$_id_string]['parent_id'] != isset($match[1]) )
return false;
+ elseif( !isset($match[1]) && $this->content[$_id_string]['parent_id'] > 0 )
+ return false;
+
+
+ if( $option !=null ){
+ if( isset($this->content[$_id_string]['attributes'][$option]) )
+ return array( $_id_string =>$this->content[$_id_string]);
+ else
+ return false;
+ }
+
+ return array( $_id_string =>$this->content[$_id_string]);
}
+ else
+ return false;
+ }
+ elseif($row_id){
+
+ if( isset($this->content[$row_id]) ) {
- return $this->content[$products_id_string];
+ if(isset($match[1]) && $this->content[$row_id]['parent_id'] != isset($match[1]) )
+ return false;
+ elseif( !isset($match[1]) && $this->content[$row_id]['parent_id'] > 0 )
+ return false;
+
+
+ if( $option !=null ){
+ if( isset($this->content[$row_id]['attributes'][$option]) )
+ return array( $row_id =>$this->content[$row_id]);
+ else
+ return false;
+ }
+
+ return array( $row_id =>$this->content[$row_id]);
+ }
+ else
+ return false;
}
else
return false;
@@ -87,6 +136,7 @@
@param $products_id_string int
@param $qty int
@param $special_class string
+ @param parent_id rowid of parent
*/
public function Set(/*$products_id_string, $qty, $special_class*/){
$args = func_get_args();
@@ -95,10 +145,21 @@
$products_id_string = $list[0];
$qty = $list[1];
$special_class = $list[2];
+ $parent_id = $list[3];
+ $grp_line = $list[4];
+
- $this->content[$products_id_string] = array('qty' => $qty);
-
+// var_dump($products_id_string); exit;
+ $this->content[$products_id_string]['pid'] = substr($products_id_string, strlen($parent_id)+4 ) ;
+ $this->content[$products_id_string]['qty'] = $qty;
+ $this->content[$products_id_string]['special_class'] = $special_class;
+ $this->content[$products_id_string]['parent_id'] = $parent_id;
+ $this->content[$products_id_string]['grp_line'] = (int)$grp_line;
+ $this->content[$products_id_string]['row_id'] = $products_id_string;
+// var_dump($this->content[$products_id_string]); exit;
$this->FixSession();
+
+ return $products_id_string;
}
/**
@@ -110,7 +171,6 @@
public function SetAttribute(/*$products_id_string, $option, $value, $attr_value*/){
$args = func_get_args();
$list = $args[0];
-
$products_id_string = $list[0];
$option = $list[1];
$value = $list[2];
@@ -118,6 +178,7 @@
$this->content[$products_id_string]['attributes'][$option] = $value;
$this->content[$products_id_string]['attributes_values'][$option] = $attr_value;
+
$this->FixSession();
}
@@ -136,6 +197,8 @@
$this->content[$products_id_string]['qty'] += $qty;
$this->FixSession();
+
+ return $products_id_string;
}
/**
@@ -166,6 +229,10 @@
$products_id_string = $list[0];
+ foreach($this->content as $id=>$row)
+ if($row['parent_id'] == $products_id_string)
+ unset($this->content[$id]);
+
unset($this->content[$products_id_string]);
$this->FixSession();
@@ -175,7 +242,7 @@
*/
public function Clean(){
$this->content = array();
-
+
$this->FixSession();
}
Modified: trunk/catalog/common/classes/cart/CartStockageCustomer.class.php
===================================================================
--- trunk/catalog/common/classes/cart/CartStockageCustomer.class.php 2015-04-07 08:08:55 UTC (rev 5258)
+++ trunk/catalog/common/classes/cart/CartStockageCustomer.class.php 2015-04-07 08:13:07 UTC (rev 5259)
@@ -33,7 +33,7 @@
if (!isset($_SESSION[$this->_namespace])) {
$_SESSION[$this->_namespace] = $this->Get();
}
-
+
$this->content = $_SESSION[$this->_namespace];
}
@@ -47,12 +47,23 @@
public function Set(/* $products_id_string, $qty, $special_class */){
$args = func_get_args();
$list = $args[0];
+
+
$products_id_string = $list[0];
$qty = $list[1];
$special_class = $list[2];
+ $parent_id = $list[3];
+ $grp_line = $list[4];
+// print_r($list);
+// exit;
+ $DB = Database::getInstance();
+ if($this->Isloggued()) {
+ $res = $DB->query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, parent_id, customers_basket_quantity, customers_basket_date_added, grp_line) values ('" . (int)$_SESSION['customer_id'] . "', '" . tep_db_input($products_id_string) . "', '" . tep_db_input($parent_id) . "', '" . $qty . "', '" . date('Ymd') . "', '".$grp_line."')");
- if($this->Isloggued())
- tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$_SESSION['customer_id'] . "', '" . tep_db_input($products_id_string) . "', '" . $qty . "', '" . date('Ymd') . "')");
+ return $res->__get('insertId');
+ }
+
+ return false;
}
/**
@@ -63,6 +74,7 @@
*/
public function SetAttribute(/*$products_id_string, $option, $value, $attr_value*/){
$args = func_get_args();
+// print_r($args);
$list = $args[0];
$products_id_string = $list[0];
$option = $list[1];
@@ -70,7 +82,7 @@
$attr_value = $list[3];
if($this->Isloggued())
- tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id,products_options_value_text) values ('" . (int)$_SESSION['customer_id'] . "', '" . tep_db_input($products_id_string) . "', '" . (int)$option . "', '" . (is_array($value)? 0 : $value) . "', '" . tep_db_input($attr_value) . "')");
+ tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id,products_options_value_text) values ('" . (int)$_SESSION['customer_id'] . "', '" . tep_db_input($products_id_string) . "', '" . (int)$option . "', '" . (is_array($value)? implode(',',$value) : $value) . "', '" . tep_db_input($attr_value) . "')");
}
/**
@@ -85,6 +97,8 @@
if($this->Isloggued())
tep_db_query($sql="update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = (customers_basket_quantity + '" . $qty . "' ) where customers_id = '" . (int)$_SESSION['customer_id'] . "' and products_id = '" . tep_db_input($products_id_string) . "'");
+
+ return $products_id_string;
}
/**
@@ -110,14 +124,30 @@
@param $products_id_string int
*/
public function Delete(/*$products_id_string*/){
+ $DB = Database::getInstance();
+
$args = func_get_args();
$list = $args[0];
$products_id_string = $list[0];
if($this->Isloggued()) {
- tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$_SESSION['customer_id'] . "' and products_id = '" . tep_db_input($products_id_string) . "'");
- tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$_SESSION['customer_id'] . "' and products_id = '" . tep_db_input($products_id_string) . "'");
+
+ $res = $DB->query("SELECT customers_basket_id as rowid from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$_SESSION['customer_id'] . "' and products_id = '" . tep_db_input($products_id_string) . "'");
+ $prod = $res->fetchAssoc();
+// print_r($prod);
+ $res = $DB->query($sql = "SELECT * from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$_SESSION['customer_id'] . "' and (parent_id = '" . $prod['rowid'] . "' OR customers_basket_id = '" . $prod['rowid'] . "')");
+ echo $sql;
+ foreach($res->fetchAllAssoc() as $row){
+ print_r($row);
+ tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$_SESSION['customer_id'] . "' and products_id = '" . tep_db_input($row['products_id']) . "'");
+
+ tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$_SESSION['customer_id'] . "' and products_id = '" . tep_db_input($row['products_id']) . "' ");
+
+ }
+ return true ;
+// tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$_SESSION['customer_id'] . "' and ( products_id = '" . tep_db_input($products_id_string) . "' OR ");
+// tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$_SESSION['customer_id'] . "' and products_id = '" . tep_db_input($products_id_string) . "'");
}
}
@@ -161,49 +191,74 @@
$products_id_string = false;
- $sql = " SELECT products_id, customers_basket_quantity FROM " . TABLE_CUSTOMERS_BASKET . " WHERE 1 ";
+ $sql = " SELECT customers_basket_id, products_id, customers_basket_quantity, parent_id, grp_line FROM " . TABLE_CUSTOMERS_BASKET . " WHERE 1 ";
$sql .= " AND customers_id = '".(int)$_SESSION['customer_id'] ."' ";
if( count($list) > 0 ){
- $products_id_string = @$list[0];
- $option = @$list[1];
- $value = @$list[2];
-
- if($products_id_string ) {
- $sql .= " AND products_id = '".$products_id_string."' ";
+
+ if(isset($list[0]) && !empty($list[0])){
+ $products_id_string = @$list[0];
+// preg_match('#(.*)____#i', $products_id_string, $match);
+
+ // print_r($match); exit;
+ // $option = @$list[1];
+ // $value = @$list[2];
+
+ if($products_id_string ) {
+ $sql .= " AND products_id = '".$products_id_string."' ";
+ }
}
+ elseif(isset($list[1])){
+ $row_id= $list[1];
+ $sql .= " AND customers_basket_id = '".$row_id."' ";
+ }
}
+ $sql .= " ORDER BY grp_line ASC, parent_id ASC ";
+// echo $sql;
$DB = Database::getInstance();
$products_query = $DB->query($sql);
-
+// print_r($products_query->fetchAllAssoc());
+// exit;
$list = array();
foreach($products_query->fetchAllAssoc() as $products) {
+ if( tep_get_prid($products['products_id']) == $products['products_id'] )
+ $products_id_string = true;
+ else
+ $products_id_string = false;
+
$tmp = array(
'qty'=> $products['customers_basket_quantity'],
- );
-
+ 'parent_id'=> $products['parent_id'],
+ 'grp_line'=> $products['grp_line'],
+ 'row_id'=> $products['customers_basket_id'],
+ 'pid'=> $products['products_id'],
+ );
+
if(!$products_id_string) {
$products_id_string = tep_get_prid($products['products_id']);
- $option = ( count(tep_get_prid_array($products['products_id']))>0 ? 1 : 0 );
+ $option = tep_get_prid_array($products['products_id']);
}
-
+// var_dump(tep_get_prid_array($products['products_id']));
// attributes
- if( $products_id_string && $option > 0) {
- $sql="select cba.products_options_id as options_id, cba.products_options_value_id as value_id, cba.products_options_value_text, po.products_options_type as type from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " cba LEFT JOIN ".TABLE_PRODUCTS_OPTIONS." po ON(cba.products_options_id = po.products_options_id ) where cba.customers_id = '" . (int)$_SESSION['customer_id'] . "' and cba.products_id = '" . tep_db_input($products['products_id']) . "' ";
+ if( $products_id_string && count($option) > 0) {
+ /*echo*/ $sql="select cba.products_options_id as options_id, cba.products_options_value_id as value_id, cba.products_options_value_text, po.products_options_type as type from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " cba LEFT JOIN ".TABLE_PRODUCTS_OPTIONS." po ON(cba.products_options_id = po.products_options_id ) where cba.customers_id = '" . (int)$_SESSION['customer_id'] . "' and cba.products_id = '" . tep_db_input($products['products_id']) . "' ";
$attributes_query = $DB->query($sql);
while ($attributes = $attributes_query->fetchAssoc()) {
// specific mode txt type option product
- if ($attributes['type'] == 2){
+ if (in_array($attributes['type'] ,array(2,5)) ){
$tmp['attributes'][$attributes['options_id']] = $attributes['value_id'];
$tmp['attributes_values'][$attributes['options_id']] = $attributes['products_options_value_text'];
+ }
+
// specific mode multi value for one option
- }elseif( $attributes['value_id'] === 0)
+ elseif( preg_match('#([0-9]*,)#',$option[$attributes['options_id']]) /*> 1*/ )//$attributes['value_id'] === 0)
$tmp['attributes'][$attributes['options_id']] = explode(',',$attributes['products_options_value_text']);
+
// normal
else
$tmp['attributes'][$attributes['options_id']] = $attributes['value_id'];
@@ -212,7 +267,7 @@
$list[ $products['products_id'] ] =$tmp;
}
-
+
return $list;
}
}
Modified: trunk/catalog/common/classes/datatype_drivers/Data_categorie.php
===================================================================
--- trunk/catalog/common/classes/datatype_drivers/Data_categorie.php 2015-04-07 08:08:55 UTC (rev 5258)
+++ trunk/catalog/common/classes/datatype_drivers/Data_categorie.php 2015-04-07 08:13:07 UTC (rev 5259)
@@ -160,6 +160,7 @@
$this->listing_sql['leftto']['groupby'] = ", ".$this->p."2c.".substr($col, strpos($col, '.')+1 )." ";
+
return $this->listing_sql['leftto'];
}
@@ -378,6 +379,7 @@
*/
function FO_load_listing(listing $listing, DataTypesChildListing $subtype, $type){
global $current_category_id, $languages_id, $list;
+// print_r($current_category_id);
$page = page::getInstance();
$DB=Database::getInstance();
@@ -443,11 +445,12 @@
$obj->description = $categories->GetText();
$obj->href = $categories->GetHref();
+
$page->SetVar('RootListing',$obj);
$page->SetVar('current_id',$current_category_id);
$page->SetVar('current_type','categorie');
+ $page->SetVar('current_object', $categories);
-
if($category_depth == 'nested'){
if(tep_not_null($list))
@@ -464,7 +467,7 @@
// put dynamical sort for childs curent datatype for this cat
// if(isset($categories->sortchids_datatype) && tep_not_null($categories->sortchids_datatype))
// $this->listing_query_sort = $categories->sortchids_datatype;
-
+// print_r($listing);
$listing->QueryAddWhere( " AND ".$this->p."2c.categories_id = '" . (int)$categories->id . "'");
}
Modified: trunk/catalog/common/classes/datatype_drivers/Data_product.php
===================================================================
--- trunk/catalog/common/classes/datatype_drivers/Data_product.php 2015-04-07 08:08:55 UTC (rev 5258)
+++ trunk/catalog/common/classes/datatype_drivers/Data_product.php 2015-04-07 08:13:07 UTC (rev 5259)
@@ -308,7 +308,7 @@
$listing->QueryAddWhere( " AND ".$this->listing_sql['col_count']." = '".$_GET['product']."' ");
}
-
+
return true;
}
@@ -578,11 +578,13 @@
$page->force_content($page_content);
+ $page->SetVar('cPath_array', $cPath_array);
$page->SetVar('current_object', $objectProduct);
$page->SetVar('current_type',$this->DataType);
$page->SetVar('current_id',(int)$_GET['products_id']);
$page->SetVar('type_id',(int)$objectProduct->GetType());
-
+// print_r($_GET);
+// exit;
return $page_content;
break;
default:
Modified: trunk/catalog/common/classes/formUtility.php
===================================================================
--- trunk/catalog/common/classes/formUtility.php 2015-04-07 08:08:55 UTC (rev 5258)
+++ trunk/catalog/common/classes/formUtility.php 2015-04-07 08:13:07 UTC (rev 5259)
@@ -226,7 +226,7 @@
if (!tep_not_null($id)) $id=tep_output_string($name);
if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]);
for ($i=0, $n=sizeof($values); $i<$n; $i++) {
- $field .='<li>'.tep_draw_radio_field($name, $id.$i, tep_output_string($values[$i]['id']),( ($default == $values[$i]['id'])? true:false), $parameters);
+ $field .='<li class="radio-inline">'.tep_draw_radio_field($name, $id.$i, tep_output_string($values[$i]['id']),( ($default == $values[$i]['id'])? true:false), $parameters);
$field .= $values[$i]['text'] . ' '.'</li>';
}
$field .= '</ul>';
@@ -243,7 +243,7 @@
if (!tep_not_null($id)) $id=tep_output_string($name);
if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]);
for ($i=0, $n=sizeof($values); $i<$n; $i++) {
- $field .='<li>'.tep_draw_checkbox_field($name, $id.$i, tep_output_string($values[$i]['id']),( ($default == $values[$i]['id'])? true:false), $parameters);
+ $field .='<li class="radio-inline">'.tep_draw_checkbox_field($name, $id.$i, tep_output_string($values[$i]['id']),( ($default == $values[$i]['id'])? true:false), $parameters);
$field .= $values[$i]['text'] . ' '.'</li>';
}
$field .= '</ul>';
Modified: trunk/catalog/common/classes/order.php
===================================================================
--- trunk/catalog/common/classes/order.php 2015-04-07 08:08:55 UTC (rev 5258)
+++ trunk/catalog/common/classes/order.php 2015-04-07 08:13:07 UTC (rev 5259)
@@ -242,6 +242,7 @@
$this->info = array(
'orders_id' => $order['orders_id'],
'orders_prefix' => $order['orders_prefix'],
+ 'orders_type' => $order['orders_type'],
'currency' => $order['currency'],
'currency_value' => $order['currency_value'],
'payment_method' => $order['payment_method'],
@@ -260,11 +261,13 @@
'date_finish' =>$order['orders_date_finished'],
);
+ $this->info['holding_origin_id']=$order['holding_origin_id'];
+
if(self::$mode) {
$this->info['facture_ref']=$order['facture_ref'];
$this->info['orders_ref']=$order['orders_ref'];
$this->info['facture_id']=$order['facture_id'];
- $this->info['holding_origin_id']=$order['holding_origin_id'];
+// $this->info['holding_origin_id']=$order['holding_origin_id'];
$this->info['synchro_event']=$order['synchro_event'];
}
@@ -317,11 +320,12 @@
'format_id' => $order['billing_address_format_id']);
$index = 0;
- $orders_products_query = tep_db_query("select orders_products_id, products_id,products_type, products_name, products_model, products_price, products_tax, products_quantity, final_price, products_returned,products_exchanged,products_exchanged_id from " .self::$tables['PRODUCTS'] . " where orders_id = '" . (int)$order_id . "'");
+ $orders_products_query = tep_db_query("select orders_products_id, products_id, parent_id, products_type, products_name, products_model, products_price, products_tax, products_quantity, final_price, products_returned,products_exchanged,products_exchanged_id from " .self::$tables['PRODUCTS'] . " where orders_id = '" . (int)$order_id . "' ORDER BY parent_id ASC ");
while ($orders_products = tep_db_fetch_array($orders_products_query)) {
$this->products[$index] = array(
'rowid' => $orders_products['orders_products_id'],
+ 'parent_id' => $orders_products['parent_id'],
'qty' => $orders_products['products_quantity'],
'id' => $orders_products['products_id'],
'type' => $orders_products['products_type'],
@@ -357,15 +361,18 @@
}
}
- $shown_price= ($this->products[$index]['final_price'] * $this->products[$index]['qty']);
+ if($this->products[$index]['parent_id'] > 0 ){
+ $shown_price= ($this->products[$index]['final_price'] * $this->products[$index]['qty']);
- $this->products[$index]['final_price_ttc'] = tep_round(tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']),$currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
- $this->products[$index]['total_line'] = tep_round($shown_price,$currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
- $this->products[$index]['total_line_taxe'] = tep_calculate_tax($shown_price, $this->products[$index]['tax']);
- $this->products[$index]['total_line_ttc'] = tep_round(tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'],$currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
+ $this->products[$index]['final_price_ttc'] = tep_round(tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']),$currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
+ $this->products[$index]['total_line'] = tep_round($shown_price,$currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
+ $this->products[$index]['total_line_taxe'] = tep_calculate_tax($shown_price, $this->products[$index]['tax']);
+ $this->products[$index]['total_line_ttc'] = tep_round(tep_add_tax($this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty'],$currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
- $this->info['tax_groups']["{$this->products[$index]['tax']}"] = '1';
+ $this->info['tax_groups']["{$this->products[$index]['tax']}"] = '1';
+ }
+
$index++;
}
}
@@ -516,6 +523,8 @@
'name' => stripslashes($prdct['name']),
'model' => $prdct['model'],
'type' => $prdct['type'],
+ 'parent_id' => $prdct['parent_id'],
+ 'grp_line' => $prdct['grp_line'],
'tax' =>tep_get_tax_rate($prdct['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),
'tax_description' => tep_get_tax_description($prdct['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),
@@ -526,6 +535,7 @@
'weight' => $prdct['weight'] ,
'id' => $prdct['id'],
+ 'parent_id' => $prdct['parent_id'],
'total_line' => $prdct['total_line'],
'total_line_taxe' => ($prdct['total_line_ttc'] -$prdct['total_line']),
Modified: trunk/catalog/common/classes/price.php
===================================================================
--- trunk/catalog/common/classes/price.php 2015-04-07 08:08:55 UTC (rev 5258)
+++ trunk/catalog/common/classes/price.php 2015-04-07 08:13:07 UTC (rev 5259)
@@ -177,13 +177,15 @@
$products_price['products_price']=(float) $objectProduct->GetPrice();
}
- $products_price['products_price'] += (float)$this->get_attributes_price($products_id, tep_get_prid_array($products_id));
+ $products_price['products_price'] += (float)$this->get_attributes_price($pid, tep_get_prid_array($products_id));
+
return (float)$products_price['products_price'];
}
private function get_attributes_price($products_id, $attributes=array()) {
- return product::get_product_attribut_price($products_id, $attributes);
+ $prix = product::get_product_attribut_price($products_id, $attributes);
+ return $prix;
}
// -- EOF Price methods --
@@ -399,7 +401,8 @@
*/
private function calcul_price($products_id,$products_price, $products_tax_rate = 0, $specials_products_price = 0, $qty=1,$tax_force=false){
- if(isset(self::$PriceCache[$products_id.'_'.$qty])) return self::$PriceCache[$products_id.'_'.$qty];
+// if(isset(self::$PriceCache[base64_encode($products_id.'_'.$qty)]))
+// return self::$PriceCache[base64_encode($products_id.'_'.$qty)];
//! discount SPPC
$products_price=self::get_SPPC_discount($products_price);
@@ -445,7 +448,7 @@
if(!is_float($array_res['total_line_ttc']) ||($_res_spe_price !=$res_spe_price) || ($_res_price !=$res_price ) )
$total_line_ttc=( (($_res_spe_price>0 && $_res_spe_price !=$_res_price)? $_res_spe_price :$_res_price) * $qty);
- return self::$PriceCache[$products_id.'_'.$qty]=array('price_ht'=>$_products_price,
+ return self::$PriceCache[base64_encode($products_id.'_'.$qty)]=array('price_ht'=>$_products_price,
'price_ttc'=>$_res_price,
'sprice_ht'=>$_specials_products_price,
'sprice_ttc'=>$_res_spe_price,
@@ -640,6 +643,7 @@
*/
public function get_products_price($products_id,$qty=1, $mode='',$tax_force=false){
$res_array=$this->calcul_price($products_id,$this->get_db_products_price($products_id), $this->get_tax_rates_from_pid($products_id), $this->get_db_products_special_price($products_id), $qty,$tax_force);
+// print_r($res_array);
if(!empty($mode) && isset($res_array[$mode])) return $res_array[$mode];
return $res_array;
Modified: trunk/catalog/common/classes/shoppingCart.php
===================================================================
--- trunk/catalog/common/classes/shoppingCart.php 2015-04-07 08:08:55 UTC (rev 5258)
+++ trunk/catalog/common/classes/shoppingCart.php 2015-04-07 08:13:07 UTC (rev 5259)
@@ -16,7 +16,9 @@
require_once DIR_FS_CATALOG . DIR_WS_COMMON_CLASSES .'cart/CartStockage.class.php';
require_once DIR_FS_CATALOG . DIR_WS_COMMON_CLASSES .'cart/CartStockageCustomer.class.php';
+require_once DIR_FS_CATALOG . DIR_WS_COMMON_CLASSES . 'cart/CartPidFormat.class.php';
+
/**
@class shoppingCart
*/
@@ -42,8 +44,16 @@
@var
*/
public $content_type;
-
+ /**
+ @var
+ */
+ public $grp_ligne_cpt = array();
/**
+ @var
+ */
+ public $convertidandrowid = array();
+
+ /**
@var stock data current user stocked in session , is object CartStockage
*/
protected static $_session;
@@ -60,6 +70,8 @@
self::$_session = new CartStockageCustomer();
else
self::$_session = new CartStockage();
+
+ $this->calculate();
}
/**
@@ -77,13 +89,11 @@
protected function CallerStockage(){
$list = func_get_args();
- $method = $list[0];
+ $method = array_shift($list);
if(self::$_session == null)
new self();
- array_shift($list);
-
return $this->CallerStockageExe( self::$_session , $method, $list);
}
@@ -102,6 +112,7 @@
@return result of method
*/
protected function CallerStockageExe(CartSession $obj, $method, $args){
+
return $obj->$method($args);
}
@@ -129,6 +140,8 @@
$this->total += tep_round($product['total_line_ttc'], $price->get_round(true));
$this->weight += ($qty * $products_weight);
+
+ $this->grp_ligne_cpt[$product['row_id']] = $product['grp_line'];;
}
// applie major/minor in total cart or total weight
@@ -138,7 +151,8 @@
elseif($row->action == '-')
$this->total -= $row->valueprice;
- if(!isset($this->cartID )) $this->cartID = $this->generate_cart_id();
+// var_dump($this->cartID);
+// if(!isset($this->cartID )) $this->cartID = $this->generate_cart_id();
}
/**
@@ -218,34 +232,40 @@
/**
- Add item
-
+
+ @brief Add item
@param $products_id string/int 19 || product Id vace option 19{1}1{3}10
@param $qty int
@param $attributes string
@param $notify boolean
@param $special_class string , permet d'ajouter element supplementaire , class de promo,
+ @param $parent_id int rowid value of parent
*/
- public function add_cart($products_id, $qty = '1', $attributes = array(), $notify = true,$special_class='') {
+ public function add_cart($products_id, $qty = '1', $attributes = array(), $notify = true,$special_class='', $parent_id=0) {
global $new_products_id_in_cart, $customer_id;
if(!is_array($attributes))
$attributes = array();
-
- $products_id_string = tep_get_uprid($products_id, $attributes);
-
- $products_id = tep_get_prid($products_id_string);
-
+// echo 'ici sdc';
+// print_r($attributes); ;
+// exit;
+// define('TTOTOOTOT',true);
+ $objPidFormat = new CartPidFormat(array($products_id, $attributes, $parent_id));
+ $products_id_string =$_pid_string = $objPidFormat->GetIdString();
+// echo 'icic';
+// print_r($list); ;
+// exit;
if (!is_numeric($products_id) || !is_numeric($qty))
- return;
+ return false;
$objectProduct=product::get_item($products_id);
if(!$objectProduct)
- return ;
+ return false;
if(Stock::check_inline(array('quantity'=>$qty, 'id'=>$products_id, 'track_stock'=>$objectProduct->GetTrackStock(), 'attributes'=>$attributes)) == true ){
+
$current = tep_get_products_stock( (int)$products_id,(array)$attributes );
//force qty if not enough stock
$qty = $current;
@@ -253,6 +273,17 @@
return ;
}
+ $grp_ligne_cpt = sizeof($this->grp_ligne_cpt);
+
+ if($parent_id <= 0){
+ $grp_ligne_cpt = $this->grp_ligne_cpt[$products_id_string] = sizeof($this->grp_ligne_cpt);
+ }
+ // For mecanical cart stocked in db
+ elseif( is_int($parent_id) && preg_match( '#('.$parent_id.'____)#i', $products_id_string) )
+ $grp_ligne_cpt = $this->grp_ligne_cpt[ $this->convertidandrowid[$parent_id] ];
+ // for mecanical cart stocked in session
+ elseif( preg_match( '#('.str_replace(array('{','}'),'',$parent_id).'____)#i', str_replace(array('{','}'),'',$products_id_string)) )
+ $grp_ligne_cpt = $this->grp_ligne_cpt[$parent_id]; ;
if ($notify == true) {
@@ -261,7 +292,7 @@
}
$Prefix = 'Set';
- if ($this->in_cart($products_id_string)==true)
+ if ($this->in_cart( $products_id_string )==true)
$Prefix = 'Update';
if (is_array($attributes)) {
@@ -269,6 +300,8 @@
while (list($option, $value) = each($attributes)) {
$attr_value = NULL;
$blank_value = FALSE;
+
+
if (strstr($option, TEXT_PREFIX)) {
if (trim($value) == NULL) {
$blank_value = TRUE;
@@ -289,19 +322,18 @@
$attr_value = implode(',',$tmp_value);
}
-
- if (!$blank_value)
+// var_dump($value);
+// if (!$blank_value && $Prefix !='Update')
$this->CallerStockage($Prefix.'Attribute',$products_id_string, $option, $value, $attr_value);
}
}
+// var_dump($products_id_string, $parent_id);
+ $id_string = $this->CallerStockage($Prefix,$products_id_string, $qty, @$special_class, $parent_id, $grp_ligne_cpt);
- $this->CallerStockage($Prefix,$products_id_string, $qty, @$special_class);
-
-// }
- // assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
- $this->cartID = $this->generate_cart_id();
-
+ $this->convertidandrowid[$id_string] = $products_id_string;
+
+ return $id_string;
}
@@ -316,7 +348,7 @@
if (is_array($list)) {
foreach($list as $row)
- $total_items +=$row['qty'];
+ $total_items += abs($row['qty']);
// while (list($products_id, ) = each($list)) $total_items += $this->get_quantity($products_id);
}
@@ -343,7 +375,7 @@
@return boolean
*/
public function in_cart($products_id_string) {
-
+// var_dump($products_id_string);
if( $this->CallerStockage('Get',$products_id_string) !=false )
return true;
@@ -392,26 +424,60 @@
function get_products() {
global $languages_id,$price;
+ static $cpt;
+
$content = $this->CallerStockage('Get');
if (!is_array($content))
return false;
$products_array = array();
+ $arraylink = array();
+ $sortlink = array();
reset($content);
-
+// print_r($content);
+// exit;
foreach($content as $products_id=>$product){
- $pid = tep_get_prid($products_id);
+// $pid = tep_get_prid($products_id);
+
+ $objPidFormat = new CartPidFormat();
+ $objPidFormat->SetIdString($products_id);
+
+ $pid = $objPidFormat->GetId();
+// var_dump($products_id, $pid);
$objectProduct=product::get_item($pid);
if($objectProduct !=false){
$prid = $objectProduct->GetId();
- $res_price=$price->get_products_price($products_id,(int)$product['qty']);
+
+
+ $res_price=$price->get_products_price($products_id,(int)$product['qty'], $product['attributes']);
+
$special=( ($res_price['price_ht'] !=$res_price['sprice_ht'] && $res_price['sprice_ht']>0)? true : false);
- $products_array[] = array('id' => $products_id,
+// var_dump($parent_row_id);
+ $parent_id = 0;
+ $parent_row_id = $objPidFormat->GetExtends('parent');
+ if($parent_row_id > 0 ) {
+ $test = $this->CallerStockage('Get','', $parent_row_id);
+ list($parent_id)= each($test);
+ }
+
+ $arraylink[$products_id] = count($arraylink);
+
+ $this->grp_ligne_cpt[$products_id] = $product['grp_line'];
+
+ $products_array[] = array(
+ 'id' => $pid,
+ 'id_string' => $products_id,
+ 'parent_id' => $parent_id,
+ 'grp_line' => $product['grp_line'],
+ 'type'=> $objectProduct->GetType(),
+
+
+
'name' => $objectProduct->GetName(),
'type' => $objectProduct->GetType(),
'model' => $objectProduct->GetModel(),
@@ -419,6 +485,7 @@
'track_stock' => $objectProduct->GetTrackStock(),
'price' => (($special)? $res_price['sprice_ht'] :$res_price['price_ht']),
+
'quantity' => $product['qty'],
'weight' => $objectProduct->GetWeight() +( isset($product['attributes']) ?(float)product::get_attributes_weight($products_id, $product['attributes']) : 0) ,
'final_price' => (($special)? $res_price['sprice_ht'] :$res_price['price_ht']),
@@ -431,25 +498,66 @@
'special_class'=> (isset($product['special_class'])? $product['special_class'] : ''),
-// 'group' => (isset($product['group'])? (array)$product['group'] : false),
+ 'group' => (isset($product['group'])? (array)$product['group'] : false),
);
// if(isset($tmp['group']['id']))
// $products_array[$tmp['group']['id']][] = $tmp;
// else
// $products_array['nogroup'][] = $tmp;
+
+
+// if(isset($sortlink[$product['grp_line']]))
+ $sortlink[$product['grp_line']][ sizeof($products_array)-1] = $products_id;
+// else
+// $sortlink[$product['grp_line']] = array( $products_id );
+
}
}
-
-
+// exit;
+// print_r($products_array);
+// exit;
// ksort($products_array);
-
+// print_r($arraylink);
+// exit;
// $list = array();
-// foreach($products_array as $grp)
-// foreach($grp as $line)
+// get_products($products_array)
+ foreach($products_array as $k=>$pd){
+// print_r($arraylink);
+// exit;
+// var_dump($pd['parent_id'], $arraylink[$pd['parent_id']]);
+ if(strlen($pd['parent_id']) > 0 && strlen($arraylink[$pd['parent_id']])>0 ) {
+
+// var_dump($arraylink[$pd['parent_id']]);
+
+ $src = $products_array[$arraylink[$pd['parent_id']]];
+
+ $src['quantity'] = (float)$pd['quantity'];
+ $src['price'] += (float)$pd['price'];
+ $src['weight'] += $pd['weight'];
+ $src['final_price'] += (float)$pd['final_price'];
+ $src['final_price_ttc'] += (float)$pd['final_price_ttc'];
+ $src['total_line'] += $pd['total_line'];
+ $src['total_line_ttc'] += $pd['total_line_ttc'];
+// print_r($src);
+ $products_array[$arraylink[$pd['parent_id']]] = $src;
+
+ // force toto ligne null , reported in parent
+ $products_array[$k]['total_line'] = 0;
+ $products_array[$k]['total_line_ttc'] = 0;
+ }
+ }
+
+
+ $return = array();
+
+ foreach($sortlink as $grp_line)
+ foreach($grp_line as $line=>$pstring)
+ $return[] = $products_array[$line];
// $list[] = $line;
-
- return $products_array;
+// print_r($return);
+// exit;
+ return $return;
}
@@ -614,35 +722,54 @@
$any_out_of_stock = 0;
$hidden='';
$products_array =array();
+ $list = array();
+
if ($this->count_contents() > 0) {
$products = $this->get_products();
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
- $pid = tep_get_prid($products[$i]['id']);
+// $pid = tep_get_prid($products[$i]['id']);
+ $objPidFormat = new CartPidFormat();
+ $objPidFormat->SetIdString($products[$i]['id']);
+
+ $pid = $objPidFormat->GetId();
+
// Push all attributes information in an array
- if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
+ if ($products[$i]['type'] !=6 && isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
while (list($option, $value) = each($products[$i]['attributes'])) {
- $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_options_values_url
+
+ $attributes = tep_db_query($sq="select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_options_values_url
from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
where pa.products_id = '" . $pid . "'
and pa.options_id = '" . $option . "'
and pa.options_id = popt.products_options_id
- and pa.options_values_id = '" . $value . "'
+ and pa.options_values_id ".(is_array($value) ? " IN(" . implode(',',$value) . ") ": " = '".$value."' " ). "
and pa.options_values_id = poval.products_options_values_id
and popt.language_id = '" . $languages_id . "'
and poval.language_id = '" . $languages_id . "'");
- $attributes_values = tep_db_fetch_array($attributes);
- if(isset($products[$i]['attributes_values'][$option]) ) {
- /* Specifique option type texte / file champ personnalisé par le client */
- $hidden .=tep_draw_hidden_field('Valueid[' . $products[$i]['id'] . '][' . $option . ']', $value);
- $hidden .=tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . TEXT_PREFIX . $option . ']', $products[$i]['attributes_values'][$option]);
- $products[$i][$option]['products_options_values_name'] = '('.$products[$i]['attributes_values'][$option].')';
- } else{
- $products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name'];
- $hidden .=tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
- }
+ if( is_array($value) )
+ foreach($attributes->fetchAllAssoc() as $row )
+ $attributes_vals[] = $row;
+ else
+ $attributes_vals = array( tep_db_fetch_array($attributes) );
+
+
+ foreach($attributes_vals as $k=>$attributes_values )
+ if(isset($products[$i]['attributes_values'][$option]) ) {
+ /* Specifique option type texte / file champ personnalisé par le client */
+ $hidden .=tep_draw_hidden_field('Valueid[' . $products[$i]['id'] . '][' . $option . ']', $value);
+ $hidden .=tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . TEXT_PREFIX . $option . ']', $products[$i]['attributes_values'][$option]);
+ $products[$i][$option]['products_options_values_name'] = '('.$products[$i]['attributes_values'][$option].')';
+ } else{
+ if($k > 0)
+ $products[$i][$option]['products_options_values_name'] .= ' ; ';
+ $products[$i][$option]['products_options_values_name'] .= $attributes_values['products_options_values_name'];
+ $hidden .=tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
+ }
+
+
$products[$i][$option]['options_values_id'] = $value;
$products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];
$products[$i][$option]['options_values_price'] = $attributes_values['options_values_price'];
@@ -660,14 +787,23 @@
$products[$i]['alert_stock'] = Stock::mark_inline();
}
- if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
+ if ($products[$i]['type'] !=6 && isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
reset($products[$i]['attributes']);
while (list($option, $value) = each($products[$i]['attributes'])) {
$products[$i]['name'] .= "<br />".'<span class="cartAttributes"> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</span>';
if(tep_not_null($products[$i][$option]['img_url']))
$products[$i]['image'] = '<a class="tn" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . tep_image(DIR_WS_IMAGES . $products[$i][$option]['img_url'], $products[$i]['name'], $page->_conf_value('SMALL_IMAGE_WIDTH'), $page->_conf_value('SMALL_IMAGE_HEIGHT')) . '</a>';
+
+
+// if($products[$i][$option]['price_prefix'] =='+')
+// $products[$i]['price'] += $products[$i][$option]['options_values_price'];
+// elseif($products[$i][$option]['price_prefix'] =='-')
+// $products[$i]['price'] -= $products[$i][$option]['options_values_price'];
}
}
+
+// print_r($products);
+// exit;
//! modification par les modules order total
$products[$i]=$this->process_cart($products[$i]);
@@ -677,12 +813,13 @@
$products_array['nogroup'][] = $products[$i];
}
- krsort($products_array);
+ krsort($products_array);
- $list = array();
- foreach($products_array as $grp)
- foreach($grp as $line)
- $list[] = $line;
+
+ if(count($products_array) > 0 )
+ foreach($products_array as $grp)
+ foreach($grp as $line)
+ $list[] = $line;
}
//! load order
Modified: trunk/catalog/includes/application_top.php
===================================================================
--- trunk/catalog/includes/application_top.php 2015-04-07 08:08:55 UTC (rev 5258)
+++ trunk/catalog/includes/application_top.php 2015-04-07 08:13:07 UTC (rev 5259)
@@ -28,18 +28,20 @@
}else require('includes/configure.php');
- if (OSCSS_DEBUG == true) {
- $oscss_debug_infos = array();
- error_reporting(-1);
- } else {
- /// set the level of error reporting
- ini_set("error_reporting",E_ALL & ~E_NOTICE);
- ini_set("display_errors","1");
- ini_set("log_errors", "0" );
- error_reporting(0);
- }
-
+// if (OSCSS_DEBUG == true) {
+// $oscss_debug_infos = array();
+// error_reporting(-1);
+// } else {
+// /// set the level of error reporting
+// ini_set("error_reporting",E_ALL & ~E_NOTICE);
+// ini_set("display_errors","1");
+// ini_set("log_errors", "0" );
+// error_reporting(0);
+// }
+ ini_set("error_reporting",E_ALL );
+ error_reporting(E_ALL);
+
// call Config Class And Init
require(DIR_FS_CATALOG.DIR_WS_COMMON_CLASSES . 'Config.php');
$Cfg = Config::getInstance((object)$conf);
@@ -210,7 +212,7 @@
while($configuration = $res->fetchAssoc())
define(strtoupper($configuration['cfgKey']), $configuration['cfgValue']);
- if ( ( !isset($_GET['admin']) || $_GET['admin'] !=md5($SecuKey)) && ( !isset($_COOKIE['osCOFFLINEID']) || $_COOKIE['osCOFFLINEID'] !=md5($SecuKey)) ) {
+ if ( ( !isset($_GET['admin']) || $_GET['admin'] !=md5($SecuKey)) && ( !isset($_COOKIE['osCOFFLINEID']) || $_COOKIE['osCOFFLINEID'] !=md5($SecuKey)) && (!isset($_GET['osCAdminDirect']) && !isset($_GET['id']))) {
if( $Cfg->GetConf('STORE_OFFLINE_MODE') == 'block')
echo '<p style="text-align:center">'.$Cfg->GetConf('STORE_OFFLINE_TXT').'</p>';
Modified: trunk/catalog/includes/classes/ModPublicOneShipping.php
===================================================================
--- trunk/catalog/includes/classes/ModPublicOneShipping.php 2015-04-07 08:08:55 UTC (rev 5258)
+++ trunk/catalog/includes/classes/ModPublicOneShipping.php 2015-04-07 08:13:07 UTC (rev 5259)
@@ -249,7 +249,7 @@
@param $NameVarConfig name of var used
@return none
*/
- protected function determineTableMethod($NameVarConfig, $obj) {
+ protected function determineTableMethod($NameVarConfig, IntShippingDepend $obj) {
$value = constant($NameVarConfig);
@@ -297,7 +297,7 @@
$table_cost = preg_split("/[:,]/" , constant($NameVarConfig) );
$shipping_factor=0;
$shipping = 0;
-
+
for ($i=0, $n=sizeof($table_cost); $i<$n; $i+=2){
if ($this->GetTotal() <= $table_cost[$i] && isset($table_cost[$i+1]) && tep_not_null($table_cost[$i+1]) ){
$shipping_factor = $table_cost[$i+1];
Modified: trunk/catalog/includes/classes/checkout_process.php
===================================================================
--- trunk/catalog/includes/classes/checkout_process.php 2015-04-07 08:08:55 UTC (rev 5258)
+++ trunk/catalog/includes/classes/checkout_process.php 2015-04-07 08:13:07 UTC (rev 5259)
@@ -78,12 +78,14 @@
// $table=((!self::$mode)? '_'.strtoupper($table) : '');
$table='';
- self::$tables=array( 'ORDERS'=>constant('TABLE'.$table.'_ORDERS'),
- 'TOTAL'=>constant('TABLE'.$table.'_ORDERS_TOTAL'),
- 'PRODUCTS'=>constant('TABLE'.$table.'_ORDERS_PRODUCTS'),
- 'ATTRIBUTES'=>constant('TABLE'.$table.'_ORDERS_PRODUCTS_ATTRIBUTES'),
- 'DOWNLOAD'=>constant('TABLE'.$table.'_ORDERS_PRODUCTS_DOWNLOAD'),
- 'HISTORY'=>constant('TABLE'.$table.'_ORDERS_STATUS_HISTORY'),
+ self::$tables=array(
+ 'ORDERS'=>constant('TABLE_ORDERS'),
+ 'TOTAL'=>constant('TABLE_ORDERS_TOTAL'),
+ 'PRODUCTS'=>constant('TABLE_ORDERS_PRODUCTS'),
+ 'ATTRIBUTES'=>constant('TABLE_ORDERS_PRODUCTS_ATTRIBUTES'),
+ 'DOWNLOAD'=>constant('TABLE_ORDERS_PRODUCTS_DOWNLOAD'),
+ 'HISTORY'=>constant('TABLE_ORDERS_STATUS_HISTORY'),
+ 'RELATION'=>constant('TABLE_ORDERS_RELATION'),
);
/**
@@ -389,7 +391,11 @@
// initialized for the email confirmation
$subtotal = 0;
$total_tax = 0;
-
+
+ $parent = 0;
+ $grp_line = 0;
+// print_r($order->products);
+// exit;
for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
/**
@@ -414,9 +420,16 @@
Process class
Enregsitrement des produits
*/
+ if( $order->products[$i]['parent_id'] <=0 && $grp_line != $order->products[$i]['grp_line'])
+ $grp_line = $order->products[$i]['grp_line'];
+ elseif( $order->products[$i]['parent_id'] > 0 && $parent > 0 )
+ $order->products[$i]['parent_id'] = $parent;
+
$order->products[$i]['row...
[truncated message content] |