Ejemplo n.º 1
0
 public function testSetGetConfig()
 {
     /* config operations require store to be loaded */
     $this->_model->load('default');
     $value = $this->_model->getConfig(Mage_Core_Model_Store::XML_PATH_STORE_IN_URL);
     $this->_model->setConfig(Mage_Core_Model_Store::XML_PATH_STORE_IN_URL, 'test');
     $this->assertEquals('test', $this->_model->getConfig(Mage_Core_Model_Store::XML_PATH_STORE_IN_URL));
     $this->_model->setConfig(Mage_Core_Model_Store::XML_PATH_STORE_IN_URL, $value);
     /* Call set before get */
     $this->_model->setConfig(Mage_Core_Model_Store::XML_PATH_USE_REWRITES, 1);
     $this->assertEquals(1, $this->_model->getConfig(Mage_Core_Model_Store::XML_PATH_USE_REWRITES));
     $this->_model->setConfig(Mage_Core_Model_Store::XML_PATH_USE_REWRITES, 0);
 }
Ejemplo n.º 2
0
 /**
  * Send email to invitee
  *
  * @param string $emailAddress
  * @param Mage_Core_Model_Store $store
  * @param Mage_Customer_Model_Customer $customer
  *
  * @return boolean
  */
 public function sendEmail($emailAddress, $store, $customer)
 {
     $mail = Mage::getModel('core/email_template');
     /* Magento 1.3 stub. */
     if (Mage::helper('points')->magentoLess14()) {
         $store->setFrontendName($store->getGroup()->getName());
     }
     /* Magento 1.3 stub ends */
     try {
         $mail->setDesignConfig(array('area' => 'frontend', 'store' => $store->getStoreId()))->sendTransactional($store->getConfig(self::XML_PATH_EMAIL_TEMPLATE), $store->getConfig(self::XML_PATH_EMAIL_IDENTITY), $this->getEmail(), null, array('url' => $this->prepareUrl($customer, $emailAddress, $store), 'message' => $this->getMessage(), 'store' => $store, 'customer' => $customer));
         if ($mail->getSentSuccess()) {
             $this->setStatus(self::INVITATION_SENT)->setUpdateDate(true)->save();
             return true;
         }
     } catch (Exception $exc) {
         Mage::helper('awcore/logger')->log($this, Mage::helper('points')->__('Error on saving invitation data for email: %s', $emailAddress), AW_Core_Model_Logger::LOG_SEVERITY_ERROR, $exc->getTraceAsString());
     }
     return false;
 }
 /**
  * Retrieve store configuration data
  *
  * @param   string $path
  * @param   string $scope
  * @return  string|null
  */
 public function getConfig($path)
 {
     if ($this->_active) {
         if ($this->_config == null) {
             $this->_loadOverrideConfigFile();
         }
         if (isset($this->_config[$path])) {
             return $this->_config[$path];
         }
     }
     return parent::getConfig($path);
 }
Ejemplo n.º 4
0
 public function processEmailEventsForSingleStore(Mage_Core_Model_Store $store)
 {
     if ($store->getConfig('mailgun/events/store')) {
         $data = array('end' => date("r", time() - 86400), 'tags' => $store->getConfig('mailgun/general/tag'));
         $mailgunEvents = $this->mailgunRequest('events', $store->getConfig('mailgun/general/domain'), $store->getConfig('mailgun/general/key'), $data);
         $events = $mailgunEvents->items;
         while (sizeof($mailgunEvents->items) > 0) {
             $mailgunEvents = $this->mailgunRequest('events', $store->getConfig('mailgun/general/domain'), $store->getConfig('mailgun/general/key'), $data, Zend_Http_Client::GET, $mailgunEvents->paging->next);
             $events = array_merge($events, $mailgunEvents->items);
         }
         $this->storeEvents($events);
     }
 }
 /**
  * Get amounts by product and store
  *
  * @param int $product
  * @param Mage_Core_Model_Store $store
  * @return array
  */
 public function getAmounts($product, $store)
 {
     $isGlobal = $store->getConfig(Mage_Core_Model_Store::XML_PATH_PRICE_SCOPE) == Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL;
     if ($isGlobal) {
         $key = $product;
     } else {
         $website = $store->getWebsiteId();
         $key = "{$product}|{$website}";
     }
     $read = $this->_getReadAdapter();
     if (!isset($this->_cache[$key])) {
         $select = $read->select()->from($this->getTable('enterprise_giftcard/amount'), array('value', 'website_id'))->where('entity_id = ?', $product);
         $bind = array('product_id' => $product);
         if ($isGlobal) {
             $select->where('website_id = 0');
         } else {
             $select->where('website_id IN (0, :website_id)');
             $bind['website_id'] = $website;
         }
         $fetched = $read->fetchAll($select, $bind);
         $this->_cache[$key] = $this->_convertPrices($fetched, $store);
     }
     return $this->_cache[$key];
 }
Ejemplo n.º 6
0
 /**
  * Get cookie restriction lifetime (in seconds)
  *
  * @return int
  */
 public function getCookieRestrictionLifetime()
 {
     return (int) $this->_currentStore->getConfig(self::XML_PATH_COOKIE_RESTRICTION_LIFETIME);
 }
Ejemplo n.º 7
0
 /**
  * Get frontend policy
  *
  * @return string|null
  */
 public function getFrontendPolicy()
 {
     return $this->_getDomainPolicyByCode((int) (string) $this->_store->getConfig(self::XML_DOMAIN_POLICY_FRONTEND));
 }
Ejemplo n.º 8
0
 /**
  * Loads the meta data for the given store.
  *
  * @param Mage_Core_Model_Store $store the store view to load the data for.
  */
 public function loadData(Mage_Core_Model_Store $store)
 {
     $this->_country = $store->getConfig('general/country/default');
 }
Ejemplo n.º 9
0
 protected function _getConfigValueWithDefault(Mage_Core_Model_Store $store, $path, $default = null)
 {
     $value = $store->getConfig($path);
     if (is_null($value) || '' === $value) {
         $value = $default;
     }
     return $value;
 }
Ejemplo n.º 10
0
 /**
  * Retrieves category/product indexer mode
  *
  * @return boolean
  */
 protected function _isLiveCategoryProductReindexEnabled()
 {
     return (bool) (string) $this->_store->getConfig(self::XML_PATH_LIVE_CATEGORY_PRODUCT_REINDEX_ENABLED);
 }
Ejemplo n.º 11
0
 /**
  * Loads the meta data for the given store.
  *
  * @param Mage_Core_Model_Store $store the store view to load the data for.
  */
 public function loadData(Mage_Core_Model_Store $store)
 {
     /** @var Mage_Admin_Model_User $user */
     /** @noinspection PhpUndefinedMethodInspection */
     $user = Mage::getSingleton('admin/session')->getUser();
     /** @var Nosto_Tagging_Helper_Url $urlHelper */
     $urlHelper = Mage::helper('nosto_tagging/url');
     /** @var Nosto_Tagging_Helper_Data $dataHelper */
     $dataHelper = Mage::helper('nosto_tagging/data');
     $this->_firstName = $user->getFirstname();
     $this->_lastName = $user->getLastname();
     $this->_email = $user->getEmail();
     $this->_languageIsoCode = substr(Mage::app()->getLocale()->getLocaleCode(), 0, 2);
     $this->_languageIsoCodeShop = substr($store->getConfig('general/locale/code'), 0, 2);
     $this->_uniqueId = $dataHelper->getInstallationId();
     $this->_previewUrlProduct = $urlHelper->getPreviewUrlProduct($store);
     $this->_previewUrlCategory = $urlHelper->getPreviewUrlCategory($store);
     $this->_previewUrlSearch = $urlHelper->getPreviewUrlSearch($store);
     $this->_previewUrlCart = $urlHelper->getPreviewUrlCart($store);
     $this->_previewUrlFront = $urlHelper->getPreviewUrlFront($store);
     $this->_shopName = $store->getName();
 }
Ejemplo n.º 12
0
 public function getDefaultAdjustment(Mage_Core_Model_Store $store)
 {
     return round(floatval($store->getConfig('shipping/lokey_shippingadjustments/default_pisa_amount')), 2);
 }
Ejemplo n.º 13
0
 /**
  * Add a logger if store configuration allows
  *
  * @param string $loggerKey
  * @param Mage_Core_Model_Store $store
  */
 public function addStoreLog($loggerKey, Mage_Core_Model_Store $store)
 {
     if ($store->getConfig('dev/log/active')) {
         $this->addStreamLog($loggerKey);
     }
 }
Ejemplo n.º 14
0
 /**
  * Loads the meta data for the given store.
  *
  * @param Mage_Core_Model_Store $store the store view to load the data for.
  */
 public function loadData(Mage_Core_Model_Store $store)
 {
     $this->_title = $store->getWebsite()->getName() . ' - ' . $store->getGroup()->getName() . ' - ' . $store->getName();
     $this->_name = substr(sha1(rand()), 0, 8);
     $this->_frontPageUrl = NostoHttpRequest::replaceQueryParamInUrl('___store', $store->getCode(), $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB));
     $this->_currencyCode = $store->getBaseCurrencyCode();
     $this->_languageCode = substr($store->getConfig('general/locale/code'), 0, 2);
     $this->_ownerLanguageCode = substr(Mage::app()->getLocale()->getLocaleCode(), 0, 2);
     /** @var Nosto_Tagging_Model_Meta_Account_Owner $owner */
     $owner = Mage::getModel('nosto_tagging/meta_account_owner');
     $owner->loadData($store);
     $this->_owner = $owner;
     /** @var Nosto_Tagging_Model_Meta_Account_Billing $billing */
     $billing = Mage::getModel('nosto_tagging/meta_account_billing');
     $billing->loadData($store);
     $this->_billing = $billing;
 }
 /**
  * Determine if a developer restriction is in place, and if we're enabling something that will use it
  * then notify and ask if it needs to be changed from its current value.
  *
  * @param  \Mage_Core_Model_Store $store
  * @param  bool                   $enabled
  * @return void
  */
 protected function detectAskAndSetDeveloperIp(\Mage_Core_Model_Store $store, $enabled)
 {
     if (!$enabled) {
         // No need to notify about developer IP restrictions if we're disabling template hints etc
         return;
     }
     /** @var OutputInterface $output */
     $output = $this->getHelper('io')->getOutput();
     if (!($devRestriction = $store->getConfig('dev/restrict/allow_ips'))) {
         return;
     }
     $this->askAndSetDeveloperIp($output, $store, $devRestriction);
 }
Ejemplo n.º 16
0
 /**
  *  Builds a record for a given store
  *
  * @param Mage_Core_Model_Store $store
  * @return array
  */
 protected function _buildStore(Mage_Core_Model_Store $store)
 {
     $locale = preg_split('/_/', $store->getConfig('general/locale/code'));
     return array('webStoreName' => $store->getName(), 'webStoreId' => $store->getStoreId(), 'language' => $locale[1], 'currencyCode' => $store->getCurrentCurrencyCode(), 'url' => $store->getUrl());
 }
Ejemplo n.º 17
0
 /**
  * Loads the meta data for the given store.
  *
  * @param Mage_Core_Model_Store $store the store view to load the data for.
  */
 public function loadData(Mage_Core_Model_Store $store)
 {
     /* @var Nosto_Tagging_Helper_Data $helper */
     $helper = Mage::helper('nosto_tagging');
     $this->_title = $helper->cleanUpAccountTitle($store->getWebsite()->getName() . ' - ' . $store->getGroup()->getName() . ' - ' . $store->getName());
     $this->_name = substr(sha1(rand()), 0, 8);
     if (!$helper->getUsePrettyProductUrls()) {
         $this->_frontPageUrl = NostoHttpRequest::replaceQueryParamInUrl('___store', $store->getCode(), $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB));
     } else {
         $this->_frontPageUrl = $store->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
     }
     $this->_currencyCode = $store->getBaseCurrencyCode();
     $this->_languageCode = substr($store->getConfig('general/locale/code'), 0, 2);
     $this->_ownerLanguageCode = substr(Mage::app()->getLocale()->getLocaleCode(), 0, 2);
     /** @var Nosto_Tagging_Model_Meta_Account_Owner $owner */
     $owner = Mage::getModel('nosto_tagging/meta_account_owner');
     $owner->loadData();
     $this->_owner = $owner;
     /** @var Nosto_Tagging_Model_Meta_Account_Billing $billing */
     $billing = Mage::getModel('nosto_tagging/meta_account_billing');
     $billing->loadData($store);
     $this->_billing = $billing;
     $this->_useCurrencyExchangeRates = !$helper->multiCurrencyDisabled($store);
     if (!$helper->multiCurrencyDisabled($store)) {
         $this->_defaultPriceVariationId = $store->getBaseCurrencyCode();
     } else {
         $this->_defaultPriceVariationId = "";
     }
     $storeLocale = $store->getConfig('general/locale/code');
     $currencyCodes = $store->getAvailableCurrencyCodes(true);
     if (is_array($currencyCodes) && count($currencyCodes) > 0) {
         /** @var Nosto_Tagging_Helper_Currency $currencyHelper */
         $currencyHelper = Mage::helper('nosto_tagging/currency');
         foreach ($currencyCodes as $currencyCode) {
             $this->_currencies[$currencyCode] = $currencyHelper->getCurrencyObject($storeLocale, $currencyCode);
         }
     }
 }
 /**
  * Retrieves fulltext indexer mode
  *
  * @return boolean
  */
 protected function _isLiveFulltextReindexEnabled()
 {
     return (bool) (string) $this->_store->getConfig(self::XML_PATH_LIVE_FULLTEXT_REINDEX_ENABLED);
 }