clampdown Posted April 26, 2016 Share Posted April 26, 2016 (edited) 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 Edited April 26, 2016 by clampdown (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted April 26, 2016 Share Posted April 26, 2016 what kind of issue you've got? you can't save it on manufacturer edit page? or you cant display it on front office or maybe both? :-) Link to comment Share on other sites More sharing options...
clampdown Posted April 26, 2016 Author Share Posted April 26, 2016 I can save short description and long description but I want to add a new description box - so I have 3 in total Link to comment Share on other sites More sharing options...
vekia Posted April 26, 2016 Share Posted April 26, 2016 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 More sharing options...
clampdown Posted April 26, 2016 Author Share Posted April 26, 2016 OK thank you I will have a go and see how I get on.I will also change description-new to description_new - thanks Link to comment Share on other sites More sharing options...
clampdown Posted April 26, 2016 Author Share Posted April 26, 2016 OK.... I've got the text box appearing on the front end - 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 Link to comment Share on other sites More sharing options...
clampdown Posted April 29, 2016 Author Share Posted April 29, 2016 Still can't get the text box to appear in the BO - any ideas from anybody ? Link to comment Share on other sites More sharing options...
vekia Posted May 2, 2016 Share Posted May 2, 2016 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 More sharing options...
clampdown Posted May 3, 2016 Author Share Posted May 3, 2016 let's clarify this means that you cant save it from edit page? instead of this, you have to edit in directly in db ? Yes - there is no new text box in the edit page Link to comment Share on other sites More sharing options...
vekia Posted May 3, 2016 Share Posted May 3, 2016 you added also public $description_new at the top of the manufacturer object definition ? (classes/manufacturer.php) Link to comment Share on other sites More sharing options...
clampdown Posted May 3, 2016 Author Share Posted May 3, 2016 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now