Jump to content

Problem z custom field w kategorii


herwaldi

Recommended Posts

Mam problem z dodaniem custom field w kategorii - Prestashop 1.7.6

 

Robię override dla override/classes/Category.php

<?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

<?php
 
class AdminCategoriesController extends AdminCategoriesControllerCore
{
     
    public function renderForm()
    {
        $this->fields_form_override = array(
            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?

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...