Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

re: default/en/category_description.tpl

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #11  
Old 01-14-2016, 04:26 AM
  seyfin's Avatar 
seyfin seyfin is offline
 

X-Cart team
  
Join Date: May 2004
Posts: 1,223
 

Default Re: default/en/category_description.tpl

Quote:
Originally Posted by Scott Godin
Yes, I have noted that distinction, when looking for Smarty functionality that doesn't exist in Flexy and figured it out from there.

with that being the case, I would highly recommend updating the documentation that I referenced from the knowledgebase to reflect this, as well as deprecating the module if you are phasing it out, so that it no longer runs on current Xcart, and shows up in the module list as not-compatible.

I would like to point out that I was only following the instructions in your own documentation

We are working on the manual update at the moment, hope this article will be also revised soon.
__________________
Sincerely yours,
Sergey Fomin
X-Cart team
Chief support group engineer

===

Check this out. Totally revamped X-Cart hosting
http://www.x-cart.com/hosting.html

Follow us:
https://twitter.com/x_cart / https://www.facebook.com/xcart / https://www.instagram.com/xcart
Reply With Quote
  #12  
Old 01-14-2016, 08:40 AM
  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

That's fine. what about the rest ?
__________________
--
Scott Godin
Reply With Quote
  #13  
Old 01-14-2016, 10:01 AM
  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 [SOLVED] Re: default/en/category_description.tpl

so after much hair pulling and despite the lack of detailed information in the online documentation, I have managed to flail my way to a workable solution while at the same time learning the proper way to do this.

In addition, I would like to point out that I would NOT have figured this out using only webmaster mode... Webmaster Kit module was *invaluable*, ultimately, in figuring out just what was needed, by virtue of the trace image here: http://i67.tinypic.com/be9geo.jpg and the information here http://kb.x-cart.com/display/XDD/Step+2+-+applying+design+changes

The docs don't go into a great deal of detail on what you need to do (athough the first step is mentioned, which lent me a clue) when you need to override something that isn't a member of @ListChild -- in this case, what I needed to add to classes/XLite/Module/MHG/TemplateMods/Main.php was

Code:
public static function runBuildCacheHandler() { parent::runBuildCacheHandler(); // Override Category view with our own, to prevent display of desc where desc = title \XLite\Core\Layout::getInstance()->removeClassFromList('Xlite\View\Category', 'center.bottom'); }

because since it's not a member of @ListChild, this won't work:

Code:
\XLite\Core\Layout::getInstance()->removeTemplateFromList('category_description.tpl', 'center.bottom');

THEN, the other part that's not mentioned clearly in the docs, or earlier in this thread, is that after having done the above, when setting up your view widget, you need to add its template back since it will not do that automatically, specifying the location in your own module's skins/default/en/modules/{Module-ID}/{Module-Name}/, after making sure to get the Namespace right, and noticing we didn't need a Decorator :

Code:
<?php // vim: set ts=4 sw=4 sts=4 et ft=php.html: namespace XLite\Module\MHG\TemplateMods\View; /** * Category widget * * @ListChild (list="center", zone="customer") */ class Category extends \XLite\View\AView { // choose our template over theirs for this viewclass protected function getDefaultTemplate() { return 'modules/MHG/TemplateMods/category_description.tpl'; } /** * Check widget visibility * * @return boolean */ protected function isVisible() { // because page title isn't part of getCategory(), it's part of the prime object if ( parent::isTitleVisible() && ($this->getPageTitle() == $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(); } }

The part that also threw me until I used App::Ack to search through the classes for it, was that the Category Title is not part of getCategory() but is instead part of the prime object. so
$this->getCategory()->get[Page|Main]Title() etc variations are not going to work.

I leave this here as an example in the hopes of saving someone else time and money.
__________________
--
Scott Godin
Reply With Quote
  #14  
Old 01-15-2016, 08:55 AM
  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

Whoopsy, left a bit of code out of my above solution that caused Simple CMS pages to fail :

Code:
class Category extends \XLite\View\AView { // add this in public static function getAllowedTargets() { $result = parent::getAllowedTargets(); $result[] = 'category'; $result[] = 'main'; return $result; }
__________________
--
Scott Godin
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 02:42 AM.

   

 
X-Cart forums © 2001-2020