Jump to content

[HELP] Product display at parent category and subcategory


Recommended Posts

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

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
)
AS
BEGIN
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

  • 5 months later...

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 category


this work for me.

Link to comment
Share on other sites

×
×
  • Create New...