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


PHP Mage_Catalog_Model_Category::getStoreId方法代码示例

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


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

示例1: _getDirectUrl

 /**
  * Get direct URL to category
  *
  * @param Mage_Catalog_Model_Category $category
  * @return string
  */
 protected function _getDirectUrl(Mage_Catalog_Model_Category $category)
 {
     /** @var $helper Enterprise_Catalog_Helper_Data */
     $helper = $this->_factory->getHelper('enterprise_catalog');
     $requestPath = $helper->getCategoryRequestPath($category->getRequestPath(), $category->getStoreId());
     return $this->getUrlInstance()->getDirectUrl($requestPath);
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:13,代码来源:Url.php

示例2: getVirtualRule

 /**
  * Force the virtual rule to be loaded for a category.
  *
  * @param Mage_Catalog_Model_Category $category The category.
  *
  * @return Smile_VirtualCategories_Model_Rule
  */
 public function getVirtualRule($category)
 {
     $virtualRule = $category->getVirtualRule();
     if (!is_object($virtualRule)) {
         $cacheKey = $category->getId();
         if ($category->getStoreId()) {
             $cacheKey = $cacheKey . '_' . $category->getStoreId();
         }
         if (!isset($this->_categoryRulesCache[$cacheKey])) {
             $backend = Mage::getSingleton('smile_virtualcategories/category_attributes_backend_virtual');
             $backend->afterLoad($category);
             $this->_categoryRulesCache[$cacheKey] = $category->getVirtualRule();
         }
         $virtualRule = $this->_categoryRulesCache[$cacheKey];
     }
     return $virtualRule;
 }
开发者ID:diglin,项目名称:smile-magento-elasticsearch,代码行数:24,代码来源:Data.php

示例3: reindex

 /**
  * Reindex a single virtual category.
  *
  * @param Mage_Catalog_Model_Category $category The category.
  *
  * @return void
  */
 public function reindex($category)
 {
     /** Reindex all data from virtual categories products positions index */
     $engine = Mage::helper('catalogsearch')->getEngine();
     $mapping = $engine->getCurrentIndex()->getMapping('product');
     $dataprovider = $mapping->getDataProvider('virtual_categories_products_position');
     $dataprovider->updateAllData($category->getStoreId(), $category->getVirtualProductIds());
 }
开发者ID:manueltoniato,项目名称:smile-magento-elasticsearch,代码行数:15,代码来源:Position.php

示例4: getProductCountExcludeOutStock

 /**
  * Get products count in category
  *
  * @param Mage_Catalog_Model_Category $category
  * @return integer
  */
 public function getProductCountExcludeOutStock($category)
 {
     $read = $this->_getReadAdapter();
     $store_data = Mage::getModel('core/store')->load($category->getStoreId());
     //load store object
     $website_id = $store_data->getWebsiteId();
     //get website id from the store
     $select = $read->select()->from(array('main_table' => $this->getTable('catalog/category_product')), "COUNT(main_table.product_id)")->joinLeft(array('stock' => $this->getTable('cataloginventory/stock_status')), 'main_table.product_id=stock.product_id AND ' . $read->quoteInto('stock.website_id=? ', $website_id), array())->where("main_table.category_id = ?", $category->getId())->where("round(stock.qty) > 0 ")->where("stock.stock_status = ? ", 1)->group("main_table.category_id");
     //echo $select->__toString(); exit;
     return (int) $read->fetchOne($select);
 }
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:17,代码来源:Hidecategories.php

示例5: afterLoad

 /**
  * Unserializes the virtual category configuration after it has been loaded.
  *
  * @param Mage_Catalog_Model_Category $object Category saved.
  *
  * @return Smile_VirtualCategories_Model_Category_Attributes_Backend_Virtual
  */
 public function afterLoad($object)
 {
     $attributeCode = $this->getAttribute()->getName();
     $data = $object->getData($attributeCode);
     if ($data && is_string($data) && strlen($data)) {
         $data = unserialize($data);
     } else {
         $data = $this->_defaultValue;
     }
     $virtualCategoryRule = Mage::getModel('smile_virtualcategories/rule');
     if (isset($data['rule_serialized'])) {
         $virtualCategoryRule->getConditions()->setConditions(array())->loadArray($data['rule_serialized']);
         if ($object->getStoreId()) {
             $virtualCategoryRule->setStoreId($object->getStoreId());
         }
     }
     $virtualCategoryRule->setCategory($object);
     $object->setData('is_virtual', $data['is_virtual']);
     $object->setData('virtual_rule', $virtualCategoryRule);
     return $this;
 }
开发者ID:anndream,项目名称:smile-magento-elasticsearch,代码行数:28,代码来源:Virtual.php

示例6: loadByCategory

 /**
  * Load url rewrite based on specified category
  *
  * @param Mage_Core_Model_Abstract $object
  * @param Mage_Catalog_Model_Category $category
  * @return Enterprise_Catalog_Model_Resource_Category
  */
 public function loadByCategory(Mage_Core_Model_Abstract $object, Mage_Catalog_Model_Category $category)
 {
     $idField = $this->_getReadAdapter()->getIfNullSql('url_rewrite_cat.id', 'default_urc.id');
     $requestPath = $this->_getReadAdapter()->getIfNullSql('url_rewrite.request_path', 'default_ur.request_path');
     $select = $this->_getReadAdapter()->select()->from(array('main_table' => $this->getTable('catalog/category')), array($this->getIdFieldName() => $idField))->where('main_table.entity_id = ?', (int) $category->getId())->joinLeft(array('url_rewrite_cat' => $this->getTable('enterprise_catalog/category')), 'url_rewrite_cat.category_id = main_table.entity_id AND url_rewrite_cat.store_id = ' . (int) $category->getStoreId(), array(''))->joinLeft(array('url_rewrite' => $this->getTable('enterprise_urlrewrite/url_rewrite')), 'url_rewrite.url_rewrite_id = url_rewrite_cat.url_rewrite_id', array(''))->joinLeft(array('default_urc' => $this->getTable('enterprise_catalog/category')), 'default_urc.category_id = main_table.entity_id AND default_urc.store_id = 0', array(''))->joinLeft(array('default_ur' => $this->getTable('enterprise_urlrewrite/url_rewrite')), 'default_ur.url_rewrite_id = default_urc.url_rewrite_id', array('request_path' => $requestPath));
     $result = $this->_getReadAdapter()->fetchRow($select);
     if ($result) {
         $object->setData($result);
     }
     $this->unserializeFields($object);
     $this->_afterLoad($object);
     return $this;
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:20,代码来源:Category.php

示例7: getObject

 public function getObject(Mage_Catalog_Model_Category $category)
 {
     $storeId = $category->getStoreId();
     /** @var Algolia_Algoliasearch_Helper_Entity_Producthelper $productHelper */
     $productHelper = Mage::helper('algoliasearch/entity_producthelper');
     $collection = $productHelper->getProductCollectionQuery($storeId, null, true, true);
     $productCollection = clone $collection;
     $productCollection = $productCollection->addCategoryFilter($category);
     $category->setProductCount($productCollection->getSize());
     $transport = new Varien_Object();
     Mage::dispatchEvent('algolia_category_index_before', array('category' => $category, 'custom_data' => $transport));
     $customData = $transport->getData();
     $category->getUrlInstance()->setStore($storeId);
     $path = '';
     foreach ($category->getPathIds() as $categoryId) {
         if ($path != '') {
             $path .= ' / ';
         }
         $path .= $this->getCategoryName($categoryId, $storeId);
     }
     $data = array('objectID' => $category->getId(), 'name' => $category->getName(), 'path' => $path, 'level' => $category->getLevel(), 'url' => $category->getUrl(), 'include_in_menu' => $category->getIncludeInMenu(), '_tags' => array('category'), 'popularity' => 1, 'product_count' => $category->getProductCount());
     try {
         $imageUrl = $this->getThumbnailUrl($category) ?: $category->getImageUrl();
         if ($imageUrl) {
             /** @var Algolia_Algoliasearch_Helper_Image $imageHelper */
             $imageHelper = Mage::helper('algoliasearch/image');
             $data['image_url'] = $imageHelper->removeProtocol($imageUrl);
         }
     } catch (\Exception $e) {
         // no image, no default, not fatal
     }
     foreach ($this->config->getCategoryAdditionalAttributes($storeId) as $attribute) {
         $value = $category->getData($attribute['attribute']);
         $attribute_resource = $category->getResource()->getAttribute($attribute['attribute']);
         if ($attribute_resource) {
             $value = $attribute_resource->getFrontend()->getValue($category);
         }
         if (isset($data[$attribute['attribute']])) {
             $value = $data[$attribute['attribute']];
         }
         if ($value) {
             $data[$attribute['attribute']] = $value;
         }
     }
     $data = array_merge($data, $customData);
     foreach ($data as &$data0) {
         $data0 = $this->try_cast($data0);
     }
     return $data;
 }
开发者ID:algolia,项目名称:algoliasearch-magento,代码行数:50,代码来源:Categoryhelper.php

示例8: getObject

 public function getObject(Mage_Catalog_Model_Category $category)
 {
     /** @var $productCollection Mage_Catalog_Model_Resource_Product_Collection */
     $productCollection = $category->getProductCollection();
     $productCollection = $productCollection->addMinimalPrice();
     $category->setProductCount($productCollection->getSize());
     $transport = new Varien_Object();
     Mage::dispatchEvent('algolia_category_index_before', array('category' => $category, 'custom_data' => $transport));
     $customData = $transport->getData();
     $storeId = $category->getStoreId();
     $category->getUrlInstance()->setStore($storeId);
     $path = '';
     foreach ($category->getPathIds() as $categoryId) {
         if ($path != '') {
             $path .= ' / ';
         }
         $path .= $this->getCategoryName($categoryId, $storeId);
     }
     $image_url = NULL;
     try {
         $image_url = $category->getImageUrl();
     } catch (Exception $e) {
         /* no image, no default: not fatal */
     }
     $data = array('objectID' => $category->getId(), 'name' => $category->getName(), 'path' => $path, 'level' => $category->getLevel(), 'url' => Mage::getBaseUrl() . $category->getRequestPath(), '_tags' => array('category'), 'popularity' => 1, 'product_count' => $category->getProductCount());
     if (!empty($image_url)) {
         $data['image_url'] = $image_url;
     }
     foreach ($this->config->getCategoryAdditionalAttributes($storeId) as $attribute) {
         $value = $category->getData($attribute['attribute']);
         $attribute_ressource = $category->getResource()->getAttribute($attribute['attribute']);
         if ($attribute_ressource) {
             $value = $attribute_ressource->getFrontend()->getValue($category);
         }
         if (isset($data[$attribute['attribute']])) {
             $value = $data[$attribute['attribute']];
         }
         if ($value) {
             $data[$attribute['attribute']] = $value;
         }
     }
     $data = array_merge($data, $customData);
     foreach ($data as &$data0) {
         $data0 = $this->try_cast($data0);
     }
     return $data;
 }
开发者ID:IvanRybakov,项目名称:algoliasearch-magento,代码行数:47,代码来源:Categoryhelper.php

示例9: getChildren

 /**
  * Return children ids of category
  *
  * @param Mage_Catalog_Model_Category $category
  * @param boolean $recursive
  * @return array
  */
 public function getChildren($category, $recursive = true)
 {
     $attributeId = $this->_getIsActiveAttributeId();
     $select = $this->_getReadAdapter()->select()->from(array('m' => $this->getEntityTable()), 'entity_id')->joinLeft(array('d' => $this->getEntityTable() . '_int'), "d.attribute_id = '{$attributeId}' AND d.store_id = 0 AND d.entity_id = m.entity_id", array())->joinLeft(array('c' => $this->getEntityTable() . '_int'), "c.attribute_id = '{$attributeId}' AND c.store_id = '{$category->getStoreId()}' AND c.entity_id = m.entity_id", array())->where('(IFNULL(c.value, d.value) = ?)', '1')->where('path LIKE ?', "{$category->getPath()}/%");
     if (!$recursive) {
         $select->where('level <= ?', $category->getLevel() + 1);
     }
     $_categories = $this->_getReadAdapter()->fetchAll($select);
     $categoriesIds = array();
     foreach ($_categories as $_category) {
         $categoriesIds[] = $_category['entity_id'];
     }
     return $categoriesIds;
     //        $this->_getTree()->load();
     //        return $this->_getTree()->getChildren($category->getId(), false);
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:23,代码来源:Resource_Eav_Mysql4_Category.php

示例10: hasCustomPositions

 /**
  * Verify if a given category has custom positions defined for products
  *
  * @param Mage_Catalog_Model_Category $category The concerned category
  *
  * @return bool
  */
 public function hasCustomPositions($category)
 {
     $result = false;
     if ($category->getId()) {
         $adapter = $this->_getReadAdapter();
         $select = $adapter->select();
         $storeIds = array_unique(array_map("intval", array(Mage_Core_Model_App::ADMIN_STORE_ID, $category->getStoreId())));
         $select->from(array("main_table" => $this->getMainTable()));
         $select->where('category_id = ?', (int) $category->getId());
         $select->where('store_id IN (?)', $storeIds);
         $result = $adapter->fetchRow($select) !== false;
     }
     return $result;
 }
开发者ID:manueltoniato,项目名称:smile-magento-elasticsearch,代码行数:21,代码来源:Position.php

示例11: getStoreIds

 /**
  * Get store identifiers where category is presented
  *
  * @param   Mage_Catalog_Model_Category $category
  * @return  array
  */
 public function getStoreIds($category)
 {
     if (!$category->getId()) {
         return array();
     }
     $nodePath = $this->_getTree()->getNodeById($category->getId())->getPath();
     $nodes = array();
     foreach ($nodePath as $node) {
         $nodes[] = $node->getId();
     }
     $stores = array();
     $storeCollection = Mage::getModel('core/store')->getCollection()->loadByCategoryIds($nodes);
     foreach ($storeCollection as $store) {
         $stores[$store->getId()] = $store->getId();
     }
     $entityStoreId = $category->getStoreId();
     if (!in_array($entityStoreId, $stores)) {
         array_unshift($stores, $entityStoreId);
     }
     if (!in_array(0, $stores)) {
         array_unshift($stores, 0);
     }
     return $stores;
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:30,代码来源:Category.php

示例12: processCategory

 /**
  * Update category url key
  *
  * @param Mage_Catalog_Model_Category $category
  * @param string $newUrlKey
  * @param int $storeId
  */
 function processCategory($category, $newUrlKey, $storeId)
 {
     $store = Mage::app()->getStore();
     Mage::app()->setCurrentStore(Mage::app()->getStore(0));
     if (!$this->isEntityProcessed(self::ENTITY_TYPE_CATEGORY, $category->getId() . '-' . $storeId) && !preg_match('~-[a-f0-9]{32}$~i', $newUrlKey)) {
         $category->setStoreId($storeId);
         $category->setUrlKey($newUrlKey . '-' . md5($category->getStoreId() . $category->getId()));
         $category->save();
         $this->_reindexCategory($category->getId());
         $category->unsetData('request_path');
         $category->unsetData('url');
         $this->markEntityProcessed(self::ENTITY_TYPE_CATEGORY, $category->getId() . '-' . $category->getStoreId());
     }
     Mage::app()->setCurrentStore($store);
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:22,代码来源:Migration.php

示例13: getDesignUpdateData

 /**
  * Get design update data of parent categories
  *
  * @param Mage_Catalog_Model_Category $category
  * @return array
  */
 public function getDesignUpdateData($category)
 {
     $categories = array();
     $pathIds = array();
     foreach (array_reverse($category->getParentIds()) as $pathId) {
         if ($pathId == AO::app()->getStore()->getRootCategoryId()) {
             $pathIds[] = $pathId;
             break;
         }
         $pathIds[] = $pathId;
     }
     $select = $this->_getReadAdapter()->select()->from(array('main_table' => $this->getMainStoreTable($category->getStoreId())), array('main_table.entity_id', 'main_table.custom_design', 'main_table.custom_design_apply', 'main_table.custom_design_from', 'main_table.custom_design_to'))->where('main_table.entity_id IN (?)', $pathIds)->where('main_table.is_active = ?', '1')->order('main_table.path DESC');
     $result = $this->_getReadAdapter()->fetchAll($select);
     foreach ($result as $row) {
         $row['id'] = $row['entity_id'];
         $categories[$row['entity_id']] = AO::getModel('catalog/category')->setData($row);
     }
     return $categories;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:25,代码来源:Resource_Eav_Mysql4_Category_Flat.php

示例14: loadByCategory

 /**
  * @param Mage_Catalog_Model_Category|Varien_Data_Tree_Node $category
  * @return $this
  */
 public function loadByCategory($category)
 {
     $this->_getResource()->loadByCategory($this, $category->getId(), $category->getStoreId());
     $this->_afterLoad();
     return $this;
 }
开发者ID:OurLaborisJoy,项目名称:FireGento_FlexCms,代码行数:10,代码来源:Changes.php

示例15: _getCategoryPath

 /**
  * @param Mage_Catalog_Model_Category $category
  * @return string
  */
 protected function _getCategoryPath($category)
 {
     $categoryPathIds = $category->getPathIds();
     array_shift($categoryPathIds);
     $categoryNames = array();
     foreach ($categoryPathIds as $categoryId) {
         $categoryNames[] = Mage::getResourceSingleton('catalog/category')->getAttributeRawValue($categoryId, 'name', $category->getStoreId());
     }
     return implode(' > ', $categoryNames);
 }
开发者ID:par-orillonsoft,项目名称:FireGento_FlexCms,代码行数:14,代码来源:PublishController.php


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