Jump to content

Edit category Friendly URLs directly from the DB


Recommended Posts

Hi there,

 

I have batch-edited friendly URLs of almost all categories on my store. I have a CSV file containing 2 columns:

 

Column A: Category ID

Column B: Desired Friendly URL

 

I've written a script that, using that CSV file, sets the desired friendly URL for each category on the table "ps_category_lang" (I have just 1 language, if it helps). I've run that script and friendly URLs were modified as expected on the database.

 

Here comes the problem. Now, when I try to access to a modified category, I get the following message from my browser:

 

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

 

Similar error message with Chrome. The thing is that, when I go to a modified category in my admin panel, friendly URL seems to be correct. And the strangest part is that, if I click "Save" on that category WITHOUT MODIFYING ANYTHING AT ALL, the category becomes available.

 

I strongly refuse to do this with all modified categories, as there are LOTS of them.

 

So, my question is: is there any other table (related with friendly URL) in the database further than "ps_category_lang" that gets modified when I click "Save" on a category?

 

Everything points that the answer to that question is affirmative, so, does anybody know which table else is modified?

 

Thanks in advance.

Link to comment
Share on other sites

What did you changed ? If you change a URL-structure than you never should this direct on database. Prestashop writes several dependencies in form from ID's if you change direct into database you will destroy this dependencies.

 

What exactly you changed by importing your csv. Name a model old URL and new URL please.

Link to comment
Share on other sites

I just changed link_rewrite column of ps_category_lang. I didn't change the URL-structure as I want it to remain unchanged: {id}-{link_rewrite}

 

Please notice I imported the CSV with a custom tool I've written myself, not using the PrestaShop's Import CSV tool.

 

Old model URL: www.mysite.com/XXXX-old-friendly-url

New model URL: www.mysite.com/XXXX-new-friendly-url

 

Being XXXX category ID.

Link to comment
Share on other sites

×
×
  • Create New...