q-skins.dk Posted October 11, 2013 Share Posted October 11, 2013 Hi all. I am trying to improve my online shop. What i want to do is to add an extra textfield like the one you have at the top on category and subcategory pages. I would like to add some at the bottom of the category and subcategory page. Does anybody know how to do that or which html file to place the code for the text box? Thanks in advance. Link to comment Share on other sites More sharing options...
vekia Posted October 11, 2013 Share Posted October 11, 2013 the question is: the text that you want to add will be the same for each category? Link to comment Share on other sites More sharing options...
q-skins.dk Posted October 11, 2013 Author Share Posted October 11, 2013 No I would like to add different text to each textbox. I was thinking is it not possible to make the box then put some text from the BO as I can do with the box which i already at the top of category page? Link to comment Share on other sites More sharing options...
vekia Posted October 11, 2013 Share Posted October 11, 2013 in this case you have to extend category object. 1) create new field in ps_category_lang table, use name "second_desc" 2) edit Category.php class (classes/Category.php) in object definition add 'second_desc' field: public static $definition = array( 'table' => 'category', 'primary' => 'id_category', 'multilang' => true, 'multilang_shop' => true, 'fields' => array( 'nleft' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'), 'nright' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'), 'level_depth' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'), 'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true), 'id_parent' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'), 'id_shop_default' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'is_root_category' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'), 'position' => array('type' => self::TYPE_INT), 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'), // Lang fields 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCatalogName', 'required' => true, 'size' => 64), 'link_rewrite' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isLinkRewrite', 'required' => true, 'size' => 64), 'description' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'), 'second_desc' => 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', 'size' => 255), ), ); and add new field in __construct function: ... /** @var boolean Status for display */ public $active = 1; /** @var integer category position */ public $position; /** @var string Description */ public $description; public $second_desc; /** @var integer Parent category ID */ public $id_parent; /** @var integer default Category id */ public $id_category_default; ... 3) add field to field list definition in AdminCategoriesController (controllers/admin/AdminCategoriesController) array( 'type' => 'textarea', 'label' => $this->l('Description:'), 'name' => 'description', 'autoload_rte' => true, 'lang' => true, 'rows' => 10, 'cols' => 100, 'hint' => $this->l('Invalid characters:').' <>;=#{}' ), array( 'type' => 'textarea', 'label' => $this->l('Second Description:'), 'name' => 'second_desc', 'autoload_rte' => true, 'lang' => true, 'rows' => 10, 'cols' => 100, 'hint' => $this->l('Invalid characters:').' <>;=#{}' ), array( 'type' => 'file', 'label' => $this->l('Image:'), 'name' => 'image', 'display_image' => true, 'desc' => $this->l('Upload a category logo from your computer.') ), effect: category edit page with new field: then just use {$second_desc} variable in category.tpl file 1 Link to comment Share on other sites More sharing options...
q-skins.dk Posted October 21, 2013 Author Share Posted October 21, 2013 Awesome Veika. Thank you so much, I will try figure it out and see if I can get it work. Link to comment Share on other sites More sharing options...
q-skins.dk Posted October 21, 2013 Author Share Posted October 21, 2013 Hi again Vekia. Do you know how to do this in PS1.4.8.2. I can't find the file AdminCategoriesController.php because I don't have a controller/admin folder? Link to comment Share on other sites More sharing options...
vekia Posted October 21, 2013 Share Posted October 21, 2013 you have to do this in /ADMIN_DIR/tabs/AdminCategories.php Link to comment Share on other sites More sharing options...
camereroloco Posted May 5, 2014 Share Posted May 5, 2014 doesnt work for presta 1.6 Someone know the way to add an extra field to a single category ? Link to comment Share on other sites More sharing options...
camereroloco Posted May 6, 2014 Share Posted May 6, 2014 Some admin delete my post !? I understand why this forum is so "poor" lol dont delete usefull reply ! How to do an override. . . there is a good trick in this tuto ! (Prestashop's doc should learn about it ?) http://nemops.com/extending-prestashop-objects/ (there is no ads...) 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