Array
(
    [err] => Duplicate entry '2021-12-03-1,' for key 'path'
    [sql] => INSERT INTO shop_categories_flat (
                   `date`-- date
                  ,`cat_id`-- int
                  ,`parent_id`-- int
                  ,`rootcat_id` -- int
                  ,`type`-- enum('boutique','sale','dressing','cellar')
                  ,`tree_lvl` -- tinyint
                  ,`ord`-- smallint
                  ,`path`-- varchar
                  ,`start_date`-- date
                  ,`end_date`-- date
                  ,`visible_in_zones`-- set('ch','eu')
                  ,`deliv_delay`-- tinyint
                  ,`eu_adjust_price_mpb`-- tinyint
                  ,`eu_adjust_price_retail`-- tinyint
                  ,`shipping`-- enum('free','not free')
                  ,`no1Warn`-- tinyint
                  ,`product_orderby_tpl`-- varchar
                  ,`name_en`-- varchar
                  ,`name_fr`-- varchar
                  ,`name_de`-- varchar
                  ,`prod_desc_en`-- varchar
                  ,`prod_desc_fr`-- varchar
                  ,`prod_desc_de`-- varchar
                  ,`special_url`-- varchar
                  ,`sticky_ps_position`-- varchar
                )
                SELECT '2021-12-03'
                    ,actvCats.id `cat_id`
                    ,actvCats.parent_id
                    ,IF(actvCats.lvl_1_cat IN(59, 60, 62),
                        actvCats.lvl_2_cat,
                        actvCats.lvl_1_cat) AS rootcat_id
                    ,CASE WHEN actvCats.lvl_1_cat = '59' THEN 'sale'
                          WHEN actvCats.lvl_1_cat = '60' THEN 'dressing'
                          WHEN actvCats.lvl_1_cat = '62' THEN 'cellar'
                          ELSE 'boutique' END AS `type`
                    ,actvCats.lvl
                    ,actvCats.ord
                    ,concat('1,',actvCats.tree_pth)
                    ,actvCats.start_date
                    ,actvCats.end_date
                    ,replace(trim(
                        concat(if(isnull(group_concat(cast(adjust_c.hidden_ch as char))),'ch',''), ' ',
                            if(isnull(group_concat(cast(adjust_c.hidden_eu as char))),'eu',''))
                    ),' ', ',') as `visible_in_zones`
                    ,substring_index(group_concat(cast(adjust_c.deliv_delay as char) order by adjust_c.lvl desc), ',', 1) `deliv_delay`
                    ,substring_index(group_concat(cast(adjust_c.eu_adjust_price_mpb as char) order by adjust_c.lvl desc), ',', 1) `eu_adjust_price_mpb`
                    ,substring_index(group_concat(cast(adjust_c.eu_adjust_price_retail as char) order by adjust_c.lvl desc), ',', 1) `eu_adjust_price_retail`
                    ,substring_index(group_concat(adjust_c.shipping order by adjust_c.lvl desc), ',', 1) `shipping`
                    ,substring_index(group_concat(adjust_c.no1Warn order by adjust_c.lvl desc), ',', 1) `no1Warn`
                    ,substring_index(group_concat(adjust_c.product_orderby_tpl order by adjust_c.lvl desc separator '§'), '§', 1) `product_orderby_tpl`
                    ,MAX(IF(d.language_id = 40, if(parent_id<>59,d.name,regexp_replace(d.name, '(.*) - .*', '\\1')), NULL)) name_en
                    ,MAX(IF(d.language_id = 47, if(parent_id<>59,d.name,regexp_replace(d.name, '(.*) - .*', '\\1')), NULL)) name_fr
                    ,MAX(IF(d.language_id = 51, if(parent_id<>59,d.name,regexp_replace(d.name, '(.*) - .*', '\\1')), NULL)) name_de
                    ,substring_index(group_concat(adjust_c.desc_en order by adjust_c.lvl desc separator '§'), '§', 1) prod_desc_en
                    ,substring_index(group_concat(adjust_c.desc_fr order by adjust_c.lvl desc separator '§'), '§', 1) prod_desc_fr
                    ,substring_index(group_concat(adjust_c.desc_de order by adjust_c.lvl desc separator '§'), '§', 1) prod_desc_de
                    ,actvCats.special_url
                    ,actvCats.sticky_ps_position
                from (
                    # all sale categories and sub-categories
                    SELECT c.id, c.parent_id, c.tree_lvl lvl, c.ord, special_url
                        ,NULLIF(substring_index(c.tree_pth,',',1), '') lvl_1_cat
                        ,NULLIF(substring_index(substring_index(c.tree_pth,',',2),',',-1), '') lvl_2_cat
                        ,c.tree_pth
                        ,sales.start_date
                        ,sales.end_date
                        ,c.visible_in_zones
                        ,c.deliv_delay
                        ,c.sticky_ps_position
                    FROM shop_categories c
                        JOIN _tmpFlatCats_ff99a1c4_sales sales ON c.tree_pth LIKE sales.catPathLike
                UNION
                    # all boutique categories
                    SELECT c.id, c.parent_id, c.tree_lvl lvl, c.ord, special_url
                        ,NULLIF(substring_index(c.tree_pth,',',1), '') lvl_1_cat
                        ,NULLIF(substring_index(substring_index(c.tree_pth,',',2),',',-1), '') lvl_2_cat
                        ,c.tree_pth
                        ,null
                        ,null
                        ,c.visible_in_zones
                        ,c.deliv_delay
                        ,0 -- sticky
                    FROM shop_categories c
                    WHERE c.tree_pth NOT LIKE '59,_%'
                ) actvCats
                    LEFT JOIN shop_category_descriptions d ON d.category_id = actvCats.id
                    # remove hidden categories - see having clause
                    LEFT JOIN _tmpFlatCats_ff99a1c4_adjust_c adjust_c on actvCats.tree_pth like adjust_c.catPathLike
                GROUP BY actvCats.id
                HAVING TRIM(BOTH ',' FROM visible_in_zones) > ''
                ORDER BY tree_pth
            
)

/var/www/myprivateboutique.ch/httpdocs/classes/Shop/Catalogue/Model/FlatCats.php:93