gray Posted July 10 Share Posted July 10 PS8.1.6 Product Link URL incorrect ?? Never noticed this before, but the product link displays a different URL. Maybe cured in newer releases, but I do not intend to upgrade just yet. Any ideas on how and why, Not gone into MySQL yet. Link to comment Share on other sites More sharing options...
gray Posted July 10 Author Share Posted July 10 Sorry, the product ID is correct. The URL should display 333-medlar-Armenian, etc, and not 333-medlar-vannes, etc. Link to comment Share on other sites More sharing options...
Nickz Posted July 10 Share Posted July 10 (edited) It might be a rewrite URL so that 333-medlar-Armenian,ends up in 333-medlar-vannes. Edited July 10 by Nickz (see edit history) Link to comment Share on other sites More sharing options...
ps8modules Posted July 10 Share Posted July 10 (edited) Hi. This happens, for example, when duplicating a product. You can reset the URL in the product details in the administration, on the SEO tab. I would probably find my module somewhere, which I wrote for Prestashop 1.6. It could be easily modified for Prestashop versions 1.7, 8.x and 9.x. When the module is started, it checks the SEO URLs stored in the database and uses the Prestashop function for generating SEO URLs. If they are different, it displays them in a table. Then you just need to click a button and change the URL. When using multiple languages, you always need to choose which one to look for the bad URL. Edited July 10 by ps8modules (see edit history) Link to comment Share on other sites More sharing options...
gray Posted July 11 Author Share Posted July 11 Darn it. You are correct. Its one of those PS things that has not been thought through. You should not have to go and push a button, this should be automatic. Yes a module to go through approx 1000 products to reset the URL would be of great help. To reduce the amount of time taken to go into every single product to possibly modify the friendly URL. Would there be an easier way directly in MySQL ?? Link to comment Share on other sites More sharing options...
ps8modules Posted July 11 Share Posted July 11 (edited) There is no command for MySQL. But I can give you a simple script that you can upload to the root of your e-shop and run. If you have at least some knowledge of PHP. Edited July 11 by ps8modules (see edit history) 1 Link to comment Share on other sites More sharing options...
ps8modules Posted July 11 Share Posted July 11 (edited) Attached is a file in the archive that you can simply upload to the root of the e-shop and call in the browser, for example https://my-domain.com/repair-products-url.php repair-products-url.zip <?php include('./config/config.inc.php'); include('./init.php'); $db = Db::getInstance(); $products = $db->executeS('SELECT a.id_products, a.id_lang, a.id_shop, a.link_rewrite, a.name FROM '._DB_PREFIX_.'product_lang a'); $log = ''; foreach($products as $p) { $toolsUrl = Tools::str2url($p['name']); $dbUrl = $p['link_rewrite']; if ($toolsUrl != $dbUrl) { $db->update( 'product_lang', array( 'link_rewrite' => $toolsUrl ), 'id_product = '.$p['id_product'].' AND id_lang = '.$p['id_lang'].' AND id_shop = '.$p['id_shop']; ); $log .= 'updated product: '.$p['id_product'].'<br>'; } } Edited July 11 by ps8modules (see edit history) 1 Link to comment Share on other sites More sharing options...
gray Posted July 14 Author Share Posted July 14 Many thanks for the great responses and code, all sorted now. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now