Skip to content

Commit

Permalink
feat: Show brand description on brand page
Browse files Browse the repository at this point in the history
  • Loading branch information
jtomaszewski committed Mar 14, 2021
1 parent e79dc71 commit 60b0b52
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Block/View.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace MageSuite\BrandManagement\Block;

class View extends \Magento\Framework\View\Element\Template
{
/**
* @var \Magento\Framework\Registry
*/
protected $registry;

public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Framework\Registry $registry,
array $data = []
) {
$this->registry = $registry;
parent::__construct($context, $data);
}

/**
* @return \MageSuite\BrandManagement\Model\Brands
*/
public function getBrand()
{
return $this->registry->registry('current_brand');
}
}
2 changes: 2 additions & 0 deletions view/frontend/layout/brands_index_index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<referenceContainer name="div.sidebar.main" htmlClass="sidebar sidebar-main cs-page-category__sidebar"/>

<referenceContainer name="content">
<block class="MageSuite\BrandManagement\Block\View" name="brand.description" template="MageSuite_BrandManagement::brand/description.phtml"/>

<block class="MageSuite\BrandManagement\Block\Result" name="search.result" template="Magento_CatalogSearch::result.phtml">
<block class="Magento\CatalogSearch\Block\SearchResult\ListProduct" name="search_result_list" template="product/list.phtml">
<arguments>
Expand Down
12 changes: 12 additions & 0 deletions view/frontend/templates/brand/description.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
// @codingStandardsIgnoreFile
/**
* @var $block \Magesuite\BrandManagement\Block\View
*/
?>
<?php $brand = $block->getBrand() ?>
<?php if ($description = $brand->getFullDescription()): ?>
<div class="cs-cms-block | cs-page-category__description">
<?php /* @escapeNotVerified */ echo $this->helper('Magento\Catalog\Helper\Output')->categoryAttribute($brand, $description, 'description') ?>
</div>
<?php endif; ?>

0 comments on commit 60b0b52

Please sign in to comment.