Skip to content

Commit 74b153c

Browse files
committed
Skeleton
1 parent 28dc962 commit 74b153c

File tree

3 files changed

+23
-24
lines changed

3 files changed

+23
-24
lines changed

Block/Categories.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,4 +217,10 @@ public function isExcluded($id)
217217
if (!$excluded) return;
218218
return in_array($id, $excluded);
219219
}
220+
221+
public function getResponsiveBreakpoints()
222+
{
223+
return array(1921 => 'visible', 1920 => 'widescreen', 1479 => 'desktop', 1200 => 'laptop', 992 => 'notebook', 768 => 'tablet', 576 => 'landscape', 480 => 'portrait', 361 => 'mobile', 1 => 'mobile');
224+
}
225+
220226
}

Block/Widget/Categories.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,6 @@ public function getCategories()
113113
return $categories;
114114
}
115115

116-
public function getResponsiveBreakpoints()
117-
{
118-
return array(1921=>'visible', 1920=>'widescreen', 1479=>'desktop', 1200=>'laptop', 992=>'notebook', 768=>'tablet', 576=>'landscape', 480=>'portrait', 361=>'mobile', 1=>'mobile');
119-
}
120-
121116
public function getSlideOptions()
122117
{
123118
return array('autoplay', 'arrows', 'autoplay-Speed', 'dots', 'infinite', 'padding', 'vertical', 'vertical-Swiping', 'responsive', 'rows', 'slides-To-Show');

view/frontend/templates/categories_widget.phtml

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,25 @@ $heading = $block->getHeading();
2121
$description = $block->isShowDescription();
2222
$itemAmount = $block->getItemAmount();
2323
if (empty($categories)) return;
24-
$selector = 'alo-content-'.uniqid();
24+
$selector = 'alo-content-' . uniqid();
2525
?>
2626
<?php $visible = (int) $this->getData('visible'); ?>
27-
<style type="text/css"><?php echo $this->getData('slide') ? '.' . $selector . ' .item{float:left; width:' . 100/$visible . '%} .'. $selector . ' .item:nth-child(n+' . ++$visible . '){display: none}' : '' ?></style>
28-
<?php if ($heading): ?>
27+
<style type="text/css">
28+
<?php echo $this->getData('slide') ? '.' . $selector . ' .item{float:left; width:' . 100 / $visible . '%} .' . $selector . ' .item:nth-child(n+' . ++$visible . '){display: none}' : '' ?>
29+
</style>
30+
<?php if ($heading) : ?>
2931
<h3 class="title"><?php echo $heading ?></h3>
3032
<p class="text"><span><?= __($this->getData('subtitle')); ?></span></p>
3133
<?php endif; ?>
3234
<div class="magepow-categories <?php echo $selector ?>" data-mage-init='{"gridSlider": {}}'>
33-
<ul class="grid-slider"
34-
<?php foreach ($this->getFrontendCfg() as $opt) :?>
35-
data-<?php echo $opt ?>='<?php echo $this->getData($opt) ?>'
36-
<?php endforeach;?>
37-
>
38-
<?php foreach ($categories as $cat): ?>
35+
<ul class="grid-slider" <?php foreach ($this->getFrontendCfg() as $opt) : ?> data-<?php echo $opt ?>='<?php echo $this->getData($opt) ?>' <?php endforeach; ?> <?php foreach ($this->getResponsiveBreakpoints() as $opt) : ?> data-<?php echo $opt ?>='<?php echo $this->getData($opt) ?>' <?php endforeach; ?>>
36+
<?php foreach ($categories as $cat) : ?>
3937
<?php $image = $this->getImageInfo($cat); ?>
4038
<li class="category-item item">
4139
<div class="category-item-info">
4240
<div class="category-image-container">
4341
<a class="category-url" href="<?php echo $cat->getUrl() ?>">
44-
<img loading="lazy" src="<?php echo $this->getImage($cat) ?>" width="<?php echo $image->getOriginalWidth() ?>" height="<?php echo $image->getOriginalHeight() ?>" alt="<?php echo $cat->getName() ?>"/>
42+
<img loading="lazy" src="<?php echo $this->getImage($cat) ?>" width="<?php echo $image->getOriginalWidth() ?>" height="<?php echo $image->getOriginalHeight() ?>" alt="<?php echo $cat->getName() ?>" />
4543
</a>
4644
</div>
4745
<div class="category-item-details">
@@ -50,27 +48,27 @@ $selector = 'alo-content-'.uniqid();
5048
<span class="category-name"><?php echo $cat->getName() ?></span>
5149
</a>
5250
</h3>
53-
54-
<?php if($description): ?>
51+
52+
<?php if ($description) : ?>
5553
<div class="category-description">
5654
<?php echo $this->getDescription($cat) ?>
5755
</div>
5856
<?php endif; ?>
59-
<?php if($itemAmount): ?>
57+
<?php if ($itemAmount) : ?>
6058
<div class="category-item-amount">
61-
<?php echo "(".$cat->getProductCollection()->count();
62-
if($cat->getProductCollection()->count()>0)echo " items)";
63-
else echo " item)";
64-
?>
59+
<?php echo "(" . $cat->getProductCollection()->count();
60+
if ($cat->getProductCollection()->count() > 0) echo " items)";
61+
else echo " item)";
62+
?>
6563
</div>
6664
<?php endif; ?>
6765
<div class="btn-link">
6866
<a class="magepow-categories-category" href="<?php echo $cat->getUrl() ?>"><?= $block->escapeHtml(__('Show now')) ?></a>
6967
</div>
70-
68+
7169
</div>
7270
</div>
7371
</li>
7472
<?php endforeach; ?>
7573
</ul>
76-
</div>
74+
</div>

0 commit comments

Comments
 (0)