View Single Post
  #10  
Old 01-13-2016, 12:53 PM
  Scott Godin's Avatar 
Scott Godin Scott Godin is offline
 

Advanced Member
  
Join Date: Aug 2014
Location: /diagonally parked in a parallel universe/
Posts: 68
 

Default Re: default/en/category_description.tpl

so far every attempt I've made to replace Xlite/View/Category.php with my module's Xlite/Module/MHG/TemplateMods/View/Category.php either breaks the store forcing me to do a soft reset, or simply fails to do anything.

Not sure what I'm doing wrong. Does the documentation need updating?

I've updated the template file to use this, via theme_tweaker (though I would much rather have this edited template file as part of my module, since I'm using my module to override it!)
Code:
<div IF="isVisible()" class="category-description">{getDescription():h}</div>

and then added the following to my module (a stripped down and edited copy of Xlite\View\Category.php )

Code:
<?php // vim: set ts=4 sw=4 sts=4 et: /** * X-Cart * * NOTICE OF LICENSE * * This source file is subject to the software license agreement * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://www.x-cart.com/license-agreement.html * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to licensing@x-cart.com so we can send you a copy immediately. * * DISCLAIMER * * Do not modify this file if you wish to upgrade X-Cart to newer versions * in the future. If you wish to customize X-Cart for your needs please * refer to http://www.x-cart.com/ for more information. * * @category X-Cart 5 * @author Qualiteam software Ltd <info@x-cart.com> * @copyright Copyright (c) 2011-2015 Qualiteam software Ltd <info@x-cart.com>. All rights reserved * @license http://www.x-cart.com/license-agreement.html X-Cart 5 License Agreement * @link http://www.x-cart.com/ */ namespace XLite\Module\MHG\TemplateMods\View; /** * Category widget * * @ListChild (list="center", zone="customer") */ class Category extends \XLite\View\AView { /** * Check widget visibility * * @return boolean */ protected function isVisible() { if ( parent::isTitleVisible() && ($this->getCategory()->getMainTitle() == $this->getCategory()->getViewDescription() ) ) { return false; } else { return parent::isVisible() && $this->getCategory()->getDescription(); } } /** * Return description with postprocessing WEB LC root constant * * @return string */ protected function getDescription() { return $this->getCategory()->getViewDescription(); } }

I have also tried doing it with
Code:
class Category extends \XLite\View\AView implements \XLite\Base\IDecorator
__________________
--
Scott Godin
Reply With Quote