예제 #1
0
 /**
  * Checks if attribute group exists
  *
  * @param Mage_Eav_Model_Entity_Attribute_Group $object
  * @return boolean
  */
 public function itemExists($object)
 {
     $adapter = $this->_getReadAdapter();
     $bind = array('attribute_set_id' => $object->getAttributeSetId(), 'attribute_group_name' => $object->getAttributeGroupName());
     $select = $adapter->select()->from($this->getMainTable())->where('attribute_set_id = :attribute_set_id')->where('attribute_group_name = :attribute_group_name');
     return $adapter->fetchRow($select, $bind) > 0;
 }
 /**
  * Checks if attribute group exists
  *
  * @param Mage_Eav_Model_Entity_Attribute_Group $object
  * @return boolean
  */
 public function itemExists($object)
 {
     $select = $this->_getReadAdapter()->select()->from($this->getMainTable())->where('attribute_set_id = ?', $object->getAttributeSetId())->where('attribute_group_name = ?', $object->getAttributeGroupName());
     if ($this->_getReadAdapter()->fetchRow($select)) {
         return true;
     }
     return false;
 }
예제 #3
0
 private function saveGroup()
 {
     if ($this->groupObj->getId()) {
         return array('result' => true);
     }
     if (!$this->attributeSetObj) {
         return array('result' => false, 'error' => "Attribute Set '{$this->attributeSetId}' is not found.");
     }
     $this->groupObj->setAttributeGroupName($this->name);
     $this->groupObj->setAttributeSetId($this->attributeSetId);
     try {
         $this->groupObj->save();
     } catch (Exception $e) {
         return array('result' => false, 'error' => $e->getMessage());
     }
     return array('result' => true, 'obj' => $this->groupObj);
 }