Created
July 31, 2017 14:15
-
-
Save yireo/9b3d61763ecff96d7fbec16f9d942629 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Basic settings | |
$storeCodes = array('bork'); | |
$attributes = array('name', 'description'); | |
$categoryIds = array(); | |
// Initialize Magento | |
require_once 'app/Mage.php'; | |
Mage::app(); | |
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); | |
// Load the category-collection | |
$categoryCollection = Mage::getModel('catalog/category')->getCollection(); | |
if(!empty($categoryIds)) { | |
$categoryCollection->addAttributeToFilter('entity_id', array('in' => $categoryIds)); | |
} | |
// Loop through the category-collection | |
$totalChars = 0; | |
foreach($categoryCollection as $category) { | |
$categoryTranslator = Mage::getModel('googletranslate/category'); | |
$categoryTranslator->translate($category, $attributes, $storeCodes); | |
$totalChars = $totalChars = $categoryTranslator->getCharCount(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment