-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Solved Issue 'Stickers not showing up in new products widget #5'
- Loading branch information
Michele Fantetti aka WaPoNe
committed
Dec 14, 2017
1 parent
ad6e99b
commit 092ae14
Showing
4 changed files
with
60 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
/** | ||
* WaPoNe | ||
* | ||
* @category WaPoNe | ||
* @package WaPoNe_Stickers | ||
* @copyright Copyright (c) 2017 WaPoNe (http://www.fantetti.net) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
*/ | ||
|
||
namespace WaPoNe\Stickers\Plugin\Catalog\NewWidget; | ||
|
||
class StickersPlugin extends \WaPoNe\Stickers\Model\Stickers | ||
{ | ||
const DISCOUNT_ACTIVATION = "stickers/stickers_page/discount_activation"; | ||
|
||
protected $_productFactory; | ||
protected $_scopeConfig; | ||
|
||
public function __construct( | ||
\Magento\Catalog\Model\ProductFactory $productFactory, | ||
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig | ||
) { | ||
$this->_productFactory = $productFactory; | ||
$this->_scopeConfig = $scopeConfig; | ||
} | ||
|
||
public function beforeGetProductPriceHtml( | ||
\Magento\Catalog\Block\Product\Widget\NewWidget $list, | ||
\Magento\Catalog\Model\Product $product, | ||
$priceType = null, | ||
$renderZone = \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST, | ||
array $arguments = [] | ||
) { | ||
$this->_product = $product; | ||
} | ||
|
||
public function afterGetProductPriceHtml( | ||
\Magento\Catalog\Block\Product\Widget\NewWidget $list, $result | ||
) { | ||
if($this->isStickerActive(self::DISCOUNT_ACTIVATION)) { | ||
$result .= $this->_setDiscountStickerHTML(); | ||
} | ||
|
||
return $result; | ||
} | ||
|
||
} |
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