-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
diptib10
committed
Apr 25, 2017
1 parent
2765e3d
commit a04aada
Showing
29 changed files
with
1,838 additions
and
535 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
extension/app/code/community/Affirm/Affirm/Block/Product/List.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
/** | ||
* OnePica | ||
* NOTICE OF LICENSE | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* http://opensource.org/licenses/osl-3.0.php | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* @category Affirm | ||
* @package Affirm_Affirm | ||
* @copyright Copyright (c) 2014 One Pica, Inc. (http://www.onepica.com) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
*/ | ||
|
||
class Affirm_Affirm_Block_Product_List extends Mage_Catalog_Block_Product_List | ||
{ | ||
private $_minMPP = null; | ||
|
||
private function _getMinMPP() | ||
{ | ||
if($this->_minMPP == null) { | ||
$this->_minMPP = $this->helper('affirm/promo_asLowAs')->getMinMPP(); | ||
if(empty($this->_minMPP)) { | ||
$this->_minMPP = 0; | ||
} | ||
} | ||
|
||
return $this->_minMPP; | ||
} | ||
|
||
public function getPriceHtml($product, $displayMinimalPrice = false, $idSuffix = '') | ||
{ | ||
$html = parent::getPriceHtml($product, $product, $idSuffix); | ||
|
||
if ($this->helper('affirm/promo_asLowAs')->isAsLowAsDisabledOnPLP()) { | ||
return $html; | ||
} | ||
|
||
$mpp = $this->_getMinMPP(); | ||
|
||
$price = $product->getFinalPrice(); | ||
if ($price > $mpp) { | ||
$categoryIds = $product->getCategoryIds(); | ||
|
||
$start_date = $product->getAffirmProductMfpStartDate(); | ||
$end_date = $product->getAffirmProductMfpEndDate(); | ||
if(empty($start_date) || empty($end_date)) { | ||
$mfpValue = $product->getAffirmProductPromoId(); | ||
} else { | ||
if(Mage::app()->getLocale()->isStoreDateInInterval(null, $start_date, $end_date)) { | ||
$mfpValue = $product->getAffirmProductPromoId(); | ||
} else { | ||
$mfpValue = ""; | ||
} | ||
} | ||
|
||
$productItemMFP = array( | ||
'value' => $mfpValue, | ||
'type' => $product->getAffirmProductMfpType(), | ||
'priority' => $product->getAffirmProductMfpPriority() ? | ||
$product->getAffirmProductMfpPriority() : 0 | ||
); | ||
|
||
$mfpValue = $this->helper('affirm/promo_asLowAs')->getAffirmMFPValue(array($productItemMFP), $categoryIds); | ||
|
||
$html .= '<div class="affirm-as-low-as" ' . (!empty($mfpValue) ? 'data-promo-id="' . $mfpValue . '"' : '') . ' data-amount="' . $this->helper('affirm/util')->formatCents($price) .'"></div>'; | ||
} | ||
|
||
return $html; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.