Skip to content

Commit

Permalink
removed lookup (also put template reference back)
Browse files Browse the repository at this point in the history
  • Loading branch information
lingwooc committed Jan 7, 2017
1 parent e7a7d14 commit 0996908
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Block/Widget/CategoryWidget.php
Expand Up @@ -3,6 +3,8 @@

class CategoryWidget extends \Magento\Framework\View\Element\Template implements \Magento\Widget\Block\BlockInterface
{
protected $_template = 'widget/categorywidget.phtml';

const DEFAULT_IMAGE_WIDTH = 250;
const DEFAULT_IMAGE_HEIGHT = 250;

Expand Down
11 changes: 4 additions & 7 deletions view/frontend/templates/widget/categorywidget.phtml
Expand Up @@ -9,16 +9,13 @@
</div>
<?php endif ?>
<div class="block-content catalog-category">
<?php
foreach($categories as $category):
$cat = $this->getCategoryModel($category->getId());
?>
<?php foreach($categories as $category):?>
<span class="category">
<a href="<?php echo $block->escapeUrl($cat->getUrl()) ?>">
<?php if($canShowImg && $cat->getImageUrl()):?>
<a href="<?php echo $block->escapeUrl($category->getUrl()) ?>">
<?php if($canShowImg && $category->getImageUrl()):?>
<img src="<?php echo $block->escapeUrl($cat->getImageUrl()) ?>" alt="" width="<?=$this->getImageWidth();?>" height="<?=$this->getImageHeight()?>"/>
<?php else:?>
<span class="cat-title"><?php echo $block->escapeHtml($cat->getName()) ?></span>
<span class="cat-title"><?php echo $block->escapeHtml($category->getName()) ?></span>
<?php endif;?>
</a>
</span>
Expand Down

0 comments on commit 0996908

Please sign in to comment.