Skip to content

Commit

Permalink
release version 2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryFan-Zip committed Aug 12, 2019
1 parent 4e6c04c commit 5ea4975
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 29 deletions.
2 changes: 1 addition & 1 deletion app/code/community/Zip/Payment/Block/Checkout/Script.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function getCheckoutScriptList()
$baseScript = $scriptBaseUrl . self::CHECKOUT_JS_PATH;
$scriptList = array($baseScript);

if (Mage::helper('zip_payment')->isUsingOnePageCheckout()) {
if (Mage::helper('zip_payment')->isOnePageCheckout()) {
array_push($scriptList, $scriptBaseUrl . self::ONEPAGE_CHECKOUT_JS_PATH);
} else {
$customScript = Mage::helper('zip_payment')
Expand Down
22 changes: 6 additions & 16 deletions app/code/community/Zip/Payment/Block/Widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,22 +139,12 @@ protected function getWidgetPageType()
$helper = Mage::helper('zip_payment');
$pageIdentifier = $helper->getPageIdentifier();

if ($helper->isUsingOnePageCheckout() || $helper->isUsingOneStepCheckout()) {
return 'checkout';
}

switch ($pageIdentifier) {
case 'cms_index_index':
return 'home';
case 'catalog_product_view':
return 'product';
case 'catalog_category_view':
return 'category';
case 'checkout_cart_index':
return 'cart';
case 'cms_page_view':
return 'landing';
}
if ($helper->isCheckoutPage()) { return 'checkout'; }
if ($pageIdentifier == 'cms_index_index') { return 'home'; }
if ($pageIdentifier == 'catalog_product_view') { return 'product'; }
if ($pageIdentifier == 'catalog_category_view') { return 'category'; }
if ($pageIdentifier == 'checkout_cart_index') { return 'cart'; }
if ($pageIdentifier == 'cms_page_view') { return 'landing'; }

return null;
}
Expand Down
25 changes: 16 additions & 9 deletions app/code/community/Zip/Payment/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,28 +145,35 @@ public function getPagePath()
{
$currentUrl = Mage::helper('core/url')->getCurrentUrl();
$url = Mage::getSingleton('core/url')->parseUrl($currentUrl);
return $url->getPath();
return rtrim($url->getPath(), '/');
}

/**
* is currently using one page checkout
* is currently checkout page
*/
public function isUsingOnePageCheckout()
public function isCheckoutPage()
{
return $this->getPagePath() == Zip_Payment_Model_Config::ONEPAGE_CHECKOUT_IDENTIFIER &&
$path = $this->getPagePath();
$checkoutPath = rtrim($this->getConfig()->getValue(Zip_Payment_Model_Config::CONFIG_CHECKOUT_PATH_PATH), '/');
return strpos($path, $checkoutPath) !== false;
}

/**
* is currently one page checkout
*/
public function isOnePageCheckout()
{
return $this->isCheckoutPage() &&
$this->getConfig()->getValue(Zip_Payment_Model_Config::CONFIG_CHECKOUT_TYPE_PATH) ==
Zip_Payment_Model_Adminhtml_System_Config_Source_CheckoutType::CHECKOUT_TYPE_ONE_PAGE;
}

/**
* is current page onestep checkout
*/
public function isUsingOneStepCheckout()
public function isOneStepCheckout()
{
$path = rtrim($this->getPagePath(), '/');
$checkoutPath = rtrim($this->getConfig()->getValue(Zip_Payment_Model_Config::CONFIG_CHECKOUT_PATH_PATH), '/');

return $path == $checkoutPath &&
return $this->isCheckoutPage() &&
$this->getConfig()->getValue(Zip_Payment_Model_Config::CONFIG_CHECKOUT_TYPE_PATH) ==
Zip_Payment_Model_Adminhtml_System_Config_Source_CheckoutType::CHECKOUT_TYPE_ONE_STEP;
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Zip/Payment/Model/Api/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ protected function getMetadata()
$metadata['platform'] = 'Magento 1';
$metadata['platform_version'] = Mage::getVersion();
$metadata['plugin'] = 'zip-magento1';
$metadata['plugin_version'] = '2.1.0';
$metadata['plugin_version'] = '2.1.1';
return $metadata;
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Zip/Payment/Model/Method.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public function getCheckoutRedirectUrl()
}

// return redirect url for one step checkout
if ($redirectUrl && ($this->_getHelper()->isUsingOneStepCheckout() || $this->_getHelper()->isRedirectCheckoutDisplayModel())) {
if ($redirectUrl && ($this->_getHelper()->isOneStepCheckout() || $this->_getHelper()->isRedirectCheckoutDisplayModel())) {
return $redirectUrl;
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Zip/Payment/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function setCheckoutLayoutHandle($observer)
{
$layoutHandle = 'checkout_layout_handle';

if (Mage::helper('zip_payment')->isUsingOnePageCheckout() || Mage::helper('zip_payment')->isUsingOneStepCheckout()) {
if (Mage::helper('zip_payment')->isOneStepCheckout()) {
Mage::app()->getLayout()->getUpdate()->addHandle($layoutHandle);
}
}
Expand Down
7 changes: 7 additions & 0 deletions app/design/frontend/base/default/layout/zip/payment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
-->

<!-- Layout handle for Checkout pages -->
<checkout_onepage_index>
<reference name="before_body_end">
<block type="zip_payment/checkout_overlay" name="zip.payment.checkout.overlay" template="zip/payment/checkout/overlay.phtml"/>
<block type="zip_payment/checkout_script" name="zip.payment.checkout.js" template="zip/payment/checkout/js.phtml"/>
</reference>
</checkout_onepage_index>

<checkout_layout_handle>
<reference name="before_body_end">
<block type="zip_payment/checkout_overlay" name="zip.payment.checkout.overlay" template="zip/payment/checkout/overlay.phtml"/>
Expand Down

0 comments on commit 5ea4975

Please sign in to comment.