Salus Posted December 16, 2014 Share Posted December 16, 2014 (edited) Hello everyone. This may not be the right forum for this (let me know if its the case), but I desperately need some help in making an sql query and I dont know where else to go. I want a query made in myphpadmin, but I guess it would also work in prestashop. I wish I can make a selective query from tables ps_product, ps_product_lang and not sure about the third table, I think it is ps_product_attribute, and export iti in csv. I need to get every product quantity form products wich have attributes. I need fields like this: id_product from ps_product, reference from ps_product, product name from ps_product_lang, and here comes the part I dont know: all the attributes a product has. I try make an example how the table should look: Product ID Ref ID Product Name (lang 2) Attribute Attribute2 Attribute 3 Quantity1 1001 Product name no attribute 1002 1002 Product name 2 color-red size-32 model-zip 32 1002 Product name 2 color-red size-44 model-button 42 1002 Product name 2 color-blue size-36 model-zip 53 1003 Product name 3 blade type-curved no attribute no attribute 10 Problem is that attributes are always changing. Some products have only colors, some have color and size, some have shape and color, others again have no attributes. The important data I need here is quantities for each combination. After query is done, I need to modify quantity data and then UPLOAD back the data through phpmysql. Doing this manually is not an option since I have 1350 products, from wich 40-50% have multiple attributes. Can this be done? Can anyone help me? Or point me towards a solution? I am stucked with this for a week now and cant advance further in releasing our site. I tried doing it myself but I do not speak proper sql unfortunately, i dont know the proper commands and the syntax Thanks is advance, any help is wellcome. Edited December 16, 2014 by Salus (see edit history) Link to comment Share on other sites More sharing options...
tuk66 Posted December 16, 2014 Share Posted December 16, 2014 Look at getAttributesResume method in /classes/Product.php if it may help. Link to comment Share on other sites More sharing options...
Salus Posted December 16, 2014 Author Share Posted December 16, 2014 (edited) Uh,oh, yes, i found it, this definitely looks like a good hint, please gimme some time to process and comprehend what am I just seeng here... My php undestanding is also very low, specially concerning syntax, but I think I can grab something outta here. Thanks, tuk66 Edited December 16, 2014 by Salus (see edit history) Link to comment Share on other sites More sharing options...
Salus Posted December 16, 2014 Author Share Posted December 16, 2014 syntax error, syntax error over and over again.... Link to comment Share on other sites More sharing options...
imagetag Posted January 24, 2015 Share Posted January 24, 2015 Maybe you managed it yourself by the time, but if not, please post your code. In general, you need a product instance to call the function, calling it like Product::getAttributesResume won't work, because the function refers to $this->id_product. So you would have in call $product->new Product($id_product) first and afterwards $product->getAttributesResume($id_lang). Link to comment Share on other sites More sharing options...
A2Lux Posted December 29, 2015 Share Posted December 29, 2015 Hi, Have you found a solution? Thank you Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now