SplashSalons Posted December 12, 2014 Share Posted December 12, 2014 I'm trying to make a way that i can update a table in my database by the backoffice: <?php class PackGroup extends ObjectModel { public $id_product; public $group_name = 0; public $group_name2 = 0; public $group_name3 = 0; /** * @see ObjectModel::$definition */ public static $definition = array( 'table' => 'pack_group', 'primary' => 'id_product', 'fields' => array( 'group_name' => array('type' => self::TYPE_STRING), 'group_name2' => array('type' => self::TYPE_STRING), 'group_name3' => array('type' => self::TYPE_STRING), ) ); } ?> and <?php include(__DIR__ . '/../../models/PackGroup.php'); class AdminPackGroupController extends ModuleAdminController { private $id_product = null; public function __construct() { $this->required_database = true; //$this->lang = true; $this->table = 'pack_group'; $this->className = 'PackGroup'; $this->id_product = Tools::getValue('id_product', null); $this->context = Context::getContext(); parent::__construct(); } public function initProcess() { $Product = new Product($this->id_product); return; parent::initProcess(); } public function initToolbar() { $this->toolbar_btn['back'] = array( 'href' => $this->context->link->getAdminLink('AdminProducts') . '&id_product=' . (int) $this->id_product . '&addproduct&key_tab=ModuleRpmoreproductscontentmoduleexpand', 'desc' => $this->l('Back') ); } public function initContent() { /* show errors and thats it - do not show content */ if (!empty($this->errors)) { return; } $this->initToolbar(); $this->context->smarty->assign(array( 'content' => $this->renderForm() )); } public function renderForm() { /* nepavyko uzkrauti objecto */ if (!($obj = $this->loadObject(true))) { return; } // $this->addJS(_MODULE_DIR_.'rpmoreproductscontentmoduleexpand/views/js/packcontentautocompletesearch.js'); $this->addCSS(_MODULE_DIR_.'rpmoreproductscontentmoduleexpand/views/css/packcontentautocompletesearch.css'); $this->fields_form = array( 'legend' => array( 'title' => $this->l('Pack Content') ), 'input' => array( array( 'type' => 'text', 'label' => $this->l('Group name'), 'name' => 'group_name' ), array( 'type' => 'text', 'label' => $this->l('Group 2 name'), 'name' => 'group_name2' ), array( 'type' => 'text', 'label' => $this->l('Group 3 name'), 'name' => 'group_name3' ), array( 'type' => 'hidden', 'name' => 'id_product' ) ), 'submit' => array( 'title' => $this->l('Save'), 'class' => 'button' ) ); return parent::renderForm(); } } ?> Did I missed something? Thanks 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