【发布时间】:2012-03-07 00:01:48
【问题描述】:
假设我有一个 store=3 的 price 属性值和另一个 store=1 的值,我如何使用 magento 模型从 store_id=3 和 attribute_id=69 的 catalog_product_entity_decimal 中删除?
【问题讨论】:
标签: magento
假设我有一个 store=3 的 price 属性值和另一个 store=1 的值,我如何使用 magento 模型从 store_id=3 和 attribute_id=69 的 catalog_product_entity_decimal 中删除?
【问题讨论】:
标签: magento
这样的?
// 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();
这将以编程方式摆脱它。
另一种选择是这样做:
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
【讨论】:
<?php
$product->setStoreId($storeId)->load($id);
$product->setAttributeCode(false);
$product->save();
此代码将从商店 $storeId 中删除属性 attribute_code 的值。
【讨论】: