pad_base Class Reference

Inherited by pad_base_multi.

List of all members.

Public Member Functions

Public Attributes

Protected Member Functions


Detailed Description

Definition at line 65 of file pad_base.php.


Constructor & Destructor Documentation

pad_base::__construct ( products_id = 0,
class_master = '' 
)

Definition at line 80 of file pad_base.php.

00080                                                          {
00081     $this->products_id  = $products_id;
00082     if ($this->products_id != 0) {
00083       $product_obj=product::get_item((int)$products_id );
00084       $this->products_tax_class_id = $product_obj->products_tax_class_id;
00085       $this->products_original_price = print_products_price_rv($product_obj);
00086       $this->products_org_price=$product_obj->products_price;
00087     }
00088     $this->_SetConfigurationProperties('PRODINFO_ATTRIBUTE_');
00089     $this->class_master=(is_object($class_master)? $class_master : false );
00090   }


Member Function Documentation

pad_base::_build_attributes_array ( build_stocked,
build_nonstocked 
) [protected]

Build an array of the attributes for the product,.

Date:
06.09.2009 12:06:10 oscim add order in sort
Parameters:
$build_stocked boolean Flag indicating if stocked attributes should be built. $build_nonstocked boolean Flag indicating if non-stocked attribute should be built.
Returns:
: array: Array of attributes for the product of the form: 'oid' => integer: products_options_id 'oname' => string: products_options_name 'ovals' => array: option values for the option id of the form 'id' => integer: products_options_values_id 'text' => string: products_options_values_name 'default' => integer: products_options_values_id that the product id contains for this option id and should be the default selection when this attribute is drawn. Set to zero if the product id did not contain this option.

Option obligatoire

Image color

url /option value

Price / option value

Active compte caractére

Definition at line 246 of file pad_base.php.

Referenced by draw_js().

00246                                                                                 {
00247     global $languages_id,$currencies,$cart,$page;
00248 
00249     if (!($build_stocked | $build_nonstocked)) return null;
00250 
00251     if ($build_stocked && $build_nonstocked) { $stocked_where=''; }
00252     elseif (_test_bool($build_stocked)) { $stocked_where="and popt.products_options_track_stock = '1'"; }
00253     elseif ($build_nonstocked) { $stocked_where="and popt.products_options_track_stock = '0'"; }
00254 
00255     $products_options_name_query = tep_db_query($sql="select distinct popt.products_options_id, popt.products_options_name,popt.products_options_condition, popt.products_options_track_stock, popt.products_options_images_enabled, popt.products_options_type, popt.products_options_length, popt.products_options_comment  from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$this->products_id . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' " . $stocked_where . " order by patrib.products_options_sort_order ,popt.products_options_sort_order ASC");
00256 
00257     $attributes=array();
00258     while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
00259       $products_options_array = array();
00260       $selected='';
00261 
00262       $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name,pov.products_options_values_thumbnail,pa.products_options_values_url, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$this->products_id . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' order by products_options_sort_order ASC");
00263 
00264       while ($products_options = tep_db_fetch_array($products_options_query)) {
00265         $products_options_array[] = array('id' => $products_options['products_options_values_id'],
00266                                           'text' => $products_options['products_options_values_name'],
00267                                           'url'=> '',
00268                                           'thumbnail'=> '' );
00269 
00273         $products_options_array[sizeof($products_options_array)-1]['thumbnail']=@$products_options['products_options_values_thumbnail'];
00274 
00276         if (_test_bool($products_options_name['products_options_images_enabled'])){
00277           $products_options_array[sizeof($products_options_array)-1]['url']=$products_options['products_options_values_url'];
00278           if(isset($page->product) && !in_array($products_options['products_options_values_url'] ,$page->product->pile_img)) $page->product->pile_img[]=$products_options['products_options_values_url'];
00279         }
00281         if ($products_options['options_values_price'] != '0') {
00282           $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($this->products_tax_class_id)) .')';
00283         }
00285         if($this->actual_price_pull_down){
00286         //Option prices will displayed as a final product price. This can (currently) only be used with a satisfying result if you have only one option per product.
00287 
00288           // in case price lowers, don't add values, subtract.
00289           // force float (in case) using the 0.0;
00290           if ($products_options['price_prefix'] == '-')  $show_price = 0.0 + $this->products_original_price - $products_options['options_values_price'];
00291           else  $show_price = 0.0 + $this->products_original_price + $products_options['options_values_price'];
00292 
00293 //           $products_options_array[sizeof($products_options_array)-1]['text'] .= ' '.$currencies->display_price( $show_price, tep_get_tax_rate($this->products_tax_class_id)).' ';
00294 //        $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($this->products_tax_class_id)) .')';
00295           $products_options_array[sizeof($products_options_array)-1]['price'] =$currencies->display_price( $show_price, tep_get_tax_rate($this->products_tax_class_id));
00296           $products_options_array[sizeof($products_options_array)-1]['prefix'] =$products_options['price_prefix'];
00297           $products_options_array[sizeof($products_options_array)-1]['adjust'] =$products_options['options_values_price'];
00298 
00299         }else{ //Display the option prices as differece prices with +/- prefix as usually
00300           if ($products_options['options_values_price'] != '0') {
00301             $products_options_array[sizeof($products_options_array)-1]['price'] = $this->products_original_price;
00302             $products_options_array[sizeof($products_options_array)-1]['prefix'] ='';
00303           }
00304         }
00305 
00306         $products_options_array[sizeof($products_options_array)-1]['original_price'] = $this->products_org_price;
00307 
00308         if(empty($selected))$selected=$products_options['products_options_values_id'];
00309       }
00310       if (isset($cart->contents[$this->products_id]['attributes'][$products_options_name['products_options_id']])) $selected = $cart->contents[$this->products_id]['attributes'][$products_options_name['products_options_id']];
00311 
00312 
00314       $this->count_lg_txt=($products_options_name['products_options_type']==1)? true : false;
00315 
00316       $attributes[]=array('oid'=>$products_options_name['products_options_id'],
00317                           'oname'=>$products_options_name['products_options_name'],
00318                           'ostock'=>$products_options_name['products_options_track_stock'],
00319                           'omode'=>$products_options_name['products_options_condition'],
00320                           'oimages'=>$products_options_name['products_options_images_enabled'],
00321                           'otype'=>$products_options_name['products_options_type'],
00322                           'olength'=>$products_options_name['products_options_length'],
00323                           'ocomment'=>$products_options_name['products_options_comment'],
00324                           'ovals'=>$products_options_array,
00325                           'default'=>$selected);
00326     }
00327     return $attributes;
00328   }

pad_base::_build_attributes_combinations ( attributes,
showoos,
markoos,
&$  combinations,
&$  selected_combination,
oidindex = 0,
comb = array(),
id = "",
text = '',
isselected = true 
) [protected]

A recursive method for building an array enumerating the attribute combinations for the product.

Parameters:
$attributes array An array of the attributes that combinations will be built for. Format is as returned by _build_attributes_array. $showoos boolean Flag indicating if non-stocked attributes should be built. $markoos string 'Left' if out of stock indication is to be appended in front of the attribute combination text. 'Right' if out of stock indication is to be appended at the end of the attribute combination text. $combinations array Array of the attribute combinations is returned in this parameter. Should be set to an empty array before an external call to this method. 'comb' => array: array of a single attribute combination options_id => options_value_id 'id' => string: options/values string for this combination in the form for the key of the products_stock table opt_id-val_id,opt_id-val_id,... 'text' => string: Text for this combination. Values text is as built by _build_attributes_array and contains the add/subtract price for the option value if applicable. Form is: values_text, values_text $selected_combination integer Index into the $combinations array of the combination that should be the default selection when the combination is drawn is returned in this parameter. Determined from product id. Should be set to zero before an external call to this method.
for internal recursion use only: $oidindex integer Index into the $attributes array of the option to operate on. $comb array Array containing option id/values of combination built so far products_options_id => products_options_value_id $id string Contains string of options/values built so far $text string Text for the options values constructed so far. $isselected boolean Flag indicating if so far all option values in this combination were indicated to be defaults in the product id.
Returns:
: see $combinations and $selected_combination parameters above no actual function return value.

Definition at line 407 of file pad_base.php.

Referenced by pad_base_multi::_draw_out_of_stock_message_js(), and _draw_out_of_stock_message_js().

00407                                                                                                                                                                                              {
00408     global $cart;
00409 
00410     foreach ($attributes[$oidindex]['ovals'] as $attrib) {
00411       $newcomb = $comb;
00412       $newcomb[$attributes[$oidindex]['oid']] = $attrib['id'];
00413       $newid=$id.','.$attributes[$oidindex]['oid'].'-'.$attrib['id'];
00414       $newtext = $text.", ".$attrib['text'];
00415 //       if (isset($cart->contents[$this->products_id]['attributes'][$attributes[$oidindex]['oid']]))
00416 //         $newisselected = ($cart->contents[$this->products_id]['attributes'][$attributes[$oidindex]['oid']] == $attrib['id']) ? $isselected : false;
00417 //       else
00418         $newisselected = false;
00419       if (isset($attributes[$oidindex+1])) {
00420         $this->_build_attributes_combinations($attributes, $showoos, $markoos, $combinations, $selected_combination, $oidindex+1, $newcomb, $newid, $newtext, $newisselected);
00421       }
00422       else {
00423         $is_out_of_stock=product::get_products_stock(tep_get_prid($this->products_id),$newcomb);
00424 
00425         if (/*$is_out_of_stock<=0 && */$showoos == true) {
00426           switch ($markoos) {
00427             case 'Left':   $newtext=( ($is_out_of_stock<=0) ? TEXT_OUT_OF_STOCK.' - ' : '').substr($newtext,2);
00428             break;
00429             case 'Right':  $newtext=substr($newtext,2).(($is_out_of_stock<=0)  ? ' - '.TEXT_OUT_OF_STOCK : '');
00430             break;
00431             default:       $newtext=substr($newtext,2);
00432           }
00433           $combinations[] = array('comb'=>$newcomb, 'id'=>substr($newid,1), 'text'=>$newtext, 'stock' =>$is_out_of_stock);
00434           if ($newisselected) $selected_combination = sizeof($combinations)-1;
00435         }
00436       }
00437     }
00438   }

pad_base::_draw_attributes ( attrib  )  [protected]

Boucle pour la mise en html des attribute.

Parameters:
$attrib array tableau attribute
Returns:
: HTML for displaying the product attributes

option non obligatoire

gestion stock

boucle adapt sortie

js exe inline

Reimplemented in pad_base_multi.

Definition at line 185 of file pad_base.php.

Referenced by draw_js().

00185                                                {
00186     $out='';
00187     $o=0;
00188     $mode_img=array();
00189 
00190     foreach($attrib as $item) {
00192       if($item['omode']==0) $item['default']='';
00193 
00195       $stocked=($item['ostock']==0)? false : true;
00196 
00198       for ($a=0, $s=sizeof($item['ovals']); $a<$s; $a++) {
00199         $mode_img[]=$mod=(!empty($item['ovals'][$a]['thumbnail'])? true : false);
00200         $item['ovals'][$a]['text']=($mod)? tep_image($item['ovals'][$a]['thumbnail'], $item['ovals'][$a]['text']):$item['ovals'][$a]['text'];
00201         $mode_url[]=(!empty($item['ovals'][$a]['url'])? true : false);
00202       }
00203 
00205       $js =" onchange=\" ";
00206 //       $js.=(in_array(true,$mode_url)) ? " up_master_image(this.value); " : "";
00207       $js.=(in_array(true,$mode_url))  ? " up_master_image(".$item['oid'].",this.value); " : "";
00208       $js.=($this->actual_price_pull_down) ? " up_master_price(".$item['oid'].",this.value); " : "";
00209       if($stocked) $js.=($this->stock_check && $this->out_of_stock_msgline) ? " stkmsg(this.form);  " : "";
00210       $js.=" \" ";
00211 
00212 
00213       $out.='<li class="product_option_item">'.
00214             '<span class="item_heading"><strong>'.$item['oname'].':</strong></span>'.
00215             '<span class="item_comment">'.$item['ocomment'].'</span>'.
00216             '<span class="item_value">'.$this->_draw_type_att($item, $js).'</span>'.
00217             "</li>\n";
00218 
00219       $this->up_master=$o;
00220       $o++;
00221     }
00222     return $out.$this->_draw_out_of_stock_message_js($attrib);
00223   }

pad_base::_draw_js_stock_array ( combinations  )  [protected]

Draw a Javascript array containing the given attribute combinations.

Generally used to draw array of in-stock combinations for Javascript out of stock validation and messaging.

Parameters:
$combinations array Array of combinations to build the Javascript array for. Array must be of the form returned by _build_attributes_combinations Usually this array only contains in-stock combinations.
Returns:
: string: Javacript array definition. Excludes the "var xxx=" and terminating ";". Form is: {optval1:{optval2:{optval3:1,optval3:1}, optval2:{optval3:1}}, optval1:{optval2:{optval3:1}}} For example if there are 3 options and the instock value combinations are: opt1 opt2 opt3 1 5 4 1 5 8 1 10 4 3 5 8 The string returned would be {1:{5:{4:1,8:1}, 10:{4:1}}, 3:{5:{8:1}}}

Definition at line 462 of file pad_base.php.

00462                                                          {
00463 // print_r($combinations);
00464     if (!((isset($combinations)) && (is_array($combinations)) && (sizeof($combinations) > 0))){
00465       return '{}';
00466     }
00467     $out='';
00468     foreach ($combinations[0]['comb'] as $oid=>$ovid) {
00469       $out.='{'.$ovid.':';
00470       $opts[]=$oid;
00471     }
00472     $out.=$combinations[0]['stock'];
00473 
00474     for ($combindex=1; $combindex<sizeof($combinations); $combindex++) {
00475       $comb=$combinations[$combindex]['comb'];
00476       for ($i=0; $i<sizeof($opts)-1; $i++) {
00477         if ($comb[$opts[$i]]!=$combinations[$combindex-1]['comb'][$opts[$i]]) break;
00478       }
00479       $out.=str_repeat('}',sizeof($opts)-1-$i).',';
00480       if ($i<sizeof($opts)-1) {
00481         for ($j=$i; $j<sizeof($opts)-1; $j++)
00482           $out.=$comb[$opts[$j]].':{';
00483       }
00484       $out.=$comb[$opts[sizeof($opts)-1]].':'. (($combinations[$combindex]['stock']>0) ? $combinations[$combindex]['stock']: 0);
00485     }
00486     $out.=str_repeat('}',sizeof($opts));
00487 
00488     return $out;
00489   }

pad_base::_draw_out_of_stock_message_js ( attributes  ) 

draw Javascript to display out of stock message for out of stock attribute combinations

Parameters:
array $attributes Array of attributes for the product. Format is as returned by _build_attributes_array.
Returns:
: string: Javascript to display out of stock message for out of stock attribute combinations

Reimplemented in pad_base_multi.

Definition at line 500 of file pad_base.php.

00500                                                       {
00501     $out='';
00502 
00503     $out.="<li><span id=\"oosmsg\" class=errorBox></span>\n";
00504 // print_r($attributes);
00505 
00506     if (($this->out_of_stock_msgline | $this->no_add_out_of_stock)) {
00507 
00508       $combinations = array();
00509       $selected_combination = 0;
00510       $this->_build_attributes_combinations($attributes, $this->show_out_of_stock, 'None', $combinations, $selected_combination);
00511 
00512       $out.="<script type=\"text/javascript\"><!--\n";
00513       $out.="  function check_test(input) {\n \n  ";
00514       $out.="   if(input.type =='select-one'){  ";
00515       $out.="    var selected_value = input.selectedIndex;  \n  ";
00516       $out.="    return input[selected_value].value;  \n  ";
00517       $out.="   } else {  \n  ";
00518       $out.="     for (var i=0; i<input.length;i++) { \n";
00519       $out.="       if (input[i].checked || input[selected_value]) return input[i].value;  \n";
00520       $out.="     } \n";
00521       $out.="    } \n";
00522       $out.="   } \n";
00523       $out.="  function chkstk(frm) {\n";
00524 
00525       // build javascript array of in stock combinations
00526       $out.="    var stk=".$this->_draw_js_stock_array($combinations).";\n";
00527       $out.="    var instk=false;\n";
00528       $out.="    if(frm ==null)  return ''; \n";
00529 
00530       // build javascript if statement to test level by level for existance
00531       $out.=' var qty = document.getElementById("products_quantity").value ;   ';
00532         for ($i=0; $i<sizeof($attributes); $i++) {
00533           $out.=' var input'.$i." = frm.elements['id[".$attributes[$i]['oid']."]']; \n";
00534           $out.=" var val".$i." =check_test(input".$i."); ";
00535         }
00536       $out.="\n".'if( stk';
00537         for ($i=0; $i<sizeof($attributes); $i++) {
00538           $out.="[val".$i."]";
00539         }
00540       $out.=' >=  qty ) return true; '."\n";
00541       $out.='else return false;';
00542       $out.="  }\n";
00543 
00544 
00545 
00546       if ($this->out_of_stock_msgline) {
00547         // set/reset out of stock message based on selection
00548         $out.="  function stkmsg(frm) {\n";
00549         $out.="    var instk=chkstk(frm);\n";
00550         $out.="    var span=document.getElementById(\"oosmsg\");\n";
00551         $out.="    while (span.childNodes[0])\n";
00552         $out.="      span.removeChild(span.childNodes[0]);\n";
00553         $out.="    if (!instk)\n";
00554         $out.="      span.appendChild(document.createTextNode(\"".addslashes(TEXT_OUT_OF_STOCK_MESSAGE)."\"));\n";
00555         $out.="    else\n";
00556         $out.="      span.appendChild(document.createTextNode(\" \"));\n";
00557         $out.="  }\n";
00558         //initialize out of stock message
00559 //         $out.="  stkmsg(document.forms.cart_quantity);\n";
00560       }
00561 
00562       if ($this->no_add_out_of_stock) {
00563         // js to not allow add to cart if selection is out of stock
00564         $out.="  function chksel() {\n";
00565         $out.="    var instk=chkstk(document.forms.cart_quantity);\n";
00566         $out.="    if (!instk) alert('".TEXT_OUT_OF_STOCK_MESSAGE."');\n";
00567         $out.="    return instk;\n";
00568         $out.="  }\n";
00569 //         $out.="  document.id_" . (int)$this->products_id . ".onsubmit=chksel;\n";
00570         $out.="  document.forms.cart_quantity.onsubmit=chksel;\n";
00571       }
00572       $out.="//--></script>\n";
00573     }
00574     $out.="</li>\n";
00575     return $out;
00576   }

pad_base::_draw_price_master ( attributes  )  [protected]

Remplacement de l'image principale du produits.

Parameters:
$attributes array

Reimplemented in pad_base_multi.

Definition at line 608 of file pad_base.php.

Referenced by draw_js().

00608                                                      {
00609     global $osCSS_Cache;
00610     $i=$this->up_master;
00611     if ($osCSS_Cache->read('_draw_price_master-'.$this->products_id.'-ctr_js', 60) ) {
00612       $out = $osCSS_Cache->getCache();
00613     } else {
00614     $out="<script type=\"text/javascript\"><!--\n";
00615 
00616     $out.="function up_master_price(idn,id_value){\n";
00617     $out.=" var master2 =  document.getElementById('price_master');\n";
00618     $tableau_JS="Tableau2";
00619     $out.= sprintf("%s = new Array();\n",$tableau_JS);
00620       for($i=0, $m=count($attributes); $i< $m; $i++){
00621         $out.=  sprintf("%s[%s]= new Array();\n",$tableau_JS, $i);
00622         foreach($attributes[$i]['ovals'] as $keyItems => $valueItems) {
00623           $out.=  sprintf("%s[%s][%s]= new Array();\n",$tableau_JS,$i, $keyItems);
00624           foreach($valueItems as $keyItem => $valueItem) {
00625             $out.=  sprintf("%s[%s][%s]['%s'] =%s;\n",$tableau_JS, $i, $keyItems, $keyItem,
00626                      ( is_string($valueItem)||empty($valueItem) ) ?  "\"".addslashes($valueItem)."\"" : $valueItem);
00627           }
00628         }
00629       }
00630 //     $out.=" var pile_price = parseFloat(".$tableau_JS."[idn][i]['adjust']);\n";
00631 //     $out.=" var pile_prefix=".$tableau_JS."[idn][i]['prefix'] ;\n";
00632     $out.="  idn= (idn-1) ;\n";
00633     $out.="  tab = ".$tableau_JS."[idn] ;\n";
00634     $out.=" var actuel = parseFloat(master2.innerHTML) ;\n";
00635 //     $out.="   if ( pile_price != actuel ){;\n";
00636 //     $out.="  if(pile_prefix == '-' )  actuel = parseFloat(master2.innerHTML)+ parseFloat(pile_price) ;\n";
00637 //     $out.="  else actuel = parseFloat(master2.innerHTML)-parseFloat(pile_price) ;\n";
00638 //     $out.="   }else actuel = parseFloat(master2.innerHTML);\n";
00639     $out.="  actuel = parseFloat(master2.innerHTML);\n";
00640     $out.=" for(i=0; i<tab.length; i++) { \n
00641               if(i==0)actuel = parseFloat(".$tableau_JS."[idn][i]['original_price']) ; \n
00642               if(".$tableau_JS."[idn][i]['id']==id_value ){\n
00643                 if(".$tableau_JS."[idn][i]['prefix'] == '+' ) master2.innerHTML=actuel+  parseFloat(".$tableau_JS."[idn][i]['adjust']) ;\n
00644                 else master2.innerHTML= actuel -  ".$tableau_JS."[idn][i]['adjust'] ;\n
00645                 pile_price = ".$tableau_JS."[idn][i]['adjust'] ;\n
00646                 pile_prefix = ".$tableau_JS."[idn][i]['prefix'] ;\n
00647               }\n
00648             } \n";
00649     $out.="}\n";
00650     $out.="//--></script>\n";
00651 
00652       $osCSS_Cache->writeBuffer($out);
00653     }
00654 
00655     return $out;
00656   }

pad_base::_draw_table_end (  )  [protected]

Draws the end of a table to wrap the product attributes display.

Intended for class internal use only.

Returns:
: string: HTML for end of table

Definition at line 175 of file pad_base.php.

Referenced by draw().

00175                                        {
00176     return '</ul>';
00177   }

pad_base::_draw_table_start (  )  [protected]

Draws the start of a table to wrap the product attributes display.

Intended for class internal use only.

Returns:
: string: HTML for start of table

Definition at line 164 of file pad_base.php.

Referenced by draw().

00164                                          {
00165     return '<ul class="production_option list">';
00166   }

pad_base::_draw_type_att ( array,
js 
) [protected]

Construction du selecteur d'attribut en fonction du type d'attribut.

Parameters:
$array array $js string

utilise la function de la class appelante, en rempacement de celle ci

Definition at line 337 of file pad_base.php.

00337                                                {
00338     $field ='';
00339 
00341     if($this->class_master !=false && method_exists($this->class_master, '_draw_type_att') )   return $this->class_master->_draw_type_att($array,$js);
00342 
00343 
00344     $selected=(tep_not_null($array['default']))? $array['default'] : '';
00345     switch ($array['otype']) {
00346       case '2': // Text
00347         $field .= '<label> '.$array['ovals'][0]['text'].'</label>'.tep_draw_hidden_field('Valueid['  .$array['oid'].']',$array['ovals'][0]['id'])
00348                 .tep_draw_input_field('id[' .TEXT_PREFIX.$array['oid'].']', 'id_' .TEXT_PREFIX .$array['oid'].'','', ' maxlength="'.$array['olength'].'" onkeydown="textCounter(this,\'progressbar' . $array['oid'] . '\',' . $array['olength'] . ')" onkeyup="textCounter(this,\'progressbar' . $array['oid'] . '\',' . $array['olength'] . ')" onfocus="textCounter(this,\'progressbar' .$array['oid'] . '\',' . $array['olength'] . ')"')
00349                 .'<div id="progressbar' . $array['oid'] . '" class="progress"></div>';
00350       break;
00351       case '5': //File
00352       break;
00353       case '3'://Radio
00354         $field .= tep_draw_pull_down_radio('id['.$array['oid'].']','id_'.$array['oid'],$array['ovals'],$selected,$js);
00355       break;
00356       case '4': //Checkbox
00357         $field .= tep_draw_pull_down_checkbox('id['.$array['oid'].']','id_'.$array['oid'],$array['ovals'],$selected,$js);
00358       break;
00359       case '1': // Select
00360       default:
00361         $field .= tep_draw_pull_down_menu('id['.$array['oid'].']','id_'.$array['oid'],$array['ovals'],$selected, $js);
00362     }
00363     return $field;
00364   }

pad_base::_draw_upimage_master ( attributes  )  [protected]

Reimplemented in pad_base_multi.

Definition at line 583 of file pad_base.php.

Referenced by draw_js().

00583                                                        {
00584     $i=$this->up_master;
00585     $out="<script type=\"text/javascript\"><!--\n";
00586     $out.="function up_master_image(idn,id_value){\n";
00587     $tableau_JS="Tableau";
00588     $out.= sprintf("%s = new Array();\n",$tableau_JS);
00589         foreach($attributes[$i]['ovals'] as $keyItems => $valueItems) {
00590           foreach($valueItems as $keyItem => $valueItem) {
00591             if($keyItem=='id') $id=$valueItem;
00592             elseif($keyItem=='url')
00593                 $out.=  sprintf("%s[%s] = %s;\n",$tableau_JS, $id,
00594                      ( is_string($valueItem)||empty($valueItem) ) ?  "\"".addslashes($valueItem)."\"" : $valueItem);
00595           }
00596         }
00597     $out.=" change_image_master('".HTTP_SERVER.DIR_WS_CATALOG.DIR_WS_IMAGES."'+".$tableau_JS."[id_value]) ;\n ";
00598     $out.="}\n";
00599     $out.="//--></script>\n";
00600     return $out;
00601   }

pad_base::_js_draw_textoption (  )  [protected]

Calcul nombre caratere restant / specifique option text champs dipso pour user.

Reimplemented in pad_base_multi.

Definition at line 664 of file pad_base.php.

Referenced by draw_js().

00664                                           {
00665     global $osCSS_Cache;
00666     if ($osCSS_Cache->read('__js_draw_textoption-'.$this->products_id.'-ctr_js', 60) ) {
00667       $out = $osCSS_Cache->getCache();
00668     } else {
00669 
00670     $out ="<script language=\"javascript\"><!--\n";
00671     $out.=" // BOF Product Type Feature\n";
00672     $out.=" function textCounter(field,counter,maxlimit,linecounter) {\n";
00673         $out.="     // text width//\n";
00674         $out.="     var fieldWidth =  parseInt(field.offsetWidth);\n";
00675         $out.="     var charcnt = field.value.length;\n";
00676         $out.="     // trim the extra text\n";
00677         $out.="     if (charcnt > maxlimit) {\n";
00678         $out.="             field.value = field.value.substring(0, maxlimit);\n";
00679         $out.="     } else {\n";
00680         $out.="     // progress bar percentage\n";
00681         $out.="     var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ;\n";
00682         $out.="     document.getElementById(counter).style.width =  parseInt((fieldWidth*percentage)/100)+\"px\";\n";
00683         $out.="     document.getElementById(counter).innerHTML=\"Limit: \"+percentage+\"%\"\n";
00684         $out.="     // color correction on style from CCFFF -> CC0000\n";
00685         $out.="     setcolor(document.getElementById(counter),percentage,\"background-color\");\n";
00686         $out.="     }\n";
00687     $out.=" }\n";
00688     $out.=" function setcolor(obj,percentage,prop){\n";
00689         $out.="     obj.style[prop] = \"rgb(80%,\"+(100-percentage)+\"%,\"+(100-percentage)+\"%)\";\n";
00690     $out.=" }\n";
00691     $out.=" // EOF Product Type Feature\n";
00692     $out.=" //-->\n";
00693     $out.="</script>\n";
00694 
00695       $osCSS_Cache->writeBuffer($out);
00696     }
00697 
00698     return $out;
00699   }

pad_base::_SetConfigurationProperties ( prefix  )  [protected]

Set local configuration properties from osCommerce configuration DB constants.

Parameters:
$prefix string Prefix for the osCommerce DB constants
Returns:
: nothing

Definition at line 99 of file pad_base.php.

Referenced by __construct().

00099                                                           {
00100     $this->show_out_of_stock    = _cst_bool($prefix . 'SHOW_OUT_OF_STOCK');
00101     $this->mark_out_of_stock    = tep_cst_define($prefix . 'MARK_OUT_OF_STOCK');
00102     $this->out_of_stock_msgline = _cst_bool($prefix . 'OUT_OF_STOCK_MSGLINE');
00103     $this->no_add_out_of_stock  = _cst_bool($prefix . 'NO_ADD_OUT_OF_STOCK');
00104     $this->actual_price_pull_down  = _cst_bool($prefix . 'ACTUAL_PRICE_PULL_DOWN');
00105     $this->stock_check  = _cst_bool('STOCK_CHECK');
00106     $this->up_master=0;
00107     // compte nbr caractére ligne / max leng / attribut texte
00108     $this->count_lg_txt=false;
00109   }

pad_base::draw (  ) 

Draws the product attributes.

This is the only method other than the constructor that is intended to be called by a user of this class. Attributes that stock is tracked for are grouped first and drawn with one dropdown list per attribute. All attributes are drawn even if no stock is available for the attribute and no indication is given that the attribute is out of stock. Attributes that stock is not tracked for are then drawn with one dropdown list per attribute.

Returns:
: string: HTML for displaying the product attributes

Definition at line 146 of file pad_base.php.

00146                          {
00147     $attributes=$this->the_attributes;
00148     if (sizeof($attributes)==0) return false;
00149     $out= '<h4>'.TEXT_PRODUCT_OPTIONS.'</h4>'.
00150           $this->_draw_table_start().
00151           $this->out.
00152           $this->_draw_table_end();
00153     return $out;
00154   }

pad_base::draw_js (  ) 

Methode draw des js dans les block header.

Necessite d'être appelé en premier Prend en charge el chargement prealable à la page, et repartis les scripts

ecriture en tanpon

return js image replace

charge pile _image class $page.product

return js price replace

Definition at line 117 of file pad_base.php.

00117                             {
00118     //load db
00119     $this->the_attributes = $this->_build_attributes_array(true, true);
00120     if(count($this->the_attributes)==0)  return;
00122     $this->out=$this->_draw_attributes($this->the_attributes);
00124     $out=$this->_draw_upimage_master($this->the_attributes);
00126     if($this->count_lg_txt)$out.=$this->_js_draw_textoption();
00128     if($this->actual_price_pull_down) $out.=$this->_draw_price_master($this->the_attributes);
00129 
00130     return $out;
00131   }


Member Data Documentation

pad_base::$mark_out_of_stock

Reimplemented in pad_base_multi.

Definition at line 69 of file pad_base.php.

pad_base::$no_add_out_of_stock

Reimplemented in pad_base_multi.

Definition at line 71 of file pad_base.php.

pad_base::$out_of_stock_msgline

Reimplemented in pad_base_multi.

Definition at line 70 of file pad_base.php.

pad_base::$products_id

Reimplemented in pad_base_multi.

Definition at line 66 of file pad_base.php.

Referenced by __construct().

pad_base::$products_tax_class_id

Reimplemented in pad_base_multi.

Definition at line 67 of file pad_base.php.

pad_base::$show_out_of_stock

Reimplemented in pad_base_multi.

Definition at line 68 of file pad_base.php.


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