Jump to content

Edit History

ps8modules

ps8modules

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>';
        }
    }

 

ps8modules

ps8modules

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

<?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>';
        }
    }

repair-products-url.zip

×
×
  • Create New...