Skip to content

Commit

Permalink
Clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
alothemes committed Dec 25, 2020
1 parent db9484c commit 66a15ba
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 45 deletions.
23 changes: 23 additions & 0 deletions Helper/Alothemes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

/**
* @Author: Alex Dong
* @Date: 2020-12-25 09:16:34
* @Last Modified by: Alex Dong
* @Last Modified time: 2020-12-25 09:17:05
*/

namespace Magiccart\Shopbrand\Helper;

class Alothemes extends Data
{
public function getTimer($_product)
{

}

public function getLabels($_product)
{

}
}
32 changes: 16 additions & 16 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,49 +107,49 @@
<field id="mobile" translate="label comment" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label><![CDATA[max-width 360: ]]></label>
<comment><![CDATA[Number product show in screen ( Size <= 360 ) ]]></comment>
<source_model>Magiccart\Alothemes\Model\System\Config\Col</source_model>
<source_model>Magiccart\Shopbrand\Model\System\Config\Col</source_model>
<validate>required-entry validate-greater-than-zero</validate>
</field>
<field id="portrait" translate="label comment" type="select" sortOrder="75" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label><![CDATA[max-width 480: ]]></label>
<comment><![CDATA[Number product show in screen ( 360 < Size < 480 ) ]]></comment>
<source_model>Magiccart\Alothemes\Model\System\Config\Col</source_model>
<source_model>Magiccart\Shopbrand\Model\System\Config\Col</source_model>
<validate>required-entry validate-greater-than-zero</validate>
</field>
<field id="landscape" translate="label comment" type="select" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label><![CDATA[max-width 640: ]]></label>
<comment><![CDATA[Number product show in screen ( 480 <= Size < 640 ) ]]></comment>
<source_model>Magiccart\Alothemes\Model\System\Config\Col</source_model>
<source_model>Magiccart\Shopbrand\Model\System\Config\Col</source_model>
<validate>required-entry validate-greater-than-zero</validate>
</field>
<field id="tablet" translate="label comment" type="select" sortOrder="85" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label><![CDATA[max-width 768: ]]></label>
<comment><![CDATA[Number product show in screen ( 640 <= Size < 768 ) ]]></comment>
<source_model>Magiccart\Alothemes\Model\System\Config\Col</source_model>
<source_model>Magiccart\Shopbrand\Model\System\Config\Col</source_model>
<validate>required-entry validate-greater-than-zero</validate>
</field>
<field id="notebook" translate="label comment" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label><![CDATA[max-width 991: ]]></label>
<comment><![CDATA[Number product show in screen ( 768 <= Size < 992 ) ]]></comment>
<source_model>Magiccart\Alothemes\Model\System\Config\Col</source_model>
<source_model>Magiccart\Shopbrand\Model\System\Config\Col</source_model>
<validate>required-entry validate-greater-than-zero</validate>
</field>
<field id="laptop" translate="label comment" type="select" sortOrder="95" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label><![CDATA[max-width 1199: ]]></label>
<comment><![CDATA[Number product show in screen ( 992 <= Size < 1200 ) ]]></comment>
<source_model>Magiccart\Alothemes\Model\System\Config\Col</source_model>
<source_model>Magiccart\Shopbrand\Model\System\Config\Col</source_model>
<validate>required-entry validate-greater-than-zero</validate>
</field>
<field id="desktop" translate="label comment" type="select" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label><![CDATA[max-width 1919: ]]></label>
<comment><![CDATA[Number product show in screen ( 1200 <= Size < 1920 ) ]]></comment>
<source_model>Magiccart\Alothemes\Model\System\Config\Col</source_model>
<source_model>Magiccart\Shopbrand\Model\System\Config\Col</source_model>
<validate>required-entry validate-greater-than-zero</validate>
</field>
<field id="visible" translate="label comment" type="select" sortOrder="105" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label><![CDATA[min-width 1920: ]]></label>
<comment><![CDATA[Number product show in screen ( Size >= 1920 ) ]]></comment>
<source_model>Magiccart\Alothemes\Model\System\Config\Col</source_model>
<source_model>Magiccart\Shopbrand\Model\System\Config\Col</source_model>
<validate>required-entry validate-greater-than-zero</validate>
</field>
</group>
Expand Down Expand Up @@ -225,49 +225,49 @@
<field id="mobile" translate="label comment" type="select" sortOrder="70" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label><![CDATA[max-width 360: ]]></label>
<comment><![CDATA[Number product show in screen ( Size <= 360 ) ]]></comment>
<source_model>Magiccart\Alothemes\Model\System\Config\Col</source_model>
<source_model>Magiccart\Shopbrand\Model\System\Config\Col</source_model>
<validate>required-entry validate-greater-than-zero</validate>
</field>
<field id="portrait" translate="label comment" type="select" sortOrder="75" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label><![CDATA[max-width 480: ]]></label>
<comment><![CDATA[Number product show in screen ( 360 < Size < 480 ) ]]></comment>
<source_model>Magiccart\Alothemes\Model\System\Config\Col</source_model>
<source_model>Magiccart\Shopbrand\Model\System\Config\Col</source_model>
<validate>required-entry validate-greater-than-zero</validate>
</field>
<field id="landscape" translate="label comment" type="select" sortOrder="80" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label><![CDATA[max-width 640: ]]></label>
<comment><![CDATA[Number product show in screen ( 480 <= Size < 640 ) ]]></comment>
<source_model>Magiccart\Alothemes\Model\System\Config\Col</source_model>
<source_model>Magiccart\Shopbrand\Model\System\Config\Col</source_model>
<validate>required-entry validate-greater-than-zero</validate>
</field>
<field id="tablet" translate="label comment" type="select" sortOrder="85" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label><![CDATA[max-width 768: ]]></label>
<comment><![CDATA[Number product show in screen ( 640 <= Size < 768 ) ]]></comment>
<source_model>Magiccart\Alothemes\Model\System\Config\Col</source_model>
<source_model>Magiccart\Shopbrand\Model\System\Config\Col</source_model>
<validate>required-entry validate-greater-than-zero</validate>
</field>
<field id="notebook" translate="label comment" type="select" sortOrder="90" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label><![CDATA[max-width 991: ]]></label>
<comment><![CDATA[Number product show in screen ( 768 <= Size < 992 ) ]]></comment>
<source_model>Magiccart\Alothemes\Model\System\Config\Col</source_model>
<source_model>Magiccart\Shopbrand\Model\System\Config\Col</source_model>
<validate>required-entry validate-greater-than-zero</validate>
</field>
<field id="laptop" translate="label comment" type="select" sortOrder="95" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label><![CDATA[max-width 1199: ]]></label>
<comment><![CDATA[Number product show in screen ( 992 <= Size < 1200 ) ]]></comment>
<source_model>Magiccart\Alothemes\Model\System\Config\Col</source_model>
<source_model>Magiccart\Shopbrand\Model\System\Config\Col</source_model>
<validate>required-entry validate-greater-than-zero</validate>
</field>
<field id="desktop" translate="label comment" type="select" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label><![CDATA[max-width 1919: ]]></label>
<comment><![CDATA[Number product show in screen ( 1200 <= Size < 1920 ) ]]></comment>
<source_model>Magiccart\Alothemes\Model\System\Config\Col</source_model>
<source_model>Magiccart\Shopbrand\Model\System\Config\Col</source_model>
<validate>required-entry validate-greater-than-zero</validate>
</field>
<field id="visible" translate="label comment" type="select" sortOrder="105" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label><![CDATA[min-width 1920: ]]></label>
<comment><![CDATA[Number product show in screen ( Size >= 1920 ) ]]></comment>
<source_model>Magiccart\Alothemes\Model\System\Config\Col</source_model>
<source_model>Magiccart\Shopbrand\Model\System\Config\Col</source_model>
<validate>required-entry validate-greater-than-zero</validate>
</field>
</group>
Expand Down
14 changes: 2 additions & 12 deletions view/frontend/templates/brand.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ $selector = 'alo-content-'.uniqid();
$brands = $this->getBrands();
if(!count($brands)) return;
?>
<div class="<?php /* @escapeNotVerified */ echo $selector ?>">
<div class="<?php /* @escapeNotVerified */ echo $selector ?>" data-mage-init='{"gridSlider": {}}'>
<?php /* @escapeNotVerified */ echo $this->getTitle() ? '<h2 class="title item">' . '<span>' . $this->getTitle() . '</span>' . '</h2>' : '' ?>
<div class="shopbrand"
<div class="shopbrand grid-slider"
<?php foreach ($this->getFrontendCfg() as $opt) :?>
data-<?php /* @escapeNotVerified */ echo $opt ?>='<?php /* @escapeNotVerified */ echo $this->getData($opt) ?>'
<?php endforeach;?>
Expand All @@ -20,13 +20,3 @@ if(!count($brands)) return;
<?php endforeach ?>
</div>
</div>
<script type="text/javascript">
require([
'jquery',
'magiccart/slick',
'alothemes',
], function($, slick, alothemes){
var shopbrand = $('.<?php echo $selector ?> .shopbrand');
if(shopbrand.length) $('head').append(magicproduct(shopbrand, '.item'));
});
</script>
5 changes: 1 addition & 4 deletions view/frontend/templates/product/grid.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ use Magento\Framework\App\Action\Action;
<?php
$_productCollection = $block->getLoadedProductCollection();
$_helper = $this->helper('Magento\Catalog\Helper\Output');
$_aloHelper = $this->helper('Magiccart\Alothemes\Helper\Data');
$_aloHelper = $this->helper('Magiccart\Shopbrand\Helper\Alothemes');
?>
<div class="mage-magictabs mc-<?php echo $this->escapeHtml($this->getTypeFilter());?>">
<?php if (!$_productCollection->count()): ?>
<div class="message info empty"><div><?php /* @escapeNotVerified */ echo __('We can\'t find products matching the selection.') ?></div></div>
<?php else: ?>
<?php //echo $block->getToolbarHtml() ?>
<?php //echo $block->getAdditionalHtml() ?>
<?php
$viewMode = 'grid';
$image = 'category_page_grid';
Expand Down Expand Up @@ -144,7 +142,6 @@ $_aloHelper = $this->helper('Magiccart\Alothemes\Helper\Data');
<?php endforeach; ?>
</ol>
</div>
<?php // echo $block->getToolbarHtml() ?>
<?php if (!$block->isRedirectToCartEnabled()) : ?>
<script type="text/x-magento-init">
{
Expand Down
14 changes: 1 addition & 13 deletions view/frontend/templates/product/gridtimer.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,17 @@ use Magento\Framework\App\Action\Action;
<?php
$_productCollection = $block->getLoadedProductCollection();
$_helper = $this->helper('Magento\Catalog\Helper\Output');
$_aloHelper = $this->helper('Magiccart\Alothemes\Helper\Data');
$_aloHelper = $this->helper('Magiccart\Shopbrand\Helper\Alothemes');
?>
<div class="mage-magictabs mc-<?php echo $this->escapeHtml($this->getType());?>">
<?php if (!$_productCollection->count()): ?>
<div class="message info empty"><div><?php /* @escapeNotVerified */ echo __('We can\'t find products matching the selection.') ?></div></div>
<?php else: ?>
<?php //echo $block->getToolbarHtml() ?>
<?php //echo $block->getAdditionalHtml() ?>
<?php
// if ($block->getMode() == 'grid') {
$viewMode = 'grid';
$image = 'category_page_grid';
$showDescription = false;
$templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::SHORT_VIEW;
// } else {
// $viewMode = 'list';
// $image = 'category_page_list';
// $showDescription = true;
// $templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::FULL_VIEW;
// }
/**
* Position for actions regarding image size changing in vde if needed
*/
$pos = $block->getPositioned();
?>
<?php
Expand Down

0 comments on commit 66a15ba

Please sign in to comment.