function edit() { JLoader::import('com_tienda.library.button', JPATH_ADMINISTRATOR . '/components'); TiendaToolBarHelper::custom('save', 'save', 'save', 'COM_TIENDA_SAVE', false, 'shippingTask'); TiendaToolBarHelper::custom('cancel', 'cancel', 'cancel', 'COM_TIENDA_CLOSE', false, 'shippingTask'); $id = JRequest::getInt('id', '0'); $sid = TiendaShippingPlugin::getShippingId(); $this->includeCustomModel('UnexServices'); $this->includeCustomTables(); $model = JModel::getInstance('UnexServices', 'TiendaModel'); if ($sid) { $model->setId((int) $sid); $item = $model->getItem(); } else { $item = new JObject(); } // Form $form = array(); $form['action'] = $this->baseLink(); $form['shippingTask'] = 'save'; $view = $this->getView('shipping_unex', 'html'); $view->hidemenu = true; $view->hidestats = true; $view->setModel($model, true); $view->assign('item', $item); $view->assign('form2', $form); $view->setLayout('edit'); $view->display(); }
function view($cachable = false, $urlparams = false) { JLoader::import('com_tienda.library.button', JPATH_ADMINISTRATOR . '/components'); TiendaToolBarHelper::_custom('save', 'save', 'save', 'COM_TIENDA_SAVE', false, 'shippingTask'); TiendaToolBarHelper::_custom('cancel', 'cancel', 'cancel', 'COM_TIENDA_CLOSE', false, 'shippingTask'); $id = JRequest::getInt('id', '0'); $sid = TiendaShippingPlugin::getShippingId(); $this->includeCustomModel('ShippingMethods'); $model = JModel::getInstance('ShippingMethods', 'TiendaModel'); $model->setId((int) $sid); $item = $model->getItem(); // Form $form = array(); $form['action'] = $this->baseLink(); $form['shippingTask'] = 'save'; //We are calling a view from the ShippingMethods we isn't actually the same controller this has, however since all it does is extend the base view it is // all good, and we don't need to remake getView() $view = $this->getView('ShippingMethods', 'html'); $view->hidemenu = true; $view->hidestats = true; $view->setTask(true); $view->setModel($model, true); $view->assign('item', $item); $view->assign('form2', $form); $view->setLayout('view'); $view->display(); }