Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

eFFeKt

Members
  • Content count

    21
  • Joined

  • Last visited

1 Follower

Profile Information

  • Real Name
    sale
  1. Hi, I just used your "Product Listing in Columns" module and it worked very well. Many thanks for that. Can you tell me how I could get fine borders around the "boxes" that the products sit in?

  2. eFFeKt

    Automatically send data feed to Froogle

    Hi Jack, thanks for your advice. i got it. if somebody else want to change the code like this, you have to replace this part of code: preg_replace($_strip_search, $_strip_replace, strip_tags( strtr($row['name'], $_cleaner_array) ) ) . "\t" . with this: preg_replace($_strip_search, $_strip_replace, strip_tags( strtr($row['mfgName'] . ' ' . $row['name'], $_cleaner_array) ) ) . "\t" .
  3. eFFeKt

    Automatically send data feed to Froogle

    Hi Jack, i want to display the two field manufacturers.manufacturers_name and the products_description.products_name just as one field as title (name). how can i combine this to fields in one? thanks :)
  4. eFFeKt

    Seperate Pricing Per Customer v3.5

    hi jan, thanks for your reply. i figured out what the problem was. i've imported some new products with easypopulate and changed one pricebreak with phpmyadmin. everything was set correctly (i've double-checked all necessary fields), but, dont ask me why, as soon as i change/add any pricebreak in phpmyadmin the failure appears. now everything works fine. i flew off the handle checking the files of my shop till i totally frustrated cleared all databasefileds with phpmyadmin. nevertheless, thank you very much for your commitment!
  5. eFFeKt

    SiteMonitor

    Thanks Jack, i solved it by myself. the scipt didn't work on my localhost. after uploading it to the server and setting the parameters in sitemonitor_configure.php, everthing works fine. sorry for claiming you :)
  6. eFFeKt

    SiteMonitor

    hi jack, thanks for this contribution. i've get this errormessage on sitemonitor_configure_setup.php: i dont know how to fix it. hope you can help.
  7. eFFeKt

    Seperate Pricing Per Customer v3.5

    hi jan, i have a problem with this contribution. i've set a minimum order-quatity of 30 to a product. in product_info.php there is already 30 typed in. if i change this, i.e. to 10, the cart doesnt update the quantity automaticly. the shopping_cart.php shows the message, that the cart is update to the minimum quantity of 30, but still on 10... only if the customer updates the cart (usually nobody do this) the quantity increase. i've a local copy of my store, where it works perfectly. when i uplad the files, the problem is not fixed. i know, that are few informations, but maybe i've heard of this problem already a can give me a hint :)
  8. eFFeKt

    Seperate Pricing Per Customer v3.5

    sorry jan, i accidentally posted the code of my backup-file, where i was trying around before i posted the first time, and doesn't noticed it... thank you for helping me out. i read the part of the php-manual and understood why should i do this. so, i've added the parts you told me. this part "$this->cg_id = $this->get_customer_group_id();" i put right below global $cart;, as you saw it before, the other part i wrote down after "return $_cg_id; }" (btw. why this part has to be at the bottom? wouldnt it be more logical to declare it befor i use it? or is it not important?). so, now i can see, that the pd_base is handling my groups_id, after i did what you advised me to do. later then i noticed that i havn't set an array to get informations from products_attributes_groups... this is the reason this code doesnt change the standard options_values_price to the options_values_price of the products_attributes_groups. (it was late, i was almost over 30 hours awake working on this code - couldnt see the forest for the trees) :blush: okay, so i added this to my code, to query this table: if ($this->cg_id != '0') { // check for a group price $pg_query = tep_db_query("select products_attributes_id, customers_group_id, options_values_price, price_prefix, products_id as price from " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " pag where products_id = '" . (int)$this->products_id . "' and pag.customers_group_id = '" . $this->cg_id . "'"); $customer_group_price_result = tep_db_fetch_array($pg_query); if (tep_not_null($customer_group_price_result['options_values_price'])) { $products_options['options_values_price'] = $customer_group_price_result['options_values_price']; } // end if (tep_not_null($customer_group_price_result['options_values_price'])) } // end if ($customer_group_id != '0') the price is now showing correctly as far as i'm logged in as retailer (cg_id=0). unfortunately, as i login as another member the script shows only the price of the lowest products_attributes_id for all attributes and ignores the price_prefix (it only adds, don't substrac, no matter what i'm using). here is the whole necessary part of where i display the prices: if(PRODINFO_ATTRIBUTE_ACTUAL_PRICE_PULL_DOWN == 'True'){ //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. if ($this->cg_id != '0') { // check for a group price $pg_query = tep_db_query("select products_attributes_id, customers_group_id, options_values_price, price_prefix, products_id as price from " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " pag where products_id = '" . (int)$this->products_id . "' and pag.customers_group_id = '" . $this->cg_id . "'"); $customer_group_price_result = tep_db_fetch_array($pg_query); if (tep_not_null($customer_group_price_result['options_values_price'])) { $products_options['options_values_price'] = $customer_group_price_result['options_values_price']; } // end if (tep_not_null($customer_group_price_result['options_values_price'])) } // end if ($customer_group_id != '0') if ($products_options['price_prefix'] == '-') {// in case price lowers, don't add values, subtract. $show_price = 0.0 + $this->products_original_price - $products_options['options_values_price']; // force float (in case) using the 0.0; } else { $show_price = 0.0 + $this->products_original_price + $products_options['options_values_price']; // force float (in case) using the 0.0; } // if ($products_options['price_prefix'] == '-') $products_options_array[sizeof($products_options_array)-1]['text'] .= ' '.$currencies->display_price( $show_price, tep_get_tax_rate($this->products_tax_class_id)).' '; i hope you will help me one more time. i guess it would be the last time ;) disgracefulness how this short piece of code can bother me so long. just wonder how i could get an A for coding at school :lol:
  9. eFFeKt

    Seperate Pricing Per Customer v3.5

    please ignore that sentence: "the price is returned by this: return $attributes;". as you can see, this is driving me totaly crazy. :)
  10. eFFeKt

    Seperate Pricing Per Customer v3.5

    i cant get it. the pd_base.php is a class, which calls the price and the display of the options, instead doing this in the product_info.php. the product_info.php requires the pd_base.php to show the options. right here: //++++ QT Pro: End Changed Code // BOF SPPC Hide attributes from customer groups $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 "); $products_attributes = tep_db_fetch_array($products_attributes_query); if ($products_attributes['total'] > 0) { //++++ QT Pro: Begin Changed code $products_id=(preg_match("/^\d{1,10}(\{\d{1,10}\}\d{1,10})*$/",$HTTP_GET_VARS['products_id']) ? $HTTP_GET_VARS['products_id'] : (int)$HTTP_GET_VARS['products_id']); require(DIR_WS_CLASSES . 'pad_' . PRODINFO_ATTRIBUTE_PLUGIN . '.php'); $class = 'pad_' . PRODINFO_ATTRIBUTE_PLUGIN; $pad = new $class($products_id); echo $pad->draw(); } //Display a table with which attributecombinations is on stock to the customer? if(PRODINFO_ATTRIBUTE_DISPLAY_STOCK_LIST == 'True'): require(DIR_WS_MODULES . "qtpro_stock_table.php"); endif; //++++ QT Pro: End Changed Code as i assume, this code has no effect on displying the attributes group_price. so i have to edit pd_base.php, which i've modified as far as the file is showing everythin else but the options_values_price of the products_attributes_groups table. as you can see here: <?php class pad_base { var $products_id; var $products_tax_class_id; var $show_out_of_stock; var $mark_out_of_stock; var $out_of_stock_msgline; var $no_add_out_of_stock; function pad_base($products_id=0) { $this->products_id = $products_id; if ($this->products_id != 0) { $tax_class_query = tep_db_query('SELECT p.products_tax_class_id, IF(s.status, s.specials_new_products_price, p.products_price) as products_price FROM ' . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id WHERE p.products_id = '" . (int)$products_id . "'"); $tax_class_array = tep_db_fetch_array($tax_class_query); $this->products_tax_class_id = $tax_class_array['products_tax_class_id']; $this->products_original_price = $tax_class_array['products_price']; } $this->_SetConfigurationProperties('PRODINFO_ATTRIBUTE_'); } function _SetConfigurationProperties($prefix) { $this->show_out_of_stock = constant($prefix . 'SHOW_OUT_OF_STOCK'); $this->mark_out_of_stock = constant($prefix . 'MARK_OUT_OF_STOCK'); $this->out_of_stock_msgline = constant($prefix . 'OUT_OF_STOCK_MSGLINE'); $this->no_add_out_of_stock = constant($prefix . 'NO_ADD_OUT_OF_STOCK'); } function draw() { $out=$this->_draw_table_start(); $out.=$this->_draw_stocked_attributes(); $out.=$this->_draw_nonstocked_attributes(); $out.=$this->_draw_table_end(); return $out; } function _draw_table_start() { $out =' <table border="0" cellspacing="0" cellpadding="2">'; $out.=' <tr>'; $out.=' <td class="main" colspan="2"><b>' . TEXT_PRODUCT_OPTIONS . '</b></td>'; $out.=' </tr>'; return $out; } function _draw_stocked_attributes() { $out = ''; $attributes = $this->_build_attributes_array(true, false); if (sizeof($attributes)>0) { foreach ($attributes as $stocked) { $out .= '<tr><td align="right" class=main><b>' . $stocked['oname'] . ":</b></td><td class=main>" . tep_draw_pull_down_menu('id['.$stocked['oid'].']',array_values($stocked['ovals']),$stocked['default']) . "</td></tr>\n"; } } return $out; } function _draw_nonstocked_attributes() { $out=''; $nonstocked_attributes = $this->_build_attributes_array(false, true); foreach($nonstocked_attributes as $nonstocked) { $out.='<tr><td align="right" class=main><b>'.$nonstocked['oname'].":</b></td><td class=main>".tep_draw_pull_down_menu('id['.$nonstocked['oid'].']',$nonstocked['ovals'],$nonstocked['default'])."</td></tr>\n"; } return $out; } function _draw_table_end() { return ' </table>'; } /* HERE IS THE PART OF CODE I NEED TO DISPLAY THE ATTRIBUTES AND OPTIONS FOR MY NEEDS */ function _build_attributes_array($build_stocked, $build_nonstocked) { global $languages_id; global $currencies; global $cart; if (!($build_stocked | $build_nonstocked)) return null; if ($build_stocked && $build_nonstocked) { $stocked_where=''; } elseif ($build_stocked) { $stocked_where="and popt.products_options_track_stock = '1'"; } elseif ($build_nonstocked) { $stocked_where="and popt.products_options_track_stock = '0'"; } $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name, popt.products_options_track_stock 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 . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 " . $stocked_where . " order by popt.products_options_name"); $attributes=array(); while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $products_options_array = array(); $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id 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 . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0"); // substitute options_values_price and prefix for those for the customer group (if available) if ($customer_group_id != '0' && tep_not_null($cg_attr_prices)) { for ($n = 0; $n < count($products_options); $n++) { for ($i = 0; $i < count($cg_attr_prices); $i++) { if ($cg_attr_prices[$i]['products_attributes_id'] == $products_options[$n]['products_attributes_id']) { $products_options[$n]['price_prefix'] = $cg_attr_prices[$i]['price_prefix']; $products_options[$n]['options_values_price'] = $cg_attr_prices[$i]['options_values_price']; } } // end for ($i = 0; $i < count($cg_att_prices); $i++) } } // end if ($customer_group_id != '0' && (tep_not_null($cg_attr_prices)) while ($products_options = tep_db_fetch_array($products_options_query)) { $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']); // global variable (session) $sppc_customer_group_id -> local variable customer_group_id if(PRODINFO_ATTRIBUTE_ACTUAL_PRICE_PULL_DOWN == 'True'){ //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. if ($products_options['price_prefix'] == '-') {// in case price lowers, don't add values, subtract. $show_price = 0.0 + $this->products_original_price - $products_options['options_values_price']; // force float (in case) using the 0.0; } else { $show_price = 0.0 + $this->products_original_price + $products_options['options_values_price']; // force float (in case) using the 0.0; } $products_options_array[sizeof($products_options_array)-1]['text'] .= ' '.$currencies->display_price( $show_price, tep_get_tax_rate($this->products_tax_class_id)).' '; }else{ //Display the option prices as differece prices with +/- prefix as usually if ($products_options['options_values_price'] != '0') { $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)) .')'; } } } 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']]; else $selected = 0; $attributes[]=array('oid'=>$products_options_name['products_options_id'], 'oname'=>$products_options_name['products_options_name'], 'ovals'=>$products_options_array, 'default'=>$selected); } return $attributes; } /* HERE IT ENDS, AND THE FILE IS STARTING TO CREATE DIFFERENT DISPLAY-OPTIONS */ function _build_attributes_combinations($attributes, $showoos, $markoos, &$combinations, &$selected_combination, $oidindex=0, $comb=array(), $id="", $text='', $isselected=true) { global $cart; foreach ($attributes[$oidindex]['ovals'] as $attrib) { $newcomb = $comb; $newcomb[$attributes[$oidindex]['oid']] = $attrib['id']; $newid=$id.','.$attributes[$oidindex]['oid'].'-'.$attrib['id']; $newtext = $text.", ".$attrib['text']; if (isset($cart->contents[$this->products_id]['attributes'][$attributes[$oidindex]['oid']])) $newisselected = ($cart->contents[$this->products_id]['attributes'][$attributes[$oidindex]['oid']] == $attrib['id']) ? $isselected : false; else $newisselected = false; if (isset($attributes[$oidindex+1])) { $this->_build_attributes_combinations($attributes, $showoos, $markoos, $combinations, $selected_combination, $oidindex+1, $newcomb, $newid, $newtext, $newisselected); } else { $is_out_of_stock=tep_check_stock(tep_get_prid($this->products_id),1,$newcomb); if (!$is_out_of_stock | ($showoos == true)) { switch ($markoos) { case 'Left': $newtext=($is_out_of_stock ? TEXT_OUT_OF_STOCK.' - ' : '').substr($newtext,2); break; case 'Right': $newtext=substr($newtext,2).($is_out_of_stock ? ' - '.TEXT_OUT_OF_STOCK : ''); break; default: $newtext=substr($newtext,2); break; } $combinations[] = array('comb'=>$newcomb, 'id'=>substr($newid,1), 'text'=>$newtext); if ($newisselected) $selected_combination = sizeof($combinations)-1; } } } } function _draw_js_stock_array($combinations) { if (!((isset($combinations)) && (is_array($combinations)) && (sizeof($combinations) > 0))){ return '{}'; } $out=''; foreach ($combinations[0]['comb'] as $oid=>$ovid) { $out.='{'.$ovid.':'; $opts[]=$oid; } $out.='1'; for ($combindex=1; $combindex<sizeof($combinations); $combindex++) { $comb=$combinations[$combindex]['comb']; for ($i=0; $i<sizeof($opts)-1; $i++) { if ($comb[$opts[$i]]!=$combinations[$combindex-1]['comb'][$opts[$i]]) break; } $out.=str_repeat('}',sizeof($opts)-1-$i).','; if ($i<sizeof($opts)-1) { for ($j=$i; $j<sizeof($opts)-1; $j++) $out.=$comb[$opts[$j]].':{'; } $out.=$comb[$opts[sizeof($opts)-1]].':1'; } $out.=str_repeat('}',sizeof($opts)); return $out; } } ?> i have highlighted the part, which is important to me. the code after it, is building an other display-option. as far as i understand php this: return $attributes; is the command to show the all i've done before. my php knowledge is a bit unincisive to understand how that code is working exactly. so i have to guess whats going on and where to put code into it. so i placed the code of the shopping cart into the file. my problem is, that i dont know hoow to call the groups price when there is one instead of the actual price, that happend here: if(PRODINFO_ATTRIBUTE_ACTUAL_PRICE_PULL_DOWN == 'True'){ //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. if ($products_options['price_prefix'] == '-') {// in case price lowers, don't add values, subtract. $show_price = 0.0 + $this->products_original_price - $products_options['options_values_price']; // force float (in case) using the 0.0; } else { $show_price = 0.0 + $this->products_original_price + $products_options['options_values_price']; // force float (in case) using the 0.0; } so i've tryed to include an } else { and a code that have to call the groups-prce. but everything i do, it doesnt take effekt or i'm getting error-messages. i think the problem is, that i think a bit to complicated... i also don't now how to include your return $_cg_id; beacause the price is returned by this: return $attributes;.
  11. eFFeKt

    Seperate Pricing Per Customer v3.5

    Thank you Jan, i've tried everything. i can't get it to work. seems to be impossible to me. : / maybe you got an idea where to put it in exactly? when i put this into the function function _build_attributes_array($build_stocked, $build_nonstocked) { global $languages_id; global $currencies; global $cart; $this->cg_id = $this->get_customer_group_id(); i'll get an error-message telling me that this is an undefinied method call, so i've tried a million other possibilities, but i'm going in circles. i'm 28 hours awak trying to get this thing done. maybe i've go to sleep a bit. hopfully you got one more tip for me. sorry for being so annoying.
  12. eFFeKt

    Seperate Pricing Per Customer v3.5

    and now my problem :) i've merged the latest version of sppc (Separate Pricing Per Customer v 4.2.2 BUG FIX - manual install) an the contribution qtpro. my problem is, that my attributes don't show the priced stored in the database row "options_values_price". i can't get the groups price showing up in the attributes list. i hope you understand what i mean, my english is quite bad... here is my code from the pd_base.php of qtpro: function _build_attributes_array($build_stocked, $build_nonstocked) { global $languages_id; global $currencies; global $cart; if (!($build_stocked | $build_nonstocked)) return null; if ($build_stocked && $build_nonstocked) { $stocked_where=''; } elseif ($build_stocked) { $stocked_where="and popt.products_options_track_stock = '1'"; } elseif ($build_nonstocked) { $stocked_where="and popt.products_options_track_stock = '0'"; } $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name, popt.products_options_track_stock 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 . " and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 order by popt.products_options_name"); $attributes=array(); while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $products_options_array = array(); $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id 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 . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0"); $list_of_prdcts_attributes_id = ''; $products_options = array(); // makes sure this array is empty again while ($_products_options = tep_db_fetch_array($products_options_query)) { $products_options[] = $_products_options; $list_of_prdcts_attributes_id .= $_products_options['products_attributes_id'].","; } if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0') { $select_list_of_prdcts_attributes_ids = "(" . substr($list_of_prdcts_attributes_id, 0 , -1) . ")"; $pag_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " where products_attributes_id IN " . $select_list_of_prdcts_attributes_ids . " AND customers_group_id = '" . $customer_group_id . "'"); while ($pag_array = tep_db_fetch_array($pag_query)) { $cg_attr_prices[] = $pag_array; } // substitute options_values_price and prefix for those for the customer group (if available) if ($customer_group_id != '0' && tep_not_null($cg_attr_prices)) { for ($n = 0; $n < count($products_options); $n++) { for ($i = 0; $i < count($cg_attr_prices); $i++) { if ($cg_attr_prices[$i]['products_attributes_id'] == $products_options[$n]['products_attributes_id']) { $products_options[$n]['price_prefix'] = $cg_attr_prices[$i]['price_prefix']; $products_options[$n]['options_values_price'] = $cg_attr_prices[$i]['options_values_price']; } } // end for ($i = 0; $i < count($cg_att_prices); $i++) } } // end if ($customer_group_id != '0' && (tep_not_null($cg_attr_prices)) }// end if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0') for ($n = 0; $n < count($products_options); $n++) { if ($products_options[$n]['options_values_price'] != '0') { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options[$n]['price_prefix'] . $currencies->display_price($products_options[$n]['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; } } // EOF SPPC attributes mod 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']]; else $selected = 0; $attributes[]=array('oid'=>$products_options_name['products_options_id'], 'oname'=>$products_options_name['products_options_name'], 'ovals'=>$products_options_array, 'default'=>$selected); } return $attributes; } hope you can help me. the rest ist working well.
  13. eFFeKt

    Seperate Pricing Per Customer v3.5

    hi, i dont know what the request authentication stands for. there ist an option when i'm editing a customer, but i dont know whats the meaning of "alert on" and "alert off". could somebody give me a hint? :) thanks in advance
  14. hi, i'm tying to merge this 3 contibutions into one. i've finally insatlled sppc and products attributes sort order, but i have no clou how to include it into the pad_base.php file of qtpro. i hope somebody can help me out of this misery. i've spend already 3 days with this code and can't find any solution. here ist the code of the first to contibs: <?php // BOF SPPC Hide attributes from customer groups $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 "); $products_attributes = tep_db_fetch_array($products_attributes_query); if ($products_attributes['total'] > 0) { ?> <table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td> </tr> <?php $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name, popt.products_options_sort_order from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 order by popt.products_options_sort_order"); while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $products_options_array = array(); $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id, pa.attribute_sort from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['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 . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 order by pa.attribute_sort "); $list_of_prdcts_attributes_id = ''; $products_options = array(); // makes sure this array is empty again while ($_products_options = tep_db_fetch_array($products_options_query)) { $products_options[] = $_products_options; $list_of_prdcts_attributes_id .= $_products_options['products_attributes_id'].","; } if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0') { $select_list_of_prdcts_attributes_ids = "(" . substr($list_of_prdcts_attributes_id, 0 , -1) . ")"; $pag_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " where products_attributes_id IN " . $select_list_of_prdcts_attributes_ids . " AND customers_group_id = '" . $customer_group_id . "'"); while ($pag_array = tep_db_fetch_array($pag_query)) { $cg_attr_prices[] = $pag_array; } // substitute options_values_price and prefix for those for the customer group (if available) if ($customer_group_id != '0' && tep_not_null($cg_attr_prices)) { for ($n = 0; $n < count($products_options); $n++) { for ($i = 0; $i < count($cg_attr_prices); $i++) { if ($cg_attr_prices[$i]['products_attributes_id'] == $products_options[$n]['products_attributes_id']) { $products_options[$n]['price_prefix'] = $cg_attr_prices[$i]['price_prefix']; $products_options[$n]['options_values_price'] = $cg_attr_prices[$i]['options_values_price']; } } // end for ($i = 0; $i < count($cg_att_prices); $i++) } } // end if ($customer_group_id != '0' && (tep_not_null($cg_attr_prices)) } // end if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0') for ($n = 0; $n < count($products_options); $n++) { $products_options_array[] = array('id' => $products_options[$n]['products_options_values_id'], 'text' => $products_options[$n]['products_options_values_name']); if ($products_options[$n]['options_values_price'] != '0') { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options[$n]['price_prefix'] . $currencies->display_price($products_options[$n]['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; } } // EOF SPPC attributes mod if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) { $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]; } else { $selected_attribute = false; } ?> <tr> <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td> <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td> </tr> <?php } ?> it has to be in here (pad_base.php): function _build_attributes_array($build_stocked, $build_nonstocked) { global $languages_id; global $currencies; global $cart; if (!($build_stocked | $build_nonstocked)) return null; if ($build_stocked && $build_nonstocked) { $stocked_where=''; } elseif ($build_stocked) { $stocked_where="and popt.products_options_track_stock = '1'"; } elseif ($build_nonstocked) { $stocked_where="and popt.products_options_track_stock = '0'"; } $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name, popt.products_options_track_stock 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 popt.products_options_name"); $attributes=array(); while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $products_options_array = array(); $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, 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 . "'"); while ($products_options = tep_db_fetch_array($products_options_query)) { $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']); if(PRODINFO_ATTRIBUTE_ACTUAL_PRICE_PULL_DOWN == 'True'){ //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. if ($products_options['price_prefix'] == '-') {// in case price lowers, don't add values, subtract. $show_price = 0.0 + $this->products_original_price - $products_options['options_values_price']; // force float (in case) using the 0.0; } else { $show_price = 0.0 + $this->products_original_price + $products_options['options_values_price']; // force float (in case) using the 0.0; } $products_options_array[sizeof($products_options_array)-1]['text'] .= ' '.$currencies->display_price( $show_price, tep_get_tax_rate($this->products_tax_class_id)).' '; }else{ //Display the option prices as differece prices with +/- prefix as usually if ($products_options['options_values_price'] != '0') { $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)) .')'; } } } 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']]; else $selected = 0; $attributes[]=array('oid'=>$products_options_name['products_options_id'], 'oname'=>$products_options_name['products_options_name'], 'ovals'=>$products_options_array, 'default'=>$selected); } return $attributes; }
×