Skip to content

Instantly share code, notes, and snippets.

@ceckoslab
Created January 23, 2013 13:27
Show Gist options
  • Select an option

  • Save ceckoslab/4605577 to your computer and use it in GitHub Desktop.

Select an option

Save ceckoslab/4605577 to your computer and use it in GitHub Desktop.
A tool, that copied all Product ( name, description and short_description ) from Engslish to Trukish store view
<?php
require_once('app/Mage.php'); //Path to Magento
umask(0);
Mage::app();
$englishStoreViewId = 4;
$turkishStoreViewId = 6;
ini_set('display_errors', 1);
$attributes = array('description', 'short_description', 'name');
$allProductIds = Mage::getModel('catalog/product')->getCollection()->getAllIds();
foreach($allProductIds as $productId) {
$fromProduct = Mage::getModel('catalog/product')
->setStoreId($englishStoreViewId)
->load($productId);
$toProduct = Mage::getModel('catalog/product')
->setStoreId($turkishStoreViewId)
->load($productId);
foreach($attributes as $attribute) {
$toProduct->setData($attribute, $fromProduct->getData($attribute));
$toProduct->getResource()->saveAttribute($toProduct, $attribute);
}
}
echo 'Ta da';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment