Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

A little help with SQL querry


Recommended Posts

Hi all

please give me a hand with this querry:


tep_db_query('select pv.products_options_values_id as id, pv.products_options_values_name as text from ('. TABLE_PRODUCTS_OPTIONS_VALUES . ' pv, '. TABLE_PRODUCTS_OPTIONS .' po) join ' . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . ' popv on (pv.products_options_values_id = popv.products_options_values_id) where popv.products_options_id = po.products_options_id and popv.products_options_id =' . $attributes['products_options_id'] . ' and po.language_id ='. (int)$languages_id . ' group by pv.products_options_values_id, products_options_values_name');


what it does now, is get all products' options' values and populate the drop-downs for search:

see it in header here:


now it shows all values that exist for given option, e.g. all shoe sizes.


I'd like to modify that so it only shows available values for each option, based on what products are available, e.g. if there are only shoes sizes 35,36,37 only these values to be in the drop-down.


I know it is simple but I am not good in SQL.

OSC beginner

Link to comment
Share on other sites

Look in the contributions for qtpro. It might be more of what you want.

thanks, bit this is not what I need

I use search by options in the advanced search. I have 3 options and they are populated with ALL the option values, e.g. in option 1 field we have 30 values, say from 1 to 30.

In my store the items which have option 1 will have a very narrow set of option values, say 1,2,3,4,9,10,11,15,23,27. So insetead of pupulation the option value with 30 options I want to populate it with only options that ARE REALLY available for my products.

The sql querry above does this for ALL options.

P.S. the reason for having way more option values than actually products with these values comes from the automated way of populating my store, so it has to stay.

Help appreciated.

OSC beginner

Link to comment
Share on other sites

Please someone help me.



Nobody will do it for you, doesn't matter how much you bump your posts permanently.


Maybe you try to help your self to learn sql and after that post the results here ?

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...