I'm getting the following error:
[15-Apr-2018 04:10:22 UTC] PHP Fatal error: Uncaught TypeError: Argument 3 passed to Mage_Catalog_Model_Resource_Abstract::_canUpdateAttribute() must be of the type array, null given, called in /home/xxxx/public_html/app/code/core/Mage/Eav/Model/Entity/Abstract.php on line 836 and defined in /home/xxxx/public_html/app/code/core/Mage/Catalog/Model/Resource/Abstract.php:368
Stack trace:
#0 /home/xxxx/public_html/app/code/core/Mage/Eav/Model/Entity/Abstract.php(836): Mage_Catalog_Model_Resource_Abstract->_canUpdateAttribute(Object(Mage_Catalog_Model_Resource_Eav_Attribute), '1', NULL)
#1 /home/xxxx/public_html/app/code/core/Mage/Eav/Model/Entity/Abstract.php(763): Mage_Eav_Model_Entity_Abstract->_collectSaveData(Object(Mage_Catalog_Model_Product))
#2 /home/xxxx/public_html/app/code/core/Mage/Core/Model/Abstract.php(180): Mage_Eav_Model_Entity_Abstract->save(Object(Mage_Catalog_Model_Product))
#3 /home/xxxx/public_html/app/code/community/Webinse/DailyDeals/Model/Observer.php(261): Mage in /home/xxxx/public_html/app/code/core/Mage/Catalog/Model/Resource/Abstract.php on line 368
Here is core/Mage/Eav/Model/Entity/Abstract.php(836)
foreach ($newData as $k => $v) {
if (is_numeric($k) || is_array($v)) {
continue;
}
if (!in_array($k, $staticFields) && !in_array($k, $attributeCodes)) {
continue;
}
$attribute = $this->getAttribute($k);
if (empty($attribute)) {
continue;
}
$attrId = $attribute->getAttributeId();
if ($this->isAttributeStatic($k)) {
$entityRow[$k] = $this->_prepareStaticValue($k, $v);
continue;
}
HERE IS LINE 836 --> if ($this->_canUpdateAttribute($attribute, $v, $origData)) {
if ($this->_isAttributeValueEmpty($attribute, $v)) {
$delete[$attribute->getBackend()->getTable()][] = array(
'attribute_id' => $attrId,
'value_id' => $attribute->getBackend()->getEntityValueId($newObject)
);
} elseif ($v !== $origData[$k]) {
$update[$attrId] = array(
'value_id' => $attribute->getBackend()->getEntityValueId($newObject),
'value' => $v,
);
}
} else if (!$this->_isAttributeValueEmpty($attribute, $v)) {
$insert[$attrId] = $v;
}
}
$result = compact('newObject', 'entityRow', 'insert', 'update', 'delete');
return $result;
}
Here is core/Mage/Catalog/Model/Resource/Abstract.php:368
HERE IS LINE 368 --> protected function _canUpdateAttribute(
Mage_Eav_Model_Entity_Attribute_Abstract $attribute,
$value,
array &$origData)
{
$result = parent::_canUpdateAttribute($attribute, $value, $origData);
if ($result &&
($attribute->isScopeStore() || $attribute->isScopeWebsite()) &&
!$this->_isAttributeValueEmpty($attribute, $value) &&
$value == $origData[$attribute->getAttributeCode()] &&
isset($origData['store_id']) && $origData['store_id'] != $this->getDefaultStoreId()
) {
return false;
}
return $result;
}
Here is code/community/Webinse/DailyDeals/Model/Observer.php(261)
public function updateDealsStatuses()
{
$helper = Mage::helper('dailydeals');
$collection = Mage::getResourceModel('catalog/product_collection')
->addAttributeToSelect('*')
->addAttributeToFilter('deal_status', true);
foreach ($collection as $item) {
if ($item->getDealStatus()) {
$stat = Mage::helper('dailydeals')->checkUpdateDealStatus($item);
if ($stat != $item->getDealStatuses()) {
$helper->changeSpecialData($item, $stat);
HERE IS LINE 261 --> $item->setDealStatuses($stat)->save();
}
}
}
}
The only thing I could find about this error seems to say I need to add Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
somewhere:
Magento failing when trying to save product inside event observer on frontend?
Add products to another category programatically
How can I fix this error? It cause my site to have a 500 server error when the daily deal is over. Thank you.