Jump to content

PS8.1.6 Product Link URL incorrect ??


Recommended Posts

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.

 

product-link-Screenshot 2025-07-10 174048.png

Link to comment
Share on other sites

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 by ps8modules (see edit history)
Link to comment
Share on other sites

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

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 by ps8modules (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...