2

say i have a value for the price attribute for store=3 and another for store=1, how do I DELETE from catalog_product_entity_decimal where store_id=3 and attribute_id=69 using magento models ?

similar to this question: Magento EAV: how to hard delete an attribute value?

Community
  • 1
  • 1
bqxbdead
  • 63
  • 3
  • 7

2 Answers2

0
<?php
$product->setStoreId($storeId)->load($id);
$product->setAttributeCode(false);
$product->save();

This code will remove value of attribute attribute_code from store $storeId.

kirtan
  • 43
  • 6
0

Something like this?

// get store 1
$this->setCurrentStore('codeforstore1'); 
$product->setData('price',null);
or
$product->setPrice(null);
$product->save();

// get store 2
$this->setCurrentStore('codeforstore2'); 
$product->setData('price',null);
or
$product->setPrice(null);
$product->save();

This will get rid of it programmatically.

Another option is to do something like this:

DELETE DATA
$id is the database table row id to be deleted.
// $id = $this->getRequest()->getParam('id');
$id = 13;
$model = Mage::getModel('catalog/resource_eav_attribute');
try {
        $model->setId($id)->delete();
        echo "Data deleted successfully."; 
    } catch (Exception $e){
        echo $e->getMessage();
}

HTH

ShaunOReilly
  • 2,186
  • 22
  • 34