Example #1
0
 public function renderForm()
 {
     if (!Module::isInstalled('agilemultipleseller')) {
         return parent::renderForm();
     }
     if (strtolower(Tools::getValue('controller')) == 'adminimport') {
         $dir = _PS_ADMIN_DIR_ . '/import/';
         if ($this->is_seller) {
             $dir .= $this->context->cookie->id_employee . '/';
         }
         if (!file_exists($dir)) {
             mkdir($dir);
         }
         $files_to_import = scandir($dir);
         uasort($files_to_import, array('AdminImportController', 'usortFiles'));
         foreach ($files_to_import as $k => &$filename) {
             if (preg_match('/^\\..*|index\\.php/i', $filename)) {
                 unset($files_to_import[$k]);
             } else {
                 if (is_dir($dir . $filename)) {
                     unset($files_to_import[$k]);
                 }
             }
         }
         unset($filename);
         $this->tpl_form_vars["files_to_import"] = $files_to_import;
         $this->tpl_form_vars["path_import"] = $dir;
     }
     if ($this->table == 'shop' and !$this->object->id) {
         $this->tpl_form_vars['form_import'] = null;
     }
     $eaccess = AgileSellerManager::get_entity_access($this->table);
     if ($eaccess['owner_table_type'] != AgileSellerManager::OWNER_TABLE_UNKNOWN and is_array($this->fields_form) and isset($this->fields_form['input']) and $this->table != 'sellerinfo') {
         $this->fields_value['id_seller'] = AgileSellerManager::getObjectOwnerID($this->table, intval(Tools::getValue('id_' . $this->table)));
         if (empty($eaccess['owner_xr_table'])) {
             if ($this->is_seller) {
                 array_unshift($this->fields_form['input'], array('type' => 'hidden', 'label' => $this->l('Seller:'), 'name' => 'id_seller', 'required' => false));
             } else {
                 array_unshift($this->fields_form['input'], array('type' => 'select', 'label' => $this->l('Seller:'), 'name' => 'id_seller', 'required' => false, 'default_value' => $this->fields_value['id_seller'], 'options' => array('query' => AgileSellerManager::getSellersNV(true, $this->l('Store Shared')), 'id' => 'id_seller', 'name' => 'name'), 'hint' => $this->l('If this is private seller data, please choose the seller. Otherwise please choose Store Shared')));
             }
         }
     }
     return parent::renderForm();
 }
 public function renderForm()
 {
     if (!($obj = $this->loadObject(true))) {
         return;
     }
     //define the field to display with the form helper
     $this->fields_form = array('tinymce' => true, 'legend' => array('title' => $this->l('GestiĆ³n de Whitelist')), 'input' => array(array('type' => 'text', 'label' => $this->l("ID Producto"), 'name' => 'id_product', 'size' => 40, 'required' => true, 'hint' => $this->l('El valor de la columna Id del listado de productos.')), array('type' => 'text', 'label' => $this->l("Precio") . " :", 'name' => 'price', 'size' => 40, 'required' => true, 'hint' => $this->l('El precio para intercambio ej: 10000.00 (decimales con ".").'))));
     //add the save button
     $this->fields_form['submit'] = array('title' => $this->l('Save'));
     return parent::renderForm();
 }
 public function renderForm()
 {
     if (Context::getContext()->shop->getContext() != Shop::CONTEXT_SHOP && Shop::isFeatureActive()) {
         $this->errors[] = $this->l('You have to select a shop before creating new orders.');
     }
     /*$id_cart = (int)Tools::getValue('id_cart');
       $cart = new Cart((int)$id_cart);
       if ($id_cart && !Validate::isLoadedObject($cart))
           $this->errors[] = $this->l('This cart does not exists');
       if ($id_cart && Validate::isLoadedObject($cart) && !$cart->id_customer)
           $this->errors[] = $this->l('The cart must have a customer');
       if (count($this->errors))
           return false;*/
     parent::renderForm();
     unset($this->toolbar_btn['save']);
     $this->addJqueryPlugin(array('autocomplete', 'fancybox', 'typewatch'));
     $defaults_order_state = array('cheque' => (int) Configuration::get('PS_OS_CHEQUE'), 'bankwire' => (int) Configuration::get('PS_OS_BANKWIRE'), 'cashondelivery' => (int) Configuration::get('PS_OS_PREPARATION'), 'other' => (int) Configuration::get('PS_OS_PAYMENT'));
     $payment_modules = array();
     foreach (PaymentModule::getInstalledPaymentModules() as $p_module) {
         $payment_modules[] = Module::getInstanceById((int) $p_module['id_module']);
     }
     $this->context->smarty->assign(array('recyclable_pack' => (int) Configuration::get('PS_RECYCLABLE_PACK'), 'gift_wrapping' => (int) Configuration::get('PS_GIFT_WRAPPING'), 'currencies' => Currency::getCurrenciesByIdShop(Context::getContext()->shop->id), 'langs' => Language::getLanguages(true, Context::getContext()->shop->id), 'payment_modules' => $payment_modules, 'order_states' => OrderState::getOrderStates((int) Context::getContext()->language->id), 'defaults_order_state' => $defaults_order_state, 'show_toolbar' => $this->show_toolbar, 'toolbar_btn' => $this->toolbar_btn, 'toolbar_scroll' => $this->toolbar_scroll, 'title' => array($this->l('Orders'), $this->l('Create order'))));
     $this->content .= $this->createTemplate('form.tpl')->fetch();
 }