1

i have a website with more than 30 store views of different languages. My task is to translate the URL keys of categories for different store views. I can translate URL keys manually but as i just said i have more than 30 store views so it will be more feasible for me to import categories URL keys through csv file. How can i achieve my task? Thank You

1 Answer 1

2

You can use Magento models, or you can use an import tool, for example FastSimpleImport which does the task much faster. You can use this code in any Magento script / model / controller:

$data = array(
    array(
        '_root' => 'RootCategoryName',
        '_category' => 'CategoryPath',
        'url_key' => 'urlkeydefault',
    ),
    array(
        '_store' => 'en',
        'url_key' => 'urlkeyen',
    ),
);

try {
    /** @var $import AvS_FastSimpleImport_Model_Import */
    $import = Mage::getModel('fastsimpleimport/import');
    $import->processCategoryImport($data);
} catch (Exception $e) {
    print_r($import->getErrorMessages());
}

Add more rows to the import with _storerepresenting the store code and url_key representing the url key (surprise!)

Of course you have to include the FastSimpleImport module into your installation for that. Please see http://avstudnitz.github.io/AvS_FastSimpleImport/categories.html for more details about category import, especially about the _root and _category parameters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.