View Single Post
  #1  
Old 04-08-2015, 03:58 AM
 
xgarb xgarb is offline
 

eXpert
  
Join Date: Jul 2004
Location: UK
Posts: 262
 

Default x5 New 'Short Description' Field in Categories - Solution and Question...

Using the example here as a guide: http://kb.x-cart.com/display/XDD/Adding+new+property+to+a+product

I've added a new field to the category admin screen to add short descriptions.

My code looks like this:

In XLite/Module/Client/ClientCatsShortDescriptions/Model/CategoryTranslation.php

Code:
namespace XLite\Module\Client\ClientCatsShortDescriptions\Model; class CategoryTranslation extends \XLite\Model\CategoryTranslation implements \XLite\Base\IDecorator { /** * @Column (type="string", length=255) */ protected $shortDescr; }

In XLite/Module/Client/ClientCatsShortDescriptions/View/Model/Category.php

Code:
namespace XLite\Module\Client\ClientCatsShortDescriptions\View\Model; class Category extends \XLite\View\Model\Category implements \XLite\Base\IDecorator { public function __construct(array $params = array(), array $sections = array()) { parent::__construct($params, $sections); $this->schemaDefault += array ( 'shortDescr' => array( self::SCHEMA_CLASS => 'XLite\View\FormField\Textarea\Advanced', self::SCHEMA_LABEL => 'Short Description', self::SCHEMA_REQUIRED => false, ), ); } }

in my template listing the categories (cut down for clarity)...
Code:
{foreach:getSubcategories(),subcategory} {subcategory.name}<br> {subcategory.shortdescr:h} {end:}

So this works very nicely except in admin the form field for entering the short descriptions is at the bottom of the page.

How can I move it to be above the normal description box?

I tried
Code:
ALTER TABLE `xc_category_translations` MODIFY `shortDescr` VARCHAR(255) AFTER `name`
in the database but it doesn't have any effect.

I guess it's something to do with the module being called last on the page?
__________________
Core version: 5.3.xx
PHP: 5.6
MySQL: 5.5.50-cll
Web server: Apache
Reply With Quote