Jump to content

Problem z custom field w kategorii

Recommended Posts

Mam problem z dodaniem custom field w kategorii - Prestashop 1.7.6


Robię override dla override/classes/Category.php

class Category extends CategoryCore {

	public $headingh1;

	public function __construct($idCategory = null, $idLang = null, $idShop = null)
	    $definition = self::$definition;

	    $definition['fields']['headingh1'] = array(
	        'type' => self::TYPE_HTML,
	        'lang' => true,
	        'validate' => 'isCleanHtml'
	    parent::__construct($idCategory, $idLang, $idShop);



Następnie override dla override/controllers/admin/AdminCategoriesController.php

class AdminCategoriesController extends AdminCategoriesControllerCore
    public function renderForm()
        $this->fields_form_override = array(
                'type' => 'textarea',
                'label' => $this->trans('Nagłówek H1', array(), 'Admin.Global'),
                'name' => 'headingh1',
                'autoload_rte' => true,
                'lang' => true,
                'hint' => $this->trans('Invalid characters:', array(), 'Admin.Notifications.Info').' <>;=#{}'
        return parent::renderForm();

W bazie dla tabeli ps_category_lang dodałem 

ALTER TABLE ps_category_lang ADD headingh1 varchar(255);

Wyczyściłem cache i pola nie widać w kategoriach..

Jakieś porady?

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More