Exemple #1
0
 public function testUnsetData()
 {
     $data = array('key1' => 'value1', 'key2' => 'value2');
     $this->_model->setData($data);
     // unset one locked
     $this->_model->lockAttribute('key1')->unsetData('key1');
     $this->assertEquals($data, $this->_model->getData());
     // unset all with read only
     $this->_model->setIsReadonly(true)->unsetData();
     $this->assertEquals($data, $this->_model->getData());
     // unset all
     $this->_model->unlockAttributes()->setIsReadonly(false)->unsetData();
     $this->assertEquals(array(), $this->_model->getData());
 }
Exemple #2
0
 /**
  * Lock a specific category or product attribute so that it can not be editted through the interface.
  * @param Mage_Eav_Model_Entity_Attribute $attribute
  * @param Mage_Catalog_Model_Abstract     $model
  * @param                                 $profile
  */
 protected function _lockAttribute(Mage_Eav_Model_Entity_Attribute $attribute, Mage_Catalog_Model_Abstract $model, $profile)
 {
     $note = $attribute->getNote() ? $attribute->getNote() : '';
     if ($attribute->getAttributeCode() == 'ho_import_profile') {
         return;
     }
     if ($note) {
         $note .= "<br />\n";
     }
     $note .= Mage::helper('ho_import')->__("Locked by import: <i>%s</i>", $profile);
     $model->lockAttribute($attribute->getAttributeCode());
     $attribute->setNote($note);
 }