From 96d39f5b3f4b2d641a04be76432b622be839b188 Mon Sep 17 00:00:00 2001 From: toandh Date: Tue, 20 Jul 2021 17:08:59 +0700 Subject: [PATCH 1/7] [Fix bug] Config products. --- Block/Adminhtml/Config/Field/Responsive.php | 4 ++-- Block/Adminhtml/Slider/Edit/Tab/Design.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Block/Adminhtml/Config/Field/Responsive.php b/Block/Adminhtml/Config/Field/Responsive.php index c4a2cb5..c7d4ced 100644 --- a/Block/Adminhtml/Config/Field/Responsive.php +++ b/Block/Adminhtml/Config/Field/Responsive.php @@ -34,8 +34,8 @@ class Responsive extends AbstractFieldArray */ protected function _prepareToRender() { - $this->addColumn('size', ['label' => __('Screen size max'), 'renderer' => false]); - $this->addColumn('items', ['label' => __('Number of items'), 'renderer' => false]); + $this->addColumn('size', ['label' => __('Screen size max'), 'renderer' => false, 'class' => 'validate-number validate-greater-than-zero']); + $this->addColumn('items', ['label' => __('Number of items'), 'renderer' => false, 'class' => 'validate-number validate-greater-than-zero']); $this->_addAfter = false; $this->_addButtonLabel = __('Add'); diff --git a/Block/Adminhtml/Slider/Edit/Tab/Design.php b/Block/Adminhtml/Slider/Edit/Tab/Design.php index 9611f07..1c7ebe6 100644 --- a/Block/Adminhtml/Slider/Edit/Tab/Design.php +++ b/Block/Adminhtml/Slider/Edit/Tab/Design.php @@ -111,6 +111,7 @@ protected function _prepareForm() 'name' => 'limit_number', 'label' => __('Limit the number of products'), 'title' => __('Limit the number of products'), + 'class' => 'validate-number validate-greater-than-zero' ]); $fieldset->addField('display_additional', 'multiselect', [ From 7368ba0f73dbc63eeca31d031e651f97d178ed65 Mon Sep 17 00:00:00 2001 From: toandh Date: Tue, 20 Jul 2021 17:29:03 +0700 Subject: [PATCH 2/7] [Fix bug] Display button --- view/frontend/web/css/source/_module.less | 229 +++++++++++----------- 1 file changed, 117 insertions(+), 112 deletions(-) diff --git a/view/frontend/web/css/source/_module.less b/view/frontend/web/css/source/_module.less index 64f5ea8..0dd9a3c 100644 --- a/view/frontend/web/css/source/_module.less +++ b/view/frontend/web/css/source/_module.less @@ -1,112 +1,117 @@ -/** - * Mageplaza - * - * NOTICE OF LICENSE - * - * This source file is subject to the Mageplaza.com license that is - * available through the world-wide-web at this URL: - * https://www.mageplaza.com/LICENSE.txt - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade this extension to newer - * version in the future. - * - * @category Mageplaza - * @package Mageplaza_Productslider - * @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) - * @license https://www.mageplaza.com/LICENSE.txt - */ -.mp-product-slider-content .owl-nav{ - font-size: 80px; -} - -.mp-product-slider-content .owl-nav button span{ - color: #D6D6D6; -} - -.mp-product-slider-content .owl-nav button span:hover{ - color: #869791; -} - -.mp-product-slider-content .owl-nav .owl-prev{ - position: absolute; - top: 40%; - left: 0; - z-index: 999; - text-shadow: none; - background: none; - border: none; -} - -.mp-product-slider-content .owl-nav .owl-next{ - position: absolute; - top: 40%; - right: 0; - z-index: 999; - text-shadow: none; - background: none; - border: none; -} - -.owl-item li.product-slider { - width: 100% !important; -} - -.mp-product-slider-title { - font-size: 3.8rem; - position: relative; - z-index: 1; - margin: 0 0 5px; - text-align: center; - display: block; - -webkit-margin-before: 0.83em; - -webkit-margin-after: 0.83em; - -webkit-margin-start: 0px; - -webkit-margin-end: 0px; -} - -.mp-product-slider-block { - margin: 0 !important; -} - -.mp-ps-info { - font-size: 1.8rem; - position: relative; - z-index: 1; - text-align: center; - display: block; - -webkit-margin-before: 1em; - -webkit-margin-after: 1em; - -webkit-margin-start: 0px; - -webkit-margin-end: 0px; - -} - -.slider-product-item-info { - width: 80% !important; -} - -.slider-product-item-actions { - margin: 0px; -} - -.product.details.slider-product-item-details { - margin-left: 10px -} - -.mp-ps-info { - color: #bbbbbb; - margin: -15px 0px 10px 0px; -} -.mp-product-slider-block .owl-carousel .owl-nav button.owl-prev, -.mp-product-slider-block .owl-carousel .owl-nav button.owl-next { - font-size: 20px; -} - - - - - - - +/** + * Mageplaza + * + * NOTICE OF LICENSE + * + * This source file is subject to the Mageplaza.com license that is + * available through the world-wide-web at this URL: + * https://www.mageplaza.com/LICENSE.txt + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade this extension to newer + * version in the future. + * + * @category Mageplaza + * @package Mageplaza_Productslider + * @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) + * @license https://www.mageplaza.com/LICENSE.txt + */ + +.mp-product-slider-content .product-items .owl-stage .owl-item .product-slider .slider-product-item-info .product-item-actions{ + margin-top: 20px; +} + +.mp-product-slider-content .owl-nav{ + font-size: 80px; +} + +.mp-product-slider-content .owl-nav button span{ + color: #D6D6D6; +} + +.mp-product-slider-content .owl-nav button span:hover{ + color: #869791; +} + +.mp-product-slider-content .owl-nav .owl-prev{ + position: absolute; + top: 40%; + left: 0; + z-index: 999; + text-shadow: none; + background: none; + border: none; +} + +.mp-product-slider-content .owl-nav .owl-next{ + position: absolute; + top: 40%; + right: 0; + z-index: 999; + text-shadow: none; + background: none; + border: none; +} + +.owl-item li.product-slider { + width: 100% !important; +} + +.mp-product-slider-title { + font-size: 3.8rem; + position: relative; + z-index: 1; + margin: 0 0 5px; + text-align: center; + display: block; + -webkit-margin-before: 0.83em; + -webkit-margin-after: 0.83em; + -webkit-margin-start: 0px; + -webkit-margin-end: 0px; +} + +.mp-product-slider-block { + margin: 0 !important; +} + +.mp-ps-info { + font-size: 1.8rem; + position: relative; + z-index: 1; + text-align: center; + display: block; + -webkit-margin-before: 1em; + -webkit-margin-after: 1em; + -webkit-margin-start: 0px; + -webkit-margin-end: 0px; + +} + +.slider-product-item-info { + width: 80% !important; +} + +.slider-product-item-actions { + margin: 0px; +} + +.product.details.slider-product-item-details { + margin-left: 10px +} + +.mp-ps-info { + color: #bbbbbb; + margin: -15px 0px 10px 0px; +} +.mp-product-slider-block .owl-carousel .owl-nav button.owl-prev, +.mp-product-slider-block .owl-carousel .owl-nav button.owl-next { + font-size: 20px; +} + + + + + + + From f04df04ac291ed2b51b97d3836ccee67340eb6c3 Mon Sep 17 00:00:00 2001 From: toandh Date: Wed, 21 Jul 2021 10:24:10 +0700 Subject: [PATCH 3/7] [Fix bug] Lazy load --- view/frontend/templates/productslider.phtml | 18 ++++++++++++++++-- .../templates/widget/productslider.phtml | 19 +++++++++++++++++-- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/view/frontend/templates/productslider.phtml b/view/frontend/templates/productslider.phtml index 0faadbf..781534c 100644 --- a/view/frontend/templates/productslider.phtml +++ b/view/frontend/templates/productslider.phtml @@ -23,12 +23,13 @@ use Mageplaza\Productslider\Block\AbstractSlider; use Magento\Framework\App\Action\Action; /** @var AbstractSlider $block */ +$helper = $this->helper(\Mageplaza\Productslider\Helper\Data::class); $mode = 'grid'; $type = 'widget-product-grid'; $title = $block->getTitle(); $blockId = $block->getSliderId() . uniqid('-', false); $items = $block->getProductCollection(); -if ($items && $items->getSize()): ?> +if ($helper->isEnabled() && $items && $items->getSize()): ?>

escapeHtml($title) ?>

escapeHtml($block->getDescription()) ?>

@@ -115,6 +116,20 @@ if ($items && $items->getSize()): ?>
+ getPagerHtml() ?> - diff --git a/view/frontend/templates/widget/productslider.phtml b/view/frontend/templates/widget/productslider.phtml index c851439..8695da4 100644 --- a/view/frontend/templates/widget/productslider.phtml +++ b/view/frontend/templates/widget/productslider.phtml @@ -23,12 +23,13 @@ use Magento\Framework\App\Action\Action; use Mageplaza\Productslider\Block\AbstractSlider; /** @var AbstractSlider $block */ - +$helper = $this->helper(\Mageplaza\Productslider\Helper\Data::class); $mode = 'grid'; $type = 'widget-product-grid'; $title = $block->getTitle(); $id = $block->getData('page_var_name') . uniqid('', false); -if ($items = $block->getProductCollection()): ?> +$items = $block->getProductCollection(); +if ($helper->isEnabled() && $items && $items->getSize()): ?>

escapeHtml($block->getTitle()) ?>

escapeHtml($block->getDescription()) ?>

@@ -114,6 +115,20 @@ if ($items = $block->getProductCollection()): ?>
+ getPagerHtml() ?>