Array
(
    [err] => Duplicate entry '2018-09-26-1' for key 'PRIMARY'
    [sql] => 
                INSERT INTO shop_categories_flat (
                   `date`-- date
                  ,`cat_id`-- int
                  ,`parent_id`-- int
                  ,`type`-- enum('boutique','sale','dressing')
                  ,`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
                  ,`name_en`-- varchar
                  ,`name_fr`-- varchar
                  ,`name_de`-- varchar
                  ,`prod_desc_en`-- varchar
                  ,`prod_desc_fr`-- varchar
                  ,`prod_desc_de`-- varchar
                  ,`special_url`-- varchar
                )
                SELECT '2018-09-26'
                    ,actvCats.id `cat_id`
                    ,actvCats.parent_id
                    ,CASE WHEN substring_index(actvCats.fullPath , ',', 2) = '1,59' THEN 'sale'
                          WHEN substring_index(actvCats.fullPath , ',', 2) = '1,60' then 'dressing'
                          ELSE 'boutique' END AS `type`
                    ,actvCats.lvl
                    ,actvCats.ord
                    ,actvCats.fullPath
                    ,actvCats.start_date
                    ,actvCats.end_date
                    ,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`
                    ,MAX(IF(d.language_id = 40, if(parent_id<>59,d.name,substring_index(d.name,' - ',1)), NULL)) name_en
                    ,MAX(IF(d.language_id = 47, if(parent_id<>59,d.name,substring_index(d.name,' - ',1)), NULL)) name_fr
                    ,MAX(IF(d.language_id = 51, if(parent_id<>59,d.name,substring_index(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
                from (
                    # all sale categories and sub-categories
                    SELECT c.id, c.parent_id, c.tree_lvl lvl, c.ord, special_url,
                        concat(replace(c.tree_path,'/',','), ',', cast(c.id as char), ',') fullPath,
                        sales.start_date,
                        sales.end_date,
                        c.visible_in_zones,
                        c.deliv_delay
                    FROM shop_categories c
                        JOIN _4a43783f_sales sales ON concat(c.tree_path,'/',c.id,'/') LIKE replace(sales.catPathLike,',','/')
                UNION
                    # all boutique categories
                    SELECT c.id, c.parent_id, c.tree_lvl lvl, c.ord, special_url,
                        concat(replace(c.tree_path,'/',','), ',', cast(c.id as char), ','),
                        null,
                        null,
                        c.visible_in_zones,
                        c.deliv_delay
                    FROM shop_categories c
                    WHERE concat(c.tree_path,'/',c.id,'/') NOT LIKE '1/59/_%'
                ) actvCats
                    LEFT JOIN shop_category_descriptions d ON d.category_id = actvCats.id
                    # remove hidden categories - see having clause
                    LEFT JOIN _4a43783f_adjust_c adjust_c on actvCats.fullPath like adjust_c.catPathLike
                GROUP BY actvCats.id
                HAVING TRIM(BOTH ',' FROM visible_in_zones) > ''
                ORDER BY fullPath
            
)

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