smarta Posted August 29, 2013 Share Posted August 29, 2013 Hi there, I can NOT override renderForm() for adding new input. Note : PS 1,531 Help plz. Thank you. Link to comment Share on other sites More sharing options...
mfedorets Posted September 4, 2013 Share Posted September 4, 2013 Hi, How have you made the override? Please show the code of child class. Link to comment Share on other sites More sharing options...
rastabimbo Posted December 16, 2013 Share Posted December 16, 2013 Hi!I've the same problem. I've understood the reason, but i can't find a solution: I putted this file in /override/controllers/admin/adminCmsController.php to override the controller. class AdminCmsController extends AdminCmsControllerCore{ public function renderForm() { if (!$this->loadObject(true)) return; if (Validate::isLoadedObject($this->object)) $this->display = 'edit'; else $this->display = 'add'; $this->toolbar_btn['save-and-preview'] = array( 'href' => '#', 'desc' => $this->l('Save and preview') ); $this->toolbar_btn['save-and-stay'] = array( 'short' => 'SaveAndStay', 'href' => '#', 'desc' => $this->l('Save and stay'), ); $this->initToolbar(); $categories = CMSCategory::getCategories($this->context->language->id, false); $html_categories = CMSCategory::recurseCMSCategory($categories, $categories[0][1], 1, $this->getFieldValue($this->object, 'id_cms_category'), 1); $this->fields_form = array( 'tinymce' => true, 'legend' => array( 'title' => $this->l('CMS Page'), 'image' => '../img/admin/tab-categories.gif' ), 'input' => array( // custom template array( 'type' => 'select_category', 'label' => $this->l('CMS Category'), 'name' => 'id_cms_category', 'options' => array( 'html' => $html_categories, ), ), array( 'type' => 'text', 'label' => $this->l('Meta title:'), 'name' => 'meta_title', 'id' => 'name', // for copyMeta2friendlyURL compatibility 'lang' => true, 'required' => true, 'class' => 'copyMeta2friendlyURL', 'hint' => $this->l('Invalid characters:').' <>;=#{}', 'size' => 50 ), array( 'type' => 'text', 'label' => $this->l('Meta description'), 'name' => 'meta_description', 'lang' => true, 'hint' => $this->l('Invalid characters:').' <>;=#{}', 'size' => 70 ), array( 'type' => 'text', 'label' => $this->l('Meta keywords'), 'name' => 'meta_keywords', 'lang' => true, 'hint' => $this->l('Invalid characters:').' <>;=#{}', 'size' => 70 ), array( 'type' => 'tags', 'label' => $this->l('Tags'), 'name' => 'tags', 'lang' => true, 'hint' => $this->l('Invalid characters:').' <>;=#{}', 'size' => 70, 'desc' => $this->l('To add "tags" click in the field, write something, and then press "Enter."') ), array( 'type' => 'text', 'label' => $this->l('Friendly URL'), 'name' => 'link_rewrite', 'required' => true, 'lang' => true, 'hint' => $this->l('Only letters and the minus (-) character are allowed') ), array( 'type' => 'textarea', 'label' => $this->l('Page content'), 'name' => 'content', 'autoload_rte' => true, 'lang' => true, 'rows' => 5, 'cols' => 40, 'hint' => $this->l('Invalid characters:').' <>;=#{}' ), array( 'type' => 'radio', 'label' => $this->l('Indexation (by search engines):'), 'name' => 'indexation', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array( array( 'id' => 'indexation_on', 'value' => 1, 'label' => $this->l('Enabled') ), array( 'id' => 'indexation_off', 'value' => 0, 'label' => $this->l('Disabled') ) ), ), array( 'type' => 'radio', 'label' => $this->l('Displayed:'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array( array( 'id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled') ), array( 'id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled') ) ), ), ), 'submit' => array( 'title' => $this->l('Save'), 'class' => 'button' ) ); if (Shop::isFeatureActive()) { $this->fields_form['input'][] = array( 'type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso', ); } $this->tpl_form_vars = array( 'active' => $this->object->active, 'PS_ALLOW_ACCENTED_CHARS_URL', (int)Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL') ); return parent::renderForm(); } } The problem is that in the end of method I would need to call the renderForm() of AdminControllerCore... But obviously i can't call parent::parent::renderForm(); So simply calling parent::renderForm() overrides my form with the model i wanted to override. I can't understand if i'm overriding it in the wrong way or if i'm missing somenthing in the procedure. Thanks a lot! Link to comment Share on other sites More sharing options...
rastabimbo Posted December 19, 2013 Share Posted December 19, 2013 anyone?!?!?!? Link to comment Share on other sites More sharing options...
NearEarthObject Posted January 5, 2014 Share Posted January 5, 2014 Replace : return parent::renderForm(); by return AdminController::renderForm(); It's going to work perfectly ! 2 1 Link to comment Share on other sites More sharing options...
Recommended Posts