diff --git a/app/Mage.php b/app/Mage.php
index cfc95f8b97..f48d1fe5b7 100644
--- a/app/Mage.php
+++ b/app/Mage.php
@@ -82,7 +82,7 @@ final class Mage {
public static function getVersion()
{
- return '1.2.0.2';
+ return '1.2.0.3';
}
/**
diff --git a/app/code/core/Mage/GoogleCheckout/Block/Adminhtml/Shipping/Merchant.php b/app/code/core/Mage/GoogleCheckout/Block/Adminhtml/Shipping/Merchant.php
index 365e522c8b..acb6b694e2 100644
--- a/app/code/core/Mage/GoogleCheckout/Block/Adminhtml/Shipping/Merchant.php
+++ b/app/code/core/Mage/GoogleCheckout/Block/Adminhtml/Shipping/Merchant.php
@@ -82,8 +82,18 @@ protected function _getRowTemplateHtml($i=0)
protected function getShippingMethods()
{
if (!$this->hasData('shipping_methods')) {
+ $website = $this->getRequest()->getParam('website');
+ $store = $this->getRequest()->getParam('store');
+
+ $storeId = null;
+ if (!is_null($website)) {
+ $storeId = Mage::getModel('core/website')->load($website, 'code')->getDefaultGroup()->getDefaultStoreId();
+ } elseif (!is_null($store)) {
+ $storeId = Mage::getModel('core/store')->load($store, 'code')->getId();
+ }
+
$methods = array();
- $carriers = Mage::getSingleton('shipping/config')->getActiveCarriers();
+ $carriers = Mage::getSingleton('shipping/config')->getActiveCarriers($storeId);
foreach ($carriers as $carrierCode=>$carrierModel) {
if (!$carrierModel->isActive()) {
continue;
@@ -92,7 +102,7 @@ protected function getShippingMethods()
if (!$carrierMethods) {
continue;
}
- $carrierTitle = Mage::getStoreConfig('carriers/'.$carrierCode.'/title');
+ $carrierTitle = Mage::getStoreConfig('carriers/'.$carrierCode.'/title', $storeId);
$methods[$carrierCode] = array(
'title' => $carrierTitle,
'methods' => array(),
diff --git a/app/code/core/Mage/GoogleCheckout/Model/Api.php b/app/code/core/Mage/GoogleCheckout/Model/Api.php
index 99579fc689..b7b55adc24 100644
--- a/app/code/core/Mage/GoogleCheckout/Model/Api.php
+++ b/app/code/core/Mage/GoogleCheckout/Model/Api.php
@@ -28,7 +28,7 @@ class Mage_GoogleCheckout_Model_Api extends Varien_Object
{
protected function _getApi($area)
{
- $api = Mage::getModel('googlecheckout/api_xml_'.$area);
+ $api = Mage::getModel('googlecheckout/api_xml_'.$area)->setStoreId($this->getStoreId());
$api->setApi($this);
return $api;
}
diff --git a/app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Abstract.php b/app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Abstract.php
index bafcd41547..04760fb402 100644
--- a/app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Abstract.php
+++ b/app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Abstract.php
@@ -50,7 +50,7 @@ public function __()
public function getMerchantId()
{
if (!$this->hasData('merchant_id')) {
- $this->setData('merchant_id', Mage::getStoreConfig('google/checkout/merchant_id'));
+ $this->setData('merchant_id', Mage::getStoreConfig('google/checkout/merchant_id', $this->getStoreId()));
}
return $this->getData('merchant_id');
}
@@ -58,7 +58,7 @@ public function getMerchantId()
public function getMerchantKey()
{
if (!$this->hasData('merchant_key')) {
- $this->setData('merchant_key', Mage::getStoreConfig('google/checkout/merchant_key'));
+ $this->setData('merchant_key', Mage::getStoreConfig('google/checkout/merchant_key', $this->getStoreId()));
}
return $this->getData('merchant_key');
}
@@ -66,7 +66,7 @@ public function getMerchantKey()
public function getServerType()
{
if (!$this->hasData('server_type')) {
- $this->setData('server_type', Mage::getStoreConfig('google/checkout/sandbox') ? "sandbox" : "");
+ $this->setData('server_type', Mage::getStoreConfig('google/checkout/sandbox', $this->getStoreId()) ? "sandbox" : "");
}
return $this->getData('server_type');
}
@@ -74,7 +74,7 @@ public function getServerType()
public function getLocale()
{
if (!$this->hasData('locale')) {
- $this->setData('locale', Mage::getStoreConfig('google/checkout/locale'));
+ $this->setData('locale', Mage::getStoreConfig('google/checkout/locale', $this->getStoreId()));
}
return $this->getData('locale');
}
@@ -165,7 +165,7 @@ public function _call($xml)
$xml = ''."\r\n".$xml;
- if (Mage::getStoreConfig('google/checkout/debug')) {
+ if (Mage::getStoreConfig('google/checkout/debug', $this->getStoreId())) {
$debug = Mage::getModel('googlecheckout/api_debug');
$debug->setDir('out')->setUrl($url)->setRequestBody($xml)->save();
}
@@ -198,6 +198,6 @@ public function _call($xml)
protected function _getCallbackUrl()
{
- return Mage::getUrl('googlecheckout/api', array('_forced_secure'=>Mage::getStoreConfig('google/checkout/use_secure_callback_url')));
+ return Mage::getUrl('googlecheckout/api', array('_forced_secure'=>Mage::getStoreConfig('google/checkout/use_secure_callback_url', $this->getStoreId())));
}
}
diff --git a/app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Callback.php b/app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Callback.php
index 09260a8aba..4d94f3762e 100644
--- a/app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Callback.php
+++ b/app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Callback.php
@@ -154,7 +154,7 @@ protected function _responseMerchantCalculationCallback()
if ($gRequestMethods = $this->getData('root/calculate/shipping/method')) {
$carriers = array();
$errors = array();
- foreach (Mage::getStoreConfig('carriers') as $carrierCode=>$carrierConfig) {
+ foreach (Mage::getStoreConfig('carriers', $this->getStoreId()) as $carrierCode=>$carrierConfig) {
if (!isset($carrierConfig['title'])) {
continue;
}
diff --git a/app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Order.php b/app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Order.php
index 4e0757d553..eab62f67dc 100644
--- a/app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Order.php
+++ b/app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Order.php
@@ -29,7 +29,7 @@ class Mage_GoogleCheckout_Model_Api_Xml_Order extends Mage_GoogleCheckout_Model_
protected function _getApiUrl()
{
$url = $this->_getBaseApiUrl();
- $url .= 'request/Merchant/'.Mage::getStoreConfig('google/checkout/merchant_id');
+ $url .= 'request/Merchant/'.Mage::getStoreConfig('google/checkout/merchant_id', $this->getStoreId());
return $url;
}
diff --git a/app/code/core/Mage/GoogleCheckout/Model/Observer.php b/app/code/core/Mage/GoogleCheckout/Model/Observer.php
index 1892dff93c..a62e96e77d 100644
--- a/app/code/core/Mage/GoogleCheckout/Model/Observer.php
+++ b/app/code/core/Mage/GoogleCheckout/Model/Observer.php
@@ -43,9 +43,9 @@ public function salesOrderShipmentTrackSaveAfter(Varien_Event_Observer $observer
return;
}
- $api = Mage::getModel('googlecheckout/api');
-
- $api->deliver($order->getExtOrderId(), $track->getCarrierCode(), $track->getNumber());
+ Mage::getModel('googlecheckout/api')
+ ->setStoreId($order->getStoreId())
+ ->deliver($order->getExtOrderId(), $track->getCarrierCode(), $track->getNumber());
}
public function salesOrderShipmentSaveAfter(Varien_Event_Observer $observer)
@@ -66,7 +66,9 @@ public function salesOrderShipmentSaveAfter(Varien_Event_Observer $observer)
}
if ($items) {
- Mage::getModel('googlecheckout/api')->shipItems($order->getExtOrderId(), $items);
+ Mage::getModel('googlecheckout/api')
+ ->setStoreId($order->getStoreId())
+ ->shipItems($order->getExtOrderId(), $items);
}
}
}
diff --git a/app/code/core/Mage/GoogleCheckout/Model/Payment.php b/app/code/core/Mage/GoogleCheckout/Model/Payment.php
index 44227b9f91..e157f0bbb3 100644
--- a/app/code/core/Mage/GoogleCheckout/Model/Payment.php
+++ b/app/code/core/Mage/GoogleCheckout/Model/Payment.php
@@ -84,7 +84,7 @@ public function getOrderPlaceRedirectUrl()
*/
public function authorize(Varien_Object $payment, $amount)
{
- $api = Mage::getModel('googlecheckout/api');
+ $api = Mage::getModel('googlecheckout/api')->setStoreId($payment->getOrder()->getStoreId());
$api->authorize($payment->getOrder()->getExtOrderId());
return $this;
@@ -114,7 +114,7 @@ public function capture(Varien_Object $payment, $amount)
}
}
- $api = Mage::getModel('googlecheckout/api');
+ $api = Mage::getModel('googlecheckout/api')->setStoreId($payment->getOrder()->getStoreId());
$api->charge($payment->getOrder()->getExtOrderId(), $amount);
$payment->setForcedState(Mage_Sales_Model_Order_Invoice::STATE_OPEN);
@@ -140,7 +140,7 @@ public function refund(Varien_Object $payment, $amount)
$reason = $this->getReason() ? $this->getReason() : $hlp->__('No Reason');
$comment = $this->getComment() ? $this->getComment() : $hlp->__('No Comment');
- $api = Mage::getModel('googlecheckout/api');
+ $api = Mage::getModel('googlecheckout/api')->setStoreId($payment->getOrder()->getStoreId());
$api->refund($payment->getOrder()->getExtOrderId(), $amount, $reason, $comment);
return $this;
@@ -166,7 +166,7 @@ public function cancel(Varien_Object $payment)
$reason = $this->getReason() ? $this->getReason() : $hlp->__('Unknown Reason');
$comment = $this->getComment() ? $this->getComment() : $hlp->__('No Comment');
- $api = Mage::getModel('googlecheckout/api');
+ $api = Mage::getModel('googlecheckout/api')->setStoreId($payment->getOrder()->getStoreId());
$api->cancel($payment->getOrder()->getExtOrderId(), $reason, $comment);
}
diff --git a/app/code/core/Mage/GoogleOptimizer/Helper/Data.php b/app/code/core/Mage/GoogleOptimizer/Helper/Data.php
index 722a075689..09ecac43e6 100644
--- a/app/code/core/Mage/GoogleOptimizer/Helper/Data.php
+++ b/app/code/core/Mage/GoogleOptimizer/Helper/Data.php
@@ -105,7 +105,7 @@ public function categoryAttribute($callObject, $attributeHtml, $params)
return $attributeHtml;
}
- $newAttributeName = 'product_'.$attributeName.'_'.$category->getId();
+ $newAttributeName = 'category_'.$attributeName.'_'.$category->getId();
if (strlen($newAttributeName) > self::MAX_ATTRIBUTE_LENGTH_LIMIT) {
$newAttributeName = 'category_';
$newAttributeName .= substr($attributeName, 0, (self::MAX_ATTRIBUTE_LENGTH_LIMIT - strlen('category__'.$category->getId())));
diff --git a/app/code/core/Mage/GoogleOptimizer/Model/Code.php b/app/code/core/Mage/GoogleOptimizer/Model/Code.php
index 5bfb8c0ff6..32ef2d151c 100644
--- a/app/code/core/Mage/GoogleOptimizer/Model/Code.php
+++ b/app/code/core/Mage/GoogleOptimizer/Model/Code.php
@@ -139,11 +139,18 @@ public function saveScripts($storeId)
if (!$this->getEntity()->getGoogleOptimizerScripts()) {
return $this;
}
+ $script = $this->getEntity()->getGoogleOptimizerScripts();
- $this->setData($this->getEntity()->getGoogleOptimizerScripts()->getData())
+ $this->setData($script->getData())
->setEntityId($this->getEntity()->getId())
- ->setEntityType($this->getEntityType())
- ->setStoreId($storeId);
+ ->setEntityType($this->getEntityType());
+
+ /**
+ * We can't modify store id if existing stcript
+ */
+ if (!$script->getId()) {
+ $this->setStoreId($storeId);
+ }
if (false === $this->_validate()) {
throw new Exception(Mage::helper('googleoptimizer')->__('All fields of script types have to be filled.'));
diff --git a/app/code/core/Mage/GoogleOptimizer/etc/config.xml b/app/code/core/Mage/GoogleOptimizer/etc/config.xml
index 78abfd5a2c..9f3b8ae5f8 100644
--- a/app/code/core/Mage/GoogleOptimizer/etc/config.xml
+++ b/app/code/core/Mage/GoogleOptimizer/etc/config.xml
@@ -75,6 +75,17 @@
Mage_GoogleOptimizer_Block
+
+
+
+
+ singleton
+ googleoptimizer/observer
+ appendToPageGoogleOptimizerScripts
+
+
+
+
@@ -111,15 +122,6 @@
-
-
-
- singleton
- googleoptimizer/observer
- appendToPageGoogleOptimizerScripts
-
-
-
diff --git a/lib/Zend/Currency.php b/lib/Zend/Currency.php
index 35b916027c..82f42e165f 100644
--- a/lib/Zend/Currency.php
+++ b/lib/Zend/Currency.php
@@ -176,7 +176,7 @@ public function toCurrency($value, array $options = array())
$value = Zend_Locale_Format::convertNumerals($value, 'Latn', $options['script']);
}
- $this->_processSymbolChoice($options);
+ $this->_processSymbolChoice($options, $value);
// Get the sign to be placed next to the number
if (is_numeric($options['display']) === false) {
@@ -228,9 +228,10 @@ protected function _concatSign($value, $sign, $options)
* Select currency symbol if multiple symbols were specified
*
* @param array $options
+ * @param integer|float $value Currency value
* @return array
*/
- protected function _processSymbolChoice($options)
+ protected function _processSymbolChoice($options, $value)
{
if (isset($options['symbol_choice']) && $options['symbol_choice']) {
$symbols = explode('|', $options['symbol']);