Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
XigenDominic committed May 5, 2020
2 parents ffb7b86 + 19338ee commit 7aed3da
Show file tree
Hide file tree
Showing 17 changed files with 145 additions and 77 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/phpcompatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: PHPCompatibility
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: 7.0-7.3
run: docker run --rm -v $PWD:/code domw/phpcompatibility phpcs --standard=PHPCompatibility --runtime-set testVersion 7.0-7.3 --colors --warning-severity=0 --report=full,summary --extensions=php,phtml ./
9 changes: 9 additions & 0 deletions .github/workflows/phpcs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: phpcs
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Magento 2 Ruleset
run: docker run --rm -v $PWD:/code domw/phpcs phpcs --colors --standard=Magento2 --report=full,summary,gitblame --extensions=php,phtml ./
14 changes: 14 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: PHPStan
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: MilesChou/composer-action@master
env:
COMPOSER_AUTH: ${{secrets.COMPOSER_AUTH}}
with:
args: install --prefer-dist --no-dev --ignore-platform-reqs
- name: PHPStan
run: docker run --rm -v $PWD:/code domw/phpstan phpstan analyze ./
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/vendor
/.idea
/.vscode
3 changes: 1 addition & 2 deletions Block/Link.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
namespace Xigen\Special\Block;

/**
* Class Link
* @package Xigen\Testimonial\Block
* Xigen Special header block link class
*/
class Link extends \Magento\Framework\View\Element\Html\Link
{
Expand Down
3 changes: 1 addition & 2 deletions Block/Widget/Special.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Xigen\Special\Block\Widget;

/**
* Special Widget class
* Xigen Special Widget block class
*/
class Special extends \Magento\Catalog\Block\Product\NewProduct implements \Magento\Widget\Block\BlockInterface
{
Expand All @@ -19,7 +19,6 @@ class Special extends \Magento\Catalog\Block\Product\NewProduct implements \Mage

/**
* Name of request parameter for page number value
* @deprecated
*/
const PAGE_VAR_NAME = 'fp';

Expand Down
6 changes: 5 additions & 1 deletion Controller/Index/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ public function __construct(
\Magento\Framework\View\Result\PageFactory $pageFactory
) {
$this->pageFactory = $pageFactory;
return parent::__construct($context);
parent::__construct($context);
}

/**
* Execute view action
* @return \Magento\Framework\Controller\ResultInterface
*/
public function execute()
{
$resultPage = $this->pageFactory->create();
Expand Down
2 changes: 1 addition & 1 deletion Model/Layer.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;

/**
* Layer class
* Xigen Special Layer model class
*/
class Layer extends \Magento\Catalog\Model\Layer
{
Expand Down
2 changes: 1 addition & 1 deletion Model/Layer/Resolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Xigen\Special\Model\Layer;

/**
* Resolver class
* Xigen Special model layer resolver class
*/
class Resolver extends \Magento\Catalog\Model\Layer\Resolver
{
Expand Down
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Special offers landing page with layered navigation and widget",
"type": "magento2-module",
"license": "proprietary",
"version": "1.1.6",
"version": "1.1.7",
"authors": [
{
"name": "Dominic Xigen",
Expand All @@ -19,7 +19,9 @@
],
"require": {
"magento/framework": "*",
"php": "~7.0.0||~7.1.0||~7.2.0||~7.3.0"
"php": "~7.0.0||~7.1.0||~7.2.0||~7.3.0",
"magento/module-layered-navigation": "*",
"magento/module-catalog": "*"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,5 +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="Xigen_Special" setup_version="1.1.6">
<module name="Xigen_Special" setup_version="1.1.7">
</module>
</config>
13 changes: 13 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
parameters:
level: 0
autoload_directories:
- Block
- Controller
- Model
- view
excludes_analyse:
- 'vendor'
ignoreErrors:
- '#invalid typehint#'
- '#unknown class#'
reportUnmatchedIgnoredErrors: false
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
* See COPYING.txt for license details.
*/

// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
// phpcs:disable Magento2.Files.LineLength.MaxExceeded
// phpcs:disable Magento2.Templates.ThisInTemplate
// phpcs:disable Generic.Files.LineLength.TooLong

use Magento\Catalog\Helper\Output;
use Magento\Framework\Data\Helper\PostHelper;

?>
<?php if (($_products = $block->getProductCollection()) && $_products->getSize()) : ?>
<?php if (($_products = $block->getProductCollection()) && $_products->getSize()): ?>
<div class="block widget block-special-products-list">
<div class="block-title">
<strong><?= $block->escapeHtml(__('Special Offers')) ?></strong>
Expand All @@ -17,7 +20,7 @@
<?php $suffix = $block->getNameInLayout(); ?>
<?php $iterator = 1; ?>
<ol class="product-items" id="widget-special-products-<?= $block->escapeHtmlAttr($suffix) ?>">
<?php foreach ($_products->getItems() as $_product) : ?>
<?php foreach ($_products->getItems() as $_product): ?>
<?= /* @escapeNotVerified */ ($iterator++ == 1) ? '<li class="product-item">' : '</li><li class="product-item">' ?>
<div class="product-item-info">
<a class="product-item-photo" href="<?= $block->escapeUrl($_product->getProductUrl()) ?>"
Expand All @@ -29,37 +32,40 @@
<a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>"
title="<?= /* @noEscape */ $block->stripTags($_product->getName(), null, true) ?>)"
class="product-item-link">
<?= /* @noEscape */ $this->helper(Magento\Catalog\Helper\Output::class)->productAttribute($_product, $_product->getName(), 'name') ?>
<?= /* @noEscape */ $this->helper(Output::class)->productAttribute($_product, $_product->getName(), 'name') ?>
</a>
</strong>
<?= /* @escapeNotVerified */ $block->getProductPriceHtml($_product, '-widget-special-' . $suffix) ?>
<div class="product-item-actions">
<div class="actions-primary">
<?php if ($_product->isSaleable()) : ?>
<?php if ($_product->getTypeInstance()->hasRequiredOptions($_product)) : ?>
<?php if ($_product->isSaleable()): ?>
<?php if ($_product->getTypeInstance()->hasRequiredOptions($_product)): ?>
<button type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"
class="action tocart primary"
data-mage-init='{"redirectUrl":{"url":"<?= $block->escapeUrl($block->getAddToCartUrl($_product)) ?>"}}'>
<span><?= $block->escapeHtml(__('Add to Cart')) ?></span>
</button>
<?php else : ?>
<?php else: ?>
<?php
$postDataHelper = $this->helper(Magento\Framework\Data\Helper\PostHelper::class);
$postDataHelper = $this->helper(PostHelper::class);
$postData = $postDataHelper->getPostData($block->escapeUrl($block->getAddToCartUrl($_product)), ['product' => $_product->getEntityId()]);
?>
<button type="button" title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"
<button type="button"
title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>"
class="action tocart primary"
data-post='<?= /* @noEscape */ $postData ?>'>
<span><?= $block->escapeHtml(__('Add to Cart')) ?></span>
</button>
<?php endif; ?>
<?php else : ?>
<?php if ($_product->getIsSalable()) : ?>
<div class="stock available" title="<?= $block->escapeHtmlAttr(__('Availability')) ?>">
<?php else: ?>
<?php if ($_product->getIsSalable()): ?>
<div class="stock available"
title="<?= $block->escapeHtmlAttr(__('Availability')) ?>">
<span><?= $block->escapeHtml(__('In stock')) ?></span>
</div>
<?php else : ?>
<div class="stock unavailable" title="<?= $block->escapeHtmlAttr(__('Availability')) ?>">
<?php else: ?>
<div class="stock unavailable"
title="<?= $block->escapeHtmlAttr(__('Availability')) ?>">
<span><?= $block->escapeHtml(__('Out of stock')) ?></span>
</div>
<?php endif; ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

?>
<?php if (($_products = $block->getProductCollection()) && $_products->getSize()) : ?>
<?php if (($_products = $block->getProductCollection()) && $_products->getSize()): ?>
<div class="block widget block-special-products-images">
<div class="block-title">
<strong><?= $block->escapeHtml(__('Special Offers')) ?></strong>
Expand All @@ -14,7 +14,7 @@
<?php $suffix = $block->getNameInLayout(); ?>
<ol id="widget-special-products-<?= $block->escapeHtmlAttr($suffix) ?>"
class="product-items product-items-images">
<?php foreach ($_products->getItems() as $_product) : ?>
<?php foreach ($_products->getItems() as $_product): ?>
<li class="product-item">
<a class="product-item-photo" href="<?= $block->escapeUrl($_product->getProductUrl()) ?>"
title="<?= /* @noEscape */ $block->stripTags($_product->getName(), null, true) ?>">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* See COPYING.txt for license details.
*/

// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
// phpcs:disable Magento2.Templates.ThisInTemplate
?>
<?php if (($_products = $block->getProductCollection()) && $_products->getSize()) : ?>
<?php if (($_products = $block->getProductCollection()) && $_products->getSize()): ?>
<div class="block widget block-special-products-names">
<div class="block-title">
<strong><?= $block->escapeHtml(__('Special Offers')) ?></strong>
Expand All @@ -15,7 +15,7 @@
<?php $suffix = $block->getNameInLayout(); ?>
<ol id="widget-special-products-<?= $block->escapeHtmlAttr($suffix) ?>"
class="product-items product-items-names">
<?php foreach ($_products->getItems() as $_product) : ?>
<?php foreach ($_products->getItems() as $_product): ?>
<li class="product-item">
<strong class="product-item-name">
<a href="<?= $block->escapeUrl($_product->getProductUrl()) ?>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
* @var $block \Xigen\Featured\Block\Widget\Featured
*/

// phpcs:disable Magento2.Files.LineLength.MaxExceeded
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
// phpcs:disable Generic.Files.LineLength.TooLong
// phpcs:disable Magento2.Templates.ThisInTemplate

if ($exist = ($block->getProductCollection() && $block->getProductCollection()->getSize())) {
$type = 'widget-special-grid';
Expand All @@ -31,7 +31,7 @@ if ($exist = ($block->getProductCollection() && $block->getProductCollection()->
}
?>

<?php if ($exist) : ?>
<?php if ($exist): ?>
<div class="block widget block-special-products <?= /* @noEscape */ $mode ?>">
<div class="block-title">
<strong role="heading" aria-level="2"><?= $block->escapeHtml($title) ?></strong>
Expand All @@ -41,10 +41,11 @@ if ($exist = ($block->getProductCollection() && $block->getProductCollection()->
<div class="products-<?= /* @noEscape */ $mode ?> <?= /* @noEscape */ $mode ?>">
<ol class="product-items <?= /* @noEscape */ $type ?>">
<?php $iterator = 1; ?>
<?php foreach ($items as $_item) : ?>
<?php foreach ($items as $_item): ?>
<?= /* @escapeNotVerified */ ($iterator++ == 1) ? '<li class="product-item">' : '</li><li class="product-item">' ?>
<div class="product-item-info">
<a href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>" class="product-item-photo">
<a href="<?= $block->escapeUrl($block->getProductUrl($_item)) ?>"
class="product-item-photo">
<?= $block->getImage($_item, $image)->toHtml() ?>
</a>
<div class="product-item-details">
Expand All @@ -57,23 +58,23 @@ if ($exist = ($block->getProductCollection() && $block->getProductCollection()->
</strong>
<?= $block->getProductPriceHtml($_item, $type); ?>

<?php if ($templateType) : ?>
<?php if ($templateType): ?>
<?= $block->getReviewsSummaryHtml($_item, $templateType) ?>
<?php endif; ?>

<?php if ($showWishlist || $showCompare || $showCart) : ?>
<?php if ($showWishlist || $showCompare || $showCart): ?>
<div class="product-item-actions">
<?php if ($showCart) : ?>
<?php if ($showCart): ?>
<div class="actions-primary">
<?php if ($_item->isSaleable()) : ?>
<?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)) : ?>
<?php if ($_item->isSaleable()): ?>
<?php if ($_item->getTypeInstance()->hasRequiredOptions($_item)): ?>
<button class="action tocart primary"
data-mage-init='{"redirectUrl":{"url":"<?= $block->escapeUrl($block->getAddToCartUrl($_item)) ?>"}}'
type="button"
title="<?= $block->escapeHtmlAttr(__('Add to Cart')) ?>">
<span><?= $block->escapeHtml(__('Add to Cart')) ?></span>
</button>
<?php else : ?>
<?php else: ?>
<?php
$postDataHelper = $this->helper(Magento\Framework\Data\Helper\PostHelper::class);
$postData = $postDataHelper->getPostData($block->getAddToCartUrl($_item), ['product' => $_item->getEntityId()])
Expand All @@ -85,26 +86,30 @@ if ($exist = ($block->getProductCollection() && $block->getProductCollection()->
<span><?= $block->escapeHtml(__('Add to Cart')) ?></span>
</button>
<?php endif; ?>
<?php else : ?>
<?php if ($_item->getIsSalable()) : ?>
<div class="stock available"><span><?= $block->escapeHtml(__('In stock')) ?></span></div>
<?php else : ?>
<div class="stock unavailable"><span><?= $block->escapeHtml(__('Out of stock')) ?></span></div>
<?php else: ?>
<?php if ($_item->getIsSalable()): ?>
<div class="stock available"><span>
<?= $block->escapeHtml(__('In stock')) ?>
</span></div>
<?php else: ?>
<div class="stock unavailable"><span>
<?= $block->escapeHtml(__('Out of stock')) ?>
</span></div>
<?php endif; ?>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if ($showWishlist || $showCompare) : ?>
<?php if ($showWishlist || $showCompare): ?>
<div class="actions-secondary" data-role="add-to-links">
<?php if ($this->helper(Magento\Wishlist\Helper\Data::class)->isAllow() && $showWishlist) : ?>
<?php if ($this->helper(Magento\Wishlist\Helper\Data::class)->isAllow() && $showWishlist): ?>
<a href="#"
data-post='<?= /* @noEscape */ $block->getAddToWishlistParams($_item) ?>'
class="action towishlist" data-action="add-to-wishlist"
title="<?= $block->escapeHtmlAttr(__('Add to Wish List')) ?>">
<span><?= $block->escapeHtml(__('Add to Wish List')) ?></span>
</a>
<?php endif; ?>
<?php if ($block->getAddToCompareUrl() && $showCompare) : ?>
<?php if ($block->getAddToCompareUrl() && $showCompare): ?>
<?php $compareHelper = $this->helper(Magento\Catalog\Helper\Product\Compare::class);?>
<a href="#" class="action tocompare"
data-post='<?= /* @noEscape */ $compareHelper->getPostDataParams($_item) ?>'
Expand Down
Loading

0 comments on commit 7aed3da

Please sign in to comment.