Skip to main content
deleted 44 characters in body
Source Link

Is there away to programatically remove a store's product's attribute value without loading the whole product or using raw sql?

The slow way that works but takes to long:

Mage::getModel('catalog/product')
            ->setStoreId>load($storeId$productId)
            ->load>setStoreId($productId$storeId)
            ->setData($code , null)
            ->save();

I've seen:

Mage::getModel('catalog/product')
            ->addAttributeUpdate($code, null , $storeId); // works for updating and inserting

This however deletes the default store value as well. (possible bug ?)

Other examples I have seen are raw mysql delete queries.

Anyone have any other ideas ?

I though that this would be something native to Magento.

Any thoughts on this?

Is there away to programatically remove a store's product's attribute value without loading the whole product or raw sql

The slow way that works but takes to long:

Mage::getModel('catalog/product')
            ->setStoreId($storeId)
            ->load($productId)
            ->setData($code , null)
            ->save();

I've seen:

Mage::getModel('catalog/product')
            ->addAttributeUpdate($code, null , $storeId); // works for updating and inserting

This however deletes the default store value as well. (possible bug ?)

Other examples are raw mysql delete queries.

Anyone have any other ideas ?

I though that this would be something native to Magento.

Is there away to programatically remove a store's product's attribute value without loading the whole product or using raw sql?

The slow way that works:

Mage::getModel('catalog/product')
            ->load($productId)
            ->setStoreId($storeId)
            ->setData($code , null)
            ->save();

I've seen:

Mage::getModel('catalog/product')
            ->addAttributeUpdate($code, null , $storeId);

This however deletes the default value as well. (possible bug ?)

Other examples I have seen are raw mysql delete queries.

I though that this would be something native to Magento.

Any thoughts on this?

Source Link

Is there away to programatically remove a store's product's attribute value without loading the whole product or raw sql

The slow way that works but takes to long:

Mage::getModel('catalog/product')
            ->setStoreId($storeId)
            ->load($productId)
            ->setData($code , null)
            ->save();

I've seen:

Mage::getModel('catalog/product')
            ->addAttributeUpdate($code, null , $storeId); // works for updating and inserting

This however deletes the default store value as well. (possible bug ?)

Other examples are raw mysql delete queries.

Anyone have any other ideas ?

I though that this would be something native to Magento.