limon213 Posted November 1, 2016 Share Posted November 1, 2016 Hello, I want to display all product list in one page. How do I do it? Or Is there any module for this? Thanks Link to comment Share on other sites More sharing options...
rocky Posted November 2, 2016 Share Posted November 2, 2016 You could create a category called "All products" and associate every product to that category. Link to comment Share on other sites More sharing options...
limon213 Posted November 2, 2016 Author Share Posted November 2, 2016 (edited) Hello, I want to display all product list in one page. How do I do it? Or Is there any module for this? Thanks Hello, Your Idea is nice. But I have 126 product It will be too tough to assign each product manually to all product category. Is there any alternative way? If I create a page and query all product there? Any more solution? Thanks Edited November 2, 2016 by limon213 (see edit history) Link to comment Share on other sites More sharing options...
musicmaster Posted November 2, 2016 Share Posted November 2, 2016 Actually using Prestools it is very easy. And prestools is free. Link to comment Share on other sites More sharing options...
rocky Posted November 3, 2016 Share Posted November 3, 2016 That will work and will probably more user-friendly than an SQL query, but I'll write it here just in case anyone needs it. You can run an SQL query like the following in phpMyAdmin: INSERT INTO `ps_category_product` (`id_category`, `id_product`) SELECT 123, `id_product` FROM `ps_product`; SELECT @i:=-1; UPDATE `ps_category_product` SET `position` = @i:=@i+1 WHERE `id_category` = 123; Change ps_ to your database prefix if it is different and 123 to the ID of the "All Products" category you created. This will add all the products to the "All Products" category and then give them all appropriate positions. Note that this query relies on the "All Products" category having no products associated with it. You can use a query like the following to delete existing associations before running the above if needed: DELETE FROM `ps_category_product` WHERE `id_category` = 123 Change ps_ to your database prefix if it is different and 123 to the ID of the "All Products" category you created. 1 Link to comment Share on other sites More sharing options...
limon213 Posted November 5, 2016 Author Share Posted November 5, 2016 (edited) That will work and will probably more user-friendly than an SQL query, but I'll write it here just in case anyone needs it. You can run an SQL query like the following in phpMyAdmin: INSERT INTO `ps_category_product` (`id_category`, `id_product`) SELECT 123, `id_product` FROM `ps_product`; SELECT @i:=-1; UPDATE `ps_category_product` SET `position` = @i:=@i+1 WHERE `id_category` = 123; Change ps_ to your database prefix if it is different and 123 to the ID of the "All Products" category you created. This will add all the products to the "All Products" category and then give them all appropriate positions. Note that this query relies on the "All Products" category having no products associated with it. You can use a query like the following to delete existing associations before running the above if needed: DELETE FROM `ps_category_product` WHERE `id_category` = 123 Change ps_ to your database prefix if it is different and 123 to the ID of the "All Products" category you created. Thank you very much. It saves my lot of time Edited November 5, 2016 by limon213 (see edit history) Link to comment Share on other sites More sharing options...
spc Posted January 17, 2018 Share Posted January 17, 2018 (edited) hello Nice script. I test it in my phpmyadmin, i add a new category id 158 name " all products ". I add it to the mysql: INSERT INTO `ps_category_product` (`id_category`, `id_product`) SELECT 158, `id_product` FROM `ps_product`; SELECT @i:=-1; UPDATE `ps_category_product` SET `position` = @i:=@i+1 WHERE `id_category` = 158; All i get is error Can some one help me, i have over 1200 products, and i don´t whant to take one by one. P.S i fix it myself, i asign a product to the category, and then i add the mysql code to phpmyadmin, and all works Thanks... Edited January 17, 2018 by spc (see edit history) 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