0

How to add categories programmatically was described here.

Now, I have two store views (English and German) under one store.

When having added a category in englisch how can I then add the data for the German store view, that is, the translation for the category name, urlkey etc.?

In the frontend user interface this is easy. You just need to usethe store view switcher. How can I do this programmatically?

0

Something like that:

$storeId = 2; // German Store ID
$categoryId = 2; // Category ID
$category = Mage::getModel('catalog/category')->load($categoryId); // Load Category
$category->setStoreId($storeId) // set Store View for which you will make changes.
->setCategoryName('German Category Name') // set category name for selected store view
->setUrlKey('url-key-in-deutsch'); // same for url key

$category->save(); // Save and done!

That's all.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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