当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Catalog_Model_Resource_Eav_Attribute::getAttributeId方法代码示例

本文整理汇总了PHP中Mage_Catalog_Model_Resource_Eav_Attribute::getAttributeId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Catalog_Model_Resource_Eav_Attribute::getAttributeId方法的具体用法?PHP Mage_Catalog_Model_Resource_Eav_Attribute::getAttributeId怎么用?PHP Mage_Catalog_Model_Resource_Eav_Attribute::getAttributeId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Catalog_Model_Resource_Eav_Attribute的用法示例。


在下文中一共展示了Mage_Catalog_Model_Resource_Eav_Attribute::getAttributeId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addIndexableAttributeFilter

 /**
  * Add filter by indexable attribute
  *
  * @param Mage_CatalogSearch_Model_Advanced $object
  * @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
  * @param string|array $value
  */
 public function addIndexableAttributeFilter($object, $attribute, $value)
 {
     if (is_string($value) && strlen($value) == 0) {
         return false;
     }
     if ($attribute->getIndexType() == 'decimal') {
         $table = $this->getTable('catalog/product_index_eav_decimal');
     } else {
         $table = $this->getTable('catalog/product_index_eav');
     }
     $tableAlias = 'ast_' . $attribute->getAttributeCode();
     $storeId = Mage::app()->getStore()->getId();
     $select = $object->getProductCollection()->getSelect();
     $select->distinct(true);
     $select->join(array($tableAlias => $table), "e.entity_id={$tableAlias}.entity_id AND {$tableAlias}.attribute_id={$attribute->getAttributeId()}" . " AND {$tableAlias}.store_id={$storeId}", array());
     if (is_array($value) && (isset($value['from']) || isset($value['to']))) {
         if (isset($value['from']) && !empty($value['from'])) {
             $select->where("{$tableAlias}.`value` >= ?", $value['from']);
         }
         if (isset($value['to']) && !empty($value['to'])) {
             $select->where("{$tableAlias}.`value` <= ?", $value['to']);
         }
         return true;
     }
     $select->where("{$tableAlias}.`value` IN(?)", $value);
     return true;
 }
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:34,代码来源:Advanced.php

示例2: addIndexableAttributeModifiedFilter

 /**
  * Add filter by indexable attribute
  *
  * @param Mage_CatalogSearch_Model_Resource_Advanced_Collection $collection
  * @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
  * @param string|array $value
  * @return bool
  */
 public function addIndexableAttributeModifiedFilter($collection, $attribute, $value)
 {
     if ($attribute->getIndexType() == 'decimal') {
         $table = $this->getTable('catalog/product_index_eav_decimal');
     } else {
         $table = $this->getTable('catalog/product_index_eav');
     }
     $tableAlias = 'a_' . $attribute->getAttributeId();
     $storeId = Mage::app()->getStore()->getId();
     $select = $collection->getSelect();
     if (is_array($value)) {
         if (isset($value['from']) && isset($value['to'])) {
             if (empty($value['from']) && empty($value['to'])) {
                 return false;
             }
         }
     }
     $select->distinct(true);
     $select->join(array($tableAlias => $table), "e.entity_id={$tableAlias}.entity_id " . " AND {$tableAlias}.attribute_id={$attribute->getAttributeId()}" . " AND {$tableAlias}.store_id={$storeId}", array());
     if (is_array($value) && (isset($value['from']) || isset($value['to']))) {
         if (isset($value['from']) && !empty($value['from'])) {
             $select->where("{$tableAlias}.value >= ?", $value['from']);
         }
         if (isset($value['to']) && !empty($value['to'])) {
             $select->where("{$tableAlias}.value <= ?", $value['to']);
         }
         return true;
     }
     $select->where("{$tableAlias}.value IN(?)", $value);
     return true;
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:39,代码来源:Advanced.php

示例3: addCustomIndexableAttributeModifiedFilter

 /**
  * Add filter by indexable attribute
  *
  * @param Mage_CatalogSearch_Model_Resource_Advanced_Collection $collection
  * @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
  * @param string|array $value
  * @return bool
  */
 public function addCustomIndexableAttributeModifiedFilter($collection, $attribute, $value)
 {
     if ($attribute->getIndexType() == 'decimal') {
         $table = $this->getTable('catalog/product_index_eav_decimal');
     } else {
         $table = $this->getTable('catalog/product_entity_int');
     }
     $tableAlias = 'a_' . $attribute->getAttributeId();
     $storeId = Mage::app()->getStore()->getId();
     $select = $collection->getSelect();
     if (is_array($value)) {
         if (isset($value['from']) && isset($value['to'])) {
             if (empty($value['from']) && empty($value['to'])) {
                 return false;
             }
         }
     }
     // $select->distinct(true);
     $select->join(array($tableAlias => $table), "cp.child_id={$tableAlias}.entity_id " . " AND {$tableAlias}.attribute_id={$attribute->getAttributeId()}" . " AND {$tableAlias}.store_id={$storeId}", array());
     /*$select->joinLeft(
           array( 'catalog_product_entity_int'),
           "catalog_product_entity_int.attribute_id={$attribute->getAttributeId()} ",
           array()
       );
       $select->join(
           array( 'catalog_product_bundle_selection'),
           "catalog_product_entity_int.entity_id=catalog_product_bundle_selection.product_id "
               . " AND e.entity_id=catalog_product_bundle_selection.parent_product_id",
           array("other_product_id"=>"catalog_product_bundle_selection.product_id")
       ); */
     if (is_array($value) && (isset($value['from']) || isset($value['to']))) {
         if (isset($value['from']) && !empty($value['from'])) {
             $select->where("{$tableAlias}.value >= ?", $value['from']);
         }
         if (isset($value['to']) && !empty($value['to'])) {
             $select->where("{$tableAlias}.value <= ?", $value['to']);
         }
         return true;
     }
     $select->where("{$tableAlias}.value", $value);
     return true;
 }
开发者ID:axovel,项目名称:easycarcare,代码行数:50,代码来源:Advanced.php


注:本文中的Mage_Catalog_Model_Resource_Eav_Attribute::getAttributeId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。