1. в файле: app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php
перед строкой:
$this->getMassactionBlock()->addItem('attributes', array(добавлял:
$sets = Mage::getResourceModel('eav/entity_attribute_set_collection')
->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())
->load()
->toOptionHash();
array_unshift($statuses, array('label'=>'', 'value'=>''));
$this->getMassactionBlock()->addItem('attribute_set', array(
'label'=> Mage::helper('catalog')->__('Change attribute set'),
'url' => $this->getUrl('*/*/massAttributeSet', array('_current'=>true)),
'additional' => array(
'visibility' => array(
'name' => 'attribute_set',
'type' => 'select',
'class' => 'required-entry',
'label' => Mage::helper('catalog')->__('Изменить набор атрибутов'),
'values' => $sets
)
)
));2. в файле: app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php
перед строкой:
protected function _isAllowed()
добавлял блок:
public function massAttributeSetAction()
{
$productIds = $this->getRequest()->getParam('product');
$storeId = (int)$this->getRequest()->getParam('store', 0);
if(!is_array($productIds)) {
$this->_getSession()->addError($this->__('Please select product(s)'));
} else {
try {
foreach ($productIds as $productId) {
$product = Mage::getSingleton('catalog/product')
->unsetData()
->setStoreId($storeId)
->load($productId)
->setAttributeSetId($this->getRequest()->getParam('attribute_set'))
->setIsMassupdate(true)
->save();
}
Mage::dispatchEvent('catalog_product_massupdate_after', array('products'=>$productIds));
$this->_getSession()->addSuccess(
$this->__('Total of %d record(s) were successfully updated', count($productIds))
);
} catch (Exception $e) {
$this->_getSession()->addError($e->getMessage());
}
}
$this->_redirect('*/*/', array('store'=>(int)$this->getRequest()->getParam('store', 0)));
}После изменения кода в magento commerce 1.4 появляется возможность смены набора атрибутов (attribute set) для уже добавленного товара.
Проверяем: в админ-панели заходим в главном меню затем “Catalog” – “Manage products” и в поле “Actions” должен появиться пункт “Изменить набор атрибутов“.
но в magento 1.5 этот вариант не работает. У кого-нибудь есть идеи на этот счет?

Вход
Регистрация
Помощь

