From 6ffaa20193c67a0795663b99ccdb5523a02768e5 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 9 Nov 2020 10:10:30 +0700 Subject: [PATCH] Clean code --- .github/ISSUE_TEMPLATE/bug_report.md | 68 +++--- .../developer-experience-issue.md | 38 +-- .github/ISSUE_TEMPLATE/feature_request.md | 44 ++-- Block/AbstractSlider.php | 16 +- Block/Adminhtml/Config/Field/Responsive.php | 2 +- Block/Adminhtml/Slider.php | 6 +- Block/Adminhtml/Slider/Edit.php | 8 +- Block/Adminhtml/Slider/Edit/Form.php | 6 +- Block/Adminhtml/Slider/Edit/Tab/Design.php | 26 +-- Block/Adminhtml/Slider/Edit/Tab/General.php | 82 +++---- Block/Adminhtml/Slider/Edit/Tab/Products.php | 44 ++-- .../Slider/Edit/Tab/Renderer/Category.php | 16 +- Block/BestSellerProducts.php | 2 +- Block/CategoryId.php | 2 +- Block/NewProducts.php | 4 +- Block/OnSaleProduct.php | 15 +- Block/Widget/Slider.php | 4 +- Block/WishlistProducts.php | 4 +- Controller/Adminhtml/Slider.php | 4 +- Controller/Adminhtml/Slider/Edit.php | 2 +- Controller/Adminhtml/Slider/MassDelete.php | 2 +- Controller/Adminhtml/Slider/MassStatus.php | 6 +- Controller/Adminhtml/Slider/Save.php | 6 +- Helper/Data.php | 8 +- Model/Config/Source/Additional.php | 8 +- Model/Config/Source/Location.php | 20 +- Model/Config/Source/ProductType.php | 46 ++-- .../Report/Product/Collection.php | 2 +- Model/Slider.php | 6 +- Observer/AddBlock.php | 8 +- Setup/InstallData.php | 40 ++-- Setup/UpgradeSchema.php | 2 +- .../Listing/Columns/SliderActions.php | 2 +- .../Listing/Columns/SliderLocation.php | 32 +-- composer.json | 52 ++--- i18n/en_US.csv | 220 +++++++++--------- view/frontend/templates/productslider.phtml | 22 +- .../templates/widget/productslider.phtml | 22 +- 38 files changed, 448 insertions(+), 449 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 65788ed..dafbad1 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,34 +1,34 @@ ---- -name: Bug report -about: Technical issue with the extension -labels: 'Issue' - ---- - - - -### Preconditions (*) - -1. -2. - -### Steps to reproduce (*) - -1. -2. - -### Expected result (*) - -1. [Screenshots, logs or description] -2. - -### Actual result (*) - -1. [Screenshots, logs or description] -2. +--- +name: Bug report +about: Technical issue with the extension +labels: 'Issue' + +--- + + + +### Preconditions (*) + +1. +2. + +### Steps to reproduce (*) + +1. +2. + +### Expected result (*) + +1. [Screenshots, logs or description] +2. + +### Actual result (*) + +1. [Screenshots, logs or description] +2. diff --git a/.github/ISSUE_TEMPLATE/developer-experience-issue.md b/.github/ISSUE_TEMPLATE/developer-experience-issue.md index 90a4fb5..597f869 100644 --- a/.github/ISSUE_TEMPLATE/developer-experience-issue.md +++ b/.github/ISSUE_TEMPLATE/developer-experience-issue.md @@ -1,19 +1,19 @@ ---- -name: Developer experience issue -about: Issues related to customization, extensibility, modularity -labels: 'Experience' - ---- - - - -### Summary (*) - - -### Examples (*) - - -### Proposed solution - +--- +name: Developer experience issue +about: Issues related to customization, extensibility, modularity +labels: 'Experience' + +--- + + + +### Summary (*) + + +### Examples (*) + + +### Proposed solution + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 3cd5bb4..c7708c5 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,22 +1,22 @@ ---- -name: Feature request -about: Request feature for development -labels: 'Feature Request' - ---- - - - -### Description (*) - - -### Expected behavior (*) - - -### Benefits - - -### Additional information - +--- +name: Feature request +about: Request feature for development +labels: 'Feature Request' + +--- + + + +### Description (*) + + +### Expected behavior (*) + + +### Benefits + + +### Additional information + diff --git a/Block/AbstractSlider.php b/Block/AbstractSlider.php index 960c6be..c542073 100644 --- a/Block/AbstractSlider.php +++ b/Block/AbstractSlider.php @@ -104,10 +104,10 @@ public function __construct( ) { $this->_productCollectionFactory = $productCollectionFactory; $this->_catalogProductVisibility = $catalogProductVisibility; - $this->_date = $dateTime; - $this->_helperData = $helperData; - $this->httpContext = $httpContext; - $this->urlEncoder = $urlEncoder; + $this->_date = $dateTime; + $this->_helperData = $helperData; + $this->httpContext = $httpContext; + $this->urlEncoder = $urlEncoder; parent::__construct($context, $data); } @@ -121,7 +121,7 @@ protected function _construct() $this->addData([ 'cache_lifetime' => $this->getSlider() ? $this->getSlider()->getTimeCache() : 86400, - 'cache_tags' => [Product::CACHE_TAG] + 'cache_tags' => [Product::CACHE_TAG] ]); $this->setTemplate('Mageplaza_Productslider::productslider.phtml'); @@ -200,8 +200,8 @@ public function getAddToCartPostParams(Product $product) return [ 'action' => $url, - 'data' => [ - 'product' => $product->getEntityId(), + 'data' => [ + 'product' => $product->getEntityId(), ActionInterface::PARAM_NAME_URL_ENCODED => $this->urlEncoder->encode($url), ] ]; @@ -341,7 +341,7 @@ public function getDescription() public function getAllOptions() { $sliderOptions = ''; - $allConfig = $this->_helperData->getModuleConfig('slider_design'); + $allConfig = $this->_helperData->getModuleConfig('slider_design'); foreach ($allConfig as $key => $value) { if ($key === 'item_slider') { diff --git a/Block/Adminhtml/Config/Field/Responsive.php b/Block/Adminhtml/Config/Field/Responsive.php index 5eadfbc..19c5c9f 100644 --- a/Block/Adminhtml/Config/Field/Responsive.php +++ b/Block/Adminhtml/Config/Field/Responsive.php @@ -37,7 +37,7 @@ protected function _prepareToRender() $this->addColumn('size', ['label' => __('Screen size max'), 'renderer' => false, 'class' => 'validate-digits']); $this->addColumn('items', ['label' => __('Number of items'), 'renderer' => false, 'class' => 'validate-digits']); - $this->_addAfter = false; + $this->_addAfter = false; $this->_addButtonLabel = __('Add'); } } diff --git a/Block/Adminhtml/Slider.php b/Block/Adminhtml/Slider.php index ae4e517..955da5c 100644 --- a/Block/Adminhtml/Slider.php +++ b/Block/Adminhtml/Slider.php @@ -36,9 +36,9 @@ class Slider extends Container */ protected function _construct() { - $this->_controller = 'adminhtml_slider'; - $this->_blockGroup = 'Mageplaza_Productslider'; - $this->_headerText = __('Sliders'); + $this->_controller = 'adminhtml_slider'; + $this->_blockGroup = 'Mageplaza_Productslider'; + $this->_headerText = __('Sliders'); $this->_addButtonLabel = __('Create New Slider'); parent::_construct(); } diff --git a/Block/Adminhtml/Slider/Edit.php b/Block/Adminhtml/Slider/Edit.php index 9a016ec..400214e 100644 --- a/Block/Adminhtml/Slider/Edit.php +++ b/Block/Adminhtml/Slider/Edit.php @@ -87,7 +87,7 @@ public function getSlider() */ protected function _construct() { - $this->_objectId = 'id'; + $this->_objectId = 'id'; $this->_blockGroup = 'Mageplaza_Productslider'; $this->_controller = 'adminhtml_slider'; @@ -96,12 +96,12 @@ protected function _construct() $this->buttonList->add( 'save-and-continue', [ - 'label' => __('Save and Continue Edit'), - 'class' => 'save', + 'label' => __('Save and Continue Edit'), + 'class' => 'save', 'data_attribute' => [ 'mage-init' => [ 'button' => [ - 'event' => 'saveAndContinueEdit', + 'event' => 'saveAndContinueEdit', 'target' => '#edit_form' ] ] diff --git a/Block/Adminhtml/Slider/Edit/Form.php b/Block/Adminhtml/Slider/Edit/Form.php index 49994fe..265dbc0 100644 --- a/Block/Adminhtml/Slider/Edit/Form.php +++ b/Block/Adminhtml/Slider/Edit/Form.php @@ -40,9 +40,9 @@ protected function _prepareForm() $form = $this->_formFactory->create( [ 'data' => [ - 'id' => 'edit_form', - 'action' => $this->getUrl('*/*/save', ['id' => $this->getRequest()->getParam('id')]), - 'method' => 'post', + 'id' => 'edit_form', + 'action' => $this->getUrl('*/*/save', ['id' => $this->getRequest()->getParam('id')]), + 'method' => 'post', 'enctype' => 'multipart/form-data' ] ] diff --git a/Block/Adminhtml/Slider/Edit/Tab/Design.php b/Block/Adminhtml/Slider/Edit/Tab/Design.php index 4c9b1ce..baa26bb 100644 --- a/Block/Adminhtml/Slider/Edit/Tab/Design.php +++ b/Block/Adminhtml/Slider/Edit/Tab/Design.php @@ -93,39 +93,39 @@ protected function _prepareForm() 'base_fieldset', [ 'legend' => __('Design'), - 'class' => 'fieldset-wide' + 'class' => 'fieldset-wide' ] ); $fieldset->addField('title', 'text', [ - 'name' => 'title', + 'name' => 'title', 'label' => __('Title'), 'title' => __('Title'), ]); $fieldset->addField('description', 'textarea', [ - 'name' => 'description', + 'name' => 'description', 'label' => __('Description'), 'title' => __('Description'), ]); $fieldset->addField('limit_number', 'text', [ - 'name' => 'limit_number', + 'name' => 'limit_number', 'label' => __('Limit the number of products'), 'title' => __('Limit the number of products'), 'class' => 'validate-digits' ]); $fieldset->addField('display_additional', 'multiselect', [ - 'name' => 'display_additional', - 'label' => __('Display additional information'), - 'title' => __('Display additional information'), + 'name' => 'display_additional', + 'label' => __('Display additional information'), + 'title' => __('Display additional information'), 'values' => $this->_additional->toOptionArray(), - 'note' => __('Select information or button(s) to display with products.') + 'note' => __('Select information or button(s) to display with products.') ]); $isResponsive = $fieldset->addField('is_responsive', 'select', [ - 'name' => 'is_responsive', - 'label' => __('Is Responsive'), - 'title' => __('Is Responsive'), + 'name' => 'is_responsive', + 'label' => __('Is Responsive'), + 'title' => __('Is Responsive'), 'options' => [ '1' => __('Yes'), '0' => __('No'), @@ -137,10 +137,10 @@ protected function _prepareForm() 'responsive_items', 'Mageplaza\Productslider\Block\Adminhtml\Slider\Edit\Tab\Renderer\Responsive', [ - 'name' => 'responsive_items', + 'name' => 'responsive_items', 'label' => __('Max Items slider'), 'title' => __('Max Items slider'), - 'note' => __('Default: 3 items.') + 'note' => __('Default: 3 items.') ] ); diff --git a/Block/Adminhtml/Slider/Edit/Tab/General.php b/Block/Adminhtml/Slider/Edit/Tab/General.php index 9b1ef4b..3ec9e26 100644 --- a/Block/Adminhtml/Slider/Edit/Tab/General.php +++ b/Block/Adminhtml/Slider/Edit/Tab/General.php @@ -110,12 +110,12 @@ public function __construct( array $data = [] ) { $this->_resourceModelSliderFactory = $resourceModelSliderFactory; - $this->_groupRepository = $groupRepository; - $this->_searchCriteriaBuilder = $searchCriteriaBuilder; - $this->_objectConverter = $objectConverter; - $this->_systemStore = $systemStore; - $this->_location = $location; - $this->_productType = $productType; + $this->_groupRepository = $groupRepository; + $this->_searchCriteriaBuilder = $searchCriteriaBuilder; + $this->_objectConverter = $objectConverter; + $this->_systemStore = $systemStore; + $this->_location = $location; + $this->_productType = $productType; parent::__construct($context, $registry, $formFactory, $data); } @@ -134,22 +134,22 @@ protected function _prepareForm() $form->setFieldNameSuffix('slider'); $fieldset = $form->addFieldset('base_fieldset', [ 'legend' => __('General Information'), - 'class' => 'fieldset-wide' + 'class' => 'fieldset-wide' ]); $fieldset->addField('name', 'text', [ - 'name' => 'name', - 'label' => __('Name'), - 'title' => __('Name'), + 'name' => 'name', + 'label' => __('Name'), + 'title' => __('Name'), 'required' => true, ]); $fieldset->addField('status', 'select', [ - 'name' => 'status', - 'label' => __('Status'), - 'title' => __('Status'), + 'name' => 'status', + 'label' => __('Status'), + 'title' => __('Status'), 'required' => true, - 'options' => [ + 'options' => [ '1' => __('Enable'), '0' => __('Disable') ] @@ -159,21 +159,21 @@ protected function _prepareForm() } $fieldset->addField('location', 'select', [ - 'name' => 'location', - 'label' => __('Position'), - 'title' => __('Position'), + 'name' => 'location', + 'label' => __('Position'), + 'title' => __('Position'), 'values' => $this->_location->toOptionArray() ]); $productType = $fieldset->addField('product_type', 'select', [ - 'name' => 'product_type', - 'label' => __('Type'), - 'title' => __('Type'), + 'name' => 'product_type', + 'label' => __('Type'), + 'title' => __('Type'), 'values' => $this->_productType->toOptionArray() ]); $categoryIds = $fieldset->addField('categories_ids', Category::class, [ - 'name' => 'categories_ids', + 'name' => 'categories_ids', 'label' => __('Categories'), 'title' => __('Categories') ]); @@ -182,51 +182,51 @@ protected function _prepareForm() /** @var RendererInterface $rendererBlock */ $rendererBlock = $this->getLayout()->createBlock(Element::class); $fieldset->addField('store_ids', 'multiselect', [ - 'name' => 'store_ids', - 'label' => __('Store Views'), - 'title' => __('Store Views'), + 'name' => 'store_ids', + 'label' => __('Store Views'), + 'title' => __('Store Views'), 'required' => true, - 'values' => $this->_systemStore->getStoreValuesForForm(false, true) + 'values' => $this->_systemStore->getStoreValuesForForm(false, true) ])->setRenderer($rendererBlock); } else { $fieldset->addField('store_ids', 'hidden', [ - 'name' => 'store_ids', + 'name' => 'store_ids', 'value' => $this->_storeManager->getStore()->getId() ]); } $customerGroups = $this->_groupRepository->getList($this->_searchCriteriaBuilder->create())->getItems(); $fieldset->addField('customer_group_ids', 'multiselect', [ - 'name' => 'customer_group_ids[]', - 'label' => __('Customer Groups'), - 'title' => __('Customer Groups'), + 'name' => 'customer_group_ids[]', + 'label' => __('Customer Groups'), + 'title' => __('Customer Groups'), 'required' => true, - 'values' => $this->_objectConverter->toOptionArray($customerGroups, 'id', 'code'), - 'note' => __('Select customer group(s) to display the block to') + 'values' => $this->_objectConverter->toOptionArray($customerGroups, 'id', 'code'), + 'note' => __('Select customer group(s) to display the block to') ]); $fieldset->addField('time_cache', 'text', [ - 'name' => 'time_cache', + 'name' => 'time_cache', 'label' => __('Cache Lifetime'), 'title' => __('Cache Lifetime'), 'class' => 'validate-digits', - 'note' => __('seconds. 86400 by default, if not set. To refresh instantly, clear the Blocks HTML Output cache.') + 'note' => __('seconds. 86400 by default, if not set. To refresh instantly, clear the Blocks HTML Output cache.') ]); $fieldset->addField('from_date', 'date', [ - 'name' => 'from_date', - 'label' => __('From Date'), - 'title' => __('From'), + 'name' => 'from_date', + 'label' => __('From Date'), + 'title' => __('From'), 'date_format' => 'M/d/yyyy', - 'timezone' => false + 'timezone' => false ]); $fieldset->addField('to_date', 'date', [ - 'name' => 'to_date', - 'label' => __('To Date'), - 'title' => __('To'), + 'name' => 'to_date', + 'label' => __('To Date'), + 'title' => __('To'), 'date_format' => 'M/d/yyyy', - 'timezone' => false + 'timezone' => false ]); $this->setChild( diff --git a/Block/Adminhtml/Slider/Edit/Tab/Products.php b/Block/Adminhtml/Slider/Edit/Tab/Products.php index 2de8b25..4102e99 100644 --- a/Block/Adminhtml/Slider/Edit/Tab/Products.php +++ b/Block/Adminhtml/Slider/Edit/Tab/Products.php @@ -73,8 +73,8 @@ public function __construct( CollectionFactory $productCollectionFactory, array $data = [] ) { - $this->_helperData = $helperData; - $this->_sliderFactory = $sliderFactory; + $this->_helperData = $helperData; + $this->_sliderFactory = $sliderFactory; $this->_productCollectionFactory = $productCollectionFactory; parent::__construct($context, $backendHelper, $data); @@ -122,19 +122,19 @@ protected function _prepareColumns() 'in_product', [ 'header_css_class' => 'a-center', - 'type' => 'checkbox', - 'name' => 'in_product', - 'align' => 'center', - 'index' => 'entity_id', - 'values' => $this->_getSelectedProducts(), + 'type' => 'checkbox', + 'name' => 'in_product', + 'align' => 'center', + 'index' => 'entity_id', + 'values' => $this->_getSelectedProducts(), ] ); $this->addColumn( 'entity_id', [ - 'header' => __('Product ID'), - 'type' => 'number', - 'index' => 'entity_id', + 'header' => __('Product ID'), + 'type' => 'number', + 'index' => 'entity_id', 'header_css_class' => 'col-id', 'column_css_class' => 'col-id', ] @@ -143,27 +143,27 @@ protected function _prepareColumns() 'name', [ 'header' => __('Name'), - 'index' => 'name', - 'class' => 'xxx', - 'width' => '50px', + 'index' => 'name', + 'class' => 'xxx', + 'width' => '50px', ] ); $this->addColumn( 'sku', [ 'header' => __('Sku'), - 'index' => 'sku', - 'class' => 'xxx', - 'width' => '50px', + 'index' => 'sku', + 'class' => 'xxx', + 'width' => '50px', ] ); $this->addColumn( 'price', [ 'header' => __('Price'), - 'type' => 'currency', - 'index' => 'price', - 'width' => '50px', + 'type' => 'currency', + 'index' => 'price', + 'width' => '50px', ] ); @@ -222,7 +222,7 @@ protected function _addColumnFilterToCollection($column) */ protected function _getSelectedProducts() { - $slider = $this->getSlider(); + $slider = $this->getSlider(); $productIds = $slider->getProductIds() ? explode('&', $slider->getProductIds()) : []; return $productIds; @@ -234,7 +234,7 @@ protected function _getSelectedProducts() protected function getSlider() { $sliderId = $this->getRequest()->getParam('id'); - $slider = $this->_sliderFactory->create(); + $slider = $this->_sliderFactory->create(); if ($sliderId) { $slider->load($sliderId); } @@ -247,7 +247,7 @@ protected function getSlider() */ public function getSelectedProducts() { - $slider = $this->getSlider(); + $slider = $this->getSlider(); $selected = $slider->getProductIds() ? explode('&', $slider->getProductIds()) : []; if (!is_array($selected)) { diff --git a/Block/Adminhtml/Slider/Edit/Tab/Renderer/Category.php b/Block/Adminhtml/Slider/Edit/Tab/Renderer/Category.php index 2b8e871..e7f3d3f 100644 --- a/Block/Adminhtml/Slider/Edit/Tab/Renderer/Category.php +++ b/Block/Adminhtml/Slider/Edit/Tab/Renderer/Category.php @@ -80,10 +80,10 @@ public function __construct( UrlInterface $urlBuilder, array $data = [] ) { - $this->_option = $options; + $this->_option = $options; $this->collectionFactory = $collectionFactory; - $this->authorization = $authorization; - $this->_urlBuilder = $urlBuilder; + $this->authorization = $authorization; + $this->_urlBuilder = $urlBuilder; parent::__construct($factoryElement, $factoryCollection, $escaper, $data); } @@ -150,7 +150,7 @@ public function getScriptHtml() } } } - } + } } } } @@ -205,10 +205,10 @@ public function getNoDisplay() public function getCategoriesTree() { /* @var $collection Collection */ - $collection = $this->collectionFactory->create(); + $collection = $this->collectionFactory->create(); $categoryById = [ CategoryModel::TREE_ROOT_ID => [ - 'value' => CategoryModel::TREE_ROOT_ID, + 'value' => CategoryModel::TREE_ROOT_ID, 'optgroup' => null, ], ]; @@ -220,8 +220,8 @@ public function getCategoriesTree() } } - $categoryById[$category->getId()]['is_active'] = 1; - $categoryById[$category->getId()]['label'] = $category->getName(); + $categoryById[$category->getId()]['is_active'] = 1; + $categoryById[$category->getId()]['label'] = $category->getName(); $categoryById[$category->getParentId()]['optgroup'][] = &$categoryById[$category->getId()]; } diff --git a/Block/BestSellerProducts.php b/Block/BestSellerProducts.php index 83ee21c..9807862 100644 --- a/Block/BestSellerProducts.php +++ b/Block/BestSellerProducts.php @@ -85,7 +85,7 @@ public function __construct( */ public function getProductCollection() { - $productIds = []; + $productIds = []; $bestSellers = $this->_bestSellersCollectionFactory->create() ->setModel('Magento\Catalog\Model\Product') ->addStoreFilter($this->getStoreId()) diff --git a/Block/CategoryId.php b/Block/CategoryId.php index 66ea11a..4a957a9 100644 --- a/Block/CategoryId.php +++ b/Block/CategoryId.php @@ -106,7 +106,7 @@ public function getProductCollection() public function getProductIdsByCategory() { $productIds = []; - $catIds = $this->getSliderCategoryIds(); + $catIds = $this->getSliderCategoryIds(); $collection = $this->_productCollectionFactory->create(); if (is_array($catIds)) { foreach ($catIds as $catId) { diff --git a/Block/NewProducts.php b/Block/NewProducts.php index dfa029e..2526525 100644 --- a/Block/NewProducts.php +++ b/Block/NewProducts.php @@ -35,8 +35,8 @@ class NewProducts extends AbstractSlider public function getProductCollection() { $visibleProducts = $this->_catalogProductVisibility->getVisibleInCatalogIds(); - $collection = $this->_productCollectionFactory->create()->setVisibility($visibleProducts); - $collection = $this->_addProductAttributesAndPrices($collection) + $collection = $this->_productCollectionFactory->create()->setVisibility($visibleProducts); + $collection = $this->_addProductAttributesAndPrices($collection) ->addAttributeToFilter( 'news_from_date', ['date' => true, 'to' => $this->getEndOfDayDate()], diff --git a/Block/OnSaleProduct.php b/Block/OnSaleProduct.php index 5f8adcb..ff5c48a 100644 --- a/Block/OnSaleProduct.php +++ b/Block/OnSaleProduct.php @@ -60,8 +60,7 @@ public function __construct( HttpContext $httpContext, EncoderInterface $urlEncoder, array $data = [] - ) - { + ) { $this->_dateTimeStore = $dateTime; parent::__construct( $context, @@ -81,23 +80,23 @@ public function __construct( public function getProductCollection() { $date = strtotime($this->_dateTimeStore->gmtDate()); - $collection = $this->_productCollectionFactory->create()->addAttributeToSelect('*'); + $collection = $this->_productCollectionFactory->create()->addAttributeToSelect('*'); $productIds = []; foreach ($collection as $product) { if ($product->getTypeId() === 'configurable' && $product->getVisibility() != 1) { $_children = $product->getTypeInstance()->getUsedProducts($product); - foreach ($_children as $child){ + foreach ($_children as $child) { $specialPrice = (float)$child->getSpecialPrice(); if ($specialPrice) { - if ($specialPrice < ((float) $child->getPrice())) { + if ($specialPrice < ((float)$child->getPrice())) { $fromDate = strtotime($child->getSpecialFromDate()); if (!is_null($child->getSpecialToDate())) { $toDate = strtotime($child->getSpecialToDate()); if ($toDate > $date) { $productIds[] = $product->getId(); } - }else { + } else { if ($fromDate < $date) { $productIds[] = $product->getId(); } @@ -109,14 +108,14 @@ public function getProductCollection() } elseif ($product->getTypeId() === 'simple' && $product->getVisibility() != 1) { $specialPriceSp = (float)$product->getData('special_price'); if ($specialPriceSp) { - if ($specialPriceSp < ((float) $product->getPrice())) { + if ($specialPriceSp < ((float)$product->getPrice())) { $fromDateSp = strtotime($product->getSpecialFromDate()); if (!is_null($product->getSpecialToDate())) { $toDateSp = strtotime($product->getSpecialToDate()); if ($toDateSp > $date) { $productIds[] = $product->getId(); } - }else { + } else { if ($fromDateSp < $date) { $productIds[] = $product->getId(); } diff --git a/Block/Widget/Slider.php b/Block/Widget/Slider.php index 4a3a3ec..7b34873 100644 --- a/Block/Widget/Slider.php +++ b/Block/Widget/Slider.php @@ -131,7 +131,7 @@ public function getCacheKeyInfo() parent::getCacheKeyInfo(), [ $this->getData('page_var_name'), - (int) $this->getRequest()->getParam($this->getData('page_var_name'), 1), + (int)$this->getRequest()->getParam($this->getData('page_var_name'), 1), $params ] ); @@ -171,7 +171,7 @@ public function getDisplayType() */ public function getCurrentPage() { - return abs((int) $this->getRequest()->getParam($this->getData('page_var_name'))); + return abs((int)$this->getRequest()->getParam($this->getData('page_var_name'))); } /** diff --git a/Block/WishlistProducts.php b/Block/WishlistProducts.php index e0fbf17..67e8775 100644 --- a/Block/WishlistProducts.php +++ b/Block/WishlistProducts.php @@ -74,7 +74,7 @@ public function __construct( array $data = [] ) { $this->_wishlistCollectionFactory = $wishlistCollectionFactory; - $this->_customerSession = $_customerSession; + $this->_customerSession = $_customerSession; parent::__construct( $context, @@ -96,7 +96,7 @@ public function getProductCollection() $collection = []; if ($this->_customerSession->isLoggedIn()) { - $wishlist = $this->_wishlistCollectionFactory->create() + $wishlist = $this->_wishlistCollectionFactory->create() ->addCustomerIdFilter($this->_customerSession->getCustomerId()); $productIds = null; diff --git a/Controller/Adminhtml/Slider.php b/Controller/Adminhtml/Slider.php index 14d713a..1cda9ae 100644 --- a/Controller/Adminhtml/Slider.php +++ b/Controller/Adminhtml/Slider.php @@ -64,7 +64,7 @@ public function __construct( Registry $coreRegistry ) { $this->_sliderFactory = $sliderFactory; - $this->_coreRegistry = $coreRegistry; + $this->_coreRegistry = $coreRegistry; parent::__construct($context); } @@ -78,7 +78,7 @@ protected function _initSlider() { $slider = $this->_sliderFactory->create(); - $sliderId = (int) $this->getRequest()->getParam('id'); + $sliderId = (int)$this->getRequest()->getParam('id'); if ($sliderId) { $slider->load($sliderId); } diff --git a/Controller/Adminhtml/Slider/Edit.php b/Controller/Adminhtml/Slider/Edit.php index 6477e44..504c13c 100644 --- a/Controller/Adminhtml/Slider/Edit.php +++ b/Controller/Adminhtml/Slider/Edit.php @@ -86,7 +86,7 @@ public function execute() $resultRedirect->setPath( '*/*/edit', [ - 'id' => $slider->getId(), + 'id' => $slider->getId(), '_current' => true ] ); diff --git a/Controller/Adminhtml/Slider/MassDelete.php b/Controller/Adminhtml/Slider/MassDelete.php index f5fdaba..1b98471 100644 --- a/Controller/Adminhtml/Slider/MassDelete.php +++ b/Controller/Adminhtml/Slider/MassDelete.php @@ -65,7 +65,7 @@ public function __construct( Filter $filter, CollectionFactory $collectionFactory ) { - $this->_filter = $filter; + $this->_filter = $filter; $this->_collectionFactory = $collectionFactory; parent::__construct($context); diff --git a/Controller/Adminhtml/Slider/MassStatus.php b/Controller/Adminhtml/Slider/MassStatus.php index 44cdf2c..4721ff7 100644 --- a/Controller/Adminhtml/Slider/MassStatus.php +++ b/Controller/Adminhtml/Slider/MassStatus.php @@ -64,7 +64,7 @@ public function __construct( Filter $filter, CollectionFactory $collectionFactory ) { - $this->filter = $filter; + $this->filter = $filter; $this->collectionFactory = $collectionFactory; parent::__construct($context); @@ -76,8 +76,8 @@ public function __construct( */ public function execute() { - $collection = $this->filter->getCollection($this->collectionFactory->create()); - $status = (int) $this->getRequest()->getParam('status'); + $collection = $this->filter->getCollection($this->collectionFactory->create()); + $status = (int)$this->getRequest()->getParam('status'); $sliderUpdated = 0; foreach ($collection as $slider) { try { diff --git a/Controller/Adminhtml/Slider/Save.php b/Controller/Adminhtml/Slider/Save.php index 607bffb..2553485 100644 --- a/Controller/Adminhtml/Slider/Save.php +++ b/Controller/Adminhtml/Slider/Save.php @@ -67,7 +67,7 @@ public function __construct( Date $dateFilter, DataPersistorInterface $dataPersistor ) { - $this->_dateFilter = $dateFilter; + $this->_dateFilter = $dateFilter; $this->dataPersistor = $dataPersistor; parent::__construct($context, $sliderFactory, $coreRegistry); @@ -80,7 +80,7 @@ public function execute() { if ($data = $this->getRequest()->getPost('slider')) { try { - $data = $this->_filterData($data); + $data = $this->_filterData($data); $slider = $this->_initSlider(); $validateResult = $slider->validateData(new DataObject($data)); @@ -139,7 +139,7 @@ public function execute() protected function _filterData($data) { $inputFilter = new Zend_Filter_Input(['from_date' => $this->_dateFilter], [], $data); - $data = $inputFilter->getUnescaped(); + $data = $inputFilter->getUnescaped(); if (isset($data['responsive_items'])) { unset($data['responsive_items']['__empty']); diff --git a/Helper/Data.php b/Helper/Data.php index 2b5405d..07b2507 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -73,8 +73,8 @@ public function __construct( HttpContext $httpContext, SliderFactory $sliderFactory ) { - $this->date = $date; - $this->httpContext = $httpContext; + $this->date = $date; + $this->httpContext = $httpContext; $this->sliderFactory = $sliderFactory; parent::__construct($context, $objectManager, $storeManager); @@ -109,7 +109,7 @@ public function getActiveSliders() public function getAllOptions() { $sliderOptions = ''; - $allConfig = $this->getModuleConfig('slider_design'); + $allConfig = $this->getModuleConfig('slider_design'); foreach ($allConfig as $key => $value) { if ($key === 'item_slider') { $sliderOptions .= $this->getResponseValue(); @@ -133,7 +133,7 @@ public function getAllOptions() public function getResponseValue() { $responsiveOptions = ''; - $responsiveConfig = $this->getModuleConfig('slider_design/responsive') + $responsiveConfig = $this->getModuleConfig('slider_design/responsive') ? $this->unserialize($this->getModuleConfig('slider_design/item_slider')) : []; diff --git a/Model/Config/Source/Additional.php b/Model/Config/Source/Additional.php index 9d22e48..78e4b00 100755 --- a/Model/Config/Source/Additional.php +++ b/Model/Config/Source/Additional.php @@ -29,8 +29,8 @@ */ class Additional implements ArrayInterface { - const SHOW_PRICE = '1'; - const SHOW_CART = '2'; + const SHOW_PRICE = '1'; + const SHOW_CART = '2'; const SHOW_REVIEW = '3'; /** @@ -58,8 +58,8 @@ public function toOptionArray() protected function toArray() { return [ - self::SHOW_PRICE => __('Price'), - self::SHOW_CART => __('Add to cart button'), + self::SHOW_PRICE => __('Price'), + self::SHOW_CART => __('Add to cart button'), self::SHOW_REVIEW => __('Review information') ]; } diff --git a/Model/Config/Source/Location.php b/Model/Config/Source/Location.php index af5843c..1bd3e4b 100644 --- a/Model/Config/Source/Location.php +++ b/Model/Config/Source/Location.php @@ -29,19 +29,19 @@ */ class Location implements ArrayInterface { - const ALLPAGE_CONTENT_TOP = 'allpage.content-top'; - const ALLPAGE_CONTENT_BOTTOM = 'allpage.content-bottom'; - const ALLPAGE_SIDEBAR_TOP = 'allpage.sidebar-top'; - const ALLPAGE_SIDEBAR_BOTTOM = 'allpage.sidebar-bottom'; - const HOMEPAGE_CONTENT_TOP = 'cms_index_index.content-top'; + const ALLPAGE_CONTENT_TOP = 'allpage.content-top'; + const ALLPAGE_CONTENT_BOTTOM = 'allpage.content-bottom'; + const ALLPAGE_SIDEBAR_TOP = 'allpage.sidebar-top'; + const ALLPAGE_SIDEBAR_BOTTOM = 'allpage.sidebar-bottom'; + const HOMEPAGE_CONTENT_TOP = 'cms_index_index.content-top'; const HOMEPAGE_CONTENT_BOTTOM = 'cms_index_index.content-bottom'; - const CATEGORY_CONTENT_TOP = 'catalog_category_view.content-top'; + const CATEGORY_CONTENT_TOP = 'catalog_category_view.content-top'; const CATEGORY_CONTENT_BOTTOM = 'catalog_category_view.content-bottom'; - const CATEGORY_SIDEBAR_TOP = 'catalog_category_view.sidebar-top'; + const CATEGORY_SIDEBAR_TOP = 'catalog_category_view.sidebar-top'; const CATEGORY_SIDEBAR_BOTTOM = 'catalog_category_view.sidebar-bottom'; - const PRODUCT_CONTENT_TOP = 'catalog_product_view.content-top'; - const PRODUCT_CONTENT_BOTTOM = 'catalog_product_view.content-bottom'; - const CHECKOUT_CONTENT_TOP = 'checkout_cart_index.content-top'; + const PRODUCT_CONTENT_TOP = 'catalog_product_view.content-top'; + const PRODUCT_CONTENT_BOTTOM = 'catalog_product_view.content-bottom'; + const CHECKOUT_CONTENT_TOP = 'checkout_cart_index.content-top'; const CHECKOUT_CONTENT_BOTTOM = 'checkout_cart_index.content-bottom'; /** diff --git a/Model/Config/Source/ProductType.php b/Model/Config/Source/ProductType.php index 1a913e2..587a355 100644 --- a/Model/Config/Source/ProductType.php +++ b/Model/Config/Source/ProductType.php @@ -29,15 +29,15 @@ */ class ProductType implements ArrayInterface { - const NEW_PRODUCTS = 'new'; + const NEW_PRODUCTS = 'new'; const BEST_SELLER_PRODUCTS = 'best-seller'; - const FEATURED_PRODUCTS = 'featured'; - const MOSTVIEWED_PRODUCTS = 'mostviewed'; - const ONSALE_PRODUCTS = 'onsale'; - const RECENT_PRODUCT = 'recent'; - const WISHLIST_PRODUCT = 'wishlist'; - const CATEGORY = 'category'; - const CUSTOM_PRODUCTS = 'custom'; + const FEATURED_PRODUCTS = 'featured'; + const MOSTVIEWED_PRODUCTS = 'mostviewed'; + const ONSALE_PRODUCTS = 'onsale'; + const RECENT_PRODUCT = 'recent'; + const WISHLIST_PRODUCT = 'wishlist'; + const CATEGORY = 'category'; + const CUSTOM_PRODUCTS = 'custom'; /** * Options getter @@ -64,15 +64,15 @@ public function toOptionArray() protected function toArray() { return [ - self::NEW_PRODUCTS => __('New Products'), + self::NEW_PRODUCTS => __('New Products'), self::BEST_SELLER_PRODUCTS => __('Best Seller Products'), - self::FEATURED_PRODUCTS => __('Featured Products'), - self::MOSTVIEWED_PRODUCTS => __('Most Viewed Products'), - self::ONSALE_PRODUCTS => __('On Sale Products'), - self::RECENT_PRODUCT => __('Recent Products'), + self::FEATURED_PRODUCTS => __('Featured Products'), + self::MOSTVIEWED_PRODUCTS => __('Most Viewed Products'), + self::ONSALE_PRODUCTS => __('On Sale Products'), + self::RECENT_PRODUCT => __('Recent Products'), // self::WISHLIST_PRODUCT => __('WishList Products'), - self::CATEGORY => __('Select By Category'), - self::CUSTOM_PRODUCTS => __('Custom Specific Products'), + self::CATEGORY => __('Select By Category'), + self::CUSTOM_PRODUCTS => __('Custom Specific Products'), ]; } @@ -99,15 +99,15 @@ public function getLabel($type) public function getBlockMap($type = null) { $maps = [ - self::NEW_PRODUCTS => 'Mageplaza\Productslider\Block\NewProducts', + self::NEW_PRODUCTS => 'Mageplaza\Productslider\Block\NewProducts', self::BEST_SELLER_PRODUCTS => 'Mageplaza\Productslider\Block\BestSellerProducts', - self::FEATURED_PRODUCTS => 'Mageplaza\Productslider\Block\FeaturedProducts', - self::MOSTVIEWED_PRODUCTS => 'Mageplaza\Productslider\Block\MostViewedProducts', - self::ONSALE_PRODUCTS => 'Mageplaza\Productslider\Block\OnSaleProduct', - self::RECENT_PRODUCT => 'Mageplaza\Productslider\Block\RecentProducts', - self::WISHLIST_PRODUCT => 'Mageplaza\Productslider\Block\WishlistProducts', - self::CATEGORY => 'Mageplaza\Productslider\Block\CategoryId', - self::CUSTOM_PRODUCTS => 'Mageplaza\Productslider\Block\CustomProducts', + self::FEATURED_PRODUCTS => 'Mageplaza\Productslider\Block\FeaturedProducts', + self::MOSTVIEWED_PRODUCTS => 'Mageplaza\Productslider\Block\MostViewedProducts', + self::ONSALE_PRODUCTS => 'Mageplaza\Productslider\Block\OnSaleProduct', + self::RECENT_PRODUCT => 'Mageplaza\Productslider\Block\RecentProducts', + self::WISHLIST_PRODUCT => 'Mageplaza\Productslider\Block\WishlistProducts', + self::CATEGORY => 'Mageplaza\Productslider\Block\CategoryId', + self::CUSTOM_PRODUCTS => 'Mageplaza\Productslider\Block\CustomProducts', ]; if ($type && isset($maps[$type])) { diff --git a/Model/ResourceModel/Report/Product/Collection.php b/Model/ResourceModel/Report/Product/Collection.php index a7264a6..a09b17f 100644 --- a/Model/ResourceModel/Report/Product/Collection.php +++ b/Model/ResourceModel/Report/Product/Collection.php @@ -56,7 +56,7 @@ public function addViewsCount($from = '', $to = '') $eventTypes = $this->_eventTypeFactory->create()->getCollection(); foreach ($eventTypes as $eventType) { if ($eventType->getEventName() == 'catalog_product_view') { - $this->getSelect()->where('report_table_views.event_type_id = ?', (int) $eventType->getId()); + $this->getSelect()->where('report_table_views.event_type_id = ?', (int)$eventType->getId()); break; } } diff --git a/Model/Slider.php b/Model/Slider.php index 9f01dac..ef37f04 100644 --- a/Model/Slider.php +++ b/Model/Slider.php @@ -85,17 +85,17 @@ public function getIdentities() */ public function validateData(DataObject $dataObject) { - $result = []; + $result = []; $fromDate = $toDate = null; if ($dataObject->hasFromDate() && $dataObject->hasToDate()) { $fromDate = $dataObject->getFromDate(); - $toDate = $dataObject->getToDate(); + $toDate = $dataObject->getToDate(); } if ($fromDate && $toDate) { $fromDate = new DateTime($fromDate); - $toDate = new DateTime($toDate); + $toDate = new DateTime($toDate); if ($fromDate > $toDate) { $result[] = __('End Date must follow Start Date.'); diff --git a/Observer/AddBlock.php b/Observer/AddBlock.php index 0b42b12..3066c35 100755 --- a/Observer/AddBlock.php +++ b/Observer/AddBlock.php @@ -61,8 +61,8 @@ public function __construct( Data $helperData, ProductType $productType ) { - $this->request = $request; - $this->helperData = $helperData; + $this->request = $request; + $this->helperData = $helperData; $this->productType = $productType; } @@ -81,9 +81,9 @@ public function execute(Observer $observer) ]); if ($type !== false) { /** @var Layout $layout */ - $layout = $observer->getEvent()->getLayout(); + $layout = $observer->getEvent()->getLayout(); $fullActionName = $this->request->getFullActionName(); - $output = $observer->getTransport()->getOutput(); + $output = $observer->getTransport()->getOutput(); foreach ($this->helperData->getActiveSliders() as $slider) { [$pageType, $location] = explode('.', $slider->getLocation()); if ($fullActionName == $pageType || $pageType == 'allpage') { diff --git a/Setup/InstallData.php b/Setup/InstallData.php index d1d628b..b49dd1b 100644 --- a/Setup/InstallData.php +++ b/Setup/InstallData.php @@ -61,27 +61,27 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $eavSetup = $this->eavSetupFactory->create(['setup' => $setup]); $eavSetup->addAttribute(Product::ENTITY, 'is_featured', [ - 'type' => 'int', - 'backend' => '', - 'frontend' => '', - 'label' => 'Featured Product', - 'note' => '', - 'input' => 'boolean', - 'class' => '', - 'source' => '', - 'global' => ScopedAttributeInterface::SCOPE_GLOBAL, - 'visible' => true, - 'required' => false, - 'user_defined' => true, - 'default' => '', - 'searchable' => false, - 'filterable' => false, - 'comparable' => false, - 'visible_on_front' => false, + 'type' => 'int', + 'backend' => '', + 'frontend' => '', + 'label' => 'Featured Product', + 'note' => '', + 'input' => 'boolean', + 'class' => '', + 'source' => '', + 'global' => ScopedAttributeInterface::SCOPE_GLOBAL, + 'visible' => true, + 'required' => false, + 'user_defined' => true, + 'default' => '', + 'searchable' => false, + 'filterable' => false, + 'comparable' => false, + 'visible_on_front' => false, 'used_in_product_listing' => true, - 'unique' => false, - 'sort_order' => 10, - 'apply_to' => 'simple,virtual,bundle,downloadable,grouped,configurable' + 'unique' => false, + 'sort_order' => 10, + 'apply_to' => 'simple,virtual,bundle,downloadable,grouped,configurable' ]); $installer->endSetup(); diff --git a/Setup/UpgradeSchema.php b/Setup/UpgradeSchema.php index 80f2055..e2e56a6 100644 --- a/Setup/UpgradeSchema.php +++ b/Setup/UpgradeSchema.php @@ -50,7 +50,7 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con 'identity' => true, 'unsigned' => true, 'nullable' => false, - 'primary' => true + 'primary' => true ], 'Rule Id') ->addColumn('name', Table::TYPE_TEXT, 255, [], 'Name') ->addColumn('status', Table::TYPE_SMALLINT, null, ['nullable' => false, 'default' => '0'], 'Status') diff --git a/Ui/Component/Listing/Columns/SliderActions.php b/Ui/Component/Listing/Columns/SliderActions.php index a33b895..f0b336f 100644 --- a/Ui/Component/Listing/Columns/SliderActions.php +++ b/Ui/Component/Listing/Columns/SliderActions.php @@ -74,7 +74,7 @@ public function prepareDataSource(array $dataSource) if (isset($item['slider_id'])) { $item[$this->getData('name')] = [ 'edit' => [ - 'href' => $this->_urlBuilder->getUrl( + 'href' => $this->_urlBuilder->getUrl( 'mpproductslider/slider/edit', ['id' => $item['slider_id']] ), diff --git a/Ui/Component/Listing/Columns/SliderLocation.php b/Ui/Component/Listing/Columns/SliderLocation.php index 60cdd7c..7485daf 100644 --- a/Ui/Component/Listing/Columns/SliderLocation.php +++ b/Ui/Component/Listing/Columns/SliderLocation.php @@ -42,8 +42,8 @@ public function prepareDataSource(array $dataSource) if (isset($dataSource['data']['items'])) { foreach ($dataSource['data']['items'] as & $item) { if (isset($item[$this->getData('name')])) { - $data = $this->getLocation($item[$this->getData('name')]); - $type = $data['type']; + $data = $this->getLocation($item[$this->getData('name')]); + $type = $data['type']; $location = $data['location']; $item[$this->getData('name')] = '' . $type . '
' . '' . $location . ''; @@ -64,59 +64,59 @@ public function getLocation($data) $location = []; switch ($data) { case Location::ALLPAGE_CONTENT_TOP: - $location['type'] = 'All Page'; + $location['type'] = 'All Page'; $location['location'] = 'Top of Content'; break; case Location::ALLPAGE_CONTENT_BOTTOM: - $location['type'] = 'All Page'; + $location['type'] = 'All Page'; $location['location'] = 'Bottom of Content'; break; case Location::ALLPAGE_SIDEBAR_TOP: - $location['type'] = 'All Page'; + $location['type'] = 'All Page'; $location['location'] = 'Sidebar Top'; break; case Location::ALLPAGE_SIDEBAR_BOTTOM: - $location['type'] = 'All Page'; + $location['type'] = 'All Page'; $location['location'] = 'Sidebar Bottom'; break; case Location::HOMEPAGE_CONTENT_TOP: - $location['type'] = 'Home Page'; + $location['type'] = 'Home Page'; $location['location'] = 'Top of Content'; break; case Location::HOMEPAGE_CONTENT_BOTTOM: - $location['type'] = 'Home Page'; + $location['type'] = 'Home Page'; $location['location'] = 'Bottom of Content'; break; case Location::CATEGORY_CONTENT_TOP: - $location['type'] = 'Category Page'; + $location['type'] = 'Category Page'; $location['location'] = 'Top of Content'; break; case Location::CATEGORY_CONTENT_BOTTOM: - $location['type'] = 'Category Page'; + $location['type'] = 'Category Page'; $location['location'] = 'Bottom of Content'; break; case Location::CATEGORY_SIDEBAR_TOP: - $location['type'] = 'Category Page'; + $location['type'] = 'Category Page'; $location['location'] = 'Sidebar Top'; break; case Location::CATEGORY_SIDEBAR_BOTTOM: - $location['type'] = 'Category Page'; + $location['type'] = 'Category Page'; $location['location'] = 'Sidebar Bottom'; break; case Location::PRODUCT_CONTENT_TOP: - $location['type'] = 'Product Page'; + $location['type'] = 'Product Page'; $location['location'] = 'Top of Content'; break; case Location::PRODUCT_CONTENT_BOTTOM: - $location['type'] = 'Product Page'; + $location['type'] = 'Product Page'; $location['location'] = 'Bottom of Content'; break; case Location::CHECKOUT_CONTENT_TOP: - $location['type'] = 'Checkout Page'; + $location['type'] = 'Checkout Page'; $location['location'] = 'Top of Content'; break; case Location::CHECKOUT_CONTENT_BOTTOM: - $location['type'] = 'Checkout Page'; + $location['type'] = 'Checkout Page'; $location['location'] = 'Bottom of Content'; break; } diff --git a/composer.json b/composer.json index 7e926fb..69888a7 100644 --- a/composer.json +++ b/composer.json @@ -1,26 +1,26 @@ -{ - "name": "mageplaza/magento-2-product-slider", - "description": "Magento 2 Product Slider", - "require": { - "mageplaza/module-core": "^1.4.5" - }, - "type": "magento2-module", - "version": "2.0.7", - "license": "proprietary", - "authors": [ - { - "name": "Mageplaza", - "email": "support@mageplaza.com", - "homepage": "https://www.mageplaza.com", - "role": "Technical Support" - } - ], - "autoload": { - "files": [ - "registration.php" - ], - "psr-4": { - "Mageplaza\\Productslider\\": "" - } - } -} +{ + "name": "mageplaza/magento-2-product-slider", + "description": "Magento 2 Product Slider", + "require": { + "mageplaza/module-core": "^1.4.5" + }, + "type": "magento2-module", + "version": "4.0.0", + "license": "proprietary", + "authors": [ + { + "name": "Mageplaza", + "email": "support@mageplaza.com", + "homepage": "https://www.mageplaza.com", + "role": "Technical Support" + } + ], + "autoload": { + "files": [ + "registration.php" + ], + "psr-4": { + "Mageplaza\\Productslider\\": "" + } + } +} diff --git a/i18n/en_US.csv b/i18n/en_US.csv index 5833656..a2415bb 100644 --- a/i18n/en_US.csv +++ b/i18n/en_US.csv @@ -1,110 +1,110 @@ -"Screen size max","Screen size max" -"Number of items","Number of items" -Add,Add -Sliders,Sliders -"Create New Slider","Create New Slider" -"Edit Slider '%1'","Edit Slider '%1'" -"New Slider","New Slider" -"Save and Continue Edit","Save and Continue Edit" -Design,Design -Title,Title -Description,Description -"Limit the number of products","Limit the number of products" -"Display additional information","Display additional information" -"Select information or button(s) to display with products.","Select information or button(s) to display with products." -"Is Responsive","Is Responsive" -Yes,Yes -No,No -"Use Config","Use Config" -"Max Items slider","Max Items slider" -"General Information","General Information" -Name,Name -Status,Status -Enable,Enable -Disable,Disable -Position,Position -Type,Type -Categories,Categories -"Store Views","Store Views" -"Customer Groups","Customer Groups" -"Select customer group(s) to display the block to","Select customer group(s) to display the block to" -"Cache Lifetime","Cache Lifetime" -"seconds. 86400 by default, if not set. To refresh instantly, clear the Blocks HTML Output cache.","seconds. 86400 by default, if not set. To refresh instantly, clear the Blocks HTML Output cache." -"From Date","From Date" -From,From -"To Date","To Date" -To,To -"Product ID","Product ID" -Sku,Sku -Price,Price -"Select Products","Select Products" -"Product Slider Information","Product Slider Information" -"The Slider has been deleted.","The Slider has been deleted." -"This Slider no longer exists.","This Slider no longer exists." -"A total of %1 record(s) have been deleted.","A total of %1 record(s) have been deleted." -"Something went wrong while updating status for %1.","Something went wrong while updating status for %1." -"A total of %1 record(s) have been updated.","A total of %1 record(s) have been updated." -"The Slider has been saved.","The Slider has been saved." -"Something went wrong while saving the Slider. %1","Something went wrong while saving the Slider. %1" -"Add to cart button","Add to cart button" -"Review information","Review information" -"All Page","All Page" -"Top of content","Top of content" -"Bottom of content","Bottom of content" -"Top of sidebar","Top of sidebar" -"Bottom of sidebar","Bottom of sidebar" -"Home Page","Home Page" -"Category page","Category page" -"Product page","Product page" -"Shopping Cart Page","Shopping Cart Page" -"New Products","New Products" -"Best Seller Products","Best Seller Products" -"Featured Products","Featured Products" -"Most Viewed Products","Most Viewed Products" -"On Sale Products","On Sale Products" -"Recent Products","Recent Products" -"Select By Category","Select By Category" -"Custom Specific Products","Custom Specific Products" -"End Date must follow Start Date.","End Date must follow Start Date." -Edit,Edit -"Add to Cart","Add to Cart" -"In stock","In stock" -"Out of stock","Out of stock" -"Add to Wish List","Add to Wish List" -"Add to Compare","Add to Compare" -"Product Slider","Product Slider" -"General Configuration","General Configuration" -"Select Yes to enable this module","Select Yes to enable this module" -"Default displayed additional info","Default displayed additional info" -"This default settings will be used when using code to insert the slider","This default settings will be used when using code to insert the slider" -"Slider Design Configuration","Slider Design Configuration" -Responsive,Responsive -"Loop Slider","Loop Slider" -"Select Yes to re-display the slider after it shows the last item","Select Yes to re-display the slider after it shows the last item" -"Margin Between Items","Margin Between Items" -"pixel. This is the distance between two items in the slider","pixel. This is the distance between two items in the slider" -"Next/Prev buttons","Next/Prev buttons" -"Select Yes to display the Next/Pre button in the slider","Select Yes to display the Next/Pre button in the slider" -"Show Dots Navigation","Show Dots Navigation" -"Select Yes to display dot navigation of the slider","Select Yes to display dot navigation of the slider" -"Lazy load images","Lazy load images" -"Select Yes to lazy load images","Select Yes to lazy load images" -Autoplay,Autoplay -"Select Yes to allow auto-displaying the next products","Select Yes to allow auto-displaying the next products" -"Autoplay TimeOut","Autoplay TimeOut" -"ms. This is the time which an item is auto-moved to the left","ms. This is the time which an item is auto-moved to the left" -"Autoplay HoverPause","Autoplay HoverPause" -"Select Yes to stop the slider when hovering the mouse over the slider area","Select Yes to stop the slider when hovering the mouse over the slider area" -"Mageplaza Product Slider","Mageplaza Product Slider" -"Display Page Control","Display Page Control" -"Select Slider","Select Slider" -"Add New Slider","Add New Slider" -Delete,Delete -"Delete Slider","Delete Slider" -"Are you sure you wan't to delete selected Slider?","Are you sure you wan't to delete selected Slider?" -"Change status","Change status" -ID,ID -"Slider Type","Slider Type" -"Slider Location","Slider Location" -"Start Date","Start Date" -"End Date","End Date" +"Screen size max","Screen size max" +"Number of items","Number of items" +Add,Add +Sliders,Sliders +"Create New Slider","Create New Slider" +"Edit Slider '%1'","Edit Slider '%1'" +"New Slider","New Slider" +"Save and Continue Edit","Save and Continue Edit" +Design,Design +Title,Title +Description,Description +"Limit the number of products","Limit the number of products" +"Display additional information","Display additional information" +"Select information or button(s) to display with products.","Select information or button(s) to display with products." +"Is Responsive","Is Responsive" +Yes,Yes +No,No +"Use Config","Use Config" +"Max Items slider","Max Items slider" +"General Information","General Information" +Name,Name +Status,Status +Enable,Enable +Disable,Disable +Position,Position +Type,Type +Categories,Categories +"Store Views","Store Views" +"Customer Groups","Customer Groups" +"Select customer group(s) to display the block to","Select customer group(s) to display the block to" +"Cache Lifetime","Cache Lifetime" +"seconds. 86400 by default, if not set. To refresh instantly, clear the Blocks HTML Output cache.","seconds. 86400 by default, if not set. To refresh instantly, clear the Blocks HTML Output cache." +"From Date","From Date" +From,From +"To Date","To Date" +To,To +"Product ID","Product ID" +Sku,Sku +Price,Price +"Select Products","Select Products" +"Product Slider Information","Product Slider Information" +"The Slider has been deleted.","The Slider has been deleted." +"This Slider no longer exists.","This Slider no longer exists." +"A total of %1 record(s) have been deleted.","A total of %1 record(s) have been deleted." +"Something went wrong while updating status for %1.","Something went wrong while updating status for %1." +"A total of %1 record(s) have been updated.","A total of %1 record(s) have been updated." +"The Slider has been saved.","The Slider has been saved." +"Something went wrong while saving the Slider. %1","Something went wrong while saving the Slider. %1" +"Add to cart button","Add to cart button" +"Review information","Review information" +"All Page","All Page" +"Top of content","Top of content" +"Bottom of content","Bottom of content" +"Top of sidebar","Top of sidebar" +"Bottom of sidebar","Bottom of sidebar" +"Home Page","Home Page" +"Category page","Category page" +"Product page","Product page" +"Shopping Cart Page","Shopping Cart Page" +"New Products","New Products" +"Best Seller Products","Best Seller Products" +"Featured Products","Featured Products" +"Most Viewed Products","Most Viewed Products" +"On Sale Products","On Sale Products" +"Recent Products","Recent Products" +"Select By Category","Select By Category" +"Custom Specific Products","Custom Specific Products" +"End Date must follow Start Date.","End Date must follow Start Date." +Edit,Edit +"Add to Cart","Add to Cart" +"In stock","In stock" +"Out of stock","Out of stock" +"Add to Wish List","Add to Wish List" +"Add to Compare","Add to Compare" +"Product Slider","Product Slider" +"General Configuration","General Configuration" +"Select Yes to enable this module","Select Yes to enable this module" +"Default displayed additional info","Default displayed additional info" +"This default settings will be used when using code to insert the slider","This default settings will be used when using code to insert the slider" +"Slider Design Configuration","Slider Design Configuration" +Responsive,Responsive +"Loop Slider","Loop Slider" +"Select Yes to re-display the slider after it shows the last item","Select Yes to re-display the slider after it shows the last item" +"Margin Between Items","Margin Between Items" +"pixel. This is the distance between two items in the slider","pixel. This is the distance between two items in the slider" +"Next/Prev buttons","Next/Prev buttons" +"Select Yes to display the Next/Pre button in the slider","Select Yes to display the Next/Pre button in the slider" +"Show Dots Navigation","Show Dots Navigation" +"Select Yes to display dot navigation of the slider","Select Yes to display dot navigation of the slider" +"Lazy load images","Lazy load images" +"Select Yes to lazy load images","Select Yes to lazy load images" +Autoplay,Autoplay +"Select Yes to allow auto-displaying the next products","Select Yes to allow auto-displaying the next products" +"Autoplay TimeOut","Autoplay TimeOut" +"ms. This is the time which an item is auto-moved to the left","ms. This is the time which an item is auto-moved to the left" +"Autoplay HoverPause","Autoplay HoverPause" +"Select Yes to stop the slider when hovering the mouse over the slider area","Select Yes to stop the slider when hovering the mouse over the slider area" +"Mageplaza Product Slider","Mageplaza Product Slider" +"Display Page Control","Display Page Control" +"Select Slider","Select Slider" +"Add New Slider","Add New Slider" +Delete,Delete +"Delete Slider","Delete Slider" +"Are you sure you wan't to delete selected Slider?","Are you sure you wan't to delete selected Slider?" +"Change status","Change status" +ID,ID +"Slider Type","Slider Type" +"Slider Location","Slider Location" +"Start Date","Start Date" +"End Date","End Date" diff --git a/view/frontend/templates/productslider.phtml b/view/frontend/templates/productslider.phtml index 7e1580f..e9469c2 100644 --- a/view/frontend/templates/productslider.phtml +++ b/view/frontend/templates/productslider.phtml @@ -28,7 +28,7 @@ $type = 'widget-product-grid'; $title = $block->getTitle(); $blockId = $block->getSliderId() . uniqid('-', false); $items = $block->getProductCollection(); -if ($block->getHelperData()->isEnabled() && $items && $items->getSize()) : ?> +if ($block->getHelperData()->isEnabled() && $items && $items->getSize()): ?>

escapeHtml($title) ?>

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

@@ -38,7 +38,7 @@ if ($block->getHelperData()->isEnabled() && $items && $items->getSize()) : ?>