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


PHP Mage_Eav_Model_Entity_Attribute_Abstract::getAttributeId方法代码示例

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


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

示例1: _prepareCollection

 protected function _prepareCollection()
 {
     //--------------------------------
     // Get collection
     //----------------------------
     /** @var Mage_Catalog_Model_Resource_Product_Collection $collection */
     $collection = Mage::getModel('catalog/product')->getCollection();
     $collection->addAttributeToSelect('sku');
     $collection->addAttributeToSelect('name');
     //--------------------------------
     // Join listing product tables
     //----------------------------
     $collection->joinTable(array('lp' => 'M2ePro/Listing_Product'), 'product_id=entity_id', array('id' => 'id', 'status' => 'status'), '{{table}}.listing_id=' . (int) $this->getListing()->getId());
     $collection->joinTable(array('elp' => 'M2ePro/Ebay_Listing_Product'), 'listing_product_id=id', array('listing_product_id' => 'listing_product_id', 'template_category_id' => 'template_category_id', 'template_other_category_id' => 'template_other_category_id', 'template_payment_mode' => 'template_payment_mode', 'template_shipping_mode' => 'template_shipping_mode', 'template_return_mode' => 'template_return_mode', 'template_description_mode' => 'template_description_mode', 'template_selling_format_mode' => 'template_selling_format_mode', 'template_synchronization_mode' => 'template_synchronization_mode', 'end_date' => 'end_date', 'start_date' => 'start_date', 'online_title' => 'online_title', 'online_sku' => 'online_sku', 'available_qty' => new Zend_Db_Expr('(online_qty - online_qty_sold)'), 'ebay_item_id' => 'ebay_item_id', 'online_category' => 'online_category', 'online_qty_sold' => 'online_qty_sold', 'online_buyitnow_price' => 'online_buyitnow_price'));
     $collection->joinTable(array('ei' => 'M2ePro/Ebay_Item'), 'id=ebay_item_id', array('item_id' => 'item_id'), NULL, 'left');
     $collection->joinTable(array('etc' => 'M2ePro/Ebay_Template_Category'), 'id=template_category_id', array('category_main_mode' => 'category_main_mode', 'category_main_id' => 'category_main_id', 'category_main_path' => 'category_main_path', 'category_main_attribute' => 'category_main_attribute'), NULL, 'left');
     $collection->joinTable(array('etoc' => 'M2ePro/Ebay_Template_OtherCategory'), 'id=template_other_category_id', array('category_secondary_mode' => 'category_secondary_mode', 'category_secondary_id' => 'category_secondary_id', 'category_secondary_path' => 'category_secondary_path', 'category_secondary_attribute' => 'category_secondary_attribute', 'store_category_main_mode' => 'store_category_main_mode', 'store_category_main_id' => 'store_category_main_id', 'store_category_main_path' => 'store_category_main_path', 'store_category_main_attribute' => 'store_category_main_attribute', 'store_category_secondary_mode' => 'store_category_secondary_mode', 'store_category_secondary_id' => 'store_category_secondary_id', 'store_category_secondary_path' => 'store_category_secondary_path', 'store_category_secondary_attribute' => 'store_category_secondary_attribute'), NULL, 'left');
     if ($this->motorsSpecificsAttribute) {
         $collection->addAttributeToSelect($this->motorsSpecificsAttribute->getAttributeCode());
         $collection->joinTable(array('eea' => Mage::getSingleton('core/resource')->getTableName('eav_entity_attribute')), 'attribute_set_id=attribute_set_id', array('is_motors_attribute_in_product_attribute_set' => 'entity_attribute_id'), '{{table}}.attribute_id = ' . $this->motorsSpecificsAttribute->getAttributeId(), 'left');
     }
     //----------------------------
     //        exit($collection->getSelect()->__toString());
     // Set collection to grid
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }
开发者ID:xiaoguizhidao,项目名称:bb,代码行数:27,代码来源:Grid.php

示例2: _isAllowedAttribute

 /**
  * Check is attribute allowed
  *
  * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @param array $attributes
  * @return boolean
  */
 protected function _isAllowedAttribute($attribute, array $filter = null)
 {
     if (!is_null($filter) && !(in_array($attribute->getAttributeCode(), $filter) || in_array($attribute->getAttributeId(), $filter))) {
         return false;
     }
     return !in_array($attribute->getFrontendInput(), $this->_ignoredAttributeTypes) && !in_array($attribute->getAttributeCode(), $this->_ignoredAttributeCodes);
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:14,代码来源:Resource.php

示例3: _saveAttributeValue

 /**
  * Insert or Update attribute data
  *
  * @param Mage_Catalog_Model_Abstract $object
  * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @param mixed $value
  * @return Mage_Catalog_Model_Resource_Abstract
  */
 protected function _saveAttributeValue($object, $attribute, $value)
 {
     $write = $this->_getWriteAdapter();
     //set default store id
     $storeId = Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID;
     $table = $attribute->getBackend()->getTable();
     /**
      * If we work in single store mode all values should be saved just
      * for default store id
      * In this case we clear all not default values
      */
     if (Mage::app()->isSingleStoreMode()) {
         $storeId = $this->getDefaultStoreId();
         $write->delete($table, array('attribute_id = ?' => $attribute->getAttributeId(), 'entity_id = ?' => $object->getEntityId(), 'store_id <> ?' => $storeId));
     }
     $data = new Varien_Object(array('entity_type_id' => $attribute->getEntityTypeId(), 'attribute_id' => $attribute->getAttributeId(), 'store_id' => $storeId, 'entity_id' => $object->getEntityId(), 'value' => $this->_prepareValueForSave($value, $attribute)));
     $bind = $this->_prepareDataForTable($data, $table);
     if ($attribute->isScopeStore()) {
         /**
          * Update attribute value for store
          */
         $this->_attributeValuesToSave[$table][] = $bind;
     } else {
         if ($attribute->isScopeWebsite() && $storeId != $this->getDefaultStoreId()) {
             /**
              * Update attribute value for website
              */
             $storeIds = Mage::app()->getStore($storeId)->getWebsite()->getStoreIds(true);
             foreach ($storeIds as $storeId) {
                 $bind['store_id'] = (int) $storeId;
                 $this->_attributeValuesToSave[$table][] = $bind;
             }
         } else {
             /**
              * Update global attribute value
              */
             $bind['store_id'] = $this->getDefaultStoreId();
             $this->_attributeValuesToSave[$table][] = $bind;
         }
     }
     return $this;
 }
开发者ID:magebrew,项目名称:magentoSetBaseImage,代码行数:50,代码来源:Product.php

示例4: _prepareCollection

 protected function _prepareCollection()
 {
     // ---------------------------------------
     // Get collection
     // ---------------------------------------
     /* @var $collection Ess_M2ePro_Model_Mysql4_Magento_Product_Collection */
     $collection = Mage::getConfig()->getModelInstance('Ess_M2ePro_Model_Mysql4_Magento_Product_Collection', Mage::getModel('catalog/product')->getResource());
     $collection->addAttributeToSelect('sku');
     $collection->addAttributeToSelect('name');
     // ---------------------------------------
     // Join listing product tables
     // ---------------------------------------
     $collection->joinTable(array('lp' => 'M2ePro/Listing_Product'), 'product_id=entity_id', array('id' => 'id', 'ebay_status' => 'status'), '{{table}}.listing_id=' . (int) $this->getListing()->getId());
     $collection->joinTable(array('elp' => 'M2ePro/Ebay_Listing_Product'), 'listing_product_id=id', array('listing_product_id' => 'listing_product_id', 'template_category_id' => 'template_category_id', 'template_other_category_id' => 'template_other_category_id', 'template_payment_mode' => 'template_payment_mode', 'template_shipping_mode' => 'template_shipping_mode', 'template_return_mode' => 'template_return_mode', 'template_description_mode' => 'template_description_mode', 'template_selling_format_mode' => 'template_selling_format_mode', 'template_synchronization_mode' => 'template_synchronization_mode', 'end_date' => 'end_date', 'start_date' => 'start_date', 'online_title' => 'online_title', 'online_sku' => 'online_sku', 'available_qty' => new Zend_Db_Expr('(online_qty - online_qty_sold)'), 'ebay_item_id' => 'ebay_item_id', 'online_category' => 'online_category', 'online_qty_sold' => 'online_qty_sold', 'online_start_price' => 'online_start_price', 'online_current_price' => 'online_current_price', 'online_reserve_price' => 'online_reserve_price', 'online_buyitnow_price' => 'online_buyitnow_price', 'min_online_price' => 'IF(
                 (`t`.`variation_min_price` IS NULL),
                 `elp`.`online_current_price`,
                 `t`.`variation_min_price`
             )', 'max_online_price' => 'IF(
                 (`t`.`variation_max_price` IS NULL),
                 `elp`.`online_current_price`,
                 `t`.`variation_max_price`
             )'));
     $collection->joinTable(array('ei' => 'M2ePro/Ebay_Item'), 'id=ebay_item_id', array('item_id' => 'item_id'), NULL, 'left');
     $collection->joinTable(array('etc' => 'M2ePro/Ebay_Template_Category'), 'id=template_category_id', array('category_main_mode' => 'category_main_mode', 'category_main_id' => 'category_main_id', 'category_main_path' => 'category_main_path', 'category_main_attribute' => 'category_main_attribute'), NULL, 'left');
     $collection->joinTable(array('etoc' => 'M2ePro/Ebay_Template_OtherCategory'), 'id=template_other_category_id', array('category_secondary_mode' => 'category_secondary_mode', 'category_secondary_id' => 'category_secondary_id', 'category_secondary_path' => 'category_secondary_path', 'category_secondary_attribute' => 'category_secondary_attribute', 'store_category_main_mode' => 'store_category_main_mode', 'store_category_main_id' => 'store_category_main_id', 'store_category_main_path' => 'store_category_main_path', 'store_category_main_attribute' => 'store_category_main_attribute', 'store_category_secondary_mode' => 'store_category_secondary_mode', 'store_category_secondary_id' => 'store_category_secondary_id', 'store_category_secondary_path' => 'store_category_secondary_path', 'store_category_secondary_attribute' => 'store_category_secondary_attribute'), NULL, 'left');
     if ($this->motorsAttribute) {
         $collection->addAttributeToSelect($this->motorsAttribute->getAttributeCode());
         $collection->joinTable(array('eea' => Mage::getSingleton('core/resource')->getTableName('eav_entity_attribute')), 'attribute_set_id=attribute_set_id', array('is_motors_attribute_in_product_attribute_set' => 'entity_attribute_id'), '{{table}}.attribute_id = ' . $this->motorsAttribute->getAttributeId(), 'left');
     }
     $collection->getSelect()->joinLeft(new Zend_Db_Expr('(
             SELECT
                 `mlpv`.`listing_product_id`,
                 MIN(`melpv`.`online_price`) as variation_min_price,
                 MAX(`melpv`.`online_price`) as variation_max_price
             FROM `' . Mage::getResourceModel('M2ePro/Listing_Product_Variation')->getMainTable() . '` AS `mlpv`
             INNER JOIN `' . Mage::getResourceModel('M2ePro/Ebay_Listing_Product_Variation')->getMainTable() . '` AS `melpv`
                 ON (`mlpv`.`id` = `melpv`.`listing_product_variation_id`)
             WHERE `melpv`.`status` != ' . Ess_M2ePro_Model_Listing_Product::STATUS_NOT_LISTED . '
             GROUP BY `mlpv`.`listing_product_id`
         )'), 'elp.listing_product_id=t.listing_product_id', array('variation_min_price' => 'variation_min_price', 'variation_max_price' => 'variation_max_price'));
     // ---------------------------------------
     // Set collection to grid
     $this->setCollection($collection);
     parent::_prepareCollection();
     if ($this->isMotorsAvailable()) {
         $this->prepareExistingMotorsData();
     }
     return $this;
 }
开发者ID:ReeceCrossland,项目名称:essua-m2epro,代码行数:49,代码来源:Grid.php

示例5: _insertAttribute

 /**
  * Insert entity attribute value
  *
  * @param Varien_Object $object
  * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @param mixed $value
  * @return Mage_Catalog_Model_Resource_Abstract
  */
 protected function _insertAttribute($object, $attribute, $value)
 {
     /**
      * save required attributes in global scope every time if store id different from default
      */
     $storeId = (int) Mage::app()->getStore($object->getStoreId())->getId();
     if ($attribute->getIsRequired() && $this->getDefaultStoreId() != $storeId) {
         $table = $attribute->getBackend()->getTable();
         $select = $this->_getReadAdapter()->select()->from($table)->where('entity_type_id = ?', $attribute->getEntityTypeId())->where('attribute_id = ?', $attribute->getAttributeId())->where('store_id = ?', $this->getDefaultStoreId())->where('entity_id = ?', $object->getEntityId());
         $row = $this->_getReadAdapter()->fetchOne($select);
         if (!$row) {
             $data = new Varien_Object(array('entity_type_id' => $attribute->getEntityTypeId(), 'attribute_id' => $attribute->getAttributeId(), 'store_id' => $this->getDefaultStoreId(), 'entity_id' => $object->getEntityId(), 'value' => $this->_prepareValueForSave($value, $attribute)));
             $bind = $this->_prepareDataForTable($data, $table);
             $this->_getWriteAdapter()->insertOnDuplicate($table, $bind, array('value'));
         }
     }
     return $this->_saveAttributeValue($object, $attribute, $value);
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:26,代码来源:Abstract.php

示例6: _isAllowedAttribute

 /**
  * Check if attribute is allowed
  *
  * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @param array $attributes
  * @return boolean
  */
 protected function _isAllowedAttribute($attribute, $attributes = null)
 {
     $isAllowed = true;
     if (is_array($attributes) && !(in_array($attribute->getAttributeCode(), $attributes) || in_array($attribute->getAttributeId(), $attributes))) {
         $isAllowed = false;
     }
     return $isAllowed;
 }
开发者ID:shebin512,项目名称:Magento_Zoff,代码行数:15,代码来源:V1.php

示例7: _insertAttribute

 /**
  * Insert entity attribute value
  *
  * @param   Varien_Object $object
  * @param   Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  * @param   mixed $value
  * @return  Mage_Eav_Model_Entity_Abstract
  */
 protected function _insertAttribute($object, $attribute, $value)
 {
     /**
      * save required attributes in global scope every time if store id different from default
      */
     $storeId = Mage::app()->getStore($object->getStoreId())->getId();
     if ($attribute->getIsRequired() && $this->getDefaultStoreId() != $storeId) {
         $bind = array('entity_type_id' => $attribute->getEntityTypeId(), 'attribute_id' => $attribute->getAttributeId(), 'store_id' => $this->getDefaultStoreId(), 'entity_id' => $object->getEntityId(), 'value' => $this->_prepareValueForSave($value, $attribute));
         $this->_getWriteAdapter()->insertOnDuplicate($attribute->getBackend()->getTable(), $bind, array('value'));
     }
     return $this->_saveAttributeValue($object, $attribute, $value);
     //        $entityIdField = $attribute->getBackend()->getEntityIdField();
     //        $row = array(
     //            $entityIdField  => $object->getId(),
     //            'entity_type_id'=> $object->getEntityTypeId(),
     //            'attribute_id'  => $attribute->getId(),
     //            'value'         => $this->_prepareValueForSave($value, $attribute),
     //            'store_id'      => $this->getDefaultStoreId()
     //        );
     //
     //        $fields = array();
     //        $bind = array();
     //        foreach ($row as $k => $v) {
     //            $fields[] = $this->_getWriteAdapter()->quoteIdentifier($k);
     //            $bind[':' . $k] = $v;
     //        }
     //
     //        $sql = sprintf('INSERT IGNORE INTO %s (%s) VALUES(%s)',
     //            $this->_getWriteAdapter()->quoteIdentifier($attribute->getBackend()->getTable()),
     //            implode(',', $fields),
     //            implode(',', array_keys($bind)));
     //
     //        $this->_getWriteAdapter()->query($sql, $bind);
     //        if (!$lastId = $this->_getWriteAdapter()->lastInsertId()) {
     //            $select = $this->_getReadAdapter()->select()
     //                ->from($attribute->getBackend()->getTable(), 'value_id')
     //                ->where($entityIdField . '=?', $row[$entityIdField])
     //                ->where('entity_type_id=?', $row['entity_type_id'])
     //                ->where('attribute_id=?', $row['attribute_id'])
     //                ->where('store_id=?', $row['store_id']);
     //            $lastId = $select->query()->fetchColumn();
     //        }
     //        if ($object->getStoreId() != $this->getDefaultStoreId()) {
     //            $this->_updateAttribute($object, $attribute, $lastId, $value);
     //        }
     //        return $this;
 }
开发者ID:joebushi,项目名称:magento-mirror,代码行数:55,代码来源:Abstract.php

示例8: _joinCustomerAttibute

 /**
  * Join customer attribute
  *
  * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
  */
 protected function _joinCustomerAttibute(Mage_Eav_Model_Entity_Attribute_Abstract $attribute)
 {
     $tableName = 'at_' . $attribute->getName();
     $joinExpr = array($tableName . '.entity_id = wishlist_table.customer_id', $this->getSelect()->getAdapter()->quoteInto($tableName . '.attribute_id = ?', $attribute->getAttributeId()));
     $this->getSelect()->joinLeft(array($tableName => $attribute->getBackend()->getTable()), implode(' AND ', $joinExpr), array());
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:11,代码来源:Collection.php


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