Jump to content

Creating NEW Description Box


clampdown

Recommended Posts

Hello,

I'm looking at creating a new description box in the manufacturer page below the products.... please see attached image.


I know I will have to change the manufacturer.tpl theme page and add the following

div class="description_box clearfix rte">
					{$manufacturer->description-new}
				</div>

I would also have to change the AdminManufacturerController.php in controllers/admin/ and add the following

array(
					'type' => 'textarea',
					'label' => $this->l('description-new'),
					'name' => 'description-new',
					'lang' => true,
					'cols' => 60,
					'rows' => 10,
					'col' => 6,
					'autoload_rte' => 'rte', //Enable TinyMCE editor for description
					'hint' => $this->l('Invalid characters:').' <>;=#{}'
$this->fields_value['description_'.$language['id_lang']] = htmlentities(stripslashes($this->getFieldValue(
				$manufacturer,
				'description-new',
				$language['id_lang']
			)), ENT_COMPAT, 'UTF-8');
		}

and add a new row called "description-new" in the ps_manufacturer_lang database table.

 

 

Is their anything else I would need to change to make this work?

Thank you

post-889557-0-36550300-1461659327_thumb.jpg

Edited by clampdown (see edit history)
Link to comment
Share on other sites

have you added new "field" to manufacturer class?

there is a static variable $definition

    public static $definition = array(
        'table' => 'manufacturer',
        'primary' => 'id_manufacturer',
        'multilang' => true,
        'fields' => array(
            'name' =>                array('type' => self::TYPE_STRING, 'validate' => 'isCatalogName', 'required' => true, 'size' => 64),
            'active' =>            array('type' => self::TYPE_BOOL),
            'date_add' =>            array('type' => self::TYPE_DATE),
            'date_upd' =>            array('type' => self::TYPE_DATE),

            /* Lang fields */
            'description' =>        array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),
            'short_description' =>    array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),
            'meta_title' =>        array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
            'meta_description' =>    array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
            'meta_keywords' =>        array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName'),
        ),
    );

it is necessary to add there field that will store your new description

 

 

 

attention!

instead "-" in the name of field use "_"

 

description-new bad

description_new good

Link to comment
Share on other sites

 

 

however the text box is not appearing in the back office > manufacturer  :( At the moment to make the text appear.... i'm having to edit the field in MySql

let's clarify

this means that you cant save it from edit page? instead of this, you have to edit in directly in db ?

Link to comment
Share on other sites

Yes
 

/** @var string A extra description */
	public $description_new; 

and in the LANG Fields as well...

public static $definition = array(
		'table' => 'manufacturer',
		'primary' => 'id_manufacturer',
		'multilang' => true,
		'fields' => array(
			'name' => 				array('type' => self::TYPE_STRING, 'validate' => 'isCatalogName', 'required' => true, 'size' => 64),
			'active' => 			array('type' => self::TYPE_BOOL),
			'date_add' => 			array('type' => self::TYPE_DATE),
			'date_upd' => 			array('type' => self::TYPE_DATE),

			// Lang fields
			'description' => 		array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),
			'short_description' => 	array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),
			'description_new' => 	array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'),
			'meta_title' => 		array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
			'meta_description' => 	array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
			'meta_keywords' => 		array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName'),
		),
	);
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...