From 7d74b7a273d9d5f34852fcd5ac68ab085eae8edc Mon Sep 17 00:00:00 2001 From: Nanda <29716662+nandadubey@users.noreply.github.com> Date: Tue, 19 Jun 2018 10:28:25 -0700 Subject: [PATCH] Dev v3.5.5 (#41) * Add admin config to enable/disable learn more from ala * Bug fix for observer after order confirmation for some non Affirm payments * version update * package file updated --- Makefile | 2 +- build/affirm_tar_to_connect_config.php | 6 +-- .../Affirm/Affirm/Block/Product/List.php | 3 +- .../Affirm/Affirm/Helper/Promo/AsLowAs.php | 16 ++++++++ .../Affirm/Affirm/Model/Order/Observer.php | 18 ++++---- .../community/Affirm/Affirm/etc/config.xml | 3 +- .../community/Affirm/Affirm/etc/system.xml | 9 ++++ .../affirm/promo/aslowas/checkout.phtml | 5 ++- .../affirm/promo/aslowas/product.phtml | 41 +++++++++++++++++-- extension/package.xml | 12 +++--- 10 files changed, 90 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index 402e32b..047ace6 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ dependencies: package: validate_version mkdir -p ./var/ - cd ./extension && tar -cvf ../var/Affirm_Affirm-3.5.4.tgz * + cd ./extension && tar -cvf ../var/Affirm_Affirm-3.5.5.tgz * cd ./build && ./magento-tar-to-connect.phar affirm_tar_to_connect_config.php clean: diff --git a/build/affirm_tar_to_connect_config.php b/build/affirm_tar_to_connect_config.php index 9aa8657..858e874 100644 --- a/build/affirm_tar_to_connect_config.php +++ b/build/affirm_tar_to_connect_config.php @@ -1,11 +1,11 @@ realpath('../var/'), -'archive_files' => 'Affirm_Affirm-3.5.4.tgz', +'archive_files' => 'Affirm_Affirm-3.5.5.tgz', 'extension_name' => 'Affirm_Magento', 'skip_version_compare' => true, -'extension_version' => '3.5.4', -'archive_connect' => 'Affirm_Affirm-3.5.4.tgz', +'extension_version' => '3.5.5', +'archive_connect' => 'Affirm_Affirm-3.5.5.tgz', 'path_output' => realpath('../var/'), 'stability' => 'stable', diff --git a/extension/app/code/community/Affirm/Affirm/Block/Product/List.php b/extension/app/code/community/Affirm/Affirm/Block/Product/List.php index 5fdbf9f..02664fd 100644 --- a/extension/app/code/community/Affirm/Affirm/Block/Product/List.php +++ b/extension/app/code/community/Affirm/Affirm/Block/Product/List.php @@ -72,7 +72,8 @@ public function getPriceHtml($product, $displayMinimalPrice = false, $idSuffix = $mfpValue = $this->helper('affirm/promo_asLowAs')->getAffirmMFPValue(array($productItemMFP), $categoryIds); - $html .= '
'; + $learnMore = ($this->helper('affirm/promo_asLowas')->isVisibleLearnMore()) ? 'true' : 'false'; + $html .= '
'; } return $html; diff --git a/extension/app/code/community/Affirm/Affirm/Helper/Promo/AsLowAs.php b/extension/app/code/community/Affirm/Affirm/Helper/Promo/AsLowAs.php index 597f5f6..87f92a6 100644 --- a/extension/app/code/community/Affirm/Affirm/Helper/Promo/AsLowAs.php +++ b/extension/app/code/community/Affirm/Affirm/Helper/Promo/AsLowAs.php @@ -79,6 +79,11 @@ class Affirm_Affirm_Helper_Promo_AsLowAs extends Mage_Core_Helper_Abstract */ const MPP_MIN_DISPLAY_VALUE = 'affirmpromo/as_low_as/min_mpp_display_value'; + /** + * Visibility of learn more with ala + */ + const AFFIRM_PROMO_LEARN_MORE = 'affirmpromo/as_low_as/learn_more'; + protected $_allRules = null; /** @@ -301,4 +306,15 @@ protected function _isAdmin() return false; } + + /** + * Check is learn-more visible on ala + * + * @param null|Mage_Core_Model_Store $store + * @return boolean + */ + public function isVisibleLearnMore($store = null) + { + return Mage::getStoreConfig(self::AFFIRM_PROMO_LEARN_MORE, $store); + } } diff --git a/extension/app/code/community/Affirm/Affirm/Model/Order/Observer.php b/extension/app/code/community/Affirm/Affirm/Model/Order/Observer.php index 9af60c1..0952c82 100644 --- a/extension/app/code/community/Affirm/Affirm/Model/Order/Observer.php +++ b/extension/app/code/community/Affirm/Affirm/Model/Order/Observer.php @@ -135,14 +135,16 @@ public function reactivateQuote($observer) $this->_isAffirmOrderSaveAfter = true; $quote = $observer->getQuote(); $methodInst = $quote->getPayment()->getMethodInstance(); - if (!Mage::helper('affirm')->getAffirmTokenCode()) { - Mage::log('Confirm has no checkout token.'); - Mage::getSingleton('core/session')->addError('Payment has failed, please reload checkout page and try again. Checkout token is not available.'); - Mage::app()->getResponse()->setRedirect(Mage::getUrl('checkout/cart'))->sendResponse(); - return; - } else if (($methodInst->getCode() == Affirm_Affirm_Model_Payment::METHOD_CODE) && !$methodInst->redirectPreOrder()) { - $quote->setIsActive(true); - $quote->save(); + if(($methodInst->getCode() == Affirm_Affirm_Model_Payment::METHOD_CODE)) { + if (!Mage::helper('affirm')->getAffirmTokenCode()) { + Mage::log('Confirm has no checkout token.'); + Mage::getSingleton('core/session')->addError('Payment has failed, please reload checkout page and try again. Checkout token is not available.'); + Mage::app()->getResponse()->setRedirect(Mage::getUrl('checkout/cart'))->sendResponse(); + return; + } else if (!$methodInst->redirectPreOrder()) { + $quote->setIsActive(true); + $quote->save(); + } } } diff --git a/extension/app/code/community/Affirm/Affirm/etc/config.xml b/extension/app/code/community/Affirm/Affirm/etc/config.xml index 3a7f3ca..133fdcf 100644 --- a/extension/app/code/community/Affirm/Affirm/etc/config.xml +++ b/extension/app/code/community/Affirm/Affirm/etc/config.xml @@ -2,7 +2,7 @@ - 3.5.4 + 3.5.5 @@ -359,6 +359,7 @@ 0.10 12 + 1 diff --git a/extension/app/code/community/Affirm/Affirm/etc/system.xml b/extension/app/code/community/Affirm/Affirm/etc/system.xml index c0006b4..7af9286 100644 --- a/extension/app/code/community/Affirm/Affirm/etc/system.xml +++ b/extension/app/code/community/Affirm/Affirm/etc/system.xml @@ -542,6 +542,15 @@ 1 0 + + + select + adminhtml/system_config_source_yesno + 60 + 1 + 1 + 0 + text diff --git a/extension/app/design/frontend/base/default/template/affirm/promo/aslowas/checkout.phtml b/extension/app/design/frontend/base/default/template/affirm/promo/aslowas/checkout.phtml index 79d93c7..75c62fd 100644 --- a/extension/app/design/frontend/base/default/template/affirm/promo/aslowas/checkout.phtml +++ b/extension/app/design/frontend/base/default/template/affirm/promo/aslowas/checkout.phtml @@ -1,8 +1,9 @@ getMFPValue(); +$mfpValue = $this->getMFPValue(); +$learnMore = ($this->helper('affirm/promo_asLowas')->isVisibleLearnMore()) ? 'true' : 'false'; ?>
- getCheckoutGrandTotal() .'">
'; ?> + getCheckoutGrandTotal() .'" data-learnmore-show="'.$learnMore.'">'; ?>