本文整理汇总了PHP中Mage_Core_Model_Store类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Store类的具体用法?PHP Mage_Core_Model_Store怎么用?PHP Mage_Core_Model_Store使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Core_Model_Store类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: executeByStore
/**
* Create inherited child configurations for a Store
*
* @param Mage_Core_Model_Store $store
*
* @return Payone_Core_Model_Domain_Config_PaymentMethod[]
*/
public function executeByStore(Mage_Core_Model_Store $store)
{
$scope = 'stores';
$scopeId = $store->getStoreId();
$parentId = $store->getWebsiteId();
$this->savePaymentConfigs($scope, $scopeId, $parentId);
}
开发者ID:kirchbergerknorr,项目名称:payone-magento,代码行数:14,代码来源:Create.php
示例2: 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));
}
开发者ID:nemphys,项目名称:magento2,代码行数:41,代码来源:CategoryControllerTest.php
示例3: 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]);
}
开发者ID:ernandes-xeo,项目名称:Aligent_Feeds,代码行数:17,代码来源:Category.php
示例4: init
/**
* Called once at that the beginning of the export. Used this to perform any
* actions required (e.g. loading categories) to set up the process.
*
* @param Mage_Core_Model_Store $oStore The store context in which this export occurs
* @param Mage_Core_Model_Config_Element $oConfig The field mapping for this feed
* @return Aligent_Feeds_Model_Googleshopping_Formatter $this
*/
public function init(Mage_Core_Model_Store $oStore, Mage_Core_Model_Config_Element $oConfig)
{
$this->_oConfig = $oConfig;
$this->_oStore = $oStore;
$this->_vBaseUrl = $oStore->getBaseUrl();
$this->_vMediaBaseUrl = $oStore->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
$this->_vProductMediaBaseUrl = $this->_vMediaBaseUrl . 'catalog/product';
return $this;
}
开发者ID:ernandes-xeo,项目名称:Aligent_Feeds,代码行数:17,代码来源:Formatter.php
示例5: 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;
}
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:16,代码来源:Website.php
示例6: _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;
}
}
开发者ID:rickbakker,项目名称:magento-turpentine,代码行数:14,代码来源:turpentineFlushCache.php
示例7: 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();
}
开发者ID:sandermangel,项目名称:adyen-magento-subscription,代码行数:16,代码来源:Label.php
示例8: checkSettings
/**
* @param Result $result
* @param \Mage_Core_Model_Store $store
* @param string $baseUrl setting
*/
protected function checkSettings(Result $result, \Mage_Core_Model_Store $store, $baseUrl)
{
$errorMessage = 'Wrong hostname configured. <info>Hostname must contain a dot</info>';
$host = parse_url($baseUrl, PHP_URL_HOST);
$isValid = (bool) strstr($host, '.');
$result->setStatus($isValid);
if ($isValid) {
$result->setMessage('<info>' . ucfirst($this->class) . ' BaseURL: <comment>' . $baseUrl . '</comment> of Store: <comment>' . $store->getCode() . '</comment> - OK');
} else {
$result->setMessage('<error>Invalid ' . ucfirst($this->class) . ' BaseURL: <comment>' . $baseUrl . '</comment> of Store: <comment>' . $store->getCode() . '</comment> ' . $errorMessage . '</error>');
}
}
开发者ID:antistatique,项目名称:n98-magerun,代码行数:17,代码来源:BaseUrlCheckAbstract.php
示例9: 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);
}
开发者ID:ernandes-xeo,项目名称:Aligent_Feeds,代码行数:20,代码来源:Condition.php
示例10: 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);
}
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:19,代码来源:Rewrite.php
示例11: _parseException
/**
* @return string
*/
protected function _parseException($node, \Mage_Core_Model_Store $store)
{
$exception = (string) \Mage::getConfig()->getNode($node . self::THEMES_EXCEPTION, AbstractMagentoStoreConfigCommand::SCOPE_STORE_VIEW, $store->getCode());
if (empty($exception)) {
return '';
}
$exceptions = unserialize($exception);
$result = array();
foreach ($exceptions as $expression) {
$result[] = 'Matched Expression: ' . $expression['regexp'];
$result[] = 'Value: ' . $expression['value'];
}
return implode("\n", $result);
}
开发者ID:aedmonds,项目名称:n98-magerun,代码行数:17,代码来源:InfoCommand.php
示例12: getDashboardRepId
/**
* Get the dashboard rep id, if applicable
* null otherwise
*
* @param Mage_Core_Model_Store
* @return string|null
*/
public function getDashboardRepId(Mage_Core_Model_Store $store)
{
if ($store->isAdmin()) {
$adminSession = $this->_getAdminSession();
$csr = $adminSession->getCustomerServiceRep() ?: Mage::getModel('eb2ccsr/representative');
$repId = $csr->getRepId();
if ($repId) {
return $repId;
}
$adminUser = $adminSession->getUser();
return $adminUser ? $adminUser->getUsername() : null;
}
return null;
}
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:21,代码来源:Data.php
示例13: checkSettings
/**
* @param Result $result
* @param \Mage_Core_Model_Store $store
* @param string $baseUrl setting
* @param string $cookieDomain setting
*/
protected function checkSettings(Result $result, \Mage_Core_Model_Store $store, $baseUrl, $cookieDomain)
{
$errorMessage = 'cookie-domain and ' . $this->class . ' base-URL do not match';
if (strlen($cookieDomain)) {
$isValid = $this->validateCookieDomainAgainstUrl($cookieDomain, $baseUrl);
$result->setStatus($isValid);
if ($isValid) {
$result->setMessage('<info>Cookie Domain (' . $this->class . '): <comment>' . $cookieDomain . '</comment> of Store: <comment>' . $store->getCode() . '</comment> - OK</info>');
} else {
$result->setMessage('<error>Cookie Domain (' . $this->class . '): <comment>' . $cookieDomain . '</comment> of Store: <comment>' . $store->getCode() . '</comment> - ERROR: ' . $errorMessage . '</error>');
}
} else {
$result->setMessage('<info>Empty cookie Domain (' . $this->class . ') of Store: <comment>' . $store->getCode() . '</comment> - OK</info>');
}
}
开发者ID:netz98,项目名称:n98-magerun,代码行数:21,代码来源:CookieDomainCheckAbstract.php
示例14: createWebstore
/**
* Create a Klevu Webstore using the API for the given Magento store.
*
* @param $customer_id
* @param Mage_Core_Model_Store $store
* @param bool $test_mode
*
* @return array An array with the following keys:
* success: boolean value indicating whether the operation was successful.
* webstore: (success only) Varien_Object containing Webstore information.
* message: message to be displayed to the user.
*/
public function createWebstore($customer_id, Mage_Core_Model_Store $store, $test_mode = false)
{
$name = sprintf("%s - %s - %s", $store->getWebsite()->getName(), $store->getName(), $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB));
$language = Mage::helper("klevu_search")->getStoreLanguage($store);
$timezone = $store->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE);
// Convert $test_mode to string
$test_mode = $test_mode ? "true" : "false";
$response = Mage::getModel("klevu_search/api_action_addwebstore")->execute(array("customerId" => $customer_id, "storeName" => $name, "language" => $language, "timezone" => $timezone, "testMode" => $test_mode));
if ($response->isSuccessful()) {
$webstore = new Varien_Object(array("store_name" => $name, "js_api_key" => $response->getJsApiKey(), "rest_api_key" => $response->getRestApiKey(), "test_account_enabled" => $test_mode));
return array("success" => true, "webstore" => $webstore, "message" => $response->getMessage());
} else {
return array("success" => false, "message" => $response->getMessage());
}
}
开发者ID:shebin512,项目名称:Magento_Zoff,代码行数:27,代码来源:Api.php
示例15: regenerateMediaFiles
/**
* Delete content of media/js and media/css folders to refresh with updated compressed/minified js/css content
* If disabled, the updates are done each time an original file is updated. Can be resource overload on live website.
*
* @param Mage_Core_Model_Observer $observer
*/
public function regenerateMediaFiles($observer)
{
if (Mage::getStoreConfigFlag('uioptimization/general/cronupdate') && (Mage::getStoreConfigFlag('uioptimization/csscompression/enabled') || Mage::getStoreConfigFlag('uioptimization/jscompression/enabled'))) {
// Clean up media/css and media/js folders and recreate the folders if necessary
try {
Mage::getModel('core/design_package')->cleanMergedJsCss();
Mage::dispatchEvent('clean_media_cache_after');
} catch (Exception $e) {
Mage::logException($e);
return;
}
$stores = Mage::app()->getStores();
foreach ($stores as $id => $v) {
$url = Zend_Uri_Http::fromString(Mage::app()->getStore($id)->getBaseUrl());
// Recreate the js and css compressed file by using the normal process
try {
$curl = new Zend_Http_Client_Adapter_Curl();
$curl->setCurlOption(CURLOPT_SSL_VERIFYPEER, false);
$curl->setCurlOption(CURLOPT_SSL_VERIFYHOST, 1);
$curl->connect($url->getHost(), $url->getPort(), Mage_Core_Model_Store::isCurrentlySecure());
$curl->write(Zend_Http_Client::GET, $url);
$curl->close();
Mage::log('[Diglin_UIOptimization_Model_Observer] Update media js/css content for the different stores', ZEND_LOG::DEBUG);
} catch (Exception $e) {
Mage::logException($e);
return;
}
}
}
}
开发者ID:FranchuCorraliza,项目名称:magento,代码行数:36,代码来源:Observer.php
示例16: getCurrentUrl
public function getCurrentUrl($fromStore = true)
{
$sidQueryParam = $this->_getSession()->getSessionIdQueryParam();
$storeUrl = Mage::app()->getStore()->isCurrentlySecure() ? $this->getUrl('', array('_secure' => true)) : $this->getUrl('');
$storeParsedUrl = parse_url($storeUrl);
$params = array('_current' => true, '_m_escape' => '', '_use_rewrite' => true, '_secure' => Mage::app()->getFrontController()->getRequest()->isSecure());
$currentUrl = Mage::getUrl('*/*/*', $params);
if (($pos = strpos($currentUrl, '?')) !== false) {
$currentUrl = substr($currentUrl, 0, $pos);
}
$requestString = ltrim(Mage::app()->getRequest()->getRequestString(), '/');
$storeParsedQuery = array();
if (isset($storeParsedUrl['query'])) {
parse_str($storeParsedUrl['query'], $storeParsedQuery);
}
$currQuery = Mage::app()->getRequest()->getQuery();
if (isset($currQuery[$sidQueryParam]) && !empty($currQuery[$sidQueryParam]) && $this->_getSession()->getSessionIdForHost($storeUrl) != $currQuery[$sidQueryParam]) {
unset($currQuery[$sidQueryParam]);
}
foreach ($currQuery as $k => $v) {
$storeParsedQuery[$k] = $v;
}
if (!Mage::getStoreConfigFlag(Mage_Core_Model_Store::XML_PATH_STORE_IN_URL, $this->getCode())) {
$storeParsedQuery['___store'] = $this->getCode();
}
//if ($fromStore !== false) {
$storeParsedQuery['___from_store'] = $fromStore === true ? Mage::app()->getStore()->getCode() : $fromStore;
//}
return $storeParsedUrl['scheme'] . '://' . $storeParsedUrl['host'] . (isset($storeParsedUrl['port']) ? ':' . $storeParsedUrl['port'] : '') . $storeParsedUrl['path'] . $requestString . ($storeParsedQuery ? '?' . http_build_query($storeParsedQuery, '', '&') : '');
return Mage::helper('mana_filters')->markLayeredNavigationUrl(Mage::getUrl('*/*/*', $params), '*/*/*', $params);
/* @var $url Mana_Seo_Rewrite_Url */
$url = Mage::getSingleton('core/url');
return $url->getUrl('*/*/*', parent::getCurrentUrl($fromStore));
}
开发者ID:vinayshuklasourcefuse,项目名称:sareez,代码行数:34,代码来源:Mana_Seo_Rewrite_Store.php
示例17: _getDefaultStore
protected function _getDefaultStore()
{
if (empty($this->_store)) {
$this->_store = new Mage_Core_Model_Store();
$this->_store->setStoreId(1)->setCode('default');
}
return $this->_store;
}
开发者ID:arslbbt,项目名称:mangentovies,代码行数:8,代码来源:App.php
示例18: 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));
}
开发者ID:relue,项目名称:magento2,代码行数:22,代码来源:WebsiteTest.php
示例19: testConstructDisableWsdlCache
/**
* Test Soap server construction with WSDL cache disabling.
*/
public function testConstructDisableWsdlCache()
{
/** Mock getConfig method to return false. */
$this->_storeMock->expects($this->any())->method('getConfig')->will($this->returnValue(false));
/** Create Soap server object. */
$server = new Mage_Webapi_Model_Soap_Server($this->_applicationMock, $this->_requestMock, $this->_domDocumentFactory);
$server->initWsdlCache();
/** Assert soap wsdl caching option was disabled after soap server initialization. */
$this->assertFalse((bool) ini_get('soap.wsdl_cache_enabled'), 'WSDL caching was not disabled.');
}
开发者ID:,项目名称:,代码行数:13,代码来源:
示例20: testGetProductNrRiskCheckAdvanced
public function testGetProductNrRiskCheckAdvanced()
{
$path = 'scoring/buergel/services';
$this->store->resetConfig();
$this->store->setConfig($path, Netresearch_Buergel_Model_System_Source_Service::RISKCHECK_ADVANCED);
$this->config = Mage::getModel('buergel/config');
$this->config->reset();
$this->config->setIsCompanyAddress(false);
$this->assertEquals(Netresearch_Buergel_Model_System_Source_Service::RISKCHECK_ADVANCED, $this->config->getProductNr());
$this->config->setIsCompanyAddress();
$this->assertEquals(Netresearch_Buergel_Model_System_Source_Service::RISKCHECK_ADVANCED, $this->config->getProductNr());
$this->config->reset();
}
开发者ID:kirchbergerknorr,项目名称:netresearch_buergel,代码行数:13,代码来源:ConfigTest.php
注:本文中的Mage_Core_Model_Store类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论