Skip to content

Commit

Permalink
Import Magento Release 1.2.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeSaferite committed Jan 26, 2009
1 parent 1f631b0 commit aadc3fa
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 35 deletions.
2 changes: 1 addition & 1 deletion app/Mage.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ final class Mage {

public static function getVersion()
{
return '1.2.0.2';
return '1.2.0.3';
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/GoogleCheckout/Model/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
12 changes: 6 additions & 6 deletions app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,31 @@ 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');
}

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');
}

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');
}

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');
}
Expand Down Expand Up @@ -165,7 +165,7 @@ public function _call($xml)

$xml = '<?xml version="1.0" encoding="UTF-8"?>'."\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();
}
Expand Down Expand Up @@ -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())));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
10 changes: 6 additions & 4 deletions app/code/core/Mage/GoogleCheckout/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
}
}
}
8 changes: 4 additions & 4 deletions app/code/core/Mage/GoogleCheckout/Model/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand All @@ -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;
Expand All @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/core/Mage/GoogleOptimizer/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -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())));
Expand Down
13 changes: 10 additions & 3 deletions app/code/core/Mage/GoogleOptimizer/Model/Code.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.'));
Expand Down
20 changes: 11 additions & 9 deletions app/code/core/Mage/GoogleOptimizer/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@
<blocks>
<googleoptimizer><class>Mage_GoogleOptimizer_Block</class></googleoptimizer>
</blocks>
<events>
<cms_page_load_after>
<observers>
<googleoptimizer_observer>
<type>singleton</type>
<class>googleoptimizer/observer</class>
<method>appendToPageGoogleOptimizerScripts</method>
</googleoptimizer_observer>
</observers>
</cms_page_load_after>
</events>
</global>
<admin>
<attributes>
Expand Down Expand Up @@ -111,15 +122,6 @@
</updates>
</layout>
<events>
<cms_page_load_after>
<observers>
<googleoptimizer_observer>
<type>singleton</type>
<class>googleoptimizer/observer</class>
<method>appendToPageGoogleOptimizerScripts</method>
</googleoptimizer_observer>
</observers>
</cms_page_load_after>
<catalog_product_load_after>
<observers>
<googleoptimizer_observer>
Expand Down
5 changes: 3 additions & 2 deletions lib/Zend/Currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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']);
Expand Down

0 comments on commit aadc3fa

Please sign in to comment.