Latest News: (loading..)
Search the Community
Showing results for tags 'qtpro stock table'.
Found 1 result
I've been trying to find an answer to this for some time. The QTPro add on has a stock table. This is in the file modules/qtpro_stock_table.php It appears to be ordering it by the table PRODUCTS_STOCK and the field products_stock_attributes. Adding different Order by to the other queries doesn't seem to change anything. The problem with the products_stock_attributes field in the table PRODUCTS_STOCK is that it is a varchar field and so sorts lexically. So for example I am getting soirting results that show: 1000 before 53 In addition the field has 2 hyphens and a comma. So I tried on the query a very complicated Order by to first separate the 2 bits of info in the products_stock_attributes field and order them separately (1st in my shop is colour, 2nd is size), then the Cast as Signed integer to order: // Get the stocklevels $products_stock_query=tep_db_query("SELECT products_stock_attributes, products_stock_quantity FROM " . TABLE_PRODUCTS_STOCK . " WHERE products_id=" . (int)$HTTP_GET_VARS['products_id'] ." ORDER BY SUBSTR(products_stock_attributes,INSTR(products_stock_attributes,'-')+1) ASC, SUBSTR(products_stock_attributes,INSTR(products_stock_attributes,',')+3) ASC, CAST(products_stock_attributes as SIGNED INTEGER) ASC"); It doesn't work. Cast as signed integer still leaves i.e. 1000 before 200 Any ideas QTPro experts out there? Has anyone else tried to get the QTPro table sorting correctly? I have the picklist in the right oder in pad_base. many thanks