Jump to content

Lost sub-categories after changing name in multistore


Recommended Posts

Hello,

 

I wanted to change the shop-id which still showed the old name I used to start the shop.

I found that when I switched ON multistore, that at advanced settings I could change the old name of the shop to the current name.

 

i did that and then clicked save, and then in settings I switched OFF multistore.

 

Then I found out that all my subcategories where missing in the front-end, they are still in the database but I can't reach them.

 

Apparently I did not associate all the categories when I saved the settings in multistore (they where not all checked only the main categories)

 

Is there a way to RE-associate them?

 

I did go back, switched on multistore and then tried to associate, but there I can now only see these same categories and not the subcategories. There must be a way????

 

 

Please help (we have about 250 (sub)categories so changing them by hand in de database is not an option.

Links to subcategories don't work as well and give 404

https://eenhoorn.eu/nl/cadeaus/gelegenheid/vaderdag/

Share this post


Link to post
Share on other sites
  • 2 months later...

Hello, I was in the same situation yesterday --- went to change shop name for one of multistore shops and did not pay attention to categories at all. So, as later I found out, in shop there were left only main categories, with no sub-categories. This definitely have to be fixed in prestashop - should the name update not touch categories, or they should be selected, when doing name editing.

 

I fixed back categories with query in phpMyAdmin (I only had categories in shop with ID 1 - this will add all categories to shop with ID 1, if they are not there already):

INSERT INTO `ps_category_shop` ( `id_category` , `id_shop` , `position` )
SELECT id_category, 1, 0
FROM `ps_category`
WHERE id_category NOT
IN (
SELECT id_category
FROM `ps_category_shop`
)

Edited by Artx (see edit history)

Share this post


Link to post
Share on other sites
  • 3 years later...
On 9/9/2016 at 11:16 PM, Artx said:

Hello, I was in the same situation yesterday --- went to change shop name for one of multistore shops and did not pay attention to categories at all. So, as later I found out, in shop there were left only main categories, with no sub-categories. This definitely have to be fixed in prestashop - should the name update not touch categories, or they should be selected, when doing name editing.

 

I fixed back categories with query in phpMyAdmin (I only had categories in shop with ID 1 - this will add all categories to shop with ID 1, if they are not there already):


INSERT INTO `ps_category_shop` ( `id_category` , `id_shop` , `position` )
SELECT id_category, 1, 0
FROM `ps_category`
WHERE id_category NOT
IN (
SELECT id_category
FROM `ps_category_shop`
)

Hello, could you explain which table should edit?

I have the same problem on Prestashop 1.7.5.0

Share this post


Link to post
Share on other sites
  • 4 months later...

Hello

so i noticed a typo in one of my categories, I have changed it in sql as everytime I changed it in the backoffice it didnt appear to want to save.

after searching the entire database for the typo and changing it the backoffice was showing the correct spelling... front end however was still showing incorrect thinking it might be cache deleted cache and found the problem was still on the front end.

I then disabled all cache and the problem on front end has now gone! but as soon as i renabled cache the typo re appears.

Manually checked cache on server and gone incognito to see if was local cache... running out of ideas!

Share this post


Link to post
Share on other sites
  • 5 months later...

insert into ps_category_shop
SELECT a.`id_category`,bb.id_shop,0
FROM `ps_category` as a
left join ps_category_shop aa on a.`id_category`=aa.`id_category`
left join ps_category as b on a.`id_parent`=b.`id_category`
left join ps_category_shop bb on b.`id_category`=bb.`id_category`
where a.id_parent>2 and aa.id_shop is null

This will restore subcategories for all shops where main categories are used and have no subcategory assigned to a shop.

Share this post


Link to post
Share on other sites
  • 4 months later...

We use your code and works Perfect! 

But only with subcategories of the first level, we have got second and third levels that did not regenerate.

Do you know how we can expand this regeneration of asociation?

Thank you very much!

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More