Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
fix #253 use default store id
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahellison committed Apr 14, 2016
1 parent 91397f9 commit fafb3c4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
18 changes: 18 additions & 0 deletions app/code/community/Amazon/Payments/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,4 +255,22 @@ public function getAdminConfig($path)
}
}

/**
* Get admin/default store id
*/
public function getAdminStoreId()
{
if ($code = Mage::getSingleton('adminhtml/config_data')->getStore()) {
return Mage::getModel('core/store')->load($code)->getId();
}
elseif ($code = Mage::getSingleton('adminhtml/config_data')->getWebsite()) {
$website_id = Mage::getModel('core/website')->load($code)->getId();
return Mage::app()->getWebsite($website_id)->getDefaultStore()->getId();
}
else
{
return Mage::app()->getDefaultStoreView()->getId();
}
}

}
2 changes: 1 addition & 1 deletion app/code/community/Amazon/Payments/Model/SimplePath.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public function autoEnable()
*/
public function getListenerUrl()
{
$url = Mage::getUrl('amazon_payments/simplepath', array('_store' => 1, '_forced_secure' => true));
$url = Mage::getUrl('amazon_payments/simplepath', array('_store' => Mage::helper('amazon_payments')->getAdminStoreId(), '_forced_secure' => true));
// Add index.php
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB, true);
return str_replace($baseUrl, $baseUrl . 'index.php/', $url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public function getCommentText(Mage_Core_Model_Config_Element $element, $current
<div style="border:1px solid #ccc; color:#666; padding:8px; margin-top:0.5em; font-size:90%">
If "No," add these URLs in Seller Central under "Allowed Return URLs":<br />
<ul style="list-style:disc inside">
<li>' . str_replace($replace_cleanup, '', Mage::getUrl('amazon_payments/customer/authorize', array('_store' => 1, '_forced_secure' => true))) . '</li>
<li>' . str_replace($replace_cleanup, '', Mage::getUrl('amazon_payments/checkout/authorize', array('_store' => 1, '_forced_secure' => true))) . '</li>
<li>' . str_replace($replace_cleanup, '', Mage::getUrl('amazon_payments/customer/authorize', array('_store' => Mage::helper('amazon_payments')->getAdminStoreId(), '_forced_secure' => true))) . '</li>
<li>' . str_replace($replace_cleanup, '', Mage::getUrl('amazon_payments/checkout/authorize', array('_store' => Mage::helper('amazon_payments')->getAdminStoreId(), '_forced_secure' => true))) . '</li>
</ul>
</div>
<style>#payment_amazon_payments_popupcomment{display:none;}</style>
Expand Down

0 comments on commit fafb3c4

Please sign in to comment.