-
Notifications
You must be signed in to change notification settings - Fork 7
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
0 parents
commit 7585f39
Showing
8 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
Model/ConfigurableProduct/ResourceModel/Product/StockStatusBaseSelectProcessor.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,13 @@ | ||
<?php | ||
namespace Nordcomputer\Showoutofstockprice\Model\ConfigurableProduct\ResourceModel\Product; | ||
|
||
use Magento\Framework\DB\Select; | ||
|
||
class StockStatusBaseSelectProcessor extends \Magento\ConfigurableProduct\Model\ResourceModel\Product\StockStatusBaseSelectProcessor | ||
{ | ||
public function process(Select $select) | ||
{ | ||
return $select; | ||
} | ||
} | ||
?> |
27 changes: 27 additions & 0 deletions
27
Model/ResourceModel/Product/CompositeBaseSelectProcessor.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,27 @@ | ||
<?php | ||
namespace Nordcomputer\Showoutofstockprice\Model\ResourceModel\Product; | ||
|
||
use Magento\CatalogInventory\Model\ResourceModel\Product\StockStatusBaseSelectProcessor; | ||
|
||
class CompositeBaseSelectProcessor extends \Magento\Catalog\Model\ResourceModel\Product\CompositeBaseSelectProcessor | ||
{ | ||
public function __construct( | ||
array $baseSelectProcessors | ||
) { | ||
|
||
|
||
// REMOVE THE STOCK STATUS PROCESSOR | ||
//................................... | ||
$finalProcessors = array(); | ||
foreach ($baseSelectProcessors as $baseSelectProcessor) { | ||
if(!is_a($baseSelectProcessor, StockStatusBaseSelectProcessor::class)) { | ||
$finalProcessors[] = $baseSelectProcessor; | ||
} | ||
} | ||
|
||
parent::__construct($finalProcessors); | ||
} | ||
|
||
} | ||
|
||
?> |
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,27 @@ | ||
<?php | ||
namespace Nordcomputer\Showoutofstockprice\Pricing\Render; | ||
|
||
use Magento\Framework\Pricing\Render\PriceBox as BasePriceBox; | ||
|
||
class FinalPriceBox extends \Magento\ConfigurableProduct\Pricing\Render\FinalPriceBox | ||
{ | ||
protected function _toHtml() | ||
{ | ||
$result = BasePriceBox::_toHtml(); | ||
//Renders MSRP in case it is enabled | ||
if ($this->isMsrpPriceApplicable()) { | ||
/** @var BasePriceBox $msrpBlock */ | ||
$msrpBlock = $this->rendererPool->createPriceRender( | ||
MsrpPrice::PRICE_CODE, | ||
$this->getSaleableItem(), | ||
[ | ||
'real_price_html' => $result, | ||
'zone' => $this->getZone(), | ||
] | ||
); | ||
$result = $msrpBlock->toHtml(); | ||
} | ||
|
||
return $this->wrapResult($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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# nordcomputer-showoutofstockprice | ||
Show prices of out-of-stock products |
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,20 @@ | ||
{ | ||
"name": "nordcomputer/showoutofstockprice", | ||
"description": "Adds price to out-of-stock products", | ||
"require": { | ||
"php": "^7.1" | ||
}, | ||
"type": "magento2-module", | ||
"license": [ | ||
"OSL-3.0", | ||
"AFL-3.0" | ||
], | ||
"autoload": { | ||
"files": [ | ||
"registration.php" | ||
], | ||
"psr-4": { | ||
"Nordcomputer\\Showoutofstockprice\\": "" | ||
} | ||
} | ||
} |
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,9 @@ | ||
<?xml version="1.0"?> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> | ||
<preference for="Magento\ConfigurableProduct\Pricing\Render\FinalPriceBox" type="Nordcomputer\Showoutofstockprice\Pricing\Render\FinalPriceBox" /> | ||
<type name="Magento\ConfigurableProduct\Model\ResourceModel\Product\LinkedProductSelectBuilder"> | ||
<arguments> | ||
<argument name="baseSelectProcessor" xsi:type="object">Nordcomputer\Showoutofstockprice\Model\ConfigurableProduct\ResourceModel\Product\StockStatusBaseSelectProcessor</argument> | ||
</arguments> | ||
</type> | ||
</config> |
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,5 @@ | ||
<?xml version="1.0"?> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> | ||
<module name="Nordcomputer_Showoutofstockprice" setup_version="0.0.1"> | ||
</module> | ||
</config> |
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,6 @@ | ||
<?php | ||
\Magento\Framework\Component\ComponentRegistrar::register( | ||
\Magento\Framework\Component\ComponentRegistrar::MODULE, | ||
'Nordcomputer_Showoutofstockprice', | ||
__DIR__ | ||
); |