Jump to content

[SOLVED]Prestashop 1.6 get feature value of products from specific category


Recommended Posts

I'm trying to get the value of a specific feature of a product that is from a specific category. the id_category_default is 13 (Processors ) and the id_feature is 6 (Power(W)

the output i'm looking for should be something like this:

  

    


<ProcessorName><ValueOfFeature>

Untill now i've tried this:

 

  

 

     


SELECT pl.name,fvl.value 
from ps_product_lang pl,ps_product p,ps_feature_value_lang fvl,ps_feature_value fv,ps_feature f,ps_feature_lang fl
where pl.id_product=p.id_product
and p.id_product in (SELECT id_product
        from ps_feature_product
        where id_feature in (select id_feature
      from ps_feature
      where id_feature = 6)
)
and pl.id_lang = 1
and pl.id_shop = 1
and p.id_shop_default=1
and p.id_category_default =13
and fvl.id_feature_value=fv.id_feature_value
and fv.id_feature=f.id_feature
and fvl.id_lang=1
and fl.id_feature =f.id_feature
and fl.id_lang=1
and f.id_feature=6

  The output is this:

  

  

 

      


<ProcessorName1><NameOfFeature><value 1 OfFeature>
      <ProcessorName1><NameOfFeature><value 2 OfFeature>
      <ProcessorName1><NameOfFeature><value 3 OfFeature>
      <ProcessorName1><NameOfFeature><value 4 OfFeature>
      
      <ProcessorName2><NameOfFeature><value 1 OfFeature>
      <ProcessorName2><NameOfFeature><value 2 OfFeature>
      <ProcessorName2><NameOfFeature><value 3 OfFeature>
      <ProcessorName2><NameOfFeature><value 4 OfFeature>
      
      <ProcessorName3><NameOfFeature><value 1 OfFeature>
       etc
      <ProcessorName4><NameOfFeature><value 1 OfFeature>
       etc

 

  what i need is to get the feature that has id_feature=6 value for the specific product :

   

 

  

 

     


<processorName1><valueOfFeature>
       <processorName2><valueOfFeature>
       <processorName3><valueOfFeature>
       <processorName4><valueOfFeature>

 

  Any help would be greatly appreciated!

 

 

Edit:solved i had to look in the database schemma more and managed to write the correct sql querry

Edited by Fuel4mind (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...