本文整理汇总了PHP中Mage_Core_Model_App::getStore方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_App::getStore方法的具体用法?PHP Mage_Core_Model_App::getStore怎么用?PHP Mage_Core_Model_App::getStore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_App
的用法示例。
在下文中一共展示了Mage_Core_Model_App::getStore方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDependencies
/**
* Retrieve field dependencies
*
* @param array $dependencies
* @param string $storeCode
* @param string $fieldPrefix
* @return array
*/
public function getDependencies($dependencies, $storeCode, $fieldPrefix = '')
{
$output = array();
foreach ($dependencies as $depend) {
/* @var array $depend */
$fieldId = $fieldPrefix . array_pop($depend['dependPath']);
$depend['dependPath'][] = $fieldId;
$dependentId = implode('_', $depend['dependPath']);
$shouldAddDependency = true;
$dependentValue = $depend['value'];
if (isset($depend['separator'])) {
$dependentValue = explode($depend['separator'], $dependentValue);
}
/** @var Mage_Backend_Model_Config_Structure_Element_Field $dependentField */
$dependentField = $this->_fieldLocator->getElement($depend['id']);
/*
* If dependent field can't be shown in current scope and real dependent config value
* is not equal to preferred one, then hide dependence fields by adding dependence
* based on not shown field (not rendered field)
*/
if (false == $dependentField->isVisible()) {
$valueInStore = $this->_application->getStore($storeCode)->getConfig($dependentField->getPath($fieldPrefix));
if (is_array($dependentValue)) {
$shouldAddDependency = !in_array($valueInStore, $dependentValue);
} else {
$shouldAddDependency = $dependentValue != $valueInStore;
}
}
if ($shouldAddDependency) {
$output[$dependentId] = $dependentValue;
}
}
return $output;
}
示例2: processTag
/**
* @param array $tag
* @param Definition $definition
*/
private function processTag($tag, Definition $definition)
{
foreach ($tag as $attribute) {
if (isset($attribute['key'])) {
$configValue = $this->_mageApp->getStore()->getConfig($attribute['key']);
$definition->addArgument($configValue);
}
}
}
示例3: _processRedirectOptions
/**
* Process redirect (R) and permanent redirect (RP)
*
* @return Mage_Core_Model_Url_Rewrite_Request
*/
protected function _processRedirectOptions()
{
$isPermanentRedirectOption = $this->_rewrite->hasOption('RP');
$external = substr($this->_rewrite->getTargetPath(), 0, 6);
if ($external === 'http:/' || $external === 'https:') {
$destinationStoreCode = $this->_app->getStore($this->_rewrite->getStoreId())->getCode();
$this->_setStoreCodeCookie($destinationStoreCode);
$this->_sendRedirectHeaders($this->_rewrite->getTargetPath(), $isPermanentRedirectOption);
}
$targetUrl = $this->_request->getBaseUrl() . '/' . $this->_rewrite->getTargetPath();
$storeCode = $this->_app->getStore()->getCode();
if (Mage::getStoreConfig('web/url/use_store') && !empty($storeCode)) {
$targetUrl = $this->_request->getBaseUrl() . '/' . $storeCode . '/' . $this->_rewrite->getTargetPath();
}
if ($this->_rewrite->hasOption('R') || $isPermanentRedirectOption) {
$this->_sendRedirectHeaders($targetUrl, $isPermanentRedirectOption);
}
$queryString = $this->_getQueryString();
if ($queryString) {
$targetUrl .= '?' . $queryString;
}
$this->_request->setRequestUri($targetUrl);
$this->_request->setPathInfo($this->_rewrite->getTargetPath());
return $this;
}
示例4: onKernelRequestSetStore
/**
* @param GetResponseEvent $event
*/
public function onKernelRequestSetStore(GetResponseEvent $event)
{
if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType() && $this->app) {
$store = $this->storeResolver->resolve($event->getRequest());
if (false !== $store) {
// keep default store in case manual override fails
$defaultStore = $this->app->getStore()->getCode();
$this->app->setCurrentStore($store);
try {
// try to load the store
$this->app->getStore();
} catch (\Mage_Core_Model_Store_Exception $e) {
$this->app->setCurrentStore($defaultStore);
}
}
}
}
示例5: _getRate
/**
* Get rate for current row, 1 by default
*
* @param $row
* @return float|int
*/
protected function _getRate($row)
{
if ($rate = $this->getColumn()->getRate()) {
return floatval($rate);
}
if ($rate = $row->getData($this->getColumn()->getRateField())) {
return floatval($rate);
}
return $this->_app->getStore()->getBaseCurrency()->getRate($this->_getCurrencyCode($row));
}
示例6: getDefaultCurrency
/**
* Retrieve default currency for selected store, website or website group
*
* @param Mage_Core_Controller_Request_Http $request
* @return string
*/
public function getDefaultCurrency(Mage_Core_Controller_Request_Http $request)
{
if ($request->getParam('store')) {
$store = $request->getParam('store');
$currencyCode = $this->_app->getStore($store)->getBaseCurrencyCode();
} else {
if ($request->getParam('website')) {
$website = $request->getParam('website');
$currencyCode = $this->_app->getWebsite($website)->getBaseCurrencyCode();
} else {
if ($request->getParam('group')) {
$group = $request->getParam('group');
$currencyCode = $this->_app->getGroup($group)->getWebsite()->getBaseCurrencyCode();
} else {
$currencyCode = $this->_app->getStore()->getBaseCurrencyCode();
}
}
}
return $currencyCode;
}
示例7: addUrlSuffixToUrlAlias
/**
* Fix url path for category in layer navigation
*
* @param Varien_Event_Observer $object
* @return Varien_Event_Observer
*/
public function addUrlSuffixToUrlAlias(Varien_Event_Observer $object)
{
$matchCodes = array(Enterprise_Catalog_Model_Category::URL_REWRITE_ENTITY_TYPE => Mage_Catalog_Helper_Category::XML_PATH_CATEGORY_URL_SUFFIX, Enterprise_Catalog_Model_Product::URL_REWRITE_ENTITY_TYPE => Mage_Catalog_Helper_Product::XML_PATH_PRODUCT_URL_SUFFIX);
$rewrite = $object->getUrlRewrite();
if ($rewrite) {
foreach ($matchCodes as $type => $xmlPath) {
if ($rewrite->getEntityType() == $type) {
$store = $this->_app->getStore($rewrite->getStoreId());
$suffix = $store->getConfig($xmlPath);
$urlPath = $rewrite->getRequestPath();
if ($suffix) {
$urlPath .= '.' . $suffix;
}
$rewrite->setRequestPath($urlPath);
break;
}
}
$object->setUrlRewrite($rewrite);
}
return $object;
}
示例8: handleBeforeCollectTotals
/**
* Before collecting item totals, check that all items
* in the quote are available to be fulfilled.
*
* @param Varien_Event_Observer
* @return self
*/
public function handleBeforeCollectTotals(Varien_Event_Observer $observer)
{
try {
$quote = $observer->getEvent()->getQuote();
$this->quantityService->checkQuoteInventory($quote);
} catch (EbayEnterprise_Inventory_Exception_Quantity_Collector_Exception $e) {
$this->logger->logException($e, $this->logContext->getMetaData(__CLASS__, [], $e));
$this->logger->warning('Caught the following exception: {exception_message}.', $this->logContext->getMetaData(__CLASS__, ['exception_message' => $e->getMessage()]));
} catch (EbayEnterprise_Inventory_Exception_Quantity_Unavailable_Exception $e) {
$this->logger->logException($e, $this->logContext->getMetaData(__CLASS__, [], $e));
$this->logger->warning('Caught the following exception: {exception_message}.', $this->logContext->getMetaData(__CLASS__, ['exception_message' => $e->getMessage()]));
if ($this->app->getStore()->isAdmin()) {
// Handling admin exception here because it is not
// being caught in the admin controller causing it
// to display exception traces in the page.
return $this->handleAdminOrderException($e, $quote);
}
// Continue to throw the exception in the frontend and let
// the frontend controller handle it.
throw $e;
}
return $this;
}
示例9: getInfoUrl
/**
* Get tax management url
*
* @return string
*/
public function getInfoUrl()
{
return $this->_app->getStore()->getConfig(Mage_Tax_Model_Config::XML_PATH_TAX_NOTIFICATION_URL);
}
示例10: getRegionJsonByStore
/**
* Retrieve regions data json
*
* @param int|null $storeId
* @return array()
*/
public function getRegionJsonByStore($storeId = null)
{
Varien_Profiler::start('TEST: ' . __METHOD__);
if (!$this->_regionJson) {
$store = $this->_app->getStore($storeId);
$cacheKey = 'DIRECTORY_REGIONS_JSON_STORE' . (string) $store->getId();
if ($this->_app->useCache('config')) {
$json = $this->_app->loadCache($cacheKey);
}
if (empty($json)) {
$regions = $this->_getRegions($storeId);
$helper = $this->_factory->getHelper('core');
$json = $helper->jsonEncode($regions);
if ($this->_app->useCache('config')) {
$this->_app->saveCache($json, $cacheKey, array('config'));
}
}
$this->_regionJson = $json;
}
Varien_Profiler::stop('TEST: ' . __METHOD__);
return $this->_regionJson;
}
示例11: _getAttributeValue
/**
* Retrieve attribute source value for search
*
* @deprecated since version 1.13.2
* @param int $attributeId
* @param mixed $value
* @param int $storeId
* @return mixed
*/
protected function _getAttributeValue($attributeId, $value, $storeId)
{
/** @var $attribute Mage_Eav_Model_Attribute */
$attribute = $this->_getSearchableAttribute($attributeId);
if (!$attribute->getIsSearchable()) {
return null;
}
if ($attribute->usesSource()) {
$attribute->setStoreId($storeId);
$value = $attribute->getSource()->getIndexOptionText($value);
if (is_array($value)) {
$value = implode($this->_separator, $value);
} elseif (empty($value)) {
$inputType = $attribute->getFrontend()->getInputType();
if ($inputType == 'select' || $inputType == 'multiselect') {
return null;
}
}
} elseif ($attribute->getBackendType() == 'datetime') {
$value = $this->_getStoreDate($storeId, $value);
} else {
$inputType = $attribute->getFrontend()->getInputType();
if ($inputType == 'price') {
$value = $this->_app->getStore($storeId)->roundPrice($value);
}
}
$value = preg_replace("#\\s+#siu", ' ', trim(strip_tags($value)));
return $value;
}
示例12: isConflictingFptTaxConfigurationSettingsIgnored
/**
* Check if warning about conflicting FPT configuration should be shown
*
* @return bool
*/
public function isConflictingFptTaxConfigurationSettingsIgnored()
{
return (bool) $this->_app->getStore()->getConfig(Mage_Tax_Model_Config::XML_PATH_TAX_NOTIFICATION_FPT_CONFIGURATION);
}
示例13: _setTheme
/**
* Set current VDE theme
*/
protected function _setTheme()
{
$themeId = $this->_backendSession->getData('theme_id');
if ($themeId !== null) {
$path = $this->_designPackage->getConfigPathByArea(Mage_Core_Model_App_Area::AREA_FRONTEND);
$this->_application->getStore()->setConfig($path, $themeId);
}
}
示例14: getBaseUrl
/**
* Get base URL path by type
*
* @param string $type
* @return string
*/
public static function getBaseUrl($type = Mage_Core_Model_Store::URL_TYPE_LINK, $secure = null)
{
return AO::$_app->getStore()->getBaseUrl($type, $secure);
}
示例15: _isCrawlerEnabled
/**
* Checks whether crawler is enabled for given store
*
* @param int $storeId
* @return null|string
*/
protected function _isCrawlerEnabled($storeId)
{
return (bool) (string) $this->_app->getStore($storeId)->getConfig(self::XML_PATH_CRAWLER_ENABLED);
}