View Single Post
  #1  
Old 04-07-2016, 01:17 PM
 
AlexB AlexB is offline
 

Newbie
  
Join Date: Apr 2016
Posts: 3
 

Default Adding a field to the banner slide

I'm trying to add live text to the banner slide. I have followed the tutorial here:

http://kb.x-cart.com/display/XDD/Adding+new+property+to+a+product

I've added two fields to the model:

PHP Code:
<?php
// vim: set ts=4 sw=4 sts=4 et:
namespace XLite\Module\My\Module\Model;

class 
BannerRotationSlide extends \XLite\Model\BannerRotationSlide implements \XLite\Base\IDecorator
{
    
/**
     * @Column (type="string", length=1024)
     */
    
protected $title;

    
/**
     * @Column (type="string", length=1024)
     */
    
protected $subtitle;
}

So far, I created the new model, and it's updated the database correctly when I redeploy the store.

But I can't seem to get the new fields to show up in the admin area. This is my view file:

//BannerRotationSlide.php
PHP Code:
<?php
// vim: set ts=4 sw=4 sts=4 et:


namespace XLite\Module\My\Module\View\Model;


class 
BannerRotationSlide extends \XLite\View\Model\BannerRotationSlide implements \XLite\Base\IDecorator
{
    public function 
__construct(array $params = array(), array $sections = array())
    {
        
parent::__construct($params$sections);

        
$this->schemaDefault += array (
            
'title' => array(
                
self::SCHEMA_CLASS    => 'XLite\View\FormField\Input\Text',
                
self::SCHEMA_LABEL    => 'Title',
                
self::SCHEMA_REQUIRED => false,
            ),
            
'subtitle' => array(
                
self::SCHEMA_CLASS    => 'XLite\View\FormField\Input\Text',
                
self::SCHEMA_LABEL    => 'Subtitle',
                
self::SCHEMA_REQUIRED => false,
            ),
        );
    }
}

So, first question is am I editing the correct file, BannerRotationSlide.php? If so, what am I doing wrong here?
__________________
5.2
Reply With Quote