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


PHP Mage_Core_Model_Website::getId方法代码示例

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


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

示例1: testLoad

 public function testLoad()
 {
     /* Test loading by id */
     $this->assertEquals(1, $this->_model->getId());
     $this->assertEquals('base', $this->_model->getCode());
     $this->assertEquals('Main Website', $this->_model->getName());
     /* Test loading by code */
     $this->_model->load('admin');
     $this->assertEquals(0, $this->_model->getId());
     $this->assertEquals('admin', $this->_model->getCode());
     $this->assertEquals('Admin', $this->_model->getName());
 }
开发者ID:natxetee,项目名称:magento2,代码行数:12,代码来源:WebsiteTest.php

示例2: _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

示例3: _saveWebsiteConfigItems

 private function _saveWebsiteConfigItems(array $configs, Mage_Core_Model_Website $website)
 {
     try {
         if (!$website->getId()) {
             throw new Exception($this->__('Website does not exist'));
         }
         if (!empty($configs)) {
             foreach ($configs as $config) {
                 if (isset($config['encrypted']) && $config['encrypted'] == 1) {
                     $config['value'] = Mage::helper('core')->encrypt($config['value']);
                 }
                 // Save config
                 $this->_checkAndSaveConfig($config['path'], $config['value'], 'websites', $website->getId(), $website->getCode());
             }
         }
     } catch (Exception $e) {
         $this->log($e->getMessage());
     }
 }
开发者ID:ThomasNegeli,项目名称:magento-configurator,代码行数:19,代码来源:Config.php

示例4: _getCollection

 /**
  * filter $collection by the cutoff date.
  * @param  string                    $cutoffDate
  * @param  Mage_Core_Model_Website   $website
  * @return Varien_Data_Collection_Db
  */
 protected function _getCollection($cutoffDate, Mage_Core_Model_Website $website)
 {
     $collection = Mage::getResourceModel('catalog/product_collection');
     $collection->addAttributeToSelect('entity_id');
     if ($cutoffDate) {
         $collection->addFieldToFilter('updated_at', array('gteq' => $cutoffDate));
     }
     $collection->addWebsiteFilter(array($website->getId()));
     return $collection;
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:16,代码来源:Price.php

示例5: clearWebsiteCache

 /**
  *  Unset website by id from app cache
  *
  * @param null|bool|int|string|Mage_Core_Model_Website $id
  * @return void
  */
 public function clearWebsiteCache($id = null)
 {
     if (is_null($id)) {
         $id = $this->getStore()->getWebsiteId();
     } elseif ($id instanceof Mage_Core_Model_Website) {
         $id = $id->getId();
     } elseif ($id === true) {
         $id = $this->_website->getId();
     }
     if (!empty($this->_websites[$id])) {
         $website = $this->_websites[$id];
         unset($this->_websites[$website->getWebsiteId()]);
         unset($this->_websites[$website->getCode()]);
     }
 }
开发者ID:mswebdesign,项目名称:Mswebdesign_Magento_1_Community_Edition,代码行数:21,代码来源:App.php

示例6: _exportQuoteForWebsite

 /**
  * export quotes to website
  *
  * @param Mage_Core_Model_Website $website
  */
 protected function _exportQuoteForWebsite(Mage_Core_Model_Website $website)
 {
     try {
         //reset quotes
         $this->_quotes = array();
         $this->_quoteIds = array();
         $websiteId = $website->getId();
         $limit = Mage::helper('ddg')->getWebsiteConfig(Dotdigitalgroup_Email_Helper_Config::XML_PATH_CONNECTOR_TRANSACTIONAL_DATA_SYNC_LIMIT, $website);
         $collection = $this->_getQuoteToImport($website, $limit);
         $ids = $collection->getColumnValues('quote_id');
         $quotes = Mage::getModel('sales/quote')->getCollection()->addFieldToFilter('entity_id', array('in' => $ids));
         foreach ($quotes as $quote) {
             $connectorQuote = Mage::getModel('ddg_automation/connector_quote', $quote);
             $this->_quotes[$websiteId][] = $connectorQuote;
             $this->_quoteIds[] = $quote->getId();
             $this->_count++;
         }
     } catch (Exception $e) {
         Mage::logException($e);
     }
 }
开发者ID:dotmailer,项目名称:dotmailer-magento-extension,代码行数:26,代码来源:Quote.php

示例7: getAcceptedSaveCookiesWebsiteIds

 /**
  * Return serialized list of accepted save cookie website
  *
  * @return string
  */
 public function getAcceptedSaveCookiesWebsiteIds()
 {
     $acceptedSaveCookiesWebsites = $this->_getAcceptedSaveCookiesWebsites();
     $acceptedSaveCookiesWebsites[$this->_website->getId()] = 1;
     return json_encode($acceptedSaveCookiesWebsites);
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:11,代码来源:Cookie.php

示例8: setWebsite

 /**
  * Set Website scope
  *
  * @param Mage_Core_Model_Website|int $website
  * @return Mage_Eav_Model_Resource_Attribute_Collection
  */
 public function setWebsite($website)
 {
     $this->_website = Mage::app()->getWebsite($website);
     $this->addBindParam('scope_website_id', $this->_website->getId());
     return $this;
 }
开发者ID:relue,项目名称:magento2,代码行数:12,代码来源:Collection.php

示例9: _removeOldIndexData

 /**
  * Remove old index data
  *
  * @param Mage_Core_Model_Website $website
  */
 protected function _removeOldIndexData(Mage_Core_Model_Website $website)
 {
     $this->_connection->delete($this->_resource->getTable('catalogrule/rule_product_price'), array('website_id = ?' => $website->getId()));
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:9,代码来源:Refresh.php

示例10: _removeOldIndexData

 /**
  * Remove old index data
  *
  * @param Mage_Core_Model_Website $website
  */
 protected function _removeOldIndexData(Mage_Core_Model_Website $website)
 {
     $this->_connection->query($this->_connection->deleteFromSelect($this->_connection->select()->from($this->_resource->getTable('catalogrule/rule_product_price'))->where('product_id IN (?)', $this->_productId)->where('website_id = ?', $website->getId()), $this->_resource->getTable('catalogrule/rule_product_price')));
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:9,代码来源:Row.php

示例11: addStockStatusToSelect

 /**
  * Add stock status to prepare index select
  *
  * @param Varien_Db_Select $select
  * @param Mage_Core_Model_Website $website
  * @return Mage_CatalogInventory_Model_Resource_Stock_Status
  */
 public function addStockStatusToSelect(Varien_Db_Select $select, Mage_Core_Model_Website $website)
 {
     $websiteId = $website->getId();
     $select->joinLeft(array('stock_status' => $this->getMainTable()), 'e.entity_id = stock_status.product_id AND stock_status.website_id=' . $websiteId, array('salable' => 'stock_status.stock_status'));
     return $this;
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:13,代码来源:Status.php

示例12: isWebsiteAssignedToProduct

 /**
  * Validate is valid association for website unassignment from product.
  * If fails validation, then this method returns false, and
  * getErrors() will return an array of errors that explain why the
  * validation failed.
  *
  * @param Mage_Core_Model_Website $website
  * @param Mage_Catalog_Model_Product $product
  * @return bool
  */
 public function isWebsiteAssignedToProduct(Mage_Core_Model_Website $website, Mage_Catalog_Model_Product $product)
 {
     if (false === array_search($website->getId(), $product->getWebsiteIds())) {
         $this->_addError(sprintf('Product #%d isn\'t assigned to website #%d', $product->getId(), $website->getId()));
     }
     return !count($this->getErrors());
 }
开发者ID:SalesOneGit,项目名称:s1_magento,代码行数:17,代码来源:Website.php

示例13: _saveUrlsInSystemConfig

 /**
  * Process core config data
  *
  * @param Mage_Core_Model_Website   $stagingWebsite
  * @param string $originalBaseUrl
  * @param string $baseUrl
  * @param string $mode
  * @param Varien_Simplexml_Element  $xmlConfig
  */
 protected function _saveUrlsInSystemConfig($stagingWebsite, $originalBaseUrl, $baseUrl, $mode = 'unsecure', $xmlConfig)
 {
     foreach ($xmlConfig->children() as $nodeName => $nodeValue) {
         if ($mode == 'secure' || $mode == 'unsecure') {
             if ($nodeName == 'base_url' || $nodeName == 'base_web_url' || $nodeName == 'base_link_url') {
                 $nodeValue = $baseUrl;
             } elseif ($mode == 'unsecure') {
                 if (strpos($nodeValue, '{{unsecure_base_url}}') !== false) {
                     $nodeValue = str_replace('{{unsecure_base_url}}', $originalBaseUrl, $nodeValue);
                 }
             } elseif ($mode == 'secure') {
                 if (strpos($nodeValue, '{{secure_base_url}}') !== false) {
                     $nodeValue = str_replace('{{secure_base_url}}', $originalBaseUrl, $nodeValue);
                 }
             }
         }
         $config = Mage::getModel('core/config_data');
         $path = 'web/' . $mode . '/' . $nodeName;
         $config->setPath($path);
         $config->setScope('websites');
         $config->setScopeId($stagingWebsite->getId());
         $config->setValue($nodeValue);
         $config->save();
     }
     return $this;
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:35,代码来源:Website.php

示例14: __addUpdateStoreGroup

 /**
  * @param array $sgConfig
  * @param Mage_Core_Model_Website $website
  * @return Mage_Core_Model_Store_Group
  */
 private function __addUpdateStoreGroup($sgConfig, $website)
 {
     // See if the store group exists otherwise create a store group
     $storeGroup = Mage::getModel('core/store_group')->load($sgConfig['name'], 'name');
     if ($storeGroup->getId()) {
         if ($storeGroup->getWebsiteId() != $website->getId() || $storeGroup->getRootCategoryId() != $sgConfig['root_category_id']) {
             $storeGroup->setWebsiteId($website->getId())->setRootCategoryId($sgConfig['root_category_id'])->save();
             $this->log("Updated store group " . $storeGroup->getName());
         }
     } else {
         $storeGroup = Mage::getModel('core/store_group');
         $storeGroup->setWebsiteId($website->getId())->setName($sgConfig['name'])->setRootCategoryId($sgConfig['root_category_id'])->save();
         $this->log("Created store group " . $storeGroup->getName());
     }
     return $storeGroup;
 }
开发者ID:mblarsen,项目名称:magento-configurator,代码行数:21,代码来源:Website.php

示例15: getProductsSalableStatus

 /**
  * Retrieve salable product statuses
  *
  * @param int|array $products
  * @param Mage_Core_Model_Website $website
  * @return array
  */
 public function getProductsSalableStatus($products, Mage_Core_Model_Website $website)
 {
     $read = $this->_getReadAdapter();
     $productsData = array();
     $select = $read->select()->from(array('e' => $this->getTable('catalog/product')), 'entity_id')->where('e.entity_id IN(?)', $products);
     // add belong to website
     $select->joinLeft(array('pw' => $this->getTable('catalog/product_website')), 'e.entity_id=pw.product_id AND pw.website_id=:website_id', array('pw.website_id'));
     $store = $website->getDefaultStore();
     // add product status
     $status = $this->_getAttribute('status');
     if ($status->isScopeGlobal()) {
         $select->join(array('t_status' => $status->getBackend()->getTable()), 'e.entity_id=t_status.entity_id' . ' AND t_status.attribute_id=:status_attribute_id' . ' AND t_status.store_id=0', array('status' => 't_status.value'));
     } else {
         $statusField = $read->getCheckSql('t2_status.value_id > 0', 't2_status.value', 't1_status.value');
         $statusTable = $status->getBackend()->getTable();
         $select->join(array('t1_status' => $statusTable), 'e.entity_id=t1_status.entity_id' . ' AND t1_status.attribute_id=:status_attribute_id' . ' AND t1_status.store_id=0', array('status' => $statusField))->joinLeft(array('t2_status' => $statusTable), 't1_status.entity_id = t2_status.entity_id' . ' AND t1_status.attribute_id = t2_status.attribute_id' . ' AND t2_status.store_id=:store_id', array());
     }
     $bind = array('status_attribute_id' => $status->getAttributeId(), 'website_id' => $website->getId(), 'store_id' => $store->getId());
     Mage::dispatchEvent('catalog_product_prepare_index_select', array('website' => $website, 'select' => $select, 'bind' => $bind));
     $query = $read->query($select, $bind);
     while ($row = $query->fetch()) {
         $salable = isset($row['salable']) ? $row['salable'] : true;
         $website = $row['website_id'] > 0 ? true : false;
         $status = $row['status'];
         $productsData[$row['entity_id']] = $salable && $status && $website;
     }
     return $productsData;
 }
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:35,代码来源:Index.php


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