コード例 #1
0
ファイル: Grid.php プロジェクト: ReeceCrossland/essua-m2epro
 public function callbackFilterMotorsAttribute(Varien_Data_Collection_Db $collection, $column)
 {
     $value = $column->getFilter()->getValue();
     if (is_null($value)) {
         return;
     }
     if (!$this->motorsAttribute) {
         return;
     }
     if ($value == 1) {
         $attributeCode = $this->motorsAttribute->getAttributeCode();
         $collection->addFieldToFilter($attributeCode, array('notnull' => true));
         $collection->addFieldToFilter($attributeCode, array('neq' => ''));
         $collection->addFieldToFilter('is_motors_attribute_in_product_attribute_set', array('notnull' => true));
     } else {
         $attributeId = $this->motorsAttribute->getId();
         $storeId = $this->getListing()->getStoreId();
         $joinCondition = 'eaa.entity_id = e.entity_id and eaa.attribute_id = ' . $attributeId;
         if (!$this->motorsAttribute->isScopeGlobal()) {
             $joinCondition .= ' and eaa.store_id = ' . $storeId;
         }
         $collection->getSelect()->joinLeft(array('eaa' => Mage::getSingleton('core/resource')->getTableName('catalog_product_entity_text')), $joinCondition, array('value'));
         $collection->getSelect()->orWhere('eaa.value IS NULL');
         $collection->getSelect()->orWhere('eaa.value = \'\'');
         $collection->getSelect()->orWhere('eea.entity_attribute_id IS NULL');
     }
 }
コード例 #2
0
ファイル: Tax.php プロジェクト: cnglobal-sl/caterez
 /**
  * Delete product data
  *
  * @param Mage_Catalog_Model_Product $product
  * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @return Mage_Weee_Model_Resource_Attribute_Backend_Weee_Tax
  */
 public function deleteProductData($product, $attribute)
 {
     $where = array('entity_id = ?' => (int) $product->getId(), 'attribute_id = ?' => (int) $attribute->getId());
     $adapter = $this->_getWriteAdapter();
     if (!$attribute->isScopeGlobal()) {
         $storeId = $product->getStoreId();
         if ($storeId) {
             $where['website_id IN(?)'] = array(0, Mage::app()->getStore($storeId)->getWebsiteId());
         }
     }
     $adapter->delete($this->getMainTable(), $where);
     return $this;
 }