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


PHP Mage_Core_Model_Website::getDefaultStore方法代码示例

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


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

示例1: _prepareTemporarySelect

 /**
  * Prepare temporary data
  *
  * @param Mage_Core_Model_Website $website
  * @return Varien_Db_Select
  */
 protected function _prepareTemporarySelect(Mage_Core_Model_Website $website)
 {
     /** @var $catalogFlatHelper Mage_Catalog_Helper_Product_Flat */
     $catalogFlatHelper = $this->_factory->getHelper('catalog/product_flat');
     /** @var $eavConfig Mage_Eav_Model_Config */
     $eavConfig = $this->_factory->getSingleton('eav/config');
     $priceAttribute = $eavConfig->getAttribute(Mage_Catalog_Model_Product::ENTITY, 'price');
     //magebrew: get Cost attribute
     $costAttribute = $eavConfig->getAttribute(Mage_Catalog_Model_Product::ENTITY, 'cost');
     $select = $this->_connection->select()->from(array('rp' => $this->_resource->getTable('catalogrule/rule_product')), array())->joinInner(array('r' => $this->_resource->getTable('catalogrule/rule')), 'r.rule_id = rp.rule_id', array())->where('rp.website_id = ?', $website->getId())->order(array('rp.product_id', 'rp.customer_group_id', 'rp.sort_order', 'rp.rule_product_id'))->joinLeft(array('pg' => $this->_resource->getTable('catalog/product_attribute_group_price')), 'pg.entity_id = rp.product_id AND pg.customer_group_id = rp.customer_group_id' . ' AND pg.website_id = rp.website_id', array())->joinLeft(array('pgd' => $this->_resource->getTable('catalog/product_attribute_group_price')), 'pgd.entity_id = rp.product_id AND pgd.customer_group_id = rp.customer_group_id' . ' AND pgd.website_id = 0', array());
     $storeId = $website->getDefaultStore()->getId();
     if ($catalogFlatHelper->isEnabled() && $storeId && $catalogFlatHelper->isBuilt($storeId)) {
         $select->joinInner(array('p' => $this->_resource->getTable('catalog/product_flat') . '_' . $storeId), 'p.entity_id = rp.product_id', array());
         $priceColumn = $this->_connection->getIfNullSql($this->_connection->getIfNullSql('pg.value', 'pgd.value'), 'p.price');
         //magebrew: Cost column select for Flat catalog
         $costColumn = $this->_connection->getIfNullSql('p.cost', 0);
     } else {
         $select->joinInner(array('pd' => $this->_resource->getTable(array('catalog/product', $priceAttribute->getBackendType()))), 'pd.entity_id = rp.product_id AND pd.store_id = 0 AND pd.attribute_id = ' . $priceAttribute->getId(), array())->joinLeft(array('p' => $this->_resource->getTable(array('catalog/product', $priceAttribute->getBackendType()))), 'p.entity_id = rp.product_id AND p.store_id = ' . $storeId . ' AND p.attribute_id = pd.attribute_id', array())->joinLeft(array('pc' => $this->_resource->getTable(array('catalog/product', $costAttribute->getBackendType()))), 'pc.entity_id = rp.product_id AND pc.store_id = 0 AND pc.attribute_id = ' . $costAttribute->getId(), array());
         $priceColumn = $this->_connection->getIfNullSql($this->_connection->getIfNullSql('pg.value', 'pgd.value'), $this->_connection->getIfNullSql('p.value', 'pd.value'));
         //magebrew: Cost column select for Eav catalog
         $costColumn = $this->_connection->getIfNullSql('pc.value', 0);
     }
     $select->columns(array('grouped_id' => $this->_connection->getConcatSql(array('rp.product_id', 'rp.customer_group_id'), '-'), 'product_id' => 'rp.product_id', 'customer_group_id' => 'rp.customer_group_id', 'from_date' => 'r.from_date', 'to_date' => 'r.to_date', 'action_amount' => 'rp.action_amount', 'action_operator' => 'rp.action_operator', 'action_stop' => 'rp.action_stop', 'sort_order' => 'rp.sort_order', 'price' => $priceColumn, 'cost' => $costColumn, 'rule_product_id' => 'rp.rule_product_id', 'from_time' => 'rp.from_time', 'to_time' => 'rp.to_time'));
     return $select;
 }
开发者ID:magebrew,项目名称:CatalogRule,代码行数:31,代码来源:Refresh.php

示例2: send

 /**
  * Send customer email
  *
  * @return bool
  */
 public function send()
 {
     if (is_null($this->_website) || is_null($this->_customer)) {
         return false;
     }
     if ($this->_type == 'price' && count($this->_priceProducts) == 0 || $this->_type == 'stock' && count($this->_stockProducts) == 0) {
         return false;
     }
     if (!$this->_website->getDefaultGroup() || !$this->_website->getDefaultGroup()->getDefaultStore()) {
         return false;
     }
     $store = $this->_website->getDefaultStore();
     $storeId = $store->getId();
     if ($this->_type == 'price' && !Mage::getStoreConfig(self::XML_PATH_EMAIL_PRICE_TEMPLATE, $storeId)) {
         return false;
     } elseif ($this->_type == 'stock' && !Mage::getStoreConfig(self::XML_PATH_EMAIL_STOCK_TEMPLATE, $storeId)) {
         return false;
     }
     // set design parameters, required for email (remember current)
     $currentDesign = Mage::getDesign()->setAllGetOld(array('store' => $storeId, 'area' => 'frontend', 'package' => Mage::getStoreConfig('design/package/name', $storeId)));
     Mage::app()->getLocale()->emulate($storeId);
     $translate = Mage::getSingleton('core/translate');
     /* @var $translate Mage_Core_Model_Translate */
     $translate->setTranslateInline(false);
     if ($this->_type == 'price') {
         $this->_getPriceBlock()->setStore($store)->reset();
         foreach ($this->_priceProducts as $product) {
             $product->setCustomerGroupId($this->_customer->getGroupId());
             $this->_getPriceBlock()->addProduct($product);
         }
         $block = $this->_getPriceBlock()->toHtml();
         $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_PRICE_TEMPLATE, $storeId);
     } elseif ($this->_type == 'stock') {
         $this->_getStockBlock()->setStore($store)->reset();
         foreach ($this->_stockProducts as $product) {
             $product->setCustomerGroupId($this->_customer->getGroupId());
             $this->_getStockBlock()->addProduct($product);
         }
         $block = $this->_getStockBlock()->toHtml();
         $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_STOCK_TEMPLATE, $storeId);
     } else {
         Mage::app()->getLocale()->revert();
         return false;
     }
     Mage::getModel('core/email_template')->setDesignConfig(array('area' => 'frontend', 'store' => $storeId))->sendTransactional($templateId, Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId), $this->_customer->getEmail(), $this->_customer->getName(), array('customerName' => $this->_customer->getName(), 'alertGrid' => $block));
     $translate->setTranslateInline(true);
     // revert current design
     Mage::getDesign()->setAllGetOld($currentDesign);
     Mage::app()->getLocale()->revert();
     return true;
 }
开发者ID:hunnybohara,项目名称:magento-chinese-localization,代码行数:56,代码来源:Email.php

示例3: send

 /**
  * Send customer email
  *
  * @return bool
  */
 public function send()
 {
     if (is_null($this->_website) || is_null($this->_customer)) {
         return false;
     }
     if ($this->_type == 'price' && count($this->_priceProducts) == 0 || $this->_type == 'stock' && count($this->_stockProducts) == 0) {
         return false;
     }
     if (!$this->_website->getDefaultGroup() || !$this->_website->getDefaultGroup()->getDefaultStore()) {
         return false;
     }
     $store = $this->_website->getDefaultStore();
     $storeId = $store->getId();
     if ($this->_type == 'price' && !Mage::getStoreConfig(self::XML_PATH_EMAIL_PRICE_TEMPLATE, $storeId)) {
         return false;
     } elseif ($this->_type == 'stock' && !Mage::getStoreConfig(self::XML_PATH_EMAIL_STOCK_TEMPLATE, $storeId)) {
         return false;
     }
     if ($this->_type != 'price' && $this->_type != 'stock') {
         return false;
     }
     $appEmulation = Mage::getSingleton('core/app_emulation');
     $initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
     if ($this->_type == 'price') {
         $this->_getPriceBlock()->setStore($store)->reset();
         foreach ($this->_priceProducts as $product) {
             $product->setCustomerGroupId($this->_customer->getGroupId());
             $this->_getPriceBlock()->addProduct($product);
         }
         $block = $this->_getPriceBlock()->toHtml();
         $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_PRICE_TEMPLATE, $storeId);
     } else {
         $this->_getStockBlock()->setStore($store)->reset();
         foreach ($this->_stockProducts as $product) {
             $product->setCustomerGroupId($this->_customer->getGroupId());
             $this->_getStockBlock()->addProduct($product);
         }
         $block = $this->_getStockBlock()->toHtml();
         $templateId = Mage::getStoreConfig(self::XML_PATH_EMAIL_STOCK_TEMPLATE, $storeId);
     }
     $appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo);
     Mage::getModel('core/email_template')->setDesignConfig(array('area' => 'frontend', 'store' => $storeId))->sendTransactional($templateId, Mage::getStoreConfig(self::XML_PATH_EMAIL_IDENTITY, $storeId), $this->_customer->getEmail(), $this->_customer->getName(), array('customerName' => $this->_customer->getName(), 'alertGrid' => $block));
     return true;
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:49,代码来源:Email.php

示例4: _addWebsiteFieldset

 /**
  * Method add website fieldset to the form.
  * @param Mage_Core_Model_Website $website
  */
 private function _addWebsiteFieldset($website, $form)
 {
     $prefixWeb = 'website-' . $website->getCode();
     /* make fieldset */
     $layoutFieldset = $form->addFieldset($prefixWeb . '_fieldset', array('legend' => Mage::helper('mturbo')->__($website->getName() . ' settings'), 'class' => 'fieldset'));
     /* add extra user control */
     $layoutFieldset->addType('html_element', Artio_MTurbo_Helper_Data::FORM_HTML);
     $layoutFieldset->addType('widget_button', Artio_MTurbo_Helper_Data::FORM_WIDGET_BUTTON);
     /* indicator whether website is enabled */
     $layoutFieldset->addField($prefixWeb . '-enabled', 'select', array('name' => $prefixWeb . '-enabled', 'label' => Mage::helper('mturbo')->__('Enable website') . ':', 'value' => '1', 'options' => array(0 => Mage::helper('mturbo')->__('No'), 1 => Mage::helper('mturbo')->__('Yes'))));
     /* add field for turbopath */
     $layoutFieldset->addField($prefixWeb . '-base_dir', 'text', array('name' => $prefixWeb . '-base_dir', 'value' => Mage::getBaseDir(), 'label' => Mage::helper('mturbo')->__('Base directory') . ':'));
     /* add field for server name */
     $layoutFieldset->addField($prefixWeb . '-server_name', 'text', array('name' => $prefixWeb . '-server_name', 'value' => Mage::helper('mturbo/website')->getServerName($website->getDefaultStore()->getCode()), 'label' => Mage::helper('mturbo')->__('Server name') . ':'));
     /* every store has one select determines whether enabled is */
     foreach ($website->getStores() as $store) {
         if ($store->getIsActive()) {
             $layoutFieldset->addField($prefixWeb . '-store-' . $store->getCode(), 'select', array('name' => $prefixWeb . '-store-' . $store->getCode(), 'label' => $store->getGroup()->getName() . '<br />' . $store->getName(), 'value' => '1', 'options' => array(0 => Mage::helper('mturbo')->__('No'), 1 => Mage::helper('mturbo')->__('Yes'))));
         }
     }
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:25,代码来源:Form.php

示例5: _calculateSpecialPrice

 /**
  * Apply special price
  *
  * @param float $finalPrice
  * @param array $priceData
  * @param Mage_Core_Model_Website $website
  * @return float
  */
 public function _calculateSpecialPrice($finalPrice, array $priceData, Mage_Core_Model_Website $website)
 {
     $store = $website->getDefaultStore();
     $specialPrice = $priceData['special_price'];
     if (!is_null($specialPrice) && $specialPrice != false) {
         if (Mage::app()->getLocale()->isStoreDateInInterval($store, $priceData['special_from_date'], $priceData['special_to_date'])) {
             $specialPrice = $finalPrice * $specialPrice / 100;
             $finalPrice = min($finalPrice, $specialPrice);
         }
     }
     return $finalPrice;
 }
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:20,代码来源:Index.php

示例6: testGetDefaultStore

 public function testGetDefaultStore()
 {
     $defaultStore = $this->_model->getDefaultStore();
     $this->assertInstanceOf('Mage_Core_Model_Store', $defaultStore);
     $this->assertEquals(1, $defaultStore->getId());
 }
开发者ID:natxetee,项目名称:magento2,代码行数:6,代码来源:WebsiteTest.php

示例7: _walkCollectionRelation

 /**
  * Walk Product Collection for Relation Parent products
  *
  * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
  * @param Mage_Core_Model_Store|Mage_Core_Model_Website $store
  * @param array $attributes
  * @param array $prices
  * @return Mage_CatalogIndex_Model_Indexer
  */
 public function _walkCollectionRelation($collection, $store, $attributes = array(), $prices = array())
 {
     if ($store instanceof Mage_Core_Model_Website) {
         $storeObject = $store->getDefaultStore();
     } elseif ($store instanceof Mage_Core_Model_Store) {
         $storeObject = $store;
     }
     $statusCond = array('in' => Mage::getSingleton('catalog/product_status')->getSaleableStatusIds());
     $productCount = $collection->getSize();
     $iterateCount = $productCount / self::STEP_SIZE;
     for ($i = 0; $i < $iterateCount; $i++) {
         $stepData = $collection->getAllIds(self::STEP_SIZE, $i * self::STEP_SIZE);
         foreach ($this->_getPriorifiedProductTypes() as $type) {
             $retriever = $this->getRetreiver($type);
             if (!$retriever->getTypeInstance()->isComposite()) {
                 continue;
             }
             $parentIds = $retriever->getTypeInstance()->getParentIdsByChild($stepData);
             if ($parentIds) {
                 $parentCollection = $this->_getProductCollection($storeObject, $parentIds);
                 $parentCollection->addAttributeToFilter('status', $statusCond);
                 $parentCollection->addFieldToFilter('type_id', $type);
                 $this->_walkCollection($parentCollection, $storeObject, $attributes, $prices);
                 $this->_afterPlainReindex($store, $parentIds);
             }
         }
     }
     return $this;
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:38,代码来源:Indexer.php


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