From b7a161ffd6aca82a2f6484696e2d0811901aa212 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 19 Mar 2021 13:12:30 +0100 Subject: [PATCH 1/3] [refactoring] implementing magento2 coding standard --- ...cessor.php => StockStatusBaseSelectProcessorN.php} | 4 ++-- etc/frontend/di.xml | 2 +- view/frontend/templates/product/view/addtocart.phtml | 2 +- view/frontend/templates/product/view/form.phtml | 11 +++++------ 4 files changed, 9 insertions(+), 10 deletions(-) rename Model/ConfigurableProduct/ResourceModel/Product/{StockStatusBaseSelectProcessor.php => StockStatusBaseSelectProcessorN.php} (56%) diff --git a/Model/ConfigurableProduct/ResourceModel/Product/StockStatusBaseSelectProcessor.php b/Model/ConfigurableProduct/ResourceModel/Product/StockStatusBaseSelectProcessorN.php similarity index 56% rename from Model/ConfigurableProduct/ResourceModel/Product/StockStatusBaseSelectProcessor.php rename to Model/ConfigurableProduct/ResourceModel/Product/StockStatusBaseSelectProcessorN.php index 5a44113..c3d7f3a 100644 --- a/Model/ConfigurableProduct/ResourceModel/Product/StockStatusBaseSelectProcessor.php +++ b/Model/ConfigurableProduct/ResourceModel/Product/StockStatusBaseSelectProcessorN.php @@ -2,12 +2,12 @@ namespace Nordcomputer\Showoutofstockprice\Model\ConfigurableProduct\ResourceModel\Product; use Magento\Framework\DB\Select; +use Magento\ConfigurableProduct\Model\ResourceModel\Product\StockStatusBaseSelectProcessor; -class StockStatusBaseSelectProcessor extends \Magento\ConfigurableProduct\Model\ResourceModel\Product\StockStatusBaseSelectProcessor +class StockStatusBaseSelectProcessorN extends StockStatusBaseSelectProcessor { public function process(Select $select) { return $select; } } -?> diff --git a/etc/frontend/di.xml b/etc/frontend/di.xml index 5e4de5d..7e4cae2 100644 --- a/etc/frontend/di.xml +++ b/etc/frontend/di.xml @@ -3,7 +3,7 @@ - Nordcomputer\Showoutofstockprice\Model\ConfigurableProduct\ResourceModel\Product\StockStatusBaseSelectProcessor + Nordcomputer\Showoutofstockprice\Model\ConfigurableProduct\ResourceModel\Product\StockStatusBaseSelectProcessorN diff --git a/view/frontend/templates/product/view/addtocart.phtml b/view/frontend/templates/product/view/addtocart.phtml index c7eef41..22557fe 100644 --- a/view/frontend/templates/product/view/addtocart.phtml +++ b/view/frontend/templates/product/view/addtocart.phtml @@ -11,7 +11,7 @@
- shouldRenderQuantity()) :?> + shouldRenderQuantity()):?>
diff --git a/view/frontend/templates/product/view/form.phtml b/view/frontend/templates/product/view/form.phtml index 3db2873..f871399 100644 --- a/view/frontend/templates/product/view/form.phtml +++ b/view/frontend/templates/product/view/form.phtml @@ -12,28 +12,27 @@ * @var $block \Magento\Catalog\Block\Product\View */ ?> -helper(Magento\Catalog\Helper\Output::class); ?> getProduct(); ?>
getOptions()) :?> enctype="multipart/form-data"> + id="product_addtocart_form"getOptions()):?> enctype="multipart/form-data"> getBlockHtml('formkey') ?> getChildHtml('form_top') ?> - hasOptions()) :?> + hasOptions()):?> getChildHtml('product_info_form_content') ?> - - getOptionsContainer() == 'container1') :?> + + getOptionsContainer() == 'container1'):?> getChildChildHtml('options_container') ?> - hasOptions() && $block->getOptionsContainer() == 'container2') :?> + hasOptions() && $block->getOptionsContainer() == 'container2'):?> getChildChildHtml('options_container') ?> getChildHtml('form_bottom') ?> From 1fc4d16f5ed2d951d15e01c07a96fb0cd524585d Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 19 Mar 2021 13:14:36 +0100 Subject: [PATCH 2/3] [minor] updated version number --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e260299..3092f2e 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "nordcomputer/showoutofstockprice", "description": "Adds price to out-of-stock products", - "version": "v0.4", + "version": "v0.4.1", "require": { "php": "^7.1|^7.2|^7.3|^7.4" }, From b51fdd7154c0d36eaf5900f3093bc641021b6489 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 19 Mar 2021 14:34:47 +0100 Subject: [PATCH 3/3] [refactoring] magento-coding-standard --- .../Product/CompositeBaseSelectProcessor.php | 8 ++------ registration.php | 6 +++--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Model/ResourceModel/Product/CompositeBaseSelectProcessor.php b/Model/ResourceModel/Product/CompositeBaseSelectProcessor.php index 45e70e6..858aec3 100644 --- a/Model/ResourceModel/Product/CompositeBaseSelectProcessor.php +++ b/Model/ResourceModel/Product/CompositeBaseSelectProcessor.php @@ -9,19 +9,15 @@ public function __construct( array $baseSelectProcessors ) { - // REMOVE THE STOCK STATUS PROCESSOR //................................... - $finalProcessors = array(); + $finalProcessors = []; foreach ($baseSelectProcessors as $baseSelectProcessor) { - if(!is_a($baseSelectProcessor, StockStatusBaseSelectProcessor::class)) { + if (!is_a($baseSelectProcessor, StockStatusBaseSelectProcessor::class)) { $finalProcessors[] = $baseSelectProcessor; } } parent::__construct($finalProcessors); } - } - -?> diff --git a/registration.php b/registration.php index 78d8846..9b3ae18 100644 --- a/registration.php +++ b/registration.php @@ -1,6 +1,6 @@