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


PHP Varien_Object::setIdFieldName方法代码示例

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


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

示例1: updateAttributes

 /**
  * Update attribute values for entity list per store
  *
  * @param array $entityIds
  * @param array $attrData
  * @param int $storeId
  * @return Mage_Catalog_Model_Product_Action
  */
 public function updateAttributes($entityIds, $attrData, $storeId)
 {
     $object = new Varien_Object();
     $object->setIdFieldName('entity_id')->setStoreId($storeId);
     $this->_getWriteAdapter()->beginTransaction();
     try {
         foreach ($attrData as $attrCode => $value) {
             $attribute = $this->getAttribute($attrCode);
             if (!$attribute->getAttributeId()) {
                 continue;
             }
             $i = 0;
             foreach ($entityIds as $entityId) {
                 $object->setId($entityId);
                 // collect data for save
                 $this->_saveAttributeValue($object, $attribute, $value);
                 // save collected data every 1000 rows
                 if ($i % 1000 == 0) {
                     $this->_processAttributeValues();
                 }
             }
         }
         $this->_processAttributeValues();
         $this->_getWriteAdapter()->commit();
     } catch (Exception $e) {
         $this->_getWriteAdapter()->rollBack();
         throw $e;
     }
     return $this;
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:38,代码来源:Action.php

示例2: _prepareCollection

 protected function _prepareCollection()
 {
     $sort = $this->getParam('sort', $this->_defaultSort);
     $dir = $this->getParam('dir', $this->_defaultDir);
     $files = $this->_helper->getLogFiles();
     if (isset($sort) && !empty($files) && isset($files[0][$sort])) {
         usort($files, function ($a, $b) use($sort, $dir) {
             $a = $a[$sort];
             $b = $b[$sort];
             if (is_numeric($a)) {
                 return $dir == 'asc' ? $a - $b : $b - $a;
             } else {
                 return $dir == 'asc' ? strcmp($a, $b) : -strcmp($a, $b);
             }
         });
     }
     $collection = new Varien_Data_Collection();
     foreach ($files as $file) {
         $item = new Varien_Object();
         $item->setIdFieldName('filename');
         $item->setFilename($file['filename']);
         $item->setFilesize($this->_helper->humanFilesize($file['filesize']));
         $item->setLines($file['lines']);
         $collection->addItem($item);
     }
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }
开发者ID:cewolf2002,项目名称:magento,代码行数:28,代码来源:Grid.php

示例3: update

 /**
  * Mage_Catalog_Model_Resource_Eav_Mysql4_Import_Product_Action::update()
  * 
  * @param mixed $entityId
  * @param mixed $data = array('statics' => , 'attributes' => , 'inventories' => )
  * @param mixed $storeId
  * @return void
  */
 public function update($entityId, $data, $storeId, $obj = null)
 {
     $object = new Varien_Object();
     $object->setIdFieldName('entity_id')->setStoreId($storeId);
     $this->_getWriteAdapter()->beginTransaction();
     try {
         if ($obj == null) {
             $obj = new Varien_Object();
         }
         if (!$obj->getId()) {
             $this->simpleLoad($obj, $entityId);
         }
         //update attributes
         foreach ($data['attributes'] as $attrCode => $value) {
             $attribute = $this->getAttribute($attrCode);
             if (!$this->__checkApply($obj, $attribute)) {
                 continue;
             }
             $object->setId($entityId);
             // collect data for save
             $this->_saveAttributeValue($object, $attribute, $value);
             // save collected data every 1000 rows
         }
         //update
         $this->__updateProductValues($entityId, $data['statics']);
         //update inventory
         if (count($data['inventories']) > 0) {
             $stockItem = Mage::getSingleton('cataloginventory/stock_item');
             $stockItem->setData(array());
             $stockItem->loadByProduct($entityId)->setProductId($entityId);
             $stockDataChanged = false;
             foreach ($data['inventories'] as $k => $v) {
                 $stockItem->setDataUsingMethod($k, $v);
                 if ($stockItem->dataHasChangedFor($k)) {
                     $stockDataChanged = true;
                 }
             }
             if ($stockDataChanged) {
                 $stockItem->save();
             }
         }
         $this->_processAttributeValues();
         $this->_getWriteAdapter()->commit();
     } catch (Exception $e) {
         $this->_getWriteAdapter()->rollBack();
         throw $e;
     }
 }
开发者ID:hyhoocchan,项目名称:extension,代码行数:56,代码来源:Action.php

示例4: _getCategories

 protected function _getCategories($categoryIds, $storeId = null, $path = null)
 {
     $isActiveAttribute = Mage::getModel('eav/entity_attribute')->loadByCode('catalog_category', 'is_active');
     $categories = array();
     if (!is_array($categoryIds)) {
         $categoryIds = array($categoryIds);
     }
     $select = $this->_getWriteAdapter()->select()->from(array('main_table' => $this->getTable('catalog/category')), array('main_table.entity_id', 'main_table.parent_id', 'is_active' => 'IFNULL(c.value, d.value)', 'main_table.path'));
     if (is_null($path)) {
         $select->where('main_table.entity_id IN(?)', $categoryIds);
     } else {
         $select->where('main_table.path LIKE ?', $path . '%')->order('main_table.path');
     }
     $table = $this->getTable('catalog/category') . '_int';
     $select->joinLeft(array('d' => $table), "d.attribute_id = '{$isActiveAttribute->getId()}' AND d.store_id = 0 AND d.entity_id = main_table.entity_id", array())->joinLeft(array('c' => $table), "c.attribute_id = '{$isActiveAttribute->getId()}' AND c.store_id = '{$storeId}' AND c.entity_id = main_table.entity_id", array());
     if (!is_null($storeId)) {
         $rootCategoryPath = $this->getStores($storeId)->getRootCategoryPath();
         $rootCategoryPathLength = strlen($rootCategoryPath);
     }
     $rowSet = $this->_getWriteAdapter()->fetchAll($select);
     foreach ($rowSet as $row) {
         if (!is_null($storeId) && substr($row['path'], 0, $rootCategoryPathLength) != $rootCategoryPath) {
             continue;
         }
         $category = new Varien_Object($row);
         $category->setIdFieldName('entity_id');
         $category->setStoreId($storeId);
         $this->_prepareCategoryParentId($category);
         $categories[$category->getId()] = $category;
     }
     unset($rowSet);
     if (!is_null($storeId) && $categories) {
         foreach (array('name', 'url_key', 'url_path') as $attributeCode) {
             $attributes = $this->_getCategoryAttribute($attributeCode, array_keys($categories), $category->getStoreId());
             foreach ($attributes as $categoryId => $attributeValue) {
                 $categories[$categoryId]->setData($attributeCode, $attributeValue);
             }
         }
     }
     return $categories;
 }
开发者ID:rlucia,项目名称:magento-oscom-migration-tool,代码行数:41,代码来源:Url.php

示例5: _getProducts

 protected function _getProducts($productIds = null, $storeId, $entityId = 0, &$lastEntityId)
 {
     $products = array();
     $websiteId = Mage::app()->getStore($storeId)->getWebsiteId();
     if (!is_null($productIds)) {
         if (!is_array($productIds)) {
             $productIds = array($productIds);
         }
     }
     $select = $this->_getWriteAdapter()->select()->useStraightJoin(true)->from(array('e' => $this->getTable('catalog/product')), array('entity_id'))->join(array('w' => $this->getTable('catalog/product_website')), $this->_getWriteAdapter()->quoteInto('e.entity_id=w.product_id AND w.website_id=?', $websiteId), array())->where('e.entity_id>?', $entityId)->order('e.entity_id')->limit($this->_productLimit);
     if (!is_null($productIds)) {
         $select->where('e.entity_id IN(?)', $productIds);
     }
     $query = $this->_getWriteAdapter()->query($select);
     while ($row = $query->fetch()) {
         $product = new Varien_Object($row);
         $product->setIdFieldName('entity_id');
         $product->setCategoryIds(array());
         $product->setStoreId($storeId);
         $products[$product->getId()] = $product;
         $lastEntityId = $product->getId();
     }
     unset($query);
     if ($products) {
         $select = $this->_getReadAdapter()->select()->from($this->getTable('catalog/category_product'), array('product_id', 'category_id'))->where('product_id IN(?)', array_keys($products));
         $categories = $this->_getReadAdapter()->fetchAll($select);
         foreach ($categories as $category) {
             $productId = $category['product_id'];
             $categoryIds = $products[$productId]->getCategoryIds();
             $categoryIds[] = $category['category_id'];
             $products[$productId]->setCategoryIds($categoryIds);
         }
         foreach (array('name', 'url_key', 'url_path', 'visibility', "status") as $attributeCode) {
             $attributes = $this->_getProductAttribute($attributeCode, array_keys($products), $storeId);
             foreach ($attributes as $productId => $attributeValue) {
                 $products[$productId]->setData($attributeCode, $attributeValue);
             }
         }
     }
     return $products;
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:41,代码来源:Url.php

示例6: synchronize

 /**
  * Synchronize flat data with eav model.
  *
  * @param Mage_Catalog_Model_Category|int $category
  * @param array $storeIds
  * @return Mage_Catalog_Model_Resource_Category_Flat
  */
 public function synchronize($category = null, $storeIds = array())
 {
     if (is_null($category)) {
         if (empty($storeIds)) {
             $storeIds = null;
         }
         $stores = $this->getStoresRootCategories($storeIds);
         $storesObjects = array();
         foreach ($stores as $storeId => $rootCategoryId) {
             $_store = new Varien_Object(array('store_id' => $storeId, 'root_category_id' => $rootCategoryId));
             $_store->setIdFieldName('store_id');
             $storesObjects[] = $_store;
         }
         $this->rebuild($storesObjects);
     } else {
         if ($category instanceof Mage_Catalog_Model_Category) {
             $categoryId = $category->getId();
             foreach ($category->getStoreIds() as $storeId) {
                 if ($storeId == Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID) {
                     continue;
                 }
                 $attributeValues = $this->_getAttributeValues($categoryId, $storeId);
                 $data = new Varien_Object($category->getData());
                 $data->addData($attributeValues[$categoryId])->setStoreId($storeId);
                 $this->_synchronize($data);
             }
         } else {
             if (is_numeric($category)) {
                 $write = $this->_getWriteAdapter();
                 $select = $write->select()->from($this->getTable('catalog/category'))->where('entity_id=?', $category);
                 $row = $write->fetchRow($select);
                 if (!$row) {
                     return $this;
                 }
                 $stores = $this->getStoresRootCategories();
                 $path = explode('/', $row['path']);
                 foreach ($stores as $storeId => $rootCategoryId) {
                     if (in_array($rootCategoryId, $path)) {
                         $attributeValues = $this->_getAttributeValues($category, $storeId);
                         $data = new Varien_Object($row);
                         $data->addData($attributeValues[$category])->setStoreId($storeId);
                         $this->_synchronize($data);
                     } else {
                         $where = $write->quoteInto('entity_id = ?', $category);
                         $write->delete($this->getMainStoreTable($storeId), $where);
                     }
                 }
             }
         }
     }
     return $this;
 }
开发者ID:shebin512,项目名称:Magento_Zoff,代码行数:59,代码来源:Flat.php

示例7: _getProductEmulator

 /**
  * Retrieve Product Emulator (Varien Object)
  *
  * @return Varien_Object
  */
 protected function _getProductEmulator()
 {
     $productEmulator = new Varien_Object();
     $productEmulator->setIdFieldName('entity_id');
     return $productEmulator;
 }
开发者ID:axovel,项目名称:easycarcare,代码行数:11,代码来源:Fulltext.php

示例8: getTableStatus

 /**
  * Retrieve table status
  *
  * @param string $tableName
  * @return Varien_Object
  */
 public function getTableStatus($tableName)
 {
     $row = $this->_write->showTableStatus($tableName);
     if ($row) {
         $statusObject = new Varien_Object();
         $statusObject->setIdFieldName('name');
         foreach ($row as $field => $value) {
             $statusObject->setData(strtolower($field), $value);
         }
         $cntRow = $this->_write->fetchRow($this->_write->select()->from($tableName, 'COUNT(1) as rows'));
         $statusObject->setRows($cntRow['rows']);
         return $statusObject;
     }
     return false;
 }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:21,代码来源:Db.php

示例9: getTableStatus

 /**
  * Retrieve table status
  *
  * @param string $tableName
  * @return Varien_Object
  */
 public function getTableStatus($tableName)
 {
     $sql = $this->_read->quoteInto('SHOW TABLE STATUS LIKE ?', $tableName);
     $row = $this->_read->fetchRow($sql);
     if ($row) {
         $statusObject = new Varien_Object();
         $statusObject->setIdFieldName('name');
         foreach ($row as $field => $value) {
             $statusObject->setData(strtolower($field), $value);
         }
         $cntRow = $this->_read->fetchRow($this->_read->select()->from($tableName, 'COUNT(*) as rows'));
         $statusObject->setRows($cntRow['rows']);
         return $statusObject;
     }
     return false;
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:22,代码来源:Db.php

示例10: array

 */
/* @var $this Mage_Core_Model_Resource_Setup */
/** @var $indexHelper Enterprise_Index_Helper_Data */
$indexHelper = Mage::helper('enterprise_index');
/** @var $client Enterprise_Mview_Model_Client */
$client = Mage::getModel('enterprise_mview/client');
$client->init('catalogsearch_fulltext');
$client->getMetadata()->setKeyColumn('product_id')->setViewName('catalogsearch_fulltext_cl')->setStatus(Enterprise_Mview_Model_Metadata::STATUS_INVALID)->setGroupCode('catalogsearch_fulltext')->save();
$client->execute('enterprise_index/action_index_changelog_create');
$subscriptions = array($this->getTable('catalog/product') => 'entity_id', $this->getTable(array('catalog/product', 'decimal')) => 'entity_id', $this->getTable(array('catalog/product', 'int')) => 'entity_id', $this->getTable(array('catalog/product', 'text')) => 'entity_id', $this->getTable(array('catalog/product', 'varchar')) => 'entity_id', $this->getTable(array('catalog/product', 'datetime')) => 'entity_id');
/** @var $resources mage_core_model_resource */
$resources = Mage::getSingleton('core/resource');
/** @var $productType mage_catalog_model_product_type */
$productType = Mage::getSingleton('catalog/product_type');
$productEmulator = new Varien_Object();
$productEmulator->setIdFieldName('entity_id');
foreach (Mage_Catalog_Model_Product_Type::getCompositeTypes() as $typeId) {
    $productEmulator->setTypeId($typeId);
    /** @var $typeInstance Mage_Catalog_Model_Product_Type_Abstract */
    $typeInstance = $productType->factory($productEmulator);
    /** @var $relation bool|Varien_Object */
    $relation = $typeInstance->isComposite() ? $typeInstance->getRelationInfo() : false;
    if ($relation && $relation->getTable()) {
        $tableName = $resources->getTableName($relation->getTable());
        $subscriptions[$tableName] = $relation->getParentFieldName();
    }
}
foreach ($subscriptions as $targetTable => $targetColumn) {
    $arguments = array('target_table' => $targetTable, 'target_column' => $targetColumn);
    $client->execute('enterprise_mview/action_changelog_subscription_create', $arguments);
}
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:31,代码来源:install-1.13.0.0.php

示例11: _getProducts

 /**
  * Retrieve Product data objects
  * LOE: remove if status(=2) is disabled or visibility(=1) false
  *
  * @param int|array $productIds
  * @param int $storeId
  * @param int $entityId
  * @param int $lastEntityId
  * @return array
  */
 protected function _getProducts($productIds, $storeId, $entityId, &$lastEntityId)
 {
     $products = array();
     $websiteId = Mage::app()->getStore($storeId)->getWebsiteId();
     $adapter = $this->_getReadAdapter();
     if ($productIds !== null) {
         if (!is_array($productIds)) {
             $productIds = array($productIds);
         }
     }
     $bind = array('website_id' => (int) $websiteId, 'entity_id' => (int) $entityId);
     $select = $adapter->select()->useStraightJoin(true)->from(array('e' => $this->getTable('catalog/product')), array('entity_id'))->join(array('w' => $this->getTable('catalog/product_website')), 'e.entity_id = w.product_id AND w.website_id = :website_id', array())->where('e.entity_id > :entity_id')->order('e.entity_id')->limit($this->_productLimit);
     if ($productIds !== null) {
         $select->where('e.entity_id IN(?)', $productIds);
     }
     //if we are to ignore disabled products... add the necessary joins and conditions
     if ($this->_helper()->HideDisabledProducts($storeId)) {
         $statusCode = Mage::getResourceModel('eav/entity_attribute')->getIdByCode('catalog_product', 'status');
         $bind['status_id'] = (int) $statusCode;
         $bind['disabled'] = Mage_Catalog_Model_Product_Status::STATUS_DISABLED;
         $bind['store_id'] = (int) $storeId;
         $bind['default_store_id'] = 0;
         $select->joinLeft(array('s' => $this->getTable(array('catalog/product', 'int'))), 'e.entity_id = s.entity_id AND s.attribute_id = :status_id AND s.store_id = :store_id', array());
         $select->joinLeft(array('ds' => $this->getTable(array('catalog/product', 'int'))), 'e.entity_id = ds.entity_id AND ds.attribute_id = :status_id AND ds.store_id = :default_store_id', array());
         $select->where('s.value <> :disabled OR (s.value IS NULL AND ds.value <> :disabled)');
     }
     //if we are to ignore not visible products... add the necessary joins and conditions
     if ($this->_helper()->HideNotVisibileProducts($storeId)) {
         $visibilityCode = Mage::getResourceModel('eav/entity_attribute')->getIdByCode('catalog_product', 'visibility');
         $bind['not_visible'] = Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE;
         $bind['visibility_id'] = (int) $visibilityCode;
         $bind['store_id'] = (int) $storeId;
         $bind['default_store_id'] = 0;
         $select->joinLeft(array('v' => $this->getTable(array('catalog/product', 'int'))), 'e.entity_id = v.entity_id AND v.attribute_id = :visibility_id AND v.store_id = :store_id', array());
         $select->joinLeft(array('dv' => $this->getTable(array('catalog/product', 'int'))), 'e.entity_id = dv.entity_id AND dv.attribute_id = :visibility_id AND dv.store_id = :default_store_id', array());
         $select->where('v.value <> :not_visible OR (v.value IS NULL AND dv.value <> :not_visible)');
     }
     $rowSet = $adapter->fetchAll($select, $bind);
     foreach ($rowSet as $row) {
         $product = new Varien_Object($row);
         $product->setIdFieldName('entity_id');
         $product->setCategoryIds(array());
         $product->setStoreId($storeId);
         $products[$product->getId()] = $product;
         $lastEntityId = $product->getId();
     }
     unset($rowSet);
     if ($products) {
         $select = $adapter->select()->from($this->getTable('catalog/category_product'), array('product_id', 'category_id'))->where('product_id IN(?)', array_keys($products));
         $categories = $adapter->fetchAll($select);
         foreach ($categories as $category) {
             $productId = $category['product_id'];
             $categoryIds = $products[$productId]->getCategoryIds();
             $categoryIds[] = $category['category_id'];
             $products[$productId]->setCategoryIds($categoryIds);
         }
         foreach (array('name', 'url_key', 'url_path') as $attributeCode) {
             $attributes = $this->_getProductAttribute($attributeCode, array_keys($products), $storeId);
             foreach ($attributes as $productId => $attributeValue) {
                 $products[$productId]->setData($attributeCode, $attributeValue);
             }
         }
     }
     return $products;
 }
开发者ID:ergontech,项目名称:Loewenstark_UrlIndexer,代码行数:75,代码来源:Url.php

示例12: _getChildrenIds

 /**
  * Retrieve entities children ids (simple products for configurable, grouped and bundles).
  *
  * @param array $entityIds Parent entities ids.
  * @param int   $websiteId Current website ids
  *
  * @return array
  */
 protected function _getChildrenIds($entityIds, $websiteId)
 {
     $children = array();
     $productTypes = array_keys(Mage::getModel('catalog/product_type')->getOptionArray());
     foreach ($productTypes as $productType) {
         $productEmulator = new Varien_Object();
         $productEmulator->setIdFieldName('entity_id');
         $productEmulator->setTypeId($productType);
         $typeInstance = Mage::getSingleton('catalog/product_type')->factory($productEmulator);
         $relation = $typeInstance->isComposite() ? $typeInstance->getRelationInfo() : false;
         if ($relation && $relation->getTable() && $relation->getParentFieldName() && $relation->getChildFieldName()) {
             $select = $this->getConnection()->select()->from(array('main' => $this->getTable($relation->getTable())), array($relation->getParentFieldName(), $relation->getChildFieldName()))->where("main.{$relation->getParentFieldName()} in (?)", $entityIds);
             if (!is_null($relation->getWhere())) {
                 $select->where($relation->getWhere());
             }
             Mage::dispatchEvent('prepare_product_children_id_list_select', array('select' => $select, 'entity_field' => 'main.product_id', 'website_field' => $websiteId));
             $data = $this->getConnection()->fetchAll($select);
             foreach ($data as $link) {
                 $parentId = $link[$relation->getParentFieldName()];
                 $childId = $link[$relation->getChildFieldName()];
                 if (!isset($children[$parentId])) {
                     $children[$parentId] = array();
                 }
                 $children[$parentId][] = $childId;
             }
         }
     }
     return $children;
 }
开发者ID:ngocdb,项目名称:smile-magento-elasticsearch,代码行数:37,代码来源:Product.php

示例13: getFiles

 /**
  * Get the (uploaded) catalog files
  * 
  * @return Varien_Object[]
  */
 public function getFiles()
 {
     $files = array();
     $filenames = scandir($this->getBaseDir());
     foreach ($filenames as $filename) {
         if (strpos($filename, '.') === 0) {
             continue;
         }
         $file = $this->getFilePath($filename);
         $filesize = filesize($file);
         $filemtime = filemtime($file);
         $inProgress = $this->isInProgress($filename);
         $data = array('filename' => $filename, 'file' => $file, 'filesize' => $filesize, 'filemtime' => $filemtime, 'status' => $inProgress);
         $object = new Varien_Object($data);
         $object->setIdFieldName('filename');
         $files[] = $object;
     }
     return $files;
 }
开发者ID:vecbralis,项目名称:magento-nedis-import,代码行数:24,代码来源:Catalog.php

示例14: _getProducts

 /**
  * Retrieve Product data objects
  *
  * @param int|array $productIds
  * @param int $storeId
  * @param int $entityId
  * @param int $lastEntityId
  * @return array
  */
 protected function _getProducts($productIds, $storeId, $entityId, &$lastEntityId)
 {
     $products = array();
     $websiteId = Mage::app()->getStore($storeId)->getWebsiteId();
     $adapter = $this->_getReadAdapter();
     if ($productIds !== null) {
         if (!is_array($productIds)) {
             $productIds = array($productIds);
         }
     }
     $bind = array('website_id' => (int) $websiteId, 'entity_id' => (int) $entityId);
     $select = $adapter->select()->useStraightJoin(true)->from(array('e' => $this->getTable('catalog/product')), array('entity_id'))->join(array('w' => $this->getTable('catalog/product_website')), 'e.entity_id = w.product_id AND w.website_id = :website_id', array())->where('e.entity_id > :entity_id')->order('e.entity_id')->limit($this->_productLimit);
     if ($productIds !== null) {
         $select->where('e.entity_id IN(?)', $productIds);
     }
     $rowSet = $adapter->fetchAll($select, $bind);
     foreach ($rowSet as $row) {
         $product = new Varien_Object($row);
         $product->setIdFieldName('entity_id');
         $product->setCategoryIds(array());
         $product->setStoreId($storeId);
         $products[$product->getId()] = $product;
         $lastEntityId = $product->getId();
     }
     unset($rowSet);
     if ($products) {
         $select = $adapter->select()->from($this->getTable('catalog/category_product'), array('product_id', 'category_id'))->where('product_id IN(?)', array_keys($products));
         $categories = $adapter->fetchAll($select);
         foreach ($categories as $category) {
             $productId = $category['product_id'];
             $categoryIds = $products[$productId]->getCategoryIds();
             $categoryIds[] = $category['category_id'];
             $products[$productId]->setCategoryIds($categoryIds);
         }
         foreach (array('name', 'url_key', 'url_path') as $attributeCode) {
             $attributes = $this->_getProductAttribute($attributeCode, array_keys($products), $storeId);
             foreach ($attributes as $productId => $attributeValue) {
                 $products[$productId]->setData($attributeCode, $attributeValue);
             }
         }
     }
     return $products;
 }
开发者ID:quyip8818,项目名称:Mag,代码行数:52,代码来源:Url.php

示例15: _getProductEmulator

 /**
  * Retrieve Product Emulator (Varien Object)
  *
  * @param string $typeId
  * @return Varien_Object
  */
 protected function _getProductEmulator($typeId)
 {
     if (!isset($this->_productEmulators[$typeId])) {
         $productEmulator = new Varien_Object();
         $productEmulator->setIdFieldName('entity_id')->setTypeId($typeId);
         $this->_productEmulators[$typeId] = $productEmulator;
     }
     return $this->_productEmulators[$typeId];
 }
开发者ID:nemphys,项目名称:magento2,代码行数:15,代码来源:Fulltext.php


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