View Single Post
  #3  
Old 04-09-2015, 05:22 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Clean URLs after upgrade

Hello @ant99,

1) Here is an external script that can generate SEO-friendly urls for your products and categories:
PHP Code:
<?php

include_once('top.inc.php');

foreach(\
XLite\Core\Database::getRepo('\XLite\Model\Category')->findAll() as $category) {
    
$category->setCleanURL(\XLite\Core\Database::getRepo('\XLite\Model\Category')->generateCleanURL());
    \
XLite\Core\Database::getEM()->flush();
}

foreach(\
XLite\Core\Database::getRepo('\XLite\Model\Product')->findAll() as $product) {
    
$product->setCleanURL(\XLite\Core\Database::getRepo('\XLite\Model\Product')
 ->
generateCleanURL());
    \
XLite\Core\Database::getEM()->flush();
}

Of course, make a backup of your DB before running it.

2) There is no way of importing SEO-friendly urls, but you can put the history of them directly to the xc_clean_urls table. The value with highest ID is used as actual SEO-friendly url. The record with the same product_id, but lesser ID will be assumed as a history url.

Hopefully, it will help.

Tony
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote