IVANH83 Posted February 20, 2010 Share Posted February 20, 2010 Hello! I have a problem related to products and categories. I have entered 3250 products sorted into subcategories. Now I would like to have the same products to display in parent categories. I know that it is possible to make edit on each product manually or enter additional records in the table (category_product) but i dont want to burden the base and individually edit each product is impossible. Now I would like to have the same product to be displayed in it's own category and all paretn categories also i.e. the products for one category to be displayed are from that one and all child categories.Pls. if anyone knows how I can make this mass product distribution and "one" product to be visible in several categories.Tnx in advance Link to comment Share on other sites More sharing options...
uddhava Posted February 21, 2010 Share Posted February 21, 2010 is this not possible during the import tool ? Link to comment Share on other sites More sharing options...
IVANH83 Posted February 22, 2010 Author Share Posted February 22, 2010 Yes i tink but i was importing 3250 products directli into DB and i know how to directly solve this problem but i wuld like to have code that solving this problem from php. Does anyone knows how to modify this for php?ALTER FUNCTION [dbo].[GetOJChildren] ( -- Add the parameters for the function here @OJID int)RETURNS @Table TABLE ( OJID int, Naziv varchar(110), ParentID int, HasChildren int)ASBEGIN insert into @Table select OJID, isnull(Sifra + ' ', '') + Naziv, ParentID, (select count(*) from [dbo].[GetOJChildren](OJID)) from OrganizacijskeJedinice where isnull(ParentID, 0) = isnull(@OJID, 0) and Aktivno = 1 RETURN END Link to comment Share on other sites More sharing options...
Victoriano Posted August 4, 2010 Share Posted August 4, 2010 try generate scripts of inserts with a script as this: SELECT CONCAT("INSERT INTO ps_category_product(id_product,id_category,position) values (" , `pro`.`id_product` , "," , (SELECT `cat`.`id_parent` FROM `ps_category` cat where `cat`.`id_category` = `pro`.`id_category`) , ", 0)") FROM `ps_category_product` pro WHERE `pro`.`id_category` NOT IN ( 1,2, 6, 7, 8, 9 ) order by `pro`.`id_product` LIMIT 0 , 500 The NOT IN ( 1,2, 6, 7, 8, 9 ) is the list of parent categorythis work for me. Link to comment Share on other sites More sharing options...
Recommended Posts