Jump to content

Add a new column/attribute to a class ( category.php )


rassy

Recommended Posts

Hi guys,

 

 

 

I would like the extend the Category and Product classes by a new field. Let's say for example: I want to be able to a special "display-color" to each category within the admin-interface.

 

I am sure that I will have to touch the Category class. BUT is there a trick to keep it simple?

 

I would be really really thankful for some guidance!

 

Kind regards

Rassy

Link to comment
Share on other sites

  • 6 months later...

hi guys,

 

the solution for add new field in table category or more exactyle in table category_lang

 

1)- add new attribute in class category.php

 

2)

a- in the same class add newField to (protected $fieldsRequired if that field is obligatoire)

c- "" "" "" protected $fieldsRequiredLang

d- "" "" "" protected $fieldsSizeLang

e- "" "" "" protected $fieldsValidateLang

f- "" "" "" function getTranslationsFieldsChild

g- "" "" "" function getSubCategories

h- "" "" "" function getTranslationsFieldsChild

 

3) in admin/tabs /AdminCategories.php

 

 

<label>'.$this->l('newField').' </label>

<div class="margin-form translatable">';

foreach ($this->_languages AS $language)

echo '

<div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">

<input type="text" name="newField_'.$language['id_lang'].'" id="newField_'.$language['id_lang'].'" value="'.htmlentities($this->getFieldValue($obj, 'newField', (int)($language['id_lang'])), ENT_COMPAT, 'UTF-8').'" />

<span class="hint" name="help_box">'.$this->l('Forbidden characters:').' <>;=#{}<span class="hint-pointer"> </span></span>

</div>';

echo ' <p class="clear"></p>

</div>

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