View Single Post
  #1  
Old 12-20-2008, 10:32 PM
  Gijs's Avatar 
Gijs Gijs is offline
 

eXpert
  
Join Date: Aug 2004
Location: Belgium
Posts: 295
 

Default A solution on how to make XC SEO - Basic Multi-lingual

Hi,

You can easily modify XC SEO to be put out correct multi-lingual html-files for categories, manufacturers and products
by adding a $variable to contain the shop's language and using the langauage versions of the sql-tables.



Edit outputfilter.seo.php as follows:

1) Create a language variable:

Put after:

Code:
if ( !defined('XCART_START') ) { header('Location: ../'); die('Access denied'); }

the following line:

Code:
$language_shop = $GLOBALS['store_language'];


2) Edit the section: # Generate filename for a category page

Change:

Code:
function _category_filename($options) { global $sql_tbl; if (!$options['result_title']) $options['result_title'] = func_query_first_cell('SELECT category FROM ' . $sql_tbl['categories'] . ' WHERE categoryid="' . $options['cat'] . '"');
To:

Code:
function _category_filename($options) { global $sql_tbl, $language_shop; if (!$options['result_title']) $options['result_title'] = func_query_first_cell('SELECT category FROM ' . $sql_tbl['categories_lng'] . ' WHERE categoryid="' . $options['cat'] . '" AND code="' . $language_shop .'"');

3) Edit the section: # Generate filename for a manufacturers page

Change:

Code:
function _manufacturer_filename($options) { global $sql_tbl; if (!$options['result_title']) $options['result_title'] = func_query_first_cell('SELECT manufacturer FROM ' . $sql_tbl['manufacturers'] . ' WHERE manufacturerid="' . $options['manufacturerid'] . '"');


To:

Code:
function _manufacturer_filename($options) { global $sql_tbl, $language_shop; if (!$options['result_title']) $options['result_title'] = func_query_first_cell('SELECT manufacturer FROM ' . $sql_tbl['manufacturers_lng'] . ' WHERE manufacturerid="' . $options['manufacturerid'] . '" AND code="' . $language_shop .'"');

4) Edit the section: # Generate filename for a product page

Change:
Code:
function _product_filename($options) { global $sql_tbl; if (!$options['result_title']) $options['result_title'] = func_query_first_cell('SELECT product FROM ' . $sql_tbl['products'] . ' WHERE productid = "' . $options['productid'] . '"');

To:

Code:
function _product_filename($options) { global $sql_tbl, $language_shop; if (!$options['result_title']) $options['result_title'] = func_query_first_cell('SELECT product FROM ' . $sql_tbl['products_lng'] . ' WHERE productid = "' . $options['productid'] . '" AND code="' . $language_shop .'"');


Note:
Works fine in x-cart 4.1.11 with XC SEO Basic.
Possibly, it should work with the other version of XC SEO (Pro, ...)

My 2 cents,

Gijs
__________________
X-cart 4.1.11
PHP 5 MySQL 5
www.wheelpalace.eu
Reply With Quote