コード例 #1
0
ファイル: Code.php プロジェクト: relue/magento2
 /**
  * Delete scripts by entity and store
  *
  * @param Mage_GoogleOptimizer_Model_Code $object
  * @param integer $store_id
  * @return Mage_GoogleOptimizer_Model_Resource_Code
  */
 public function deleteByEntityType($object, $store_id)
 {
     $adapter = $this->_getWriteAdapter();
     $entityIds = $object->getEntityIds();
     if (!empty($entityIds)) {
         $where[$this->getMainTable() . '.entity_id IN (?)'] = $entityIds;
     } else {
         $where[$this->getMainTable() . '.entity_id=?'] = $object->getEntity()->getId();
     }
     $where[$this->getMainTable() . '.entity_type=?'] = $object->getEntityType();
     $where[$this->getMainTable() . '.store_id=?'] = $store_id;
     $adapter->delete($this->getMainTable(), $where);
     $this->_afterDelete($object);
     return $this;
 }
コード例 #2
0
ファイル: Product.php プロジェクト: njaeger/magento_github
 protected function _validate()
 {
     $_validationResult = parent::_validate();
     if (!$_validationResult) {
         return false;
     }
     $attributesFlag = false;
     if ($attributes = $this->getAttributes()) {
         $attributesCount = 0;
         foreach ($attributes as $_attributeId => $_attributeValue) {
             if ($_attributeValue != '') {
                 $attributesCount++;
             }
         }
         if ($attributesCount && $attributesCount <= self::DEFAULT_COUNT_OF_ATTRIBUTES) {
             $attributesFlag = true;
         }
     }
     if ($this->_validateEntryFlag && !$attributesFlag) {
         return false;
     }
     if (!$this->_validateEntryFlag && $attributesFlag) {
         return false;
     }
     return true;
 }
コード例 #3
0
ファイル: Mysql4_Code.php プロジェクト: ronseigel/agent-ohm
 /**
  * Delete scripts by entity and store
  *
  * @param Mage_GoogleOptimizer_Model_Code $object
  * @param integer $store_id
  * @return Mage_GoogleOptimizer_Model_Mysql4_Code
  */
 public function deleteByEntityType($object, $store_id)
 {
     $write = $this->_getWriteAdapter();
     if ($write) {
         $entityIds = $object->getEntityIds();
         if (!empty($entityIds)) {
             $where = $write->quoteInto($this->getMainTable() . '.entity_id IN (?)', $entityIds);
         } else {
             $where = $write->quoteInto($this->getMainTable() . '.entity_id=?', $object->getEntity()->getId());
         }
         $where .= ' AND ' . $write->quoteInto($this->getMainTable() . '.entity_type=?', $object->getEntityType()) . ' AND ' . $write->quoteInto($this->getMainTable() . '.store_id=?', $store_id);
         $write->delete($this->getMainTable(), $where);
     }
     $this->_afterDelete($object);
     return $this;
 }
コード例 #4
0
ファイル: Page.php プロジェクト: njaeger/magento_github
 protected function _validate()
 {
     if ($this->getPageType() && $this->getPageType() == self::PAGE_TYPE_VARIANT) {
         if ($this->getTrackingScript()) {
             return true;
         }
     }
     return parent::_validate();
 }
コード例 #5
0
ファイル: Category.php プロジェクト: njaeger/magento_github
 /**
  * Removing scripts assigned to entity
  *
  * @param integer $storeId
  * @return Mage_GoogleOptimizer_Model_Code
  */
 public function deleteScripts($storeId)
 {
     $category = $this->getEntity();
     if ($category) {
         /**
          * We need check category children ids
          */
         $ids = $category->getDeletedChildrenIds();
         if (is_array($ids)) {
             $ids[] = $category->getId();
         } else {
             $ids = array($category->getId());
         }
         $this->setEntityIds($ids);
     }
     return parent::deleteScripts($storeId);
 }