Jump to content

Enabling friendly urls shows correct product, but url shows different product in my site


Recommended Posts

http://alvinjiang.bl...duplicated.html

I found this, but it seems like a ton of work for 1000's of products...any way to do this via script?

 

Yes, I did this to help one of my customers a time ago. This is what I used:

 

$sql = "SELECT pl.`id_product`, pl.`name`, pl.`id_lang` FROM `"._DB_PREFIX_."product_lang` pl";
$res = Db::getInstance()->ExecuteS($sql);
foreach ($res as $p) {
$sql = "UPDATE `"._DB_PREFIX_."product_lang` SET `link_rewrite` = '".Tools::link_rewrite($p['name'])."'
  WHERE `id_product` = '{$p['id_product']}' AND `id_lang` = '{$p['id_lang']}'";
Db::getInstance()->Execute($sql);
}

 

Please make sure to backup your database before running the script.

Edited by Bazze (see edit history)
  • Like 1
Link to comment
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...