Skip to content

Commit

Permalink
Merge pull request #14 from nordcomputer/magento-coding-standard
Browse files Browse the repository at this point in the history
Magento coding standard
  • Loading branch information
nordcomputer authored Mar 23, 2021
2 parents 8959e49 + b51fdd7 commit fe54531
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
?>
8 changes: 2 additions & 6 deletions Model/ResourceModel/Product/CompositeBaseSelectProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

}

?>
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -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"
},
Expand Down
2 changes: 1 addition & 1 deletion etc/frontend/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<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>
<argument name="baseSelectProcessor" xsi:type="object">Nordcomputer\Showoutofstockprice\Model\ConfigurableProduct\ResourceModel\Product\StockStatusBaseSelectProcessorN</argument>
</arguments>
</type>
</config>
6 changes: 3 additions & 3 deletions registration.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Nordcomputer_Showoutofstockprice',
__DIR__
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Nordcomputer_Showoutofstockprice',
__DIR__
);
2 changes: 1 addition & 1 deletion view/frontend/templates/product/view/addtocart.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<div class="box-tocart">
<div class="fieldset">
<?php if ($block->shouldRenderQuantity()) :?>
<?php if ($block->shouldRenderQuantity()):?>
<div class="field qty">
<label class="label" for="qty"><span><?= $block->escapeHtml(__('Qty')) ?></span></label>
<div class="control">
Expand Down
11 changes: 5 additions & 6 deletions view/frontend/templates/product/view/form.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,27 @@
* @var $block \Magento\Catalog\Block\Product\View
*/
?>
<?php $_helper = $this->helper(Magento\Catalog\Helper\Output::class); ?>
<?php $_product = $block->getProduct(); ?>

<div class="product-add-form">
<form data-product-sku="<?= $block->escapeHtmlAttr($_product->getSku()) ?>"
action="<?= $block->escapeUrl($block->getSubmitUrl($_product)) ?>" method="post"
id="product_addtocart_form"<?php if ($_product->getOptions()) :?> enctype="multipart/form-data"<?php endif; ?>>
id="product_addtocart_form"<?php if ($_product->getOptions()):?> enctype="multipart/form-data"<?php endif; ?>>
<input type="hidden" name="product" value="<?= (int)$_product->getId() ?>" />
<input type="hidden" name="selected_configurable_option" value="" />
<input type="hidden" name="related_product" id="related-products-field" value="" />
<input type="hidden" name="item" value="<?= (int)$block->getRequest()->getParam('id') ?>" />
<?= $block->getBlockHtml('formkey') ?>
<?= $block->getChildHtml('form_top') ?>
<?php if (!$block->hasOptions()) :?>
<?php if (!$block->hasOptions()):?>
<?= $block->getChildHtml('product_info_form_content') ?>
<?php else :?>
<?php if ($block->getOptionsContainer() == 'container1') :?>
<?php else:?>
<?php if ($block->getOptionsContainer() == 'container1'):?>
<?= $block->getChildChildHtml('options_container') ?>
<?php endif;?>
<?php endif; ?>

<?php if ($block->hasOptions() && $block->getOptionsContainer() == 'container2') :?>
<?php if ($block->hasOptions() && $block->getOptionsContainer() == 'container2'):?>
<?= $block->getChildChildHtml('options_container') ?>
<?php endif;?>
<?= $block->getChildHtml('form_bottom') ?>
Expand Down

0 comments on commit fe54531

Please sign in to comment.