Jump to content

PhaseClone

Members
  • Content count

    5
  • Joined

  • Last visited

1 Follower

Profile Information

  • Real Name
    Chris
  1. @@twigster try this: edit your pad_base.php file: FIND: $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 . "'"); REPLACE WITH: // Begin QT Pro 4.6.1 (sort by products options values id MOD) 7-2-13 $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 . "' order by pov.products_options_values_id"); /* $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 . "'"); */ // End QT Pro 4.6.1 (sort by products options values id MOD) 7-2-13 The old code is still preserved in the system for you to restore if you need. Please note, this sorts the options by ID, so the order you put them into osCommerce becomes the order that osCommerce displays them.
  2. @PhaseClone Nope, I'm wrong about what I just posted as a problem. It's not a problem, except for some of my items some of the time. They appear to have gotten their colors and sizes transposed on the stock display table and the menu.
  3. My problem is now solved, but it's now a bug report in QT Pro. Consider an item with one color and many sizes. For example, a hardware store sells work gloves in various sizes but they're all the same color: Red/Small, Red/Medium, Red/Large, Red/XLarge or Consider an item with one size and many colors. For example, a hardware store sells plastic garden shovels that have different colors: Orange/Shovel, Silver/Shovel, Gray/Shovel, White/Shovel Each of these items fails to appear properly in stock if the non-varying unit (for the gloves, that's RED and for the shovels, that's SHOVEL) is declared separately in the product attributes system: the products_attributes, products_options, products_options_values, and products_options_values_to_products_options tables. Workaround: on any grid containing only one color with many sizes, or on any grid containing one size with many colors, merge the attributes so they are not separated on two menus. For example, describe the gloves as "red gloves," and then only offer sizes, or describe the shovel as a "shovel" and only offer colors. This problem may not occur if you add all your products manually, but if you're importing products from another database, it helps to know.
  4. @@twigster I know from looking at pad_multiple_dropdowns that the system loops through individual queries to build a set of results (see my recent post). Each query it runs is just ONE combination of attributes, like "RED / SMALL," so I'm guessing the only way to influence the ordering of the options would be to figure out a way to get the option sort column into a query of all the options before you run anything else. Then you would need to use "ORDER BY" in SQL to control sorting order. Then you would run a "for..next" loop covering the range of numbers covered in your sort column. Then on each loop, you could add the sort column's value to the "WHERE" clause of the query, getting you the rows in order. Unfortunately, since I'm so new to this, I can't tell you exactly how you're going to do that, but if you know some SQL, you should be able to get it.
  5. I've got QT Pro working on an osC 2.3.3 storefront with only one other module. Product info displays the attribute sizes properly, but certain products say they're out of stock--even when the stock table displays quantities. It's not happening to everything, but since I've got over two thousand products in there, I really don't want to go through every single item if I can avoid it. Does anybody know which part of the system this kind of error happens in? I tried looking in pad_multiple_dropdowns, and I even got it to print its queries on the screen for me so I could try them in MySQL. On products that make this mistake, the query still loads the correct data in MySQL. The quantities I see on MySQL match the ones I see on the product detail page. The quantities are above the low stock threshold, but on the faulty items, the item still cannot be added to my cart. Anybody have any ideas? <?php /* QT Pro Version 4.1 pad_multiple_dropdowns.php Contribution extension to: osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2004, 2005 Ralph Day Released under the GNU General Public License Based on prior works released under the GNU General Public License: QT Pro prior versions Ralph Day, October 2004 Tom Wojcik aka TomThumb 2004/07/03 based on work by Michael Coffman aka coffman FREEZEHELL - 08/11/2003 freezehell@hotmail.com Copyright (c) 2003 IBWO Joseph Shain, January 2003 osCommerce MS2 Copyright (c) 2003 osCommerce Modifications made: 11/2004 - Created 12/2004 - Fix _draw_out_of_stock_message_js to add semicolon to end of js stock array 03/2005 - Remove '&' for pass by reference from parameters to call of _build_attributes_combinations. Only needed on method definition and causes error messages on some php versions/configurations ******************************************************************************************* QT Pro Product Attributes Display Plugin pad_multiple_dropdowns.php - Display stocked product attributes first as one dropdown for each attribute. Class Name: pad_multiple_dropdowns This class generates the HTML to display product attributes. First, product attributes that stock is tracked for are displayed, each attribute in its own dropdown list. Then attributes that stock is not tracked for are displayed, each attribute in its own dropdown list. Methods overidden or added: _draw_stocked_attributes draw attributes that stock is tracked for _draw_out_of_stock_message_js draw Javascript to display out of stock message for out of stock attribute combinations */ require_once(DIR_WS_CLASSES . 'pad_base.php'); class pad_multiple_dropdowns extends pad_base { /* Method: _draw_stocked_attributes draw dropdown lists for attributes that stock is tracked for Parameters: none Returns: string: HTML to display dropdown lists for attributes that stock is tracked for */ function _draw_stocked_attributes() { global $languages_id; $out=''; $attributes = $this->_build_attributes_array(true, false); if (sizeof($attributes)>0) { for($o=0; $o<sizeof($attributes); $o++) { $s=sizeof($attributes[$o]['ovals']); for ($a=0; $a<$s; $a++) { /* diagnostic code here */ $sqlTest = "select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_id = '" . (int)$this->products_id . "' AND products_stock_attributes REGEXP '(^|,)" . (int)$attributes[$o]['oid'] . "-" . (int)$attributes[$o]['ovals'][$a]['id'] . "(,|$)' AND products_stock_quantity > 0"; echo "<strong>" . $sqlTest . "</strong><br /><br />"; /* end diagnostic code */ $attribute_stock_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_id = '" . (int)$this->products_id . "' AND products_stock_attributes REGEXP '(^|,)" . (int)$attributes[$o]['oid'] . "-" . (int)$attributes[$o]['ovals'][$a]['id'] . "(,|$)' AND products_stock_quantity > 0"); $out_of_stock=(tep_db_num_rows($attribute_stock_query)==0); if ($out_of_stock && ($this->show_out_of_stock == 'True')) { switch ($this->mark_out_of_stock) { case 'Left': $attributes[$o]['ovals'][$a]['text']=TEXT_OUT_OF_STOCK.' - '.$attributes[$o]['ovals'][$a]['text']; break; case 'Right': $attributes[$o]['ovals'][$a]['text'].=' - '.TEXT_OUT_OF_STOCK; break; } } elseif ($out_of_stock && ($this->show_out_of_stock != 'True')) { unset($attributes[$o]['ovals'][$a]); } } $out.='<tr><td align="right" class=main><strong>'.$attributes[$o]['oname'].":</strong></td><td class=main>".tep_draw_pull_down_menu('id['.$attributes[$o]['oid'].']',array_values($attributes[$o]['ovals']),$attributes[$o]['default'], "onchange=\"stkmsg(this.form);\"")."</td></tr>\n"; } $out.=$this->_draw_out_of_stock_message_js($attributes); return $out; } } /* Method: _draw_out_of_stock_message_js draw Javascript to display out of stock message for out of stock attribute combinations Parameters: $attributes array 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 */ function _draw_out_of_stock_message_js($attributes) { $out=''; $out.="<tr><td> </td><td><span id=\"oosmsg\" class=errorBox></span>\n"; if (($this->out_of_stock_msgline == 'True' | $this->no_add_out_of_stock == 'True')) { $out.="<SCRIPT LANGUAGE=\"Javascript\"><!--\n"; $combinations = array(); $selected_combination = 0; $this->_build_attributes_combinations($attributes, false, 'None', $combinations, $selected_combination); $out.=" function chkstk(frm) {\n"; // build javascript array of in stock combinations $out.=" var stk=".$this->_draw_js_stock_array($combinations).";\n"; $out.=" var instk=false;\n"; // build javascript if statement to test level by level for existance $out.=' '; for ($i=0; $i<sizeof($attributes); $i++) { $out.='if (stk'; for ($j=0; $j<=$i; $j++) { $out.="[frm['id[".$attributes[$j]['oid']."]'].value]"; } $out.=') '; } $out.="instk=true;\n"; $out.=" return instk;\n"; $out.=" }\n"; if ($this->out_of_stock_msgline == 'True') { // set/reset out of stock message based on selection $out.=" function stkmsg(frm) {\n"; $out.=" var instk=chkstk(frm);\n"; $out.=" var span=document.getElementById(\"oosmsg\");\n"; $out.=" while (span.childNodes[0])\n"; $out.=" span.removeChild(span.childNodes[0]);\n"; $out.=" if (!instk)\n"; $out.=" span.appendChild(document.createTextNode(\"".TEXT_OUT_OF_STOCK_MESSAGE."\"));\n"; $out.=" else\n"; $out.=" span.appendChild(document.createTextNode(\" \"));\n"; $out.=" }\n"; //initialize out of stock message $out.=" stkmsg(document.cart_quantity);\n"; } if ($this->no_add_out_of_stock == 'True') { // js to not allow add to cart if selection is out of stock $out.=" function chksel() {\n"; $out.=" var instk=chkstk(document.cart_quantity);\n"; $out.=" if (!instk) alert('".TEXT_OUT_OF_STOCK_MESSAGE."');\n"; $out.=" return instk;\n"; $out.=" }\n"; $out.=" document.cart_quantity.onsubmit=chksel;\n"; } $out.="//--></SCRIPT>\n"; } $out.="</td></tr>\n"; return $out; } } ?>
×