更改Magento产品';属性集。

更改Magento产品';属性集。,magento,magento-1.7,magmi,Magento,Magento 1.7,Magmi,我想更改Magento的属性集。我搜索了一遍,每个人都建议删除该产品,并使用新的属性集重新导入它 我也这么做了,但是在导入数据后,我看不到产品评论和与产品相关的博客文章 有人能告诉我,在重新导入具有新属性集的产品后,是否可以获得产品评论和相关博客帖子。一旦删除产品,就无法获得旧评论 您不需要删除该产品。可以通过编辑和使用更改属性集。 另一种方法是创建新的属性集并创建新产品。一旦设置,您就不能更改产品的属性集。但是可以使用此模块,这样您就不必重新导入数据 我用于更改属性集 我以前有你上面推荐的分机

我想更改Magento的属性集。我搜索了一遍,每个人都建议删除该产品,并使用新的属性集重新导入它

我也这么做了,但是在导入数据后,我看不到产品评论和与产品相关的博客文章


有人能告诉我,在重新导入具有新属性集的产品后,是否可以获得产品评论和相关博客帖子。

一旦删除产品,就无法获得旧评论

您不需要删除该产品。可以通过编辑和使用更改属性集。
另一种方法是创建新的属性集并创建新产品。

一旦设置,您就不能更改产品的属性集。但是可以使用此模块,这样您就不必重新导入数据

我用于更改属性集


我以前有你上面推荐的分机,很酷。但是前者有更多的功能。

它做起来很精细,有点凌乱:

  • 确保设置了新的属性集
  • 导出要更改的产品
  • 删除您正在网站上更改的产品
  • 更改已下载文件上的属性集
  • 再次导入已更改的文件
  • 打开每个更改的产品,设置其属性值,然后保存

或者像我所做的那样,从Amasty安装这个很棒的扩展—它使更改变得轻而易举,并提供了更多节省时间和增强选项。

也可以直接在数据库中更改属性集

  • 在表
    eav\u attribute\u set
  • 更改
    目录\产品\实体中的属性集ID

当然,以这种方式更改数据时要小心。

是。我们可以通过编程更改产品属性集。 我更喜欢在目录产品网格中创建massaction,以多选产品,然后为产品选择massaction

public function changeattributesetAction()
{
    $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()->addException($e, $e->getMessage());
            }
    }
    $this->_redirect('adminhtml/catalog_product/index/', array());
}
在grid.php中创建massaction

$sets = Mage::getResourceModel('eav/entity_attribute_set_collection')
                ->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())
                ->load()
                ->toOptionHash();

$this->getMassactionBlock()->addItem('changeattributeset', array(
                'label'=> Mage::helper('catalog')->__('Change attribute set'),
                'url'  => $block->getUrl('*/*/changeattributeset', array('_current'=>true)),
                'additional' => array(
                    'visibility' => array(
                        'name' => 'attribute_set',
                        'type' => 'select',
                        'class' => 'required-entry',
                        'label' => Mage::helper('catalog')->__('Attribute Set'),
                        'values' => $sets
                    )
                )
            )); 
为所选产品的更改属性集创建控制器操作

public function changeattributesetAction()
{
    $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()->addException($e, $e->getMessage());
            }
    }
    $this->_redirect('adminhtml/catalog_product/index/', array());
}

流动对这方面的影响是什么?是否必须在EAV属性表中更改ID,例如也引用它的varchar?更新
catalog\u product\u entity
SET
attribute\u SET\u ID
='9',其中
catalog\u product\u entity
entity\u ID=15,14;当我添加多个its not update.shouldnt=replace in(15,14)omg magento时,对于单个id,这段代码中的错误是什么。你已经存在了多少年了,但你仍然把这样的东西弄得如此笨重