shoppingCart Class Reference

Inherited by shopping_cart_action.

List of all members.

Public Member Functions

Public Attributes

Private Member Functions


Detailed Description

Definition at line 15 of file shoppingCart.php.


Member Function Documentation

shoppingCart::add_cart ( products_id,
qty = '1',
attributes = '',
notify = true,
special_class = '' 
)

Add item.

Parameters:
$products_id string/int 19 || product Id vace option 19{1}1{3}10
$qty int
$attributes string
$notify boolean
$special_class string , permet d'ajouter element supplementaire , class de promo,

Definition at line 169 of file shoppingCart.php.

00169                                                                                                          {
00170     global $new_products_id_in_cart, $customer_id;
00171 
00172     $products_id_string = tep_get_uprid($products_id, $attributes);
00173     $products_id = tep_get_prid($products_id_string);
00174 
00175     if (is_numeric($products_id) && is_numeric($qty)) {
00176       $product_obj=product::get_item($products_id);
00177 
00178       if($product_obj !=false){
00179         if ($notify == true) {
00180           $new_products_id_in_cart = $products_id;
00181           tep_session_register('new_products_id_in_cart');
00182         }
00183 
00184         if ($this->in_cart($products_id_string)==true) {
00185           $this->update_quantity($products_id_string, $qty, $attributes);
00186         }
00187         else {
00188           $this->contents[$products_id_string] = array('qty' => $qty);
00189           if(!empty($special_class)) $this->contents[$products_id_string]['special_class'] = $special_class;
00190   // insert into database
00191           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_string) . "', '" . $qty . "', '" . date('Ymd') . "')");
00192           if (is_array($attributes)) {
00193             reset($attributes);
00194             while (list($option, $value) = each($attributes)) {
00195               $attr_value = NULL;
00196               $blank_value = FALSE;
00197               if (strstr($option, TEXT_PREFIX)) {
00198                 if (trim($value) == NULL) {
00199                   $blank_value = TRUE;
00200                 } else {
00201                   $option = substr($option, strlen(TEXT_PREFIX));
00202                   $attr_value = htmlspecialchars(stripslashes($value), ENT_QUOTES);
00203                   $value = $_POST['Valueid'][$option];
00204                   $this->contents[$products_id_string]['attributes_values'][$option] = $attr_value;
00205                 }
00206               }
00207 
00208               if (!$blank_value) {
00209               $this->contents[$products_id_string]['attributes'][$option] = $value;
00210   // insert into database
00211               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,products_options_value_text) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id_string) . "', '" . (int)$option . "', '" . (int)$value . "', '" . tep_db_input($attr_value) . "')");
00212               }
00213             }
00214           }
00215         }
00216         // assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
00217         $this->cartID = $this->generate_cart_id();
00218       }
00219 
00220     }
00221   }

shoppingCart::calculate (  )  [private]

Definition at line 51 of file shoppingCart.php.

Referenced by show_total(), and show_weight().

00051                                {
00052     global $price;
00053     $this->total = 0;
00054     $this->weight = 0;
00055     $incart=$this->get_products();
00056 
00057     if (!is_array($incart)) return ;
00058 
00059     foreach($incart as $product) {
00060       $qty = $product['quantity'];
00061       $products_weight = $product['weight'];
00062 
00063       $this->total += tep_round($product['total_line_ttc'], $price->get_round(true));
00064       $this->weight += ($qty * $products_weight);
00065 
00066     }
00067 
00068     if(!isset($this->cartID )) $this->cartID = $this->generate_cart_id();
00069   }

shoppingCart::cleanup (  ) 

Definition at line 73 of file shoppingCart.php.

00073                             {
00074     reset($this->contents);
00075     while (list($key,) = each($this->contents)) {
00076       if (!isset($this->contents[$key]['qty']) ||$this->contents[$key]['qty'] < 1) {
00077         unset($this->contents[$key]);
00078         // remove from database
00079         if (tep_session_is_registered('customer_id')) {
00080           tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($key) . "'");
00081           tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($key) . "'");
00082         }
00083       }
00084     }
00085     $this->contents=array();
00086   }

shoppingCart::count_contents (  ) 

get total number of items in cart

Definition at line 270 of file shoppingCart.php.

Referenced by get_content_type(), and init_draw().

00270                                    {
00271     $total_items = 0;
00272     if (is_array($this->contents)) {
00273       reset($this->contents);
00274       while (list($products_id, ) = each($this->contents))  $total_items += $this->get_quantity($products_id);
00275     }
00276     return $total_items;
00277   }

shoppingCart::draw_cart ( product  ) 

Init base module actif pour la page shopping_cart.

Definition at line 562 of file shoppingCart.php.

00562                                      {
00563     $this->init_ot();
00564     return $this->otm->draw_cart('',$product);
00565   }

shoppingCart::generate_cart_id ( length = 5  )  [private]

Definition at line 90 of file shoppingCart.php.

Referenced by add_cart(), calculate(), remove(), and restore_contents().

00090                                                  {
00091     return tep_create_random_value($length, 'digits');
00092   }

shoppingCart::get_content_type (  ) 

Definition at line 398 of file shoppingCart.php.

00398                                      {
00399     $this->content_type = 'physical';
00400 
00401     $array_content_type=array();
00402 
00403     if ($this->count_contents() > 0) {
00404       reset($this->contents);
00405       while (list($products_id, ) = each($this->contents)) {
00406         $virtual_products_result = tep_db_query("select * from ".TABLE_PRODUCTS_VIRTUAL." where productsID=".(int)$products_id);
00407         if (tep_db_num_rows($virtual_products_result) > 0) {
00408           $res=tep_db_fetch_array($virtual_products_result);
00409 
00410           $array_content_type[] = (in_array($res['typeID'], explode(';',TYPE_VIRTUAL_PRODUCTS)))? 'virtual' : 'physical';
00411         }
00412         else $array_content_type[] = 'physical';
00413       }
00414     }
00415 
00416     if(in_array('virtual',$array_content_type) && in_array('physical',$array_content_type)) $this->content_type =  'mixed';
00417     elseif(in_array('virtual',$array_content_type)) $this->content_type =  'virtual';
00418 
00419     if ( (_cst_bool('DOWNLOAD_ENABLED')) && ($this->count_contents() > 0) ) {
00420       reset($this->contents);
00421       while (list($products_id, ) = each($this->contents)) {
00422         if (isset($this->contents[$products_id]['attributes'])) {
00423           reset($this->contents[$products_id]['attributes']);
00424           while (list(, $value) = each($this->contents[$products_id]['attributes'])) {
00425             $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");
00426             $virtual_check = tep_db_fetch_array($virtual_check_query);
00427 
00428             if ($virtual_check['total'] > 0) {
00429               switch ($this->content_type) {
00430                 case 'mixed':
00431                 case 'physical':
00432                   $this->content_type = 'mixed';
00433                   break;
00434                 default:
00435                  $this->content_type = 'virtual';
00436                 break;
00437               }
00438             }
00439           }
00440         }
00441       }
00442     }
00443 
00444     return $this->content_type;
00445   }

shoppingCart::get_header (  ) 

Chargement dans les header de pages.

Definition at line 45 of file shoppingCart.php.

00045                               {
00046     return false;
00047   }

shoppingCart::get_product_id_list (  ) 

Definition at line 323 of file shoppingCart.php.

00323                                         {
00324     $product_id_list = '';
00325     if (is_array($this->contents)) {
00326       reset($this->contents);
00327       while (list($products_id, ) = each($this->contents)) {
00328         $product_id_list .= ', ' . $products_id;
00329       }
00330     }
00331 
00332     return substr($product_id_list, 2);
00333   }

shoppingCart::get_products (  ) 

Boucle qui recupere les produist de $content Utilisé dans tous les recap panier/order/checkcout.

Definition at line 341 of file shoppingCart.php.

Referenced by calculate(), and init_draw().

00341                           {
00342     global $languages_id,$price;
00343     if (!is_array($this->contents)) return false;
00344     $products_array = array();
00345     reset($this->contents);
00346 
00347     foreach($this->contents as $products_id=>$product){
00348       $pid = tep_get_prid($products_id);
00349       $product_obj=product::get_item($pid);
00350 
00351       if($product_obj !=false){
00352         $prid = $product_obj->products_id;
00353 
00354         $res_price=$price->get_products_price($products_id,(int)$product['qty']);
00355         $special=( ($res_price['price_ht'] !=$res_price['sprice_ht'] && $res_price['sprice_ht']>0)? true : false);
00356 
00357         $products_array[] = array('id' => $products_id,
00358                                   'name' => $product_obj->products_name,
00359                                   'model' => $product_obj->products_model,
00360                                   'image' => $product_obj->products_image,
00361                                   'track_stock' => $product_obj->track_stock,
00362                                   'price' =>  (($special)? $res_price['sprice_ht'] :$res_price['price_ht']),
00363                                   'quantity' => $product['qty'],
00364                                   'weight' => $product_obj->products_weight +( isset($this->contents[$products_id]['attributes']) ?(float)product::get_attributes_weight($products_id, $this->contents[$products_id]['attributes']) : 0) ,
00365                                   'final_price' => (($special)? $res_price['sprice_ht'] :$res_price['price_ht']),
00366                                   'final_price_ttc' => (($special)? $res_price['sprice_ttc'] :$res_price['price_ttc']),
00367                                   'total_line' => $res_price['total_line'],
00368                                   'total_line_ttc' => $res_price['total_line_ttc'],
00369                                   'tax_class_id' => $product_obj->products_tax_class_id,
00370                                   'attributes' => (isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''),
00371                                   'attributes_values' => (isset($this->contents[$products_id]['attributes_values']) ? $this->contents[$products_id]['attributes_values'] : ''),
00372                                   'special_class'=> (isset($this->contents[$products_id]['special_class'])? $this->contents[$products_id]['special_class'] : ''),
00373                                   );
00374       }
00375     }
00376     return $products_array;
00377   }

shoppingCart::get_quantity ( products_id  ) 

Recup qty.

Parameters:
$products_id int
Returns:
numeric

Definition at line 284 of file shoppingCart.php.

Referenced by count_contents().

00284                                              {
00285     if (isset($this->contents[$products_id]))  return $this->contents[$products_id]['qty'];
00286     else return 0;
00287   }

shoppingCart::in_cart ( products_id_string  ) 
Parameters:
$products_id_string string/int
Returns:
boolean

Definition at line 293 of file shoppingCart.php.

Referenced by add_cart().

00293                                                {
00294     if (isset($this->contents[$products_id_string]))  return true;
00295     else  return false;
00296   }

shoppingCart::init_draw (  ) 

Init base module actif pour la page shopping_cart Report de l'entete de la page.

Returns:
object

Stock check

modification par les modules order total

Definition at line 476 of file shoppingCart.php.

00476                              {
00477     global $page,$cart,$languages_id;
00478 
00479     $this->init_ot();
00480     $res=$this->otm->_extents('init_draw');
00481 
00482     $this->DC = new objectInfo(array());
00483     $products=array();
00484     $any_out_of_stock = 0;
00485     $hidden='';
00486 
00487     if ($this->count_contents() > 0) {
00488 
00489       $products = $this->get_products();
00490       for ($i=0, $n=sizeof($products); $i<$n; $i++) {
00491         $pid = tep_get_prid($products[$i]['id']);
00492         // Push all attributes information in an array
00493         if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
00494           while (list($option, $value) = each($products[$i]['attributes'])) {
00495               $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
00496                                           from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
00497                                           where pa.products_id = '" . $pid . "'
00498                                           and pa.options_id = '" . $option . "'
00499                                           and pa.options_id = popt.products_options_id
00500                                           and pa.options_values_id = '" . $value . "'
00501                                           and pa.options_values_id = poval.products_options_values_id
00502                                           and popt.language_id = '" . $languages_id . "'
00503                                           and poval.language_id = '" . $languages_id . "'");
00504               $attributes_values = tep_db_fetch_array($attributes);
00505 
00506             if(isset($products[$i]['attributes_values'][$option]) ) {
00507             /* Specifique option type texte / file champ personnalisé par le client */
00508               $hidden .=tep_draw_hidden_field('Valueid[' . $products[$i]['id'] . '][' . $option . ']', $value);
00509               $hidden .=tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . TEXT_PREFIX . $option . ']',  $products[$i]['attributes_values'][$option]);
00510               $products[$i][$option]['products_options_values_name'] = '('.$products[$i]['attributes_values'][$option].')';
00511             } else{
00512               $products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name'];
00513               $hidden .=tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
00514             }
00515             $products[$i][$option]['options_values_id'] = $value;
00516             $products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];
00517             $products[$i][$option]['options_values_price'] = $attributes_values['options_values_price'];
00518             $products[$i][$option]['price_prefix'] = $attributes_values['price_prefix'];
00519             $products[$i][$option]['img_url'] = $attributes_values['products_options_values_url'];
00520 
00521           }
00522         }
00523 
00524         $products[$i]['name'] = $products[$i]['name'] ;
00525 
00527         if( Stock::check_inline($products[$i]) ) {
00528           $any_out_of_stock = 1;
00529           $products[$i]['name']  .= Stock::mark_inline();
00530         }
00531 
00532         if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
00533           reset($products[$i]['attributes']);
00534           while (list($option, $value) = each($products[$i]['attributes'])) {
00535             $products[$i]['name'] .= "<br />".'<span class="cartAttributes"> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</span>';
00536             if(tep_not_null($products[$i][$option]['img_url']))
00537               $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>';
00538           }
00539         }
00541         $products[$i]=$this->process_cart($products[$i]);
00542       }
00543     }
00544     $this->DC->products=$products;
00545     $this->DC->hidden=$hidden;
00546     $this->DC->any_out_of_stock=$any_out_of_stock;
00547     return $this->DC;
00548   }

shoppingCart::init_ot (  )  [private]

Inititalisation des moduel order_total.

Definition at line 461 of file shoppingCart.php.

Referenced by draw_cart(), init_draw(), process_cart(), and show_list_total().

00461                             {
00462     global $page,$cart,$languages_id;
00463 
00464     if( ($order_total_modules=$page->return_object('order_total_modules')) ===false){
00465       $order_total_modules = new order_total;
00466       $page->add_object('order_total_modules',$order_total_modules);
00467     }
00468     $this->otm=$order_total_modules;
00469   }

shoppingCart::process_cart ( product  )  [private]

Init base module actif pour la page shopping_cart Intervention boucle definiton des produits.

Definition at line 554 of file shoppingCart.php.

Referenced by init_draw().

00554                                          {
00555     $this->init_ot();
00556     return $this->otm->process_cart('',$product);
00557   }

shoppingCart::remove ( products_id  ) 
Parameters:
$products_id int
Returns:
boolean

Definition at line 302 of file shoppingCart.php.

00302                                        {
00303       global $customer_id;
00304 
00305       unset($this->contents[$products_id]);
00306       if (tep_session_is_registered('customer_id')) {
00307         tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
00308         tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
00309       }
00310 
00311       // assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
00312       $this->cartID = $this->generate_cart_id();
00313       return true;
00314     }

shoppingCart::remove_all (  ) 

Definition at line 316 of file shoppingCart.php.

00316                           {
00317       $this->reset();
00318     }

shoppingCart::reset ( reset_database = false  ) 

Definition at line 143 of file shoppingCart.php.

Referenced by add_cart(), cleanup(), count_contents(), get_content_type(), get_product_id_list(), get_products(), init_draw(), remove_all(), restore_contents(), shoppingCart(), unserialize(), and update_quantity().

00143                                           {
00144     global $customer_id;
00145 
00146     $this->contents = array();
00147     $this->total = 0;
00148     $this->weight = 0;
00149     $this->content_type = false;
00150 
00151     if (tep_session_is_registered('customer_id') && ($reset_database == true)) {
00152       tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "'");
00153       tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "'");
00154     }
00155 
00156     unset($this->cartID);
00157     if (tep_session_is_registered('cartID')) tep_session_unregister('cartID');
00158   }

shoppingCart::restore_contents (  ) 

Definition at line 98 of file shoppingCart.php.

00098                                      {
00099     global $customer_id;
00100 
00101     if (!tep_session_is_registered('customer_id')) return false;
00102     $DB=Database::getInstance();
00103 
00104     // insert current cart contents in database
00105     if (is_array($this->contents)) {
00106       reset($this->contents);
00107       while (list($products_id, ) = each($this->contents)) {
00108         $qty = $this->contents[$products_id]['qty'];
00109         $product_query = $DB->query($sql="select products_id from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
00110 
00111         if (!$product_query->__get('numRows')) {
00112           $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') . "')");
00113           if (isset($this->contents[$products_id]['attributes'])) {
00114             reset($this->contents[$products_id]['attributes']);
00115             while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
00116               $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 . "')");
00117             }
00118           }
00119         } else {
00120           $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) . "'");
00121         }
00122       }
00123     }
00124 
00125     // reset per-session cart contents, but not the database contents
00126     $this->reset(false);
00127 
00128     $products_query = $DB->query("select products_id, customers_basket_quantity from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "'");
00129     while ($products = $products_query->fetchAssoc()) {
00130       $this->contents[$products['products_id']] = array('qty' => $products['customers_basket_quantity']);
00131       // attributes
00132       $attributes_query = $DB->query("select products_options_id, products_options_value_id, products_options_value_text from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products['products_id']) . "'");
00133       while ($attributes = $attributes_query->fetchAssoc()) {
00134         if ($attributes['products_options_value_id'] == PRODUCTS_OPTIONS_VALUE_TEXT_ID)  $this->contents[$products['products_id']]['attributes'][$attributes['products_options_id']] = $attributes['products_options_value_text'];
00135         else $this->contents[$products['products_id']]['attributes'][$attributes['products_options_id']] = $attributes['products_options_value_id'];
00136       }
00137     }
00138 
00139     $this->cartID = $this->generate_cart_id();
00140   }

shoppingCart::shoppingCart (  ) 

Definition at line 38 of file shoppingCart.php.

00038                           {
00039     $this->reset();
00040   }

shoppingCart::show_list_total (  ) 

Init base module actif pour la page shopping_cart.

Definition at line 570 of file shoppingCart.php.

00570                                    {
00571     $list=array();
00572     $this->init_ot();
00573 
00574     $this->ListTotal = strip_tags($this->show_total());
00575     foreach($this->otm->_extents('show_list_total') as $k=>$mod){
00576       $list[]=$mod;
00577     }
00578     return $list;
00579   }

shoppingCart::show_total (  ) 

Renvoi du total panier.

Definition at line 383 of file shoppingCart.php.

Referenced by show_list_total().

00383                                {
00384     $this->calculate();
00385     return $this->total;
00386   }

shoppingCart::show_weight (  ) 

Renvoi du poids total du panier.

Definition at line 391 of file shoppingCart.php.

00391                                 {
00392     $this->calculate();
00393     return $this->weight;
00394   }

shoppingCart::unserialize ( broken  ) 

Definition at line 449 of file shoppingCart.php.

00449                                 {
00450     for(reset($broken);$kv=each($broken);) {
00451       $key=$kv['key'];
00452       if (isset($this->$key) && gettype($this->$key)!="user function")
00453       $this->$key=$kv['value'];
00454     }
00455   }

shoppingCart::update_quantity ( products_id,
quantity = '',
attributes = '' 
)

Mise a jour quantite one item.

Parameters:
$products_id 19 || product Id vace option 19{1}1{3}10 string/int
$quantity int
$attributes string

Definition at line 229 of file shoppingCart.php.

Referenced by add_cart().

00229                                                                                   {
00230     global $customer_id;
00231 
00232     $products_id_string = tep_get_uprid($products_id, $attributes);
00233     $products_id = tep_get_prid($products_id_string);
00234 
00235     if (is_numeric($products_id) && isset($this->contents[$products_id_string]) && is_numeric($quantity)) {
00236       $this->contents[$products_id_string] = array('qty' => $quantity);
00237   // update database
00238       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_string) . "'");
00239       if (is_array($attributes)) {
00240         reset($attributes);
00241         while (list($option, $value) = each($attributes)) {
00242           $attr_value = NULL;
00243           $blank_value = FALSE;
00244           if (strstr($option, TEXT_PREFIX)) {
00245             if (trim($value) == NULL) {
00246               $blank_value = TRUE;
00247             } else {
00248               $option = substr($option, strlen(TEXT_PREFIX));
00249               $attr_value = htmlspecialchars(stripslashes($value), ENT_QUOTES);
00250               $value = (isset($_POST['Valueid'][$products_id_string][$option])? $_POST['Valueid'][$products_id_string][$option]:  $option); // PRODUCTS_OPTIONS_VALUE_TEXT_ID;
00251               $this->contents[$products_id_string]['attributes_values'][$option] = $attr_value;
00252             }
00253           }
00254 
00255           if (!$blank_value) {
00256             $this->contents[$products_id_string]['attributes'][$option] = $value;
00257   // update database
00258             if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '" . (int)$value . "', products_options_value_text = '" . tep_db_input($attr_value) . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id_string) . "' and products_options_id = '" . (int)$option . "'");
00259           }
00260         }
00261       }
00262     }
00263   }


Member Data Documentation

shoppingCart::$cartID

ID du panier, unique int.

Definition at line 33 of file shoppingCart.php.

shoppingCart::$content_type

Definition at line 36 of file shoppingCart.php.

shoppingCart::$contents

Definition at line 18 of file shoppingCart.php.

shoppingCart::$total

Total panier numeric.

Definition at line 23 of file shoppingCart.php.

shoppingCart::$weight

Poids du panier numeric.

Definition at line 28 of file shoppingCart.php.


The documentation for this class was generated from the following file: