本文整理汇总了PHP中Mage_Core_Model_Store::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Store::getId方法的具体用法?PHP Mage_Core_Model_Store::getId怎么用?PHP Mage_Core_Model_Store::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Store
的用法示例。
在下文中一共展示了Mage_Core_Model_Store::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: translate
/**
* Translates a category id stored in the supplied field to a full category path.
*
* @param array $aRow A flat product row
* @param string $vField The name of the filed in which the category id is found.
* @param Mage_Core_Model_Store $oStore The store context we're currently exporting.
* @return mixed
*/
public function translate($aRow, $vField, $oStore)
{
if ($oStore->getId() !== $this->_iStoreId) {
$this->_iDefaultCondition = Mage::getStoreConfig(self::CONFIG_CONDITION, $oStore->getId());
$this->_iStoreId = $oStore->getId();
}
$vFieldValue = false;
if (array_key_exists($vField, $aRow)) {
$vFieldValue = $aRow[$vField];
}
return Mage::getSingleton('aligent_feeds/source_condition')->getGoogleValue($vFieldValue ? $vFieldValue : $this->_iDefaultCondition);
}
示例2: getStoreId
/**
* Retrieve store Id
*
* @return int
*/
public function getStoreId()
{
if (is_null($this->_store)) {
try {
$this->_store = Mage::app()->getStore($this->getVar('store'));
} catch (Exception $e) {
$message = Mage::helper('eav')->__('Invalid store specified');
$this->addException($message, Varien_Convert_Exception::FATAL);
throw $e;
}
}
return $this->_store->getId();
}
示例3: testSaveAction
/**
* @magentoDataFixture Mage/Core/_files/store.php
* @magentoDbIsolation enabled
* @dataProvider saveActionDataProvider
* @param array $inputData
* @param array $defaultAttributes
* @param array $attributesSaved
*/
public function testSaveAction($inputData, $defaultAttributes, $attributesSaved = array())
{
$store = new Mage_Core_Model_Store();
$store->load('fixturestore', 'code');
$storeId = $store->getId();
$this->getRequest()->setPost($inputData);
$this->getRequest()->setParam('store', $storeId);
$this->getRequest()->setParam('id', 2);
$this->dispatch('backend/admin/catalog_category/save');
$messages = Mage::getSingleton('Mage_Backend_Model_Session')->getMessages(false)->getItemsByType(Mage_Core_Model_Message::SUCCESS);
$this->assertNotEmpty($messages, "Could not save category");
$this->assertEquals('The category has been saved.', current($messages)->getCode());
$category = new Mage_Catalog_Model_Category();
$category->setStoreId($storeId);
$category->load(2);
$errors = array();
foreach ($attributesSaved as $attribute => $value) {
$actualValue = $category->getData($attribute);
if ($value !== $actualValue) {
$errors[] = "value for '{$attribute}' attribute must be '{$value}', but '{$actualValue}' is found instead";
}
}
foreach ($defaultAttributes as $attribute => $exists) {
if ($exists !== $category->getExistsStoreValueFlag($attribute)) {
if ($exists) {
$errors[] = "custom value for '{$attribute}' attribute is not found";
} else {
$errors[] = "custom value for '{$attribute}' attribute is found, but default one must be used";
}
}
}
$this->assertEmpty($errors, "\n" . join("\n", $errors));
}
示例4: export
public function export(Mage_Core_Model_Store $oStore, $vFeedname, Mage_Core_Model_Config_Element $oConfig)
{
Mage::getSingleton('aligent_feeds/log')->log("Beginning {$vFeedname} export for store #" . $oStore->getId() . " - " . $oStore->getName());
Mage::getSingleton('aligent_feeds/log')->logMemoryUsage();
Mage::getSingleton('aligent_feeds/log')->log("Initialising file writers...");
$this->_initWriters($oStore, $vFeedname, $oConfig);
// Prepare the csv file header
Mage::getSingleton('aligent_feeds/log')->log("Begin preparing header rows...");
Mage::getSingleton('aligent_feeds/log')->logMemoryUsage();
$this->_prepareHeaders($oConfig);
// Initialise the formatter
Mage::getSingleton('aligent_feeds/log')->log("Initialising Feed Formatter...");
Mage::getSingleton('aligent_feeds/feed_formatter')->init($oStore, $oConfig);
Mage::getSingleton('aligent_feeds/log')->log("Initialised Feed Formatter.");
Mage::getSingleton('aligent_feeds/log')->logMemoryUsage();
$oConn = Mage::getModel('core/resource')->getConnection('catalog_read');
$vCategoryProductTable = Mage::getModel('core/resource_setup', 'core_setup')->getTable('catalog/category_product');
$vCategoryFlatTable = Mage::getResourceSingleton('catalog/category_flat')->getMainStoreTable($oStore->getId());
$vProductFlatTable = Mage::getResourceModel('catalog/product_flat_indexer')->getFlatTableName($oStore->getId());
// Complicated subquery to get the most deeply nested category that this
// product is assigned to. Picking the most deeply nested on the assumption
// that the deepest category is most likely to be the most specific.
$oSubSelect = new Varien_Db_Select($oConn);
$oSubSelect->from(array('ccf' => $vCategoryFlatTable), 'entity_id')->joinInner(array('ccp2' => 'catalog_category_product'), 'ccf.entity_id=ccp2.category_id', array())->where('ccp2.product_id=main_table.entity_id')->where('ccf.is_active=1')->order('level', Zend_Db_Select::SQL_DESC)->limit(1);
$oSelect = new Varien_Db_Select($oConn);
$oSelect->from(array('main_table' => $vProductFlatTable), array('main_table.*', 'category_id' => new Zend_Db_Expr('(' . $oSubSelect . ')')))->where('visibility IN (?)', array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH));
// Allow the feed definition to include a "before_query_filter". This method
// will be allowed to modify the query before it's executed.
if ($oConfig->before_query_filter) {
Mage::getSingleton('aligent_feeds/log')->log("Calling before query filter...");
$vClass = (string) $oConfig->before_query_filter->class;
$vMethod = (string) $oConfig->before_query_filter->method;
$aParams = (array) $oConfig->before_query_filter->params;
Mage::getSingleton($vClass)->{$vMethod}($oSelect, $oStore, $aParams);
Mage::getSingleton('aligent_feeds/log')->log("Before query filter done.");
}
Mage::getSingleton('aligent_feeds/log')->log("Exporting products...");
$oResource = Mage::getModel('core/resource_iterator')->walk($oSelect, array(function ($aArgs) {
Mage::getSingleton('aligent_feeds/log')->log("Exporting product #" . $aArgs['idx'] . " SKU: " . $aArgs['row']['sku'], Zend_Log::DEBUG, true);
if ($aArgs['idx'] % 100 == 0) {
Mage::getSingleton('aligent_feeds/log')->log("Exporting product #" . $aArgs['idx'] . "...", Zend_Log::INFO);
Mage::getSingleton('aligent_feeds/log')->logMemoryUsage();
}
$aRows = Mage::getSingleton('aligent_feeds/feed_formatter')->prepareRow($aArgs['row']);
if (count($aRows) > 0) {
foreach ($aRows as $aRow) {
foreach ($aArgs['writers'] as $oWriter) {
$oWriter->writeDataRow($aRow);
}
}
}
}), array('writers' => $this->_oWriters, 'config' => $oConfig, 'store' => $oStore));
$this->_closeWriters();
$this->_sendFeed();
Mage::getSingleton('aligent_feeds/status')->addSuccess("Generated {$vFeedname} data for store #" . $oStore->getId() . " - " . $oStore->getName());
Mage::getSingleton('aligent_feeds/log')->log("Finished {$vFeedname} data export for store #" . $oStore->getId() . " - " . $oStore->getName());
Mage::getSingleton('aligent_feeds/log')->logMemoryUsage();
return $this;
}
示例5: setData
public function setData($key, $value = null)
{
parent::setData($key, $value);
if ($this->getStoreId() && $this->store && $this->store->getId() != $this->getStoreId()) {
$this->store = null;
}
return $this;
}
示例6: getConfig
/**
* @param string $key
* @return mixed
*/
protected function getConfig($key)
{
if (isset($this->_store)) {
$storeId = $this->_store->getId();
} else {
$storeId = null;
}
return Mage::getStoreConfig('mehulchaudhari_feedsgenerator/' . $this->_configPath . '/' . $key, $storeId);
}
示例7: translate
/**
* Translates a category id stored in the supplied field to a full category path.
*
* @param array $aRow A flat product row
* @param string $vField The name of the filed in which the category id is found.
* @param Mage_Core_Model_Store $oStore The store context we're currently exporting.
* @return mixed
*/
public function translate($aRow, $vField, $oStore)
{
if ($oStore->getId() !== $this->_iStoreId) {
$this->_aCategoryPaths = array();
$this->_initCategories($oStore);
$this->_iStoreId = $oStore->getId();
}
return $this->_getCategoryPath($aRow[$vField]);
}
示例8: _getSubscriberObject
/**
* Return subscriber object with basic attribues
*
* @param string $email
* @param string $status OPTIONAL
* @return Mage_Newsletter_Model_Subscriber
*/
protected function _getSubscriberObject($email, $status = Mage_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED)
{
$subscriber = Mage::getModel('newsletter/subscriber')->loadByEmail($email);
$subscriber->setImportMode(TRUE)->setBulksync(TRUE);
if (!$subscriber->getId()) {
$subscriber->setStoreId($this->_store->getId())->setSubscriberConfirmCode(Mage::getModel('newsletter/subscriber')->randomSequence())->setEmail($email);
}
$subscriber->setStatus($status);
return $subscriber;
}
示例9: loadBySubscription
/**
* @param Adyen_Subscription_Model_Product_Subscription $subscription
* @param Mage_Core_Model_Store|int $store
* @return $this
*/
public function loadBySubscription(Adyen_Subscription_Model_Product_Subscription $subscription, $store)
{
$labels = $this->getCollection()->addFieldToFilter('subscription_id', $subscription->getId());
if ($store instanceof Mage_Core_Model_Store) {
$storeId = $store->getId();
} else {
$storeId = $store;
}
$labels->addFieldToFilter('store_id', $storeId);
return $labels->getFirstItem();
}
示例10: getExtension
/**
* Function retrieves extension stored in Magento configuration.
* Default in category extension.
* @param Mage_Core_Model_Store $store
*/
public function getExtension($store)
{
if (!isset($store) || !$store) {
return Mage::getStoreConfig('catalog/seo/category_url_suffix');
}
$extension = Mage::getStoreConfig('catalog/seo/category_url_suffix', $store->getId());
if (isset($extension) && $extension != '' && $extension[0] == '.') {
$extension = '\\' . $extension;
}
return $extension;
}
示例11: _flushAllSpecialPrices
/**
* @param Mage_Core_Model_Store $store
*/
protected function _flushAllSpecialPrices($store)
{
/** @var Mage_Catalog_Model_Resource_Product_Collection $products */
$products = Mage::getResourceModel('catalog/product_collection')->setStoreId($store->getId())->addAttributeToFilter('special_from_date', array('lteq' => now(true)))->addAttributeToFilter(array(array('attribute' => 'special_to_date', 'gteq' => now(true)), array('attribute' => 'special_to_date', 'null' => true)))->addWebsiteFilter($store->getWebsiteId());
$size = $products->getSize();
if ($size) {
$msg = sprintf('process store %s and %s product(s) with all special prices', $store->getCode(), $size);
Mage::getSingleton('core/resource_iterator')->walk($products->getSelect(), array(array($this, 'iteratorCallback')), array('size' => $size, 'msg' => $msg, 'store' => $store));
echo PHP_EOL;
}
}
示例12: getRequestPathByIdPath
/**
* Retrieve request_path using id_path and current store's id.
*
* @param string $idPath
* @param int|Mage_Core_Model_Store $store
* @return string|false
*/
public function getRequestPathByIdPath($idPath, $store)
{
if ($store instanceof Mage_Core_Model_Store) {
$storeId = (int) $store->getId();
} else {
$storeId = (int) $store;
}
$select = $this->_getReadAdapter()->select();
/* @var $select Zend_Db_Select */
$select->from(array('main_table' => $this->getMainTable()), 'request_path')->where('main_table.store_id = ?', $storeId)->where('main_table.id_path = ?', $idPath)->limit(1);
return $this->_getReadAdapter()->fetchOne($select);
}
示例13: getStore
/**
* @return Mage_Core_Model_Store
*/
public function getStore()
{
// Only attempt to load the store if a storeId is present
if ($this->_storeId) {
if (is_null($this->_store) || $this->_store->getId() != $this->_storeId) {
$this->_store = Mage::getModel('core/store')->load($this->_storeId);
}
} else {
if (is_null($this->_store)) {
$this->_store = Mage::app()->getStore();
}
}
return $this->_store;
}
示例14: testSetGroupsAndStores
/**
* @covers Mage_Core_Model_Website::setGroups
* @covers Mage_Core_Model_Website::setStores
* @covers Mage_Core_Model_Website::getStores
*/
public function testSetGroupsAndStores()
{
/* Groups */
$expectedGroup = new Mage_Core_Model_Store_Group();
$expectedGroup->setId(123);
$this->_model->setDefaultGroupId($expectedGroup->getId());
$this->_model->setGroups(array($expectedGroup));
$groups = $this->_model->getGroups();
$this->assertSame($expectedGroup, reset($groups));
/* Stores */
$expectedStore = new Mage_Core_Model_Store();
$expectedStore->setId(456);
$expectedGroup->setDefaultStoreId($expectedStore->getId());
$this->_model->setStores(array($expectedStore));
$stores = $this->_model->getStores();
$this->assertSame($expectedStore, reset($stores));
}
示例15: _addOneClickMethodsToConfig
/**
* @param Mage_Core_Model_Store $store
* @return $this
*/
protected function _addOneClickMethodsToConfig(Mage_Core_Model_Store $store)
{
Varien_Profiler::start(__CLASS__ . '::' . __FUNCTION__);
$customer = Mage::helper('adyen/billing_agreement')->getCurrentCustomer();
if (!$customer || !$customer->getId()) {
return $this;
}
$baCollection = Mage::getResourceModel('adyen/billing_agreement_collection');
$baCollection->addFieldToFilter('customer_id', $customer->getId());
$baCollection->addFieldToFilter('store_id', $store->getId());
$baCollection->addActiveFilter();
foreach ($baCollection as $billingAgreement) {
// Only show payment methods that are enabled by the merchant
$agreementData = json_decode($billingAgreement->agreement_data, true);
$recurringPaymentType = Mage::getStoreConfig('payment/adyen_oneclick/recurring_payment_type', $store);
$this->_createPaymentMethodFromBA($billingAgreement, $store);
}
Varien_Profiler::stop(__CLASS__ . '::' . __FUNCTION__);
}