function getContent() { // Check if the module is configured if (!$this->ebay_profile->getConfiguration('EBAY_PAYPAL_EMAIL')) { return '<p class="error"><b>' . $this->ebay->l('Please configure the \'General settings\' tab before using this tab') . '</b></p><br /><script type="text/javascript">$("#menuTab4").addClass("wrong")</script>'; } $iso = $this->context->language->iso_code; $iso_tiny_mce = file_exists(_PS_ROOT_DIR_ . '/js/tiny_mce/langs/' . $iso . '.js') ? $iso : 'en'; // Display Form $url_vars = array('id_tab' => '4', 'section' => 'template'); if (version_compare(_PS_VERSION_, '1.5', '>')) { $url_vars['controller'] = Tools::getValue('controller'); } else { $url_vars['tab'] = Tools::getValue('tab'); } $action_url = $this->_getUrl($url_vars); if (Tools::getValue('reset_template')) { $ebay_product_template = EbayProductTemplate::getContent($this->ebay, $this->smarty); } else { $ebay_product_template = Tools::getValue('ebay_product_template', $this->ebay_profile->getConfiguration('EBAY_PRODUCT_TEMPLATE')); } $ebay_product_template_title = $this->ebay_profile->getConfiguration('EBAY_PRODUCT_TEMPLATE_TITLE'); $smarty_vars = array('action_url' => $action_url, 'ebay_product_template' => $ebay_product_template, 'ebay_product_template_title' => $ebay_product_template_title, 'features_product' => Feature::getFeatures($this->context->language->id), 'ad' => dirname($_SERVER['PHP_SELF']), 'base_uri' => __PS_BASE_URI__, 'is_one_dot_three' => Tools::substr(_PS_VERSION_, 0, 3) == '1.3', 'is_one_dot_five' => version_compare(_PS_VERSION_, '1.5', '>'), 'theme_css_dir' => _THEME_CSS_DIR_); if (Tools::substr(_PS_VERSION_, 0, 3) == '1.3') { $smarty_vars['theme_name'] = _THEME_NAME_; $smarty_vars['language'] = file_exists(_PS_ROOT_DIR_ . '/js/tinymce/jscripts/tiny_mce/langs/' . $iso . '.js') ? $iso : 'en'; } elseif (version_compare(_PS_VERSION_, '1.5', '>')) { $smarty_vars['iso'] = file_exists(_PS_ROOT_DIR_ . '/js/tiny_mce/langs/' . $iso . '.js') ? $iso : 'en'; } else { $smarty_vars['iso_type_mce'] = $iso_tiny_mce; $smarty_vars['ps_js_dir'] = _PS_JS_DIR_; } return $this->display('formTemplateManager.tpl', $smarty_vars); }
function getContent() { $is_one_dot_five = version_compare(_PS_VERSION_, '1.5', '>'); // Smarty $template_vars = array('id_tab' => Tools::getValue('id_tab'), 'controller' => Tools::getValue('controller'), 'tab' => Tools::getValue('tab'), 'configure' => Tools::getValue('configure'), 'tab_module' => Tools::getValue('tab_module'), 'module_name' => Tools::getValue('module_name'), 'token' => Tools::getValue('token'), 'ebay_token' => Configuration::get('EBAY_SECURITY_TOKEN'), '_module_dir_' => _MODULE_DIR_, 'ebay_categories' => EbayCategoryConfiguration::getEbayCategories($this->ebay_profile->id), 'id_lang' => $this->context->cookie->id_lang, 'id_ebay_profile' => $this->ebay_profile->id, '_path' => $this->path, 'possible_attributes' => AttributeGroup::getAttributesGroups($this->context->cookie->id_lang), 'possible_features' => Feature::getFeatures($this->context->cookie->id_lang, true), 'date' => pSQL(date('Ymdhis')), 'conditions' => $this->_translatePSConditions(EbayCategoryConditionConfiguration::getPSConditions()), 'form_items_specifics' => EbaySynchronizer::getNbSynchronizableEbayCategoryCondition(), 'form_items_specifics_mixed' => EbaySynchronizer::getNbSynchronizableEbayCategoryConditionMixed(), 'isOneDotFive' => $is_one_dot_five); return $this->display('formItemsSpecifics.tpl', $template_vars); }
public function renderForm() { if (!$this->object->id) { $this->object->price = -1; } $shops = Shop::getShops(); if (count($this->context->employee->getAssociatedShops()) > 1) { $shops = array_merge(array(0 => array('id_shop' => 0, 'name' => $this->l('All shops'))), $shops); } $this->fields_form = array('legend' => array('title' => $this->l('Specific price rules')), 'input' => array(array('type' => 'text', 'label' => $this->l('Name:'), 'name' => 'name', 'size' => 33, 'maxlength' => 32, 'required' => true, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}'), array('type' => 'select', 'label' => $this->l('Shop:'), 'name' => 'id_shop', 'options' => array('query' => $shops, 'id' => 'id_shop', 'name' => 'name'), 'condition' => Shop::isFeatureActive(), 'default_value' => Shop::getContextShopID()), array('type' => 'select', 'label' => $this->l('Currency:'), 'name' => 'id_currency', 'options' => array('query' => array_merge(array(0 => array('id_currency' => 0, 'name' => $this->l('All currencies'))), Currency::getCurrencies()), 'id' => 'id_currency', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Country:'), 'name' => 'id_country', 'options' => array('query' => array_merge(array(0 => array('id_country' => 0, 'name' => $this->l('All countries'))), Country::getCountries((int) $this->context->language->id)), 'id' => 'id_country', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Group:'), 'name' => 'id_group', 'options' => array('query' => array_merge(array(0 => array('id_group' => 0, 'name' => $this->l('All groups'))), Group::getGroups((int) $this->context->language->id)), 'id' => 'id_group', 'name' => 'name')), array('type' => 'text', 'label' => $this->l('From quantity:'), 'name' => 'from_quantity', 'size' => 6, 'maxlength' => 10, 'required' => true), array('type' => 'text', 'label' => $this->l('Price (tax excl.):'), 'name' => 'price', 'size' => 6, 'disabled' => $this->object->price == -1 ? 1 : 0, 'maxlength' => 10, 'suffix' => $this->context->currency->getSign('right')), array('type' => 'checkbox', 'name' => 'leave_bprice', 'values' => array('query' => array(array('id' => 'on', 'name' => $this->l('Leave base price'), 'val' => '1', 'checked' => '1')), 'id' => 'id', 'name' => 'name')), array('type' => 'date', 'label' => $this->l('From:'), 'name' => 'from', 'size' => 12), array('type' => 'date', 'label' => $this->l('To:'), 'name' => 'to', 'size' => 12), array('type' => 'select', 'label' => $this->l('Reduction type:'), 'name' => 'reduction_type', 'options' => array('query' => array(array('reduction_type' => 'amount', 'name' => $this->l('Amount')), array('reduction_type' => 'percentage', 'name' => $this->l('Percentage'))), 'id' => 'reduction_type', 'name' => 'name')), array('type' => 'text', 'label' => $this->l('Reduction:'), 'name' => 'reduction', 'required' => true)), 'submit' => array('title' => $this->l('Save'), 'class' => 'button')); if (($value = $this->getFieldValue($this->object, 'price')) != -1) { $price = number_format($value, 2); } else { $price = ''; } $this->fields_value = array('price' => $price, 'from_quantity' => ($value = $this->getFieldValue($this->object, 'from_quantity')) ? $value : 1, 'reduction' => number_format(($value = $this->getFieldValue($this->object, 'reduction')) ? $value : 0, 2), 'leave_bprice_on' => $price ? 0 : 1); $attribute_groups = array(); $attributes = Attribute::getAttributes((int) $this->context->language->id); foreach ($attributes as $attribute) { if (!isset($attribute_groups[$attribute['id_attribute_group']])) { $attribute_groups[$attribute['id_attribute_group']] = array('id_attribute_group' => $attribute['id_attribute_group'], 'name' => $attribute['attribute_group']); } $attribute_groups[$attribute['id_attribute_group']]['attributes'][] = array('id_attribute' => $attribute['id_attribute'], 'name' => $attribute['name']); } $features = Feature::getFeatures((int) $this->context->language->id); foreach ($features as &$feature) { $feature['values'] = FeatureValue::getFeatureValuesWithLang((int) $this->context->language->id, $feature['id_feature'], true); } $this->tpl_form_vars = array('manufacturers' => Manufacturer::getManufacturers(), 'suppliers' => Supplier::getSuppliers(), 'attributes_group' => $attribute_groups, 'features' => $features, 'categories' => Category::getSimpleCategories((int) $this->context->language->id), 'conditions' => $this->object->getConditions(), 'is_multishop' => Shop::isFeatureActive()); return parent::renderForm(); }
public function initFormFeatures($obj) { if (!$this->default_form_language) { $this->getLanguages(); } $tpl_path = _PS_MODULE_DIR_ . 'advancedfeaturesvalues/views/templates/admin/products/features.tpl'; $data = $this->context->smarty->createTemplate($tpl_path, $this->context->smarty); $data->assign('default_form_language', $this->default_form_language); $data->assign('languages', $this->_languages); if (!Feature::isFeatureActive()) { $this->displayWarning($this->l('This feature has been disabled. ') . ' <a href="index.php?tab=AdminPerformance&token=' . Tools::getAdminTokenLite('AdminPerformance') . '#featuresDetachables">' . $this->l('Performances') . '</a>'); } else { if ($obj->id) { if ($this->product_exists_in_shop) { $features = Feature::getFeatures($this->context->language->id, Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP); foreach ($features as $k => $tab_features) { $features[$k]['current_item'] = array(); $features[$k]['val'] = array(); $custom = true; foreach ($obj->getFeatures() as $tab_products) { if ($tab_products['id_feature'] == $tab_features['id_feature']) { $features[$k]['current_item'][] = $tab_products['id_feature_value']; } } $features[$k]['featureValues'] = FeatureValue::getFeatureValuesWithLang($this->context->language->id, (int) $tab_features['id_feature']); if (count($features[$k]['featureValues'])) { foreach ($features[$k]['featureValues'] as $value) { if (in_array($value['id_feature_value'], $features[$k]['current_item'])) { $custom = false; } } } if ($custom && !empty($features[$k]['current_item'])) { $features[$k]['val'] = FeatureValue::getFeatureValueLang($features[$k]['current_item'][0]); } } $data->assign('available_features', $features); $data->assign('product', $obj); $data->assign('link', $this->context->link); $data->assign('default_form_language', $this->default_form_language); } else { $this->displayWarning($this->l('You must save the product in this shop before adding features.')); } } else { $this->displayWarning($this->l('You must save this product before adding features.')); } } $this->tpl_form_vars['custom_form'] = $data->fetch(); }
/** * Display form * * @global string $currentIndex Current URL in order to keep current Tab */ public function displayForm($isMainTab = true) { global $currentIndex; parent::displayForm(); if (!($obj = $this->loadObject(true))) { return; } echo ' <h2>' . $this->l('Add a new feature value') . '</h2> <form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . Tools::getValue('token') . '" method="post"> ' . ($obj->id ? '<input type="hidden" name="id_feature_value" value="' . $obj->id . '" />' : '') . ' <fieldset class="width2"> <legend><img src="../img/t/AdminFeatures.gif" />' . $this->l('Add a new feature value') . '</legend> <label>' . $this->l('Value:') . ' </label> <div class="margin-form">'; foreach ($this->_languages as $language) { echo ' <div id="value_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;"> <input size="33" type="text" name="value_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'value', (int) $language['id_lang']), ENT_COMPAT, 'UTF-8') . '" /><sup> *</sup> <span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span> </div> <script type="text/javascript"> var flag_fields = \'value\'; </script>'; } $this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'flag_fields', 'value', false, true); echo ' <div class="clear"></div> </div> <label>' . $this->l('Feature:') . ' </label> <div class="margin-form"> <select name="id_feature">'; $features = Feature::getFeatures($this->_defaultFormLanguage); foreach ($features as $feature) { echo '<option value="' . $feature['id_feature'] . '"' . ($this->getFieldValue($obj, 'id_feature') == $feature['id_feature'] ? ' selected="selected"' : '') . '>' . $feature['name'] . '</option>'; } echo ' </select><sup> *</sup> </div> ' . Module::hookExec('featureValueForm', array('id_feature_value' => $obj->id)) . ' <div class="margin-form"> <input type="submit" value="' . $this->l(' Save ') . '" name="submitAdd' . $this->table . '" class="button" /> </div> <div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div> </fieldset> </form>'; }
/** * Display form * * @global string $currentIndex Current URL in order to keep current Tab */ public function displayForm($token = NULL) { global $currentIndex; $defaultLanguage = intval(Configuration::get('PS_LANG_DEFAULT')); $languages = Language::getLanguages(); $obj = $this->loadObject(true); echo ' <script type="text/javascript"> id_language = Number(' . $defaultLanguage . '); </script> <form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . ($token ? $token : $this->token) . '" method="post"> ' . ($obj->id ? '<input type="hidden" name="id_feature_value" value="' . $obj->id . '" />' : '') . ' <fieldset class="width3"><legend><img src="../img/t/AdminFeatures.gif" />' . $this->l('Value') . '</legend> <label>' . $this->l('Value:') . ' </label> <div class="margin-form">'; foreach ($languages as $language) { echo ' <div id="value_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;"> <input size="33" type="text" name="value_' . $language['id_lang'] . '" value="' . htmlentities($this->getFieldValue($obj, 'value', intval($language['id_lang'])), ENT_COMPAT, 'UTF-8') . '" /><sup> *</sup> <span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer"> </span></span> </div>'; } $this->displayFlags($languages, $defaultLanguage, 'value', 'value'); echo ' <div style="clear: both;"></div> </div> <label>' . $this->l('Feature:') . ' </label> <div class="margin-form"> <select name="id_feature">'; $features = Feature::getFeatures($defaultLanguage); foreach ($features as $feature) { echo '<option value="' . $feature['id_feature'] . '"' . ($this->getFieldValue($obj, 'id_feature') == $feature['id_feature'] ? ' selected="selected"' : '') . '>' . $feature['name'] . '</option>'; } echo ' </select><sup> *</sup> </div> <div class="margin-form"> <input type="submit" value="' . $this->l(' Save ') . '" name="submitAdd' . $this->table . '" class="button" /> </div> <div class="small"><sup>*</sup> ' . $this->l('Required field') . '</div> </fieldset> </form>'; }
public function renderForm() { if (!$this->object->id) { $this->object->price = -1; } $this->fields_form = array('legend' => array('title' => $this->trans('Catalog price rules', array(), 'Admin.Catalog.Feature'), 'icon' => 'icon-dollar'), 'input' => array(array('type' => 'text', 'label' => $this->trans('Name', array(), 'Admin.Global'), 'name' => 'name', 'maxlength' => 255, 'required' => true), array('type' => 'select', 'label' => $this->trans('Shop', array(), 'Admin.Global'), 'name' => 'shop_id', 'options' => array('query' => Shop::getShops(), 'id' => 'id_shop', 'name' => 'name'), 'condition' => Shop::isFeatureActive(), 'default_value' => Shop::getContextShopID()), array('type' => 'select', 'label' => $this->trans('Currency', array(), 'Admin.Global'), 'name' => 'id_currency', 'options' => array('query' => array_merge(array(0 => array('id_currency' => 0, 'name' => $this->trans('All currencies', array(), 'Admin.Global'))), Currency::getCurrencies(false, true, true)), 'id' => 'id_currency', 'name' => 'name')), array('type' => 'select', 'label' => $this->trans('Country', array(), 'Admin.Global'), 'name' => 'id_country', 'options' => array('query' => array_merge(array(0 => array('id_country' => 0, 'name' => $this->trans('All countries', array(), 'Admin.Global'))), Country::getCountries((int) $this->context->language->id)), 'id' => 'id_country', 'name' => 'name')), array('type' => 'select', 'label' => $this->trans('Group', array(), 'Admin.Global'), 'name' => 'id_group', 'options' => array('query' => array_merge(array(0 => array('id_group' => 0, 'name' => $this->trans('All groups', array(), 'Admin.Global'))), Group::getGroups((int) $this->context->language->id)), 'id' => 'id_group', 'name' => 'name')), array('type' => 'text', 'label' => $this->trans('From quantity', array(), 'Admin.Catalog.Feature'), 'name' => 'from_quantity', 'maxlength' => 10, 'required' => true), array('type' => 'text', 'label' => $this->trans('Price (tax excl.)', array(), 'Admin.Catalog.Feature'), 'name' => 'price', 'disabled' => $this->object->price == -1 ? 1 : 0, 'maxlength' => 10, 'suffix' => $this->context->currency->getSign('right')), array('type' => 'checkbox', 'name' => 'leave_bprice', 'values' => array('query' => array(array('id' => 'on', 'name' => $this->trans('Leave initial price', array(), 'Admin.Catalog.Feature'), 'val' => '1', 'checked' => '1')), 'id' => 'id', 'name' => 'name')), array('type' => 'datetime', 'label' => $this->trans('From', array(), 'Admin.Global'), 'name' => 'from'), array('type' => 'datetime', 'label' => $this->trans('To', array(), 'Admin.Global'), 'name' => 'to'), array('type' => 'select', 'label' => $this->trans('Reduction type', array(), 'Admin.Catalog.Feature'), 'name' => 'reduction_type', 'options' => array('query' => array(array('reduction_type' => 'amount', 'name' => $this->trans('Amount', array(), 'Admin.Global')), array('reduction_type' => 'percentage', 'name' => $this->trans('Percentage', array(), 'Admin.Global'))), 'id' => 'reduction_type', 'name' => 'name')), array('type' => 'select', 'label' => $this->trans('Reduction with or without taxes', array(), 'Admin.Catalog.Feature'), 'name' => 'reduction_tax', 'align' => 'center', 'options' => array('query' => array(array('lab' => $this->trans('Tax included', array(), 'Admin.Global'), 'val' => 1), array('lab' => $this->trans('Tax excluded', array(), 'Admin.Global'), 'val' => 0)), 'id' => 'val', 'name' => 'lab')), array('type' => 'text', 'label' => $this->trans('Reduction', array(), 'Admin.Catalog.Feature'), 'name' => 'reduction', 'required' => true)), 'submit' => array('title' => $this->trans('Save', array(), 'Admin.Actions'))); if (($value = $this->getFieldValue($this->object, 'price')) != -1) { $price = number_format($value, 6); } else { $price = ''; } $this->fields_value = array('price' => $price, 'from_quantity' => ($value = $this->getFieldValue($this->object, 'from_quantity')) ? $value : 1, 'reduction' => number_format(($value = $this->getFieldValue($this->object, 'reduction')) ? $value : 0, 6), 'leave_bprice_on' => $price ? 0 : 1, 'shop_id' => ($value = $this->getFieldValue($this->object, 'id_shop')) ? $value : 1); $attribute_groups = array(); $attributes = Attribute::getAttributes((int) $this->context->language->id); foreach ($attributes as $attribute) { if (!isset($attribute_groups[$attribute['id_attribute_group']])) { $attribute_groups[$attribute['id_attribute_group']] = array('id_attribute_group' => $attribute['id_attribute_group'], 'name' => $attribute['attribute_group']); } $attribute_groups[$attribute['id_attribute_group']]['attributes'][] = array('id_attribute' => $attribute['id_attribute'], 'name' => $attribute['name']); } $features = Feature::getFeatures((int) $this->context->language->id); foreach ($features as &$feature) { $feature['values'] = FeatureValue::getFeatureValuesWithLang((int) $this->context->language->id, $feature['id_feature'], true); } $this->tpl_form_vars = array('manufacturers' => Manufacturer::getManufacturers(), 'suppliers' => Supplier::getSuppliers(), 'attributes_group' => $attribute_groups, 'features' => $features, 'categories' => Category::getSimpleCategories((int) $this->context->language->id), 'conditions' => $this->object->getConditions(), 'is_multishop' => Shop::isFeatureActive()); return parent::renderForm(); }
/** * AdminController::renderForm() override * @see AdminController::renderForm() */ public function initFormFeatureValue() { $this->setTypeValue(); $this->fields_form[0]['form'] = array('legend' => array('title' => $this->l('Feature value'), 'image' => '../img/t/AdminFeatures.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Value:'), 'name' => 'value', 'lang' => true, 'size' => 33, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}', 'required' => true), array('type' => 'select', 'label' => $this->l('Feature:'), 'name' => 'id_feature', 'options' => array('query' => Feature::getFeatures($this->context->language->id), 'id' => 'id_feature', 'name' => 'name'), 'required' => true)), 'submit' => array('title' => $this->l(' Save '), 'class' => 'button')); // Create Object FeatureValue $feature_value = new FeatureValue(Tools::getValue('id_feature_value')); $this->tpl_vars = array('feature_value' => $feature_value); $this->getlanguages(); $helper = new HelperForm(); $helper->currentIndex = self::$currentIndex; $helper->token = $this->token; $helper->table = $this->table; $helper->identifier = $this->identifier; $helper->override_folder = 'feature_value/'; $helper->id = $feature_value->id; $helper->toolbar_scroll = false; $helper->tpl_vars = $this->tpl_vars; $helper->languages = $this->_languages; $helper->default_form_language = $this->default_form_language; $helper->allow_employee_form_lang = $this->allow_employee_form_lang; $helper->fields_value = $this->getFieldsValue($feature_value); $helper->toolbar_btn = $this->toolbar_btn; $helper->title = $this->l('Add a new feature value'); $this->content .= $helper->generateForm($this->fields_form); }
/** * Create the form that will be displayed in the configuration of your module. */ protected function renderForm() { $features_list = Feature::getFeatures($this->context->language->id); $features_list[] = array('id_feature' => 0, 'name' => $this->l('(None)')); $form = array('legend' => array('title' => $this->l('Settings'), 'icon' => 'icon-cogs'), 'input' => array(array('type' => 'select', 'label' => $this->l('Version Feature'), 'name' => 'id_feature', 'required' => true, 'options' => array('query' => $features_list, 'id' => 'id_feature', 'name' => 'name'), 'desc' => $this->l('When using a GIT repository as source, the script will be able to auto detect & use the latest TAG') . '<br/>' . $this->l('The TAG name will be stored as a custom value of this feature, allowing your customers to see the published current version number'))), 'submit' => array('title' => $this->l('Save'))); $helper = new HelperForm(); $helper->module = $this; $helper->identifier = $this->identifier; $helper->submit_action = 'submitAutozipModule'; $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false) . '&configure=' . $this->name . '&tab_module=' . $this->tab . '&module_name=' . $this->name; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->fields_value['id_feature'] = (int) Configuration::get('AUTOZIP_ID_FEATURE'); return $helper->generateForm(array(array('form' => $form))); }
public function deletePrestashopDefaultFeatures() { $all_features = Feature::getFeatures($this->context->language->id); foreach ($all_features as $ftr_k => $ftr_v) { $obj_feature = new Feature($ftr_v['id_feature']); $obj_feature->delete(); } return true; }
public function getContent() { $this->html = ''; if (Tools::isSubmit('submitNetEven')) { if (Tools::getValue('NETEVEN_LOGIN') && Tools::getValue('NETEVEN_PASSWORD')) { Gateway::updateConfig('NETEVEN_LOGIN', Tools::getValue('NETEVEN_LOGIN')); Gateway::updateConfig('NETEVEN_PASSWORD', Tools::getValue('NETEVEN_PASSWORD')); Gateway::updateConfig('COMMENT', Tools::getValue('COMMENT')); Gateway::updateConfig('DEFAULT_BRAND', Tools::getValue('DEFAULT_BRAND')); Gateway::updateConfig('IMAGE_TYPE_NAME', Tools::getValue('IMAGE_TYPE_NAME')); Gateway::updateConfig('SYNCHRONISATION_ORDER', (int) Tools::getValue('SYNCHRONISATION_ORDER')); Gateway::updateConfig('SYNCHRONISATION_PRODUCT', (int) Tools::getValue('SYNCHRONISATION_PRODUCT')); Gateway::updateConfig('TYPE_SKU', (string) Tools::getValue('TYPE_SKU')); $this->html .= $this->displayConfirmation($this->l('Les paramètres ont bien été mis à jour')); } else { $this->html .= $this->displayError($this->l('Les login et mot de passe NetEven sont obligatoire')); } } elseif (Tools::isSubmit('submitNetEvenShipping')) { Gateway::updateConfig('SHIPPING_DELAY', Tools::getValue('SHIPPING_DELAY')); Gateway::updateConfig('SHIPPING_PRICE_LOCAL', Tools::getValue('SHIPPING_PRICE_LOCAL')); Gateway::updateConfig('SHIPPING_PRICE_INTERNATIONAL', Tools::getValue('SHIPPING_PRICE_INTERNATIONAL')); Gateway::updateConfig('SHIPPING_BY_PRODUCT', (int) Tools::getValue('SHIPPING_BY_PRODUCT')); Gateway::updateConfig('SHIPPING_BY_PRODUCT_FIELDNAME', Tools::getValue('SHIPPING_BY_PRODUCT_FIELDNAME')); Gateway::updateConfig('SHIPPING_CARRIER_FRANCE', Tools::getValue('SHIPPING_CARRIER_FRANCE')); Gateway::updateConfig('SHIPPING_ZONE_FRANCE', Tools::getValue('SHIPPING_ZONE_FRANCE')); Gateway::updateConfig('SHIPPING_CARRIER_INTERNATIONAL', Tools::getValue('SHIPPING_CARRIER_INTERNATIONAL')); Gateway::updateConfig('SHIPPING_ZONE_INTERNATIONAL', Tools::getValue('SHIPPING_ZONE_INTERNATIONAL')); $this->html .= $this->displayConfirmation($this->l('Les paramètres de livraison ont bien été mis à jour')); } elseif (Tools::isSubmit('submitDev')) { Gateway::updateConfig('NETEVEN_URL', Tools::getValue('NETEVEN_URL')); Gateway::updateConfig('NETEVEN_NS', Tools::getValue('NETEVEN_NS')); Gateway::updateConfig('MAIL_LIST_ALERT', Tools::getValue('MAIL_LIST_ALERT')); Gateway::updateConfig('DEBUG', (int) Tools::getValue('DEBUG')); Gateway::updateConfig('SEND_REQUEST_BY_EMAIL', (int) Tools::getValue('SEND_REQUEST_BY_EMAIL')); $this->html .= $this->displayConfirmation($this->l('Les paramètres de maintenance ont bien été mis à jour')); } elseif (Tools::isSubmit('submitCustomizableFeilds')) { $customizable_field_name = Tools::getValue('customizable_field_name'); $customizable_field_value = Tools::getValue('customizable_field_value'); $customizable_string = ''; foreach ($customizable_field_name as $key => $value) { if (!$customizable_field_name[$key] || !$customizable_field_value[$key]) { continue; } if ($customizable_string) { $customizable_string .= '¤'; } $customizable_string .= $customizable_field_name[$key] . '|' . $customizable_field_value[$key]; } Gateway::updateConfig('CUSTOMIZABLE_FIELDS', $customizable_string); } // Lists of order status $order_states = OrderState::getOrderStates((int) $this->context->cookie->id_lang); // Lists of features $features = Feature::getFeatures((int) $this->context->cookie->id_lang); // Lists of attribute groups $attribute_groups = AttributeGroup::getAttributesGroups((int) $this->context->cookie->id_lang); $neteven_features = Db::getInstance()->ExecuteS('SELECT * FROM `' . _DB_PREFIX_ . 'orders_gateway_feature`'); $neteven_feature_categories = array(); foreach ($neteven_features as $neteven_feature) { if (!isset($neteven_feature_categories[$neteven_feature['category']])) { $neteven_feature_categories[$neteven_feature['category']] = array(); } $neteven_feature_categories[$neteven_feature['category']][] = $neteven_feature; } if ($this->getSOAP()) { $this->html .= $this->displayForm($order_states, $features, $attribute_groups, $neteven_feature_categories); } else { $this->html .= $this->displayError($this->l('This module requires the SOAP extension to run')); } return $this->html; }
protected function generateFeaturesData() { $delimiter = ';'; $line = array(); $titles = array(); $new_path = new Sampledatainstall(); $f = fopen($new_path->sendPath() . 'output/features.vsc', 'w'); foreach ($this->feature_fields as $field => $array) { $titles[] = $array['label']; } fputcsv($f, $titles, $delimiter, '"'); $features = Feature::getFeatures($this->use_lang); if ($features) { foreach ($features as $feature) { $feature = new Feature($feature['id_feature'], $this->use_lang); foreach ($this->feature_fields as $field => $array) { $line[$field] = property_exists('Feature', $field) && !is_array($feature->{$field}) && !Tools::isEmpty($feature->{$field}) ? $feature->{$field} : ''; } if (!$line[$field]) { $line[$field] = ''; } fputcsv($f, $line, $delimiter, '"'); } } fclose($f); }
private function initContentForFeatures() { $tlwvvxr = "features"; ${"GLOBALS"}["pihske"] = "features"; $jxbahojyvlt = "available_features_all"; $fotyrrre = "available_features_all"; $lueyeppw = "features"; ${"GLOBALS"}["iavdbtipeie"] = "tab_features"; ${$lueyeppw} = Feature::getFeatures($this->id_language); foreach (${$tlwvvxr} as ${${"GLOBALS"}["qtxqhylrbsm"]} => ${${"GLOBALS"}["iavdbtipeie"]}) { ${"GLOBALS"}["ringgeomwho"] = "tab_products"; $oovownr = "k"; $dibecrefieyf = "k"; ${"GLOBALS"}["llnriurbfb"] = "features"; ${"GLOBALS"}["krrouj"] = "k"; ${"GLOBALS"}["ezrxbtdf"] = "features"; ${${"GLOBALS"}["nrjxzlhiqjg"]}[${${"GLOBALS"}["krrouj"]}]["current_item"] = false; ${${"GLOBALS"}["nrjxzlhiqjg"]}[${$dibecrefieyf}]["val"] = array(); ${${"GLOBALS"}["vwmhyvovziq"]} = true; foreach ($this->object->getFeatures() as ${${"GLOBALS"}["ringgeomwho"]}) { $hozllwqodl = "features"; $koyfxiz = "k"; ${"GLOBALS"}["hkqtkv"] = "tab_products"; ${"GLOBALS"}["icrwrssx"] = "tab_products"; $wbqcupctp = "tab_features"; if (${${"GLOBALS"}["hkqtkv"]}["id_feature"] == ${$wbqcupctp}["id_feature"]) { ${$hozllwqodl}[${$koyfxiz}]["current_item"] = ${${"GLOBALS"}["icrwrssx"]}["id_feature_value"]; } } ${${"GLOBALS"}["nrjxzlhiqjg"]}[${${"GLOBALS"}["qtxqhylrbsm"]}]["featureValues"] = FeatureValue::getFeatureValuesWithLang($this->id_language, (int) ${${"GLOBALS"}["kowgsfpm"]}["id_feature"]); if (count(${${"GLOBALS"}["nrjxzlhiqjg"]}[${$oovownr}]["featureValues"])) { $gtmlwoq = "features"; $ryjttmtpvt = "k"; foreach (${$gtmlwoq}[${$ryjttmtpvt}]["featureValues"] as ${${"GLOBALS"}["kzwkbwmzgtl"]}) { $rtsfkxsq = "features"; $tduybwwrxb = "value"; if (${$rtsfkxsq}[${${"GLOBALS"}["qtxqhylrbsm"]}]["current_item"] == ${$tduybwwrxb}["id_feature_value"]) { ${${"GLOBALS"}["vwmhyvovziq"]} = false; } } } if (${${"GLOBALS"}["vwmhyvovziq"]}) { ${${"GLOBALS"}["llnriurbfb"]}[${${"GLOBALS"}["qtxqhylrbsm"]}]["val"] = FeatureValue::getFeatureValueLang(${${"GLOBALS"}["ezrxbtdf"]}[${${"GLOBALS"}["qtxqhylrbsm"]}]["current_item"]); } } ${$jxbahojyvlt} = ""; foreach (${${"GLOBALS"}["nrjxzlhiqjg"]} as ${${"GLOBALS"}["jtsfpdcbh"]}) { ${"GLOBALS"}["tpyuivnp"] = "available_features_all"; ${${"GLOBALS"}["mogxjutudv"]} = ${${"GLOBALS"}["tpyuivnp"]} . "custom_" . ${${"GLOBALS"}["jtsfpdcbh"]}["id_feature"] . "¤"; } self::$smarty->assign(array("available_features_all" => ${$fotyrrre}, "available_features" => ${${"GLOBALS"}["pihske"]})); }
public function initFormFeatures($obj) { $data = $this->createTemplate($this->tpl_form); if (!Feature::isFeatureActive()) { $this->displayWarning($this->l('This feature has been disabled, you can active this feature at this page:') . ' <a href="index.php?tab=AdminPerformance&token=' . Tools::getAdminTokenLite('AdminPerformance') . '#featuresDetachables">' . $this->l('Performances') . '</a>'); } else { if ($obj->id) { if ($this->product_exists_in_shop) { $features = Feature::getFeatures($this->context->language->id); foreach ($features as $k => $tab_features) { $features[$k]['current_item'] = false; $features[$k]['val'] = array(); $custom = true; foreach ($obj->getFeatures() as $tab_products) { if ($tab_products['id_feature'] == $tab_features['id_feature']) { $features[$k]['current_item'] = $tab_products['id_feature_value']; } } $features[$k]['featureValues'] = FeatureValue::getFeatureValuesWithLang($this->context->language->id, (int) $tab_features['id_feature']); if (count($features[$k]['featureValues'])) { foreach ($features[$k]['featureValues'] as $value) { if ($features[$k]['current_item'] == $value['id_feature_value']) { $custom = false; } } } if ($custom) { $features[$k]['val'] = FeatureValue::getFeatureValueLang($features[$k]['current_item']); } } $data->assign('available_features', $features); $data->assign('product', $obj); $data->assign('link', $this->context->link); $data->assign('languages', $this->_languages); $data->assign('default_form_language', $this->default_form_language); } else { $this->displayWarning($this->l('You must save this product in this shop before adding features.')); } } else { $this->displayWarning($this->l('You must save this product before adding features.')); } } $this->tpl_form_vars['custom_form'] = $data->fetch(); }
/** * Display the BO html with smart templates */ public function _displayForm() { // Add the specific jquery ui plugins, module JS & CSS $this->context->controller->addJqueryUI('ui.tabs'); $this->context->controller->addJqueryPlugin('autocomplete'); $this->context->controller->addJs($this->_path . 'js/admin/' . $this->name . '.js'); $this->context->controller->addCss(array($this->_path . 'css/admin/' . $this->name . '.css' => 'all', _PS_JS_DIR_ . 'jquery/ui/themes/base/jquery.ui.all.css')); /* Display the errors / warnings / confirmations */ $this->context->smarty->assign(array('aPrediggoWarnings' => $this->_warnings, 'aPrediggoConfirmations' => $this->_confirmations, 'aPrediggoErrors' => $this->_errors, 'path' => $this->_path, 'lang_iso' => $this->context->language->iso_code)); // Display the errors $this->_html .= $this->display(__FILE__, 'views/templates/admin/errors.tpl'); // Display the tabs $this->_html .= $this->display(__FILE__, 'views/templates/admin/tabs.tpl'); $this->_display = 'index'; $iShopContext = (int) (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP); /* * MAIN CONFIGURATION */ $this->fields_form['main_conf']['form'] = array('legend' => array('title' => $this->l('Main Configuration'), 'image' => _PS_ADMIN_IMG_ . 'employee.gif'), 'input' => array(array('label' => $this->l('Web Site ID'), 'type' => 'text', 'name' => 'web_site_id', 'size' => 50, 'required' => true, 'desc' => $this->l('Login of the Prediggo solution')), array('label' => $this->l('Profil ID'), 'type' => 'text', 'name' => 'gateway_profil_id', 'size' => 50, 'disabled' => 'disabled', 'desc' => $this->l('Profile ID of the current shop')), array('type' => 'button', 'name' => 'mainConfSubmit', 'class' => 'button', 'title' => $this->l(' Save ')))); $this->fields_value['web_site_id'] = $this->oPrediggoConfig->web_site_id; $this->fields_value['gateway_profil_id'] = (int) $this->context->shop->id; /* * EXPORT MAIN CONFIGURATION */ $sCronFilePath = Tools::getShopDomain(true) . str_replace(_PS_ROOT_DIR_ . '/', __PS_BASE_URI__, $this->_path) . 'crons/export.php?token=' . Tools::getAdminToken('DataExtractorController'); $this->fields_form['export_conf']['form'] = array('legend' => array('title' => $this->l('Export Configuration'), 'image' => _PS_ADMIN_IMG_ . 'cog.gif'), 'input' => array(array('label' => $this->l('Logs storage activation'), 'type' => 'radio', 'name' => 'logs_file_generation', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'logs_file_generation_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'logs_file_generation_off', 'value' => 0, 'label' => $this->l('No'))), 'required' => true, 'desc' => $this->l('The logs files are stored in the folder "logs" of the module')), array('label' => $this->l('Products file generation activation'), 'type' => 'radio', 'name' => 'products_file_generation', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'products_file_generation_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'products_file_generation_off', 'value' => 0, 'label' => $this->l('No'))), 'required' => true, 'desc' => $this->l('Define if the products can be exported into a zip file for the use of the prediggo solution'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Orders file generation activation'), 'type' => 'radio', 'name' => 'orders_file_generation', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'orders_file_generation_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'orders_file_generation_off', 'value' => 0, 'label' => $this->l('No'))), 'required' => true, 'desc' => $this->l('Define if the orders can be exported into a zip file for the use of the prediggo solution'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Customers file generation activation'), 'type' => 'radio', 'name' => 'customers_file_generation', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'customers_file_generation_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'customers_file_generation_off', 'value' => 0, 'label' => $this->l('No'))), 'required' => true, 'desc' => $this->l('Define if the customers can be exported into a zip file for the use of the prediggo solution'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Product\'s image cover export activation'), 'type' => 'radio', 'name' => 'export_product_image', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'export_product_image_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'export_product_image_off', 'value' => 0, 'label' => $this->l('No'))), 'required' => true, 'desc' => $this->l('Define if the product\'s image covers are included in the export of the products'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Product\'s description export activation'), 'type' => 'radio', 'name' => 'export_product_description', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'export_product_description_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'export_product_description_off', 'value' => 0, 'label' => $this->l('No'))), 'required' => true, 'desc' => $this->l('Define if the product\'s descriptions are included in the export of the products'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Product minimum quantity:'), 'type' => 'text', 'name' => 'export_product_min_quantity', 'required' => true, 'desc' => $this->l('Minimum quantity of a product to be exported'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Number of days considering that an order can be exported:'), 'type' => 'text', 'name' => 'nb_days_order_valide', 'required' => true, 'desc' => $this->l('Number of days to select orders into the export by their date of creation'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Number of days considering that a customer can be exported:'), 'type' => 'text', 'name' => 'nb_days_customer_last_visit_valide', 'required' => true, 'desc' => $this->l('Number of days to select customers into the export by their date of creation'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('type' => 'button', 'name' => 'exportConfSubmit', 'class' => 'button', 'title' => $this->l(' Save '), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('type' => 'hint', 'name' => 'protection_xml_path', 'content' => $this->l('If you want to execute the export by a cron, use the following link:') . ' <a href="' . $sCronFilePath . '">' . $sCronFilePath . '</a>.'), array('label' => $this->l('Launch the files export by clicking on the following button:'), 'type' => 'button', 'name' => 'manualExportSubmit', 'class' => 'button', 'title' => $this->l(' Export files '), 'disabled' => (int) $iShopContext ? 'disabled' : ''))); $this->fields_value['products_file_generation'] = (int) $this->oPrediggoConfig->products_file_generation; $this->fields_value['orders_file_generation'] = (int) $this->oPrediggoConfig->orders_file_generation; $this->fields_value['customers_file_generation'] = (int) $this->oPrediggoConfig->customers_file_generation; $this->fields_value['logs_file_generation'] = (int) $this->oPrediggoConfig->logs_file_generation; $this->fields_value['export_product_image'] = (int) $this->oPrediggoConfig->export_product_image; $this->fields_value['export_product_description'] = (int) $this->oPrediggoConfig->export_product_description; $this->fields_value['export_product_min_quantity'] = (int) $this->oPrediggoConfig->export_product_min_quantity; $this->fields_value['nb_days_order_valide'] = (int) $this->oPrediggoConfig->nb_days_order_valide; $this->fields_value['nb_days_customer_last_visit_valide'] = (int) $this->oPrediggoConfig->nb_days_customer_last_visit_valide; /* * ATTRIBUTE SELECTION */ $this->fields_form['attributes_selection']['form'] = array('legend' => array('title' => $this->l('Prediggo attributes selection'), 'image' => _PS_ADMIN_IMG_ . 'quick.gif'), 'input' => array(array('label' => $this->l('Attributes:'), 'type' => 'attribute_selector', 'name' => 'attribute_selector', 'names' => array('attributes' => 'attributes_groups_ids[]', 'features' => 'features_ids[]'), 'values' => array('attributes' => AttributeGroup::getAttributesGroups((int) $this->context->cookie->id_lang), 'features' => Feature::getFeatures((int) $this->context->cookie->id_lang)), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('type' => 'button', 'name' => 'exportPrediggoAttributesSubmit', 'class' => 'button', 'title' => $this->l(' Save the prediggo attributes '), 'disabled' => (int) $iShopContext ? 'disabled' : ''))); $this->fields_value['attribute_selector'] = array('attributes' => explode(',', $this->oPrediggoConfig->attributes_groups_ids), 'features' => explode(',', $this->oPrediggoConfig->features_ids)); /* * RECOMMANDATIONS BLACK LIST */ $this->fields_form['black_list_reco']['form'] = array('legend' => array('title' => $this->l('Products not included in the recommendations'), 'image' => _PS_ADMIN_IMG_ . 'nav-logout.gif'), 'input' => array(array('label' => $this->l('Product:'), 'type' => 'autocomplete', 'name' => 'products_ids_not_recommendable', 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('type' => 'button', 'name' => 'exportNotRecoSubmit', 'class' => 'button', 'title' => $this->l(' Save the black list '), 'disabled' => (int) $iShopContext ? 'disabled' : ''))); $this->fields_value['products_ids_not_recommendable'] = array(); if (!empty($this->oPrediggoConfig->products_ids_not_recommendable)) { foreach (explode(',', $this->oPrediggoConfig->products_ids_not_recommendable) as $iID) { $oProduct = new Product((int) $iID, false, (int) $this->context->cookie->id_lang, (int) $this->context->shop->id, $this->context); $this->fields_value['products_ids_not_recommendable'][] = array('id' => (int) $iID, 'name' => $oProduct->name); unset($oProduct); } } /* * SEARCH BLACK LIST */ $this->fields_form['black_list_search']['form'] = array('legend' => array('title' => $this->l('Products not included in the searchs'), 'image' => _PS_ADMIN_IMG_ . 'nav-logout.gif'), 'input' => array(array('label' => $this->l('Product:'), 'type' => 'autocomplete', 'name' => 'products_ids_not_searchable', 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('type' => 'button', 'name' => 'exportNotSearchSubmit', 'class' => 'button', 'title' => $this->l(' Save the black list '), 'disabled' => (int) $iShopContext ? 'disabled' : ''))); $this->fields_value['products_ids_not_searchable'] = array(); if (!empty($this->oPrediggoConfig->products_ids_not_searchable)) { foreach (explode(',', $this->oPrediggoConfig->products_ids_not_searchable) as $iID) { $oProduct = new Product((int) $iID, false, (int) $this->context->cookie->id_lang, (int) $this->context->shop->id, $this->context); $this->fields_value['products_ids_not_searchable'][] = array('id' => (int) $iID, 'name' => $oProduct->name); unset($oProduct); } } /* * HTACCESS PROTECTION */ $sExportRepositoryPath = Tools::getShopDomain(true) . str_replace(_PS_ROOT_DIR_ . '/', __PS_BASE_URI__, $this->_path) . 'xmlfiles/'; $this->fields_form['htaccess_conf']['form'] = array('legend' => array('title' => $this->l('Export File protection'), 'image' => _PS_ADMIN_IMG_ . 'access.png'), 'input' => array(array('type' => 'hint', 'name' => 'export_cron', 'content' => $this->l('Your files are created into your PrestaShop plateform into the following folder :') . ' <a href="' . $sExportRepositoryPath . '">' . $sExportRepositoryPath . '</a>.<br/>' . $this->l('The data contained into these files are critical and require a protection.') . $this->l('Please restrict the access to these files by applying a protection with an authentication requiring a login and a password!') . '<br/>' . $this->l('The Basic Authentication module is not configured by default on Nginx web server. Please, refer to this documentation to configure it : http://wiki.nginx.org/HttpAuthBasicModule.')), array('label' => $this->l('Login:'******'type' => 'text', 'name' => 'htpasswd_user', 'required' => true, 'desc' => $this->l('Login of the export folder protection')), array('label' => $this->l('Password:'******'type' => 'text', 'name' => 'htpasswd_pwd', 'required' => true, 'desc' => $this->l('Password of the export folder protection')), array('type' => 'button', 'name' => 'exportProtectionConfSubmit', 'class' => 'button', 'title' => $this->l(' Save ')))); $this->fields_value['htpasswd_user'] = $this->oPrediggoConfig->htpasswd_user; $this->fields_value['htpasswd_pwd'] = $this->oPrediggoConfig->htpasswd_pwd; /* * RECOMMENDATIONS MAIN CONFIGURATION */ $this->fields_form['recommendation_conf']['form'] = array('legend' => array('title' => $this->l('Main recommendations settings'), 'image' => _PS_ADMIN_IMG_ . 'page_world.png'), 'input' => array(array('label' => $this->l('Logs storage activation:'), 'type' => 'radio', 'name' => 'logs_reco_file_generation', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'logs_reco_file_generation_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'logs_reco_file_generation_off', 'value' => 0, 'label' => $this->l('No'))), 'required' => true, 'desc' => $this->l('The logs files are stored in the folder "logs" of the module'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('URL of the recommendations server:'), 'type' => 'text', 'name' => 'server_url_recommendations', 'size' => 50, 'required' => true, 'desc' => $this->l('Url called to get the recommendations from the prediggo solution'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('type' => 'button', 'name' => 'mainRecommendationConfSubmit', 'class' => 'button', 'title' => $this->l(' Save '), 'disabled' => (int) $iShopContext ? 'disabled' : ''))); $this->fields_value['logs_reco_file_generation'] = (int) $this->oPrediggoConfig->logs_reco_file_generation; $this->fields_value['server_url_recommendations'] = $this->oPrediggoConfig->server_url_recommendations; /* * HOMEPAGE RECOMMENDATIONS */ $this->fields_form['home_reco_conf']['form'] = array('legend' => array('title' => $this->l('Home page configuration'), 'image' => _PS_ADMIN_IMG_ . 'picture.gif'), 'input' => array(array('label' => $this->l('Display the recommendations block:'), 'type' => 'radio', 'name' => 'home_recommendations', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'home_recommendations_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'home_recommendations_off', 'value' => 0, 'label' => $this->l('No'))), 'required' => true, 'desc' => $this->l('Add a block of recommended products in the homepage of your website'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Number of items in the recommendations block:'), 'type' => 'text', 'name' => 'home_nb_items', 'desc' => $this->l('Number of recommended products in the block'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Title of the recommendation block :'), 'type' => 'text', 'size' => 50, 'name' => 'home_block_title', 'lang' => true, 'desc' => $this->l('Title of the block'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('type' => 'button', 'name' => 'exportHomeRecommendationConfSubmit', 'class' => 'button', 'title' => $this->l(' Save '), 'disabled' => (int) $iShopContext ? 'disabled' : ''))); $this->fields_value['home_recommendations'] = (int) $this->oPrediggoConfig->home_recommendations; $this->fields_value['home_nb_items'] = (int) $this->oPrediggoConfig->home_nb_items; $this->fields_value['home_block_title'] = $this->oPrediggoConfig->home_block_title; /* * 404 PAGE RECOMMENDATIONS */ $this->fields_form['error_reco_conf']['form'] = array('legend' => array('title' => $this->l('404 page configuration'), 'image' => _PS_ADMIN_IMG_ . 'picture.gif'), 'input' => array(array('label' => $this->l('Display the recommendations block:'), 'type' => 'radio', 'name' => 'error_recommendations', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'error_recommendations_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'error_recommendations_off', 'value' => 0, 'label' => $this->l('No'))), 'required' => true, 'desc' => $this->l('Add a block of recommended products in the 404 page of your website'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Number of items in the recommendations block:'), 'type' => 'text', 'name' => 'error_nb_items', 'desc' => $this->l('Number of recommended products in the block'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Title of the recommendation block :'), 'type' => 'text', 'name' => 'error_block_title', 'size' => 50, 'lang' => true, 'desc' => $this->l('Title of the block'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('type' => 'button', 'name' => 'export404RecommendationConfSubmit', 'class' => 'button', 'title' => $this->l(' Save '), 'disabled' => (int) $iShopContext ? 'disabled' : ''))); $this->fields_value['error_recommendations'] = (int) $this->oPrediggoConfig->error_recommendations; $this->fields_value['error_nb_items'] = (int) $this->oPrediggoConfig->error_nb_items; $this->fields_value['error_block_title'] = $this->oPrediggoConfig->error_block_title; /* * PRODUCT PAGE RECOMMENDATIONS */ $this->fields_form['product_reco_conf']['form'] = array('legend' => array('title' => $this->l('Product page configuration'), 'image' => _PS_ADMIN_IMG_ . 'picture.gif'), 'input' => array(array('label' => $this->l('Display the recommendations block:'), 'type' => 'radio', 'name' => 'product_recommendations', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'product_recommendations_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'product_recommendations_off', 'value' => 0, 'label' => $this->l('No'))), 'required' => true, 'desc' => $this->l('Add a block of recommended products in the products pages of your website'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Number of items in the recommendations block:'), 'type' => 'text', 'name' => 'product_nb_items', 'desc' => $this->l('Number of recommended products in the block'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Title of the recommendation block :'), 'type' => 'text', 'name' => 'product_block_title', 'size' => 50, 'lang' => true, 'desc' => $this->l('Title of the block'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('type' => 'button', 'name' => 'exportProductRecommendationConfSubmit', 'class' => 'button', 'title' => $this->l(' Save '), 'disabled' => (int) $iShopContext ? 'disabled' : ''))); $this->fields_value['product_recommendations'] = (int) $this->oPrediggoConfig->product_recommendations; $this->fields_value['product_nb_items'] = (int) $this->oPrediggoConfig->product_nb_items; $this->fields_value['product_block_title'] = $this->oPrediggoConfig->product_block_title; /* * CATEGORY PAGE RECOMMENDATIONS */ $this->fields_form['category_reco_conf']['form'] = array('legend' => array('title' => $this->l('Category page configuration'), 'image' => _PS_ADMIN_IMG_ . 'picture.gif'), 'input' => array(array('label' => $this->l('Display the recommendations block:'), 'type' => 'radio', 'name' => 'category_recommendations', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'category_recommendations_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'category_recommendations_off', 'value' => 0, 'label' => $this->l('No'))), 'required' => true, 'desc' => $this->l('Add a block of recommended products in the categories pages of your website'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Number of items in the recommendations block:'), 'type' => 'text', 'name' => 'category_nb_items', 'desc' => $this->l('Number of recommended products in the block'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Title of the recommendation block :'), 'type' => 'text', 'name' => 'category_block_title', 'size' => 50, 'lang' => true, 'desc' => $this->l('Title of the block'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('type' => 'button', 'name' => 'exportCategoryRecommendationConfSubmit', 'class' => 'button', 'title' => $this->l(' Save '), 'disabled' => (int) $iShopContext ? 'disabled' : ''))); $this->fields_value['category_recommendations'] = (int) $this->oPrediggoConfig->category_recommendations; $this->fields_value['category_nb_items'] = (int) $this->oPrediggoConfig->category_nb_items; $this->fields_value['category_block_title'] = $this->oPrediggoConfig->category_block_title; /* * CUSTOMER PAGE RECOMMENDATIONS */ $this->fields_form['customer_reco_conf']['form'] = array('legend' => array('title' => $this->l('Customers pages configuration'), 'image' => _PS_ADMIN_IMG_ . 'picture.gif'), 'input' => array(array('label' => $this->l('Display the recommendations block:'), 'type' => 'radio', 'name' => 'customer_recommendations', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'customer_recommendations_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'customer_recommendations_off', 'value' => 0, 'label' => $this->l('No'))), 'required' => true, 'desc' => $this->l('Add a block of recommended products in the customers pages of your website'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Number of items in the recommendations block:'), 'type' => 'text', 'name' => 'customer_nb_items', 'desc' => $this->l('Number of recommended products in the block'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Title of the recommendation block :'), 'type' => 'text', 'name' => 'customer_block_title', 'size' => 50, 'lang' => true, 'desc' => $this->l('Title of the block'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('type' => 'button', 'name' => 'exportCustomerRecommendationConfSubmit', 'class' => 'button', 'title' => $this->l(' Save '), 'disabled' => (int) $iShopContext ? 'disabled' : ''))); $this->fields_value['customer_recommendations'] = (int) $this->oPrediggoConfig->customer_recommendations; $this->fields_value['customer_nb_items'] = (int) $this->oPrediggoConfig->customer_nb_items; $this->fields_value['customer_block_title'] = $this->oPrediggoConfig->customer_block_title; /* * CART PAGE RECOMMENDATIONS */ $this->fields_form['cart_reco_conf']['form'] = array('legend' => array('title' => $this->l('Cart page configuration'), 'image' => _PS_ADMIN_IMG_ . 'picture.gif'), 'input' => array(array('label' => $this->l('Display the recommendations block:'), 'type' => 'radio', 'name' => 'cart_recommendations', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'cart_recommendations_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'cart_recommendations_off', 'value' => 0, 'label' => $this->l('No'))), 'required' => true, 'desc' => $this->l('Add a block of recommended products in the cart page of your website'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Number of items in the recommendations block:'), 'type' => 'text', 'name' => 'cart_nb_items', 'desc' => $this->l('Number of recommended products in the block'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Title of the recommendation block :'), 'type' => 'text', 'name' => 'cart_block_title', 'size' => 50, 'lang' => true, 'desc' => $this->l('Title of the block'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('type' => 'button', 'name' => 'exportCartRecommendationConfSubmit', 'class' => 'button', 'title' => $this->l(' Save '), 'disabled' => (int) $iShopContext ? 'disabled' : ''))); $this->fields_value['cart_recommendations'] = (int) $this->oPrediggoConfig->cart_recommendations; $this->fields_value['cart_nb_items'] = (int) $this->oPrediggoConfig->cart_nb_items; $this->fields_value['cart_block_title'] = $this->oPrediggoConfig->cart_block_title; /* * BLOCK LAYERED MODULE RECOMMENDATIONS */ $this->fields_form['blocklayered_reco_conf']['form'] = array('legend' => array('title' => $this->l('Block layered module configuration'), 'image' => _PS_ADMIN_IMG_ . 'picture.gif'), 'input' => array(array('label' => $this->l('Display the recommendations block:'), 'type' => 'radio', 'name' => 'blocklayered_recommendations', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'blocklayered_recommendations_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'blocklayered_recommendations_off', 'value' => 0, 'label' => $this->l('No'))), 'required' => true, 'desc' => $this->l('Add a block of recommended products in the block layered module'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Number of items in the recommendations block:'), 'type' => 'text', 'name' => 'blocklayered_nb_items', 'desc' => $this->l('Number of recommended products in the block'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Title of the recommendation block :'), 'type' => 'text', 'name' => 'blocklayered_block_title', 'size' => 50, 'lang' => true, 'desc' => $this->l('Title of the block'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('type' => 'button', 'name' => 'exportBlocklayeredRecommendationConfSubmit', 'class' => 'button', 'title' => $this->l(' Save '), 'disabled' => (int) $iShopContext ? 'disabled' : ''))); $this->fields_value['blocklayered_recommendations'] = (int) $this->oPrediggoConfig->blocklayered_recommendations; $this->fields_value['blocklayered_nb_items'] = (int) $this->oPrediggoConfig->blocklayered_nb_items; $this->fields_value['blocklayered_block_title'] = $this->oPrediggoConfig->blocklayered_block_title; /* * SEARCH MAIN CONFIGURATION */ $this->fields_form['search_conf']['form'] = array('legend' => array('title' => $this->l('Main search settings'), 'image' => _PS_ADMIN_IMG_ . 'search.gif'), 'input' => array(array('label' => $this->l('Display the search block:'), 'type' => 'radio', 'name' => 'search_active', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'search_active_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'search_active_off', 'value' => 0, 'label' => $this->l('No'))), 'required' => true, 'desc' => $this->l('Enable the search block in the front office'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Number of items per page:'), 'type' => 'text', 'name' => 'search_nb_items', 'desc' => $this->l('Number of products per page'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Minimum number of chars to launch a search:'), 'type' => 'text', 'name' => 'search_nb_min_chars', 'desc' => $this->l('Minimum number of character to allow the user to execute a search'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Logs storage activation:'), 'type' => 'radio', 'name' => 'logs_search_file_generation', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'logs_search_file_generation_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'logs_search_file_generation_off', 'value' => 0, 'label' => $this->l('No'))), 'required' => true, 'desc' => $this->l('The logs files are stored in the folder "logs" of the module'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('URL of the search server:'), 'type' => 'text', 'name' => 'server_url_search', 'desc' => $this->l('Url called to get the search from the prediggo solution'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Searchandizing activation:'), 'type' => 'radio', 'name' => 'searchandizing_active', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'searchandizing_active_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'searchandizing_active_off', 'value' => 0, 'label' => $this->l('No'))), 'required' => true, 'desc' => $this->l('Enable the searchandizing block in the front office'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Layered navigation activation:'), 'type' => 'radio', 'name' => 'layered_navigation_active', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'layered_navigation_active_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'layered_navigation_active_off', 'value' => 0, 'label' => $this->l('No'))), 'required' => true, 'desc' => $this->l('Enable the prediggo layered navigation in the search page of the front office'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('type' => 'button', 'name' => 'mainSearchConfSubmit', 'class' => 'button', 'title' => $this->l(' Save '), 'disabled' => (int) $iShopContext ? 'disabled' : ''))); $this->fields_value['search_active'] = (int) $this->oPrediggoConfig->search_active; $this->fields_value['search_nb_items'] = (int) $this->oPrediggoConfig->search_nb_items; $this->fields_value['search_nb_min_chars'] = (int) $this->oPrediggoConfig->search_nb_min_chars; $this->fields_value['logs_search_file_generation'] = (int) $this->oPrediggoConfig->logs_search_file_generation; $this->fields_value['server_url_search'] = $this->oPrediggoConfig->server_url_search; $this->fields_value['searchandizing_active'] = (int) $this->oPrediggoConfig->searchandizing_active; $this->fields_value['layered_navigation_active'] = (int) $this->oPrediggoConfig->layered_navigation_active; /* * SEARCH AUTOCOMPLETION CONFIGURATION */ $this->fields_form['search_autocompletion_conf']['form'] = array('legend' => array('title' => $this->l('Autocompletion configuration'), 'image' => _PS_ADMIN_IMG_ . 'download_page.png'), 'input' => array(array('label' => $this->l('Autocompletion activation:'), 'type' => 'radio', 'name' => 'autocompletion_active', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'autocompletion_active_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'autocompletion_active_off', 'value' => 0, 'label' => $this->l('No'))), 'required' => true, 'desc' => $this->l('Enable the prediggo autocompletion to propose words when the customer is typing his search'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Number of items in the search autocompletion:'), 'type' => 'text', 'name' => 'autocompletion_nb_items', 'desc' => $this->l('Number of products displayed in the prediggo autocompletion'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('Suggestion activation:'), 'type' => 'radio', 'name' => 'suggest_active', 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'suggest_active_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'suggest_active_off', 'value' => 0, 'label' => $this->l('No'))), 'required' => true, 'desc' => $this->l('Enable the prediggo suggestion to propose words when the customer is typing his search'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('label' => $this->l('List of suggestion:'), 'type' => 'text', 'name' => 'suggest_words', 'lang' => true, 'desc' => $this->l('List of keywords separated by comma (iPad 2, iPhone 4S, iPhone)'), 'disabled' => (int) $iShopContext ? 'disabled' : ''), array('type' => 'button', 'name' => 'exportSearchAutocompletionConfSubmit', 'class' => 'button', 'title' => $this->l(' Save '), 'disabled' => (int) $iShopContext ? 'disabled' : ''))); $this->fields_value['autocompletion_active'] = (int) $this->oPrediggoConfig->autocompletion_active; $this->fields_value['autocompletion_nb_items'] = (int) $this->oPrediggoConfig->autocompletion_nb_items; $this->fields_value['suggest_active'] = (int) $this->oPrediggoConfig->suggest_active; $this->fields_value['suggest_words'] = $this->oPrediggoConfig->suggest_words; $this->context->controller->getLanguages(); $helper = $this->initForm(); $helper->submit_action = ''; $helper->title = $this->l('Prediggo configuration'); if (Shop::getContext() == Shop::CONTEXT_SHOP) { $helper->title .= ' [ ' . $this->l('Shop') . ' : ' . $this->context->shop->name . ' ]'; } else { $helper->title .= ' [ ' . $this->l('All shops') . ' ]'; } $helper->fields_value = $this->fields_value; $this->_html .= $helper->generateForm($this->fields_form); }
protected function getReadableFields($fields) { global $cookie; $titles = array('id_product' => array('name' => $this->l('Product ID', __CLASS__), 'class' => 'prodRel'), 'active' => array('name' => $this->l('Product status', __CLASS__), 'class' => 'prodRel'), 'date_add' => array('name' => $this->l('Addition date', __CLASS__), 'class' => 'prodRel'), 'date_upd' => array('name' => $this->l('Update date', __CLASS__), 'class' => 'prodRel'), 'id_category_default' => array('name' => $this->l('Default Category ID', __CLASS__), 'class' => 'prodRel'), 'id_manufacturer' => array('name' => $this->l('Manufacturer ID', __CLASS__), 'class' => 'prodRel'), 'id_supplier' => array('name' => $this->l('Supplier ID', __CLASS__), 'class' => 'prodRel'), 'id_tax' => array('name' => $this->l('Tax ID', __CLASS__), 'class' => 'prodRel'), 'description' => array('name' => $this->l('Description', __CLASS__), 'class' => 'prodRel'), 'description_short' => array('name' => $this->l('Short Description', __CLASS__), 'class' => 'prodRel'), 'meta_description' => array('name' => $this->l('Meta Description', __CLASS__), 'class' => 'prodRel'), 'meta_keywords' => array('name' => $this->l('Meta Keywords', __CLASS__), 'class' => 'prodRel'), 'meta_title' => array('name' => $this->l('Meta Title', __CLASS__), 'class' => 'prodRel'), 'quantity' => array('name' => $this->l('Quantity in stock', __CLASS__), 'class' => 'prodRel'), 'name' => array('name' => $this->l('Product\'s name', __CLASS__), 'class' => 'prodRel'), 'reference' => array('name' => $this->l('Reference', __CLASS__), 'class' => 'prodRel'), 'supplier_reference' => array('name' => $this->l('Supplier\'s Reference', __CLASS__), 'class' => 'prodRel'), 'weight' => array('name' => $this->l('Weight', __CLASS__), 'class' => 'prodRel'), 'wholesale_price' => array('name' => $this->l('Wholesale Price', __CLASS__), 'class' => 'prodRel'), 'price' => array('name' => $this->l('Price', __CLASS__), 'class' => 'prodRel'), 'ecotax' => array('name' => $this->l('Ecotax', __CLASS__), 'class' => 'prodRel'), 'location' => array('name' => $this->l('Location', __CLASS__), 'class' => 'prodRel'), 'ean13' => array('name' => $this->l('Ean13', __CLASS__), 'class' => 'prodRel'), 'reduction_from' => array('name' => $this->l('Reduction from', __CLASS__), 'class' => 'prodRel'), 'reduction_to' => array('name' => $this->l('Reduction to', __CLASS__), 'class' => 'prodRel'), 'reduction_percent' => array('name' => $this->l('Reduction percent', __CLASS__), 'class' => 'prodRel'), 'reduction_price' => array('name' => $this->l('Reduction price', __CLASS__), 'class' => 'prodRel'), 'available_now' => array('name' => $this->l('Available now', __CLASS__), 'class' => 'prodRel'), 'available_later' => array('name' => $this->l('Available later', __CLASS__), 'class' => 'prodRel'), 'available_for_order' => array('name' => $this->l('Available for order', __CLASS__), 'class' => 'prodRel'), 'additional_shipping_cost' => array('name' => $this->l('Additional shipping cost', __CLASS__), 'class' => 'prodRel'), 'condition' => array('name' => $this->l('Condition', __CLASS__), 'class' => 'prodRel'), 'height' => array('name' => $this->l('Height', __CLASS__), 'class' => 'prodRel'), 'width' => array('name' => $this->l('Width', __CLASS__), 'class' => 'prodRel'), 'depth' => array('name' => $this->l('Depth', __CLASS__), 'class' => 'prodRel'), 'upc' => array('name' => $this->l('UPC', __CLASS__), 'class' => 'prodRel'), 'show_price' => array('name' => $this->l('Show price', __CLASS__), 'class' => 'prodRel'), 'unit_price_ratio' => array('name' => $this->l('Unit Price ratio', __CLASS__), 'class' => 'prodRel'), 'online_only' => array('name' => $this->l('Online Only', __CLASS__), 'class' => 'prodRel'), 'minimal_quantity' => array('name' => $this->l('Minimal quantity', __CLASS__), 'class' => 'prodRel'), 'id_tax_rules_group' => array('name' => $this->l('Tax Rule Group ID', __CLASS__), 'class' => 'prodRel'), 'unity' => array('name' => $this->l('Unity', __CLASS__), 'class' => 'prodRel')); $result = array(); foreach ($fields as $field) { $result[$field] = isset($titles[$field]) ? $titles[$field] : array('name' => $field, 'class' => 'prodRel'); } $result['tax_rate'] = array('name' => $this->l('Tax Rate', __CLASS__), 'class' => 'prodRel'); $result['total_tax'] = array('name' => $this->l('Total Tax', __CLASS__), 'class' => 'prodRel'); $result['manufacturer_name'] = array('name' => $this->l('Manufacturer', __CLASS__), 'class' => 'prodRel'); $result['supplier_name'] = array('name' => $this->l('Supplier', __CLASS__), 'class' => 'prodRel'); $result['picture_link'] = array('name' => $this->l('Picture url', __CLASS__), 'class' => 'prodRel'); $result['product_link'] = array('name' => $this->l('Product url', __CLASS__), 'class' => 'prodRel'); $result['shipping_price'] = array('name' => $this->l('Shipping Price', __CLASS__), 'class' => 'prodRel'); $result['shipping_with_fee'] = array('name' => $this->l('Shipping price including COD fee', __CLASS__), 'class' => 'prodRel'); $result['category_name'] = array('name' => $this->l('Category Name', __CLASS__), 'class' => 'prodRel'); $result['price_with_tax'] = array('name' => $this->l('Price (tax incl)', __CLASS__), 'class' => 'prodRel'); uasort($result, array($this, 'cmpField')); //get group of attributes $attr_result = array(); $attrGroups = AttributeGroup::getAttributesGroups($cookie->id_lang); foreach ($attrGroups as $ag) { $attr_result['ag' . $ag['id_attribute_group']] = array('name' => $ag['name'], 'class' => 'attrRel'); } uasort($attr_result, array($this, 'cmpField')); $result = $result + $attr_result; //get features $feat_result = array(); $features = Feature::getFeatures($cookie->id_lang); foreach ($features as $ft) { $feat_result['ft' . $ft['id_feature']] = array('name' => $ft['name'], 'class' => 'featRel'); } uasort($feat_result, array($this, 'cmpField')); $result = $result + $feat_result; $result['empty_field'] = array('name' => $this->l('Empty Field', __CLASS__), 'class' => 'specialRel'); return $result; }
public function postProcess() { if (Tools::isSubmit('submitAddMultiFeature')) { $product = new Product((int) Tools::getValue('id_product')); // Delete all features $product->deleteFeatures(); // Get the features $features = Feature::getFeatures($this->context->language->id); $languages = Language::getLanguages(false); foreach ($features as $feature) { // Verify if the feature have normal value (not custom) $has_normal_value = QiMultiFeatureApi::HasThisFeatureNormalValue((int) $feature['id_feature']); // If the feature have custom feature value, make an input, else make a checkbox selector if ($has_normal_value == false) { $values = array(); // For each language, we get the post value foreach ($languages as $language) { if (Tools::getIsset($feature['id_feature'] . '_' . $language['id_lang'])) { $value_lang = Tools::getValue($feature['id_feature'] . '_' . $language['id_lang']); if (!empty($value_lang)) { $values[$language['id_lang']] = $value_lang; } } } // Add the feature custom value to the product if (!empty($values)) { QiMultiFeatureApi::addCustomFeatureToProductId($product->id, $feature['id_feature'], $language['id_lang'], $values); } } else { // Add checkbox value $feature_values = QiMultiFeatureApi::getValuesForFeatureId($feature['id_feature']); foreach ($feature_values as $feature_value) { $value_chk = Tools::getValue($feature['id_feature'] . '_' . $feature_value['id_feature_value']); // Add the feature value to the product if (!empty($value_chk)) { QiMultiFeatureApi::addFeatureToProduct($product->id, $feature['id_feature'], $feature_value['id_feature_value']); } } } } } else { parent::postProcess(); } }
/** * AdminController::renderForm() override * @see AdminController::renderForm() */ public function initFormFeatureValue() { $this->setTypeValue(); $this->fields_form[0]['form'] = array('legend' => array('title' => $this->l('Feature value'), 'icon' => 'icon-info-sign'), 'input' => array(array('type' => 'select', 'label' => $this->l('Feature'), 'name' => 'id_feature', 'options' => array('query' => Feature::getFeatures($this->context->language->id), 'id' => 'id_feature', 'name' => 'name'), 'required' => true), array('type' => 'text', 'label' => $this->l('Value'), 'name' => 'value', 'lang' => true, 'size' => 33, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}', 'required' => true)), 'submit' => array('title' => $this->l('Save')), 'buttons' => array('save-and-stay' => array('title' => $this->l('Save then add another value'), 'name' => 'submitAdd' . $this->table . 'AndStay', 'type' => 'submit', 'class' => 'btn btn-default pull-right', 'icon' => 'process-icon-save'))); $this->fields_value['id_feature'] = (int) Tools::getValue('id_feature'); // Create Object FeatureValue $feature_value = new FeatureValue(Tools::getValue('id_feature_value')); $this->tpl_vars = array('feature_value' => $feature_value); $this->getlanguages(); $helper = new HelperForm(); $helper->show_cancel_button = true; $back = Tools::safeOutput(Tools::getValue('back', '')); if (empty($back)) { $back = self::$currentIndex . '&token=' . $this->token; } if (!Validate::isCleanHtml($back)) { die(Tools::displayError()); } $helper->back_url = $back; $helper->currentIndex = self::$currentIndex; $helper->token = $this->token; $helper->table = $this->table; $helper->identifier = $this->identifier; $helper->override_folder = 'feature_value/'; $helper->id = $feature_value->id; $helper->toolbar_scroll = false; $helper->tpl_vars = $this->tpl_vars; $helper->languages = $this->_languages; $helper->default_form_language = $this->default_form_language; $helper->allow_employee_form_lang = $this->allow_employee_form_lang; $helper->fields_value = $this->getFieldsValue($feature_value); $helper->toolbar_btn = $this->toolbar_btn; $helper->title = $this->l('Add a new feature value'); $this->content .= $helper->generateForm($this->fields_form); }
public static function prepareTitle($data) { $product = new Product($data['real_id_product'], false, $data['id_lang']); $features = Feature::getFeatures($data['id_lang']); $features_product = $product->getFrontFeatures($data['id_lang']); $tags = array('{TITLE}', '{BRAND}', '{REFERENCE}', '{EAN}'); $values = array($data['name'], $data['manufacturer_name'], $data['reference'], $data['ean13']); foreach ($features as $feature) { $tags[] = trim(str_replace(' ', '_', Tools::strtoupper('{FEATURE_' . $feature['name'] . '}'))); $hasFeature = array_map(array('EbayRequest', 'getValueOfFeature'), $features_product, $feature); if (isset($hasFeature[0]) && $hasFeature[0]) { $values[] = $hasFeature[0]; } else { $values[] = ''; } } return EbaySynchronizer::fillTemplateTitle($tags, $values, $data['titleTemplate']); }
function displayFormFeatures($obj) { global $cookie, $currentIndex; parent::displayForm(); if ($obj->id) { $feature = Feature::getFeatures((int) $cookie->id_lang); $ctab = ''; foreach ($feature as $tab) { $ctab .= 'ccustom_' . $tab['id_feature'] . '¤'; } $ctab = rtrim($ctab, '¤'); echo ' <table cellpadding="5"> <tr> <td colspan="2"> <b>' . $this->l('Assign features to this product:') . '</b><br /> <ul style="margin: 10px 0 0 20px;"> <li>' . $this->l('You can specify a value for each relevant feature regarding this product, empty fields will not be displayed.') . '</li> <li>' . $this->l('You can either set a specific value, or select among existing pre-defined values you added previously.') . '</li> </ul> </td> </tr> </table> <hr style="width:100%;" /><br />'; // Header $nb_feature = Feature::nbFeatures((int) $cookie->id_lang); echo ' <table border="0" cellpadding="0" cellspacing="0" class="table" style="width:900px;"> <tr> <th>' . $this->l('Feature') . '</td> <th style="width:30%">' . $this->l('Pre-defined value') . '</td> <th style="width:40%"><u>' . $this->l('or') . '</u> ' . $this->l('Customized value') . '</td> </tr>'; if (!$nb_feature) { echo '<tr><td colspan="3" style="text-align:center;">' . $this->l('No features defined') . '</td></tr>'; } echo '</table>'; // Listing if ($nb_feature) { echo ' <table cellpadding="5" style="width: 900px; margin-top: 10px">'; foreach ($feature as $tab_features) { $current_item = false; $custom = true; foreach ($obj->getFeatures() as $tab_products) { if ($tab_products['id_feature'] == $tab_features['id_feature']) { $current_item = $tab_products['id_feature_value']; } } $featureValues = FeatureValue::getFeatureValuesWithLang((int) $cookie->id_lang, (int) $tab_features['id_feature']); echo ' <tr> <td>' . $tab_features['name'] . '</td> <td style="width: 30%">'; if (sizeof($featureValues)) { echo ' <select id="feature_' . $tab_features['id_feature'] . '_value" name="feature_' . $tab_features['id_feature'] . '_value" onchange="$(\'.custom_' . $tab_features['id_feature'] . '_\').val(\'\');"> <option value="0">--- </option>'; foreach ($featureValues as $value) { if ($current_item == $value['id_feature_value']) { $custom = false; } echo '<option value="' . $value['id_feature_value'] . '"' . ($current_item == $value['id_feature_value'] ? ' selected="selected"' : '') . '>' . substr($value['value'], 0, 40) . (Tools::strlen($value['value']) > 40 ? '...' : '') . ' </option>'; } echo '</select>'; } else { echo '<input type="hidden" name="feature_' . $tab_features['id_feature'] . '_value" value="0" /><span style="font-size: 10px; color: #666;">' . $this->l('N/A') . ' - <a href="index.php?tab=AdminFeatures&addfeature_value&id_feature=' . (int) $tab_features['id_feature'] . '&token=' . Tools::getAdminToken('AdminFeatures' . (int) Tab::getIdFromClassName('AdminFeatures') . (int) $cookie->id_employee) . '" style="color: #666; text-decoration: underline;">' . $this->l('Add pre-defined values first') . '</a></span>'; } echo ' </td> <td style="width:40%" class="translatable">'; $tab_customs = $custom ? FeatureValue::getFeatureValueLang($current_item) : array(); foreach ($this->_languages as $language) { echo ' <div class="lang_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none') . '; float: left;"> <textarea class="custom_' . $tab_features['id_feature'] . '_" name="custom_' . $tab_features['id_feature'] . '_' . $language['id_lang'] . '" cols="40" rows="1" onkeyup="if (isArrowKey(event)) return ;$(\'#feature_' . $tab_features['id_feature'] . '_value\').val(0);" >' . htmlentities(Tools::getValue('custom_' . $tab_features['id_feature'] . '_' . $language['id_lang'], FeatureValue::selectLang($tab_customs, $language['id_lang'])), ENT_COMPAT, 'UTF-8') . '</textarea> </div>'; } echo ' </td> </tr>'; } echo ' <tr> <td style="height: 50px; text-align: center;" colspan="3"><input type="submit" name="submitProductFeature" id="submitProductFeature" value="' . $this->l('Save modifications') . '" class="button" /></td> </tr>'; } echo '</table> <hr style="width:100%;" /> <div style="text-align:center;"> <a href="index.php?tab=AdminFeatures&addfeature&token=' . Tools::getAdminToken('AdminFeatures' . (int) Tab::getIdFromClassName('AdminFeatures') . (int) $cookie->id_employee) . '" onclick="return confirm(\'' . $this->l('You will lose all modifications not saved, you may want to save modifications first?', __CLASS__, true, false) . '\');"><img src="../img/admin/add.gif" alt="new_features" title="' . $this->l('Add a new feature') . '" /> ' . $this->l('Add a new feature') . '</a> </div>'; } else { echo '<b>' . $this->l('You must save this product before adding features') . '.</b>'; } }
private function _displayForm() { global $cookie; $genderTab = array(1 => 'M.', 2 => 'Mme', 9 => '', 0 => ''); $features = Feature::getFeatures($cookie->id_lang); $order_states = OrderState::getOrderStates($cookie->id_lang); $carriers = Carrier::getCarriers($cookie->id_lang); $countries = Country::getCountries($cookie->id_lang); $confs = Configuration::getMultiple(array('PS_SHOP_NAME', 'EMC_LOGIN', 'EMC_GENDER', 'EMC_LAST_NAME', 'EMC_FIRST_NAME', 'EMC_ADDRESS', 'EMC_ZIP_CODE', 'EMC_CITY', 'EMC_COUNTRY', 'EMC_PHONE', 'EMC_EMAIL')); $link = '<a href="http://www.envoimoinscher.com/inscription.html?tracking=prestashop_module_v1 &login='******'EMC_LOGIN']) ? htmlspecialchars($confs['EMC_LOGIN'], ENT_COMPAT, 'UTF-8') : '') . ' &facturation.contact_civ=' . (isset($genderTab[(int) Configuration::get('EMC_GENDER')]) ? htmlspecialchars($genderTab[(int) Configuration::get('EMC_GENDER')], ENT_COMPAT, 'UTF-8') : '') . ' &facturation.contact_ste=' . (isset($confs['PS_SHOP_NAME']) ? htmlspecialchars($confs['PS_SHOP_NAME'], ENT_COMPAT, 'UTF-8') : '') . ' &facturation.contact_nom=' . (isset($confs['EMC_LAST_NAME']) ? htmlspecialchars($confs['EMC_LAST_NAME'], ENT_COMPAT, 'UTF-8') : '') . ' &facturation.contact_prenom=' . (isset($confs['EMC_FIRST_NAME']) ? htmlspecialchars($confs['EMC_FIRST_NAME'], ENT_COMPAT, 'UTF-8') : '') . ' &user_type=entreprise&facturation.pz_id=' . (isset($confs['EMC_COUNTRY']) ? htmlspecialchars($confs['EMC_COUNTRY'], ENT_COMPAT, 'UTF-8') : '') . ' &facturation.adresse1=' . (isset($confs['EMC_ADDRESS']) ? htmlspecialchars($confs['EMC_ADDRESS'], ENT_COMPAT, 'UTF-8') : '') . ' &facturation.contact_cp=' . (isset($confs['EMC_ZIP_CODE']) ? htmlspecialchars($confs['EMC_ZIP_CODE'], ENT_COMPAT, 'UTF-8') : '') . ' &facturation.contact_ville=' . (isset($confs['EMC_CITY']) ? htmlspecialchars($confs['EMC_CITY'], ENT_COMPAT, 'UTF-8') : '') . ' &facturation.contact_tel=' . (isset($confs['EMC_PHONE']) ? htmlspecialchars($confs['EMC_PHONE'], ENT_COMPAT, 'UTF-8') : '') . ' &facturation.contact_email=' . (isset($confs['EMC_EMAIL']) ? htmlspecialchars($confs['EMC_EMAIL'], ENT_COMPAT, 'UTF-8') : '') . ' &url_renvoi=' . urlencode(Tools::getProtocol() . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . Tools::safeOutput($_SERVER['REQUEST_URI'])) . '">'; $this->_html .= '<form action="' . Tools::safeOutput($_SERVER['REQUEST_URI']) . '" method="post" class="form"> <div style="float: right; width: 440px; height: 165px; border: 1px dashed rgb(102, 102, 102); padding: 8px; margin-left: 12px;margin-top: 11px;">' . $link . ' <h3>' . $this->l('Create Envoimoinscher account:') . '</h3> <p style="text-align:justify">' . $this->l('To create your account on Envoimoinscher, click the image below. You will go to a dedicated personal space where you will find the necessary tools for easy management of your shipments.') . '</p> <img src="' . $this->_path . '/ps_emc.png" alt="" /></a> </div> <fieldset style="width:420px;float:left"><legend><img src="' . $this->_path . 'logo.gif" alt="" /> ' . $this->l('Description') . '</legend> <img style="float:left;margin-right:10px" src="' . $this->_path . 'logocarre.png" alt="" /><p style="text-align:justify"><b>' . $this->l('This module allows you to compare carrier offers and online ordering services\' negotiated delivery rates.') . '</b></p> <p style="text-align:justify">' . $this->l('Please enter your Envoimoinscher username below. If you are not a customer Envoimoinscher, you can easily create an account by clicking') . $link . ' ' . $this->l('here') . '.</a></p><br> <h3 style="text-align:center"><a href="http://www.prestashop.com/download/partner_modules/docs/doc_emc.pdf">' . $this->l('Download Documentation') . '</a></h3> </fieldset> <div class="clear"> </div> <fieldset class="width2"><legend><img src="' . $this->_path . 'logo.gif" alt="" /> ' . $this->l('Settings') . '</legend> <label>' . $this->l('Width') . ' : </label> <div class="margin-form"> <select name="EMC_WIDTH"> <option value="O">' . $this->l('Choose a feature ...') . '</option>'; foreach ($features as $feature) { $this->_html .= '<option value="' . (int) $feature['id_feature'] . '" ' . ((int) Tools::getValue('EMC_WIDTH', (int) Configuration::get('EMC_WIDTH')) == (int) $feature['id_feature'] ? ' selected="selected" ' : '') . ' > ' . htmlspecialchars($feature['name'], ENT_COMPAT, 'UTF-8') . '</option>'; } $this->_html .= '</select> <sup> *</sup> <p>' . $this->l('Choose width in the list') . '</p> </div> <div class="clear"> </div> <label>' . $this->l('Height') . ' : </label> <div class="margin-form"> <select name="EMC_HEIGHT"> <option value="O">' . $this->l('Choose a feature ...') . '</option>'; foreach ($features as $feature) { $this->_html .= '<option value="' . (int) $feature['id_feature'] . '" ' . ((int) Tools::getValue('EMC_HEIGHT', (int) Configuration::get('EMC_HEIGHT')) == (int) $feature['id_feature'] ? ' selected="selected" ' : '') . ' > ' . htmlspecialchars($feature['name'], ENT_COMPAT, 'UTF-8') . '</option>'; } $this->_html .= '</select> <sup> *</sup> <p>' . $this->l('Choose Height in the list') . '</p> </div> <div class="clear"> </div> <label>' . $this->l('Depth') . ' : </label> <div class="margin-form"> <select name="EMC_DEPTH"> <option value="O">' . $this->l('Choose a feature ...') . '</option>'; foreach ($features as $feature) { $this->_html .= '<option value="' . (int) $feature['id_feature'] . '" ' . ((int) Tools::getValue('EMC_DEPTH', (int) Configuration::get('EMC_DEPTH')) == (int) $feature['id_feature'] ? ' selected="selected" ' : '') . ' > ' . htmlspecialchars($feature['name'], ENT_COMPAT, 'UTF-8') . '</option>'; } $this->_html .= '</select> <sup> *</sup> <p>' . $this->l('Choose Depth in the list') . '</p> </div> <div class="clear"> </div> <label for="id_order_state">' . $this->l('Packaging') . ' :</label> <div class="margin-form"> <select name="EMC_PACKAGING_DEFAULT"> <option value="">' . $this->l('Choose packaging...') . '</option>'; foreach ($this->packaging as $package => $value) { $this->_html .= '<option ' . (Tools::getValue('EMC_PACKAGING_DEFAULT', Configuration::get('EMC_PACKAGING_DEFAULT')) == $value ? ' selected="selected" ' : '') . ' value="' . $value . '">' . htmlspecialchars($package, ENT_COMPAT, 'UTF-8') . '</option>'; } $this->_html .= '</select> <p>' . $this->l('Choose the default packaging.') . '</p> </div> <div class="clear"> </div> <label for="id_order_state">' . $this->l('Nature of content') . ' :</label> <div class="margin-form">' . self::selectNature(Tools::getValue('type_objet', Configuration::get('EMC_CONTENT'))) . '<p>' . $this->l('Choose the default nature of content.') . '</p> </div> <div class="clear"> </div> <label for="id_order_state">' . $this->l('Order state to export') . ' :</label> <div class="margin-form"> <select name="EMC_ORDER_STATE"> <option value="O">' . $this->l('Choose a state ...') . '</option>'; foreach ($order_states as $state) { $this->_html .= '<option value="' . (int) $state['id_order_state'] . '" style="background-color:' . $state['color'] . ';"'; if (Tools::getValue('EMC_ORDER_STATE', Configuration::get('EMC_ORDER_STATE')) == (int) $state['id_order_state']) { $this->_html .= ' selected="selected"'; } $this->_html .= '>' . htmlspecialchars($state['name'], ENT_COMPAT, 'UTF-8') . '</option>'; } $this->_html .= '</select> <sup> *</sup> <p>' . $this->l('Choose the order state to export to Envoi Moins Cher.') . '</p> </div> <div class="clear"> </div> <label>' . $this->l('Carrier') . ' : </label> <div class="margin-form"> <select name="EMC_CARRIER"> <option value="O">' . $this->l('Choose a carrier ...') . '</option>'; foreach ($carriers as $carrier) { $this->_html .= '<option value="' . (int) $carrier['id_carrier'] . '" ' . (Tools::getValue('EMC_CARRIER', Configuration::get('EMC_CARRIER')) == $carrier['id_carrier'] ? ' selected="selected" ' : '') . ' > ' . htmlspecialchars($carrier['name'], ENT_COMPAT, 'UTF-8') . '</option>'; } $this->_html .= '</select> <sup> *</sup> <p>' . $this->l('Choose a carrier in the list') . '</p> </div> <div class="clear"> </div> <label for="id_order_state">' . $this->l('Order state "Order past"') . ' :</label> <div class="margin-form"> <select name="EMC_ORDER_PAST_STATE"> <option value="O">' . $this->l('Choose a state ...') . '</option>'; foreach ($order_states as $state) { $this->_html .= '<option value="' . (int) $state['id_order_state'] . '" style="background-color:' . $state['color'] . ';"'; if (Tools::getValue('EMC_ORDER_PAST_STATE', Configuration::get('EMC_ORDER_PAST_STATE')) == $state['id_order_state']) { $this->_html .= ' selected="selected"'; } $this->_html .= '>' . htmlspecialchars($state['name'], ENT_COMPAT, 'UTF-8') . '</option>'; } $this->_html .= '</select> <sup> *</sup> <p>' . $this->l('Choose the order state past.') . '</p> </div> <div class="clear"> </div> <label for="id_order_state">' . $this->l('Order state send') . ' :</label> <div class="margin-form"> <select name="EMC_SEND_STATE"> <option value="O">' . $this->l('Choose a state ...') . '</option>'; foreach ($order_states as $state) { $this->_html .= '<option value="' . $state['id_order_state'] . '" style="background-color:' . $state['color'] . ';"'; if (Tools::getValue('EMC_SEND_STATE', Configuration::get('EMC_SEND_STATE')) == $state['id_order_state']) { $this->_html .= ' selected="selected"'; } $this->_html .= '>' . htmlspecialchars($state['name'], ENT_COMPAT, 'UTF-8') . '</option>'; } $this->_html .= '</select> <sup> *</sup> <p>' . $this->l('Choose the order state send.') . '</p> </div> <div class="clear"> </div>'; //objet livré (pas géré actuellement) $this->_html .= '<label for="id_order_state">' . $this->l('Order state delivered') . ' :</label> <div class="margin-form"> <select name="EMC_DELIVERY_STATE"> <option value="O">' . $this->l('Choose a state ...') . '</option>'; foreach ($order_states as $state) { $this->_html .= '<option value="' . (int) $state['id_order_state'] . '" style="background-color:' . $state['color'] . ';"'; if (Tools::getValue('EMC_DELIVERY_STATE', (int) Configuration::get('EMC_DELIVERY_STATE')) == (int) $state['id_order_state']) { $this->_html .= ' selected="selected"'; } $this->_html .= '>' . htmlspecialchars($state['name'], ENT_COMPAT, 'UTF-8') . '</option>'; } $this->_html .= '</select> <sup> *</sup> <p>' . $this->l('Choose the order state delivered.') . '</p> </div> <div class="clear"> </div> '; $this->_html .= ' <label>' . $this->l('E-mail') . ' : </label> <div class="margin-form"> <input type="radio" name="EMC_EMAILS" id="active_on" value="7" ' . (Tools::getValue('EMC_EMAILS', Configuration::get('EMC_EMAILS')) ? 'checked="checked" ' : '') . '/> <label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Enabled') . '" /></label> <input type="radio" name="EMC_EMAILS" id="active_off" value="0" ' . (!Tools::getValue('EMC_EMAILS', Configuration::get('EMC_EMAILS')) ? 'checked="checked" ' : '') . '/> <label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" /></label> <p>' . $this->l('Enables or disables sending mail from EMC'); //.', '.$this->l('unless it informs the recipient that it is sent by default.').'</p> $this->_html .= '</div> <div class="clear"> </div> <label>' . $this->l('EMC Login') . ' : </label> <div class="margin-form"> <input type="text" name="EMC_LOGIN" value="' . htmlspecialchars(Tools::getValue('EMC_LOGIN', Configuration::get('EMC_LOGIN')), ENT_COMPAT, 'UTF-8') . '"> <sup> *</sup> <p>' . $this->l('Set your EMC login') . '</p> </div> <div class="clear"> </div> <p>----------------------------------------------------------------------------------------</p> <h2>' . $this->l('Sender Information') . ' : </h2> <label>' . $this->l('Gender') . ' : </label> <div class="margin-form"> <input name="EMC_GENDER" id="id_gender1" value="1" ' . (Tools::getValue('EMC_GENDER', Configuration::get('EMC_GENDER')) == 1 ? 'checked="checked"' : '') . ' type="radio"> M. <input name="EMC_GENDER" id="id_gender2" value="2" ' . (Tools::getValue('EMC_GENDER', Configuration::get('EMC_GENDER')) == 2 ? 'checked="checked"' : '') . ' type="radio"> Mme <p>' . $this->l('Select gender of sender') . '</p> </div> <div class="clear"> </div> <label>' . $this->l('Last name') . ' : </label> <div class="margin-form"> <input type="text" name="EMC_LAST_NAME" value="' . htmlspecialchars(Tools::getValue('EMC_LAST_NAME', Configuration::get('EMC_LAST_NAME')), ENT_COMPAT, 'UTF-8') . '"> <sup> *</sup> <p>' . $this->l('Set the Last Name of sender') . '</p> </div> <div class="clear"> </div> <label>' . $this->l('First name') . ' : </label> <div class="margin-form"> <input type="text" name="EMC_FIRST_NAME" value="' . htmlspecialchars(Tools::getValue('EMC_FIRST_NAME', Configuration::get('EMC_FIRST_NAME')), ENT_COMPAT, 'UTF-8') . '"> <sup> *</sup> <p>' . $this->l('Set the First name of sender') . '</p> </div> <div class="clear"> </div> <label>' . $this->l('Address') . ' : </label> <div class="margin-form"> <input size="40" type="text" name="EMC_ADDRESS" value="' . htmlspecialchars(Tools::getValue('EMC_ADDRESS', Configuration::get('EMC_ADDRESS')), ENT_COMPAT, 'UTF-8') . '"> <sup> *</sup> <p>' . $this->l('Set the Address of sender') . '</p> </div> <div class="clear"> </div> <label>' . $this->l('Zip code') . ' : </label> <div class="margin-form"> <input type="text" name="EMC_ZIP_CODE" value="' . htmlspecialchars(Tools::getValue('EMC_ZIP_CODE', Configuration::get('EMC_ZIP_CODE')), ENT_COMPAT, 'UTF-8') . '"> <sup> *</sup> <p>' . $this->l('Set the zip code of sender') . '</p> </div> <div class="clear"> </div> <label>' . $this->l('City') . ' : </label> <div class="margin-form"> <input type="text" name="EMC_CITY" value="' . htmlspecialchars(Tools::getValue('EMC_CITY', Configuration::get('EMC_CITY')), ENT_COMPAT, 'UTF-8') . '"> <sup> *</sup> <p>' . $this->l('Set the city of sender') . '</p> </div> <div class="clear"> </div> <label>' . $this->l('Country') . ' : </label> <div class="margin-form"> <select name="EMC_COUNTRY"> <option value="">' . $this->l('Choose a country ...') . '</option>'; foreach ($countries as $country) { $this->_html .= '<option value="' . htmlspecialchars($country['iso_code'], ENT_COMPAT, 'UTF-8') . '" '; if (Tools::getValue('EMC_COUNTRY', Configuration::get('EMC_COUNTRY')) == $country['iso_code']) { $this->_html .= ' selected="selected"'; } $this->_html .= '>' . htmlspecialchars($country['name'], ENT_COMPAT, 'UTF-8') . '</option>'; } $this->_html .= '</select> <sup> *</sup> <p>' . $this->l('Select the country of sender in the list') . '</p> </div> <div class="clear"> </div> <label>' . $this->l('Phone') . ' : </label> <div class="margin-form"> <input type="text" name="EMC_PHONE" value="' . htmlspecialchars(Tools::getValue('EMC_PHONE', Configuration::get('EMC_PHONE')), ENT_COMPAT, 'UTF-8') . '"> <sup> *</sup> <p>' . $this->l('Set the Phone of sender') . '</p> </div> <div class="clear"> </div> <label>' . $this->l('Email') . ' : </label> <div class="margin-form"> <input type="text" name="EMC_EMAIL" value="' . htmlspecialchars(Tools::getValue('EMC_EMAIL', Configuration::get('EMC_EMAIL')), ENT_COMPAT, 'UTF-8') . '"> <sup> *</sup> <p>' . $this->l('Set the e-mail of sender') . '</p> </div> <div class="clear"> </div> <div class="margin-form"> <input type="submit" value="' . $this->l('Save') . '" name="submitSave" class="button" style="margin:10px 0px 0px 25px;" /> </div> </fieldset></form> <div class="clear"> </div>'; }
private function _displayFormItemsSpecifics() { // Smarty $template_vars = array('id_tab' => Tools::safeOutput(Tools::getValue('id_tab')), 'controller' => Tools::getValue('controller'), 'tab' => Tools::getValue('tab'), 'configure' => Tools::getValue('configure'), 'tab_module' => Tools::getValue('tab_module'), 'module_name' => Tools::getValue('module_name'), 'token' => Tools::getValue('token'), 'ebay_token' => Configuration::get('EBAY_SECURITY_TOKEN'), '_module_dir_' => _MODULE_DIR_, 'ebay_categories' => EbayCategoryConfiguration::getEbayCategories(), 'id_lang' => $this->context->cookie->id_lang, '_path' => $this->_path, 'possible_attributes' => AttributeGroup::getAttributesGroups($this->context->cookie->id_lang), 'possible_features' => Feature::getFeatures($this->context->cookie->id_lang, true), 'date' => pSQL(date('Ymdhis')), 'conditions' => $this->_translatePSConditions(EbayCategoryConditionConfiguration::getPSConditions())); $this->smarty->assign($template_vars); return $this->display(dirname(__FILE__), '/views/templates/hook/formItemsSpecifics.tpl'); }
/** * Display the BO html with smart templates */ public function _displayForm() { global $smarty, $cookie; $smarty->assign(array('oModule' => $this, 'cookie' => $cookie)); $this->_html .= '<div id="prediggo_conf">'; // Display errors $smarty->assign(array('aPrediggoWarnings' => $this->_warnings, 'aPrediggoConfirmations' => $this->_confirmations, 'aPrediggoErrors' => $this->_errors)); $this->_html .= $this->display(__FILE__, 'bo_errors.tpl'); $this->_html .= $this->display(__FILE__, 'bo_tabs.tpl'); // Display Main Configuration management $smarty->assign(array('formAction' => Tools::safeOutput($_SERVER['REQUEST_URI']), 'oPrediggoConfig' => $this->oPrediggoConfig, 'aLanguages' => Language::getLanguages(false))); $this->_html .= $this->display(__FILE__, 'bo_main_conf.tpl'); // Get Export Attribute manager $aPrediggoAttributesGroups = explode(',', $this->oPrediggoExportConfig->attributes_groups_ids); $aPrediggoFeatures = explode(',', $this->oPrediggoExportConfig->features_ids); $smarty->assign(array('oPrediggoExportConfig' => $this->oPrediggoExportConfig, 'aPrediggoAttributesGroups' => $aPrediggoAttributesGroups, 'aPrediggoFeatures' => $aPrediggoFeatures, 'aGroupAttributes' => AttributeGroup::getAttributesGroups((int) $cookie->id_lang), 'aFeatures' => Feature::getFeatures((int) $cookie->id_lang))); $sAttributeManager = $this->display(__FILE__, 'bo_export_attribute_manager.tpl'); // Get Recommendations black list $aPrediggoProductsNotRecommendable = $this->oPrediggoExportConfig->products_ids_not_recommendable; if (!empty($aPrediggoProductsNotRecommendable)) { $aPrediggoProductsNotRecommendable = explode(',', $aPrediggoProductsNotRecommendable); foreach ($aPrediggoProductsNotRecommendable as $k => $iID) { $aPrediggoProductsNotRecommendable[$k] = new Product((int) $iID, false, (int) $cookie->id_lang); } } // Get Search black list $aPrediggoProductsNotSearchable = $this->oPrediggoExportConfig->products_ids_not_searchable; if (!empty($aPrediggoProductsNotSearchable)) { $aPrediggoProductsNotSearchable = explode(',', $aPrediggoProductsNotSearchable); foreach ($aPrediggoProductsNotSearchable as $k => $iID) { $aPrediggoProductsNotSearchable[$k] = new Product((int) $iID, false, (int) $cookie->id_lang); } } $smarty->assign(array('aPrediggoProductsNotRecommendable' => $aPrediggoProductsNotRecommendable, 'aPrediggoProductsNotSearchable' => $aPrediggoProductsNotSearchable)); $sBackListManager = $this->display(__FILE__, 'bo_black_lists.tpl'); // Display Export Configuration management $smarty->assign(array('sAttributeManager' => $sAttributeManager, 'sBackListManager' => $sBackListManager, 'sExportRepositoryPath' => $this->oDataExtractorController->getRepositoryPath(), 'sCronFilePath' => Tools::getShopDomain(true) . str_replace(_PS_ROOT_DIR_ . '/', __PS_BASE_URI__, $this->_path) . 'cron_export.php')); $this->_html .= $this->display(__FILE__, 'bo_export_conf.tpl'); // Display Recommendations Configuration management $smarty->assign(array('oPrediggoRecommendationConfig' => $this->oPrediggoRecommendationConfig)); $this->_html .= $this->display(__FILE__, 'bo_recommendation_conf.tpl'); // Display Recommendations Configuration management $smarty->assign(array('oPrediggoSearchConfig' => $this->oPrediggoSearchConfig)); $this->_html .= $this->display(__FILE__, 'bo_search_conf.tpl'); $this->_html .= '</div>'; }
function displayFormFeatures($obj, $languages, $defaultLanguage) { global $cookie, $currentIndex; if ($obj->id) { $feature = Feature::getFeatures(intval($cookie->id_lang)); $ctab = ''; foreach ($feature as $tab) { $ctab .= 'ccustom_' . $tab['id_feature'] . '¤'; } $ctab = rtrim($ctab, '¤'); echo ' <table cellpadding="5"> <tr> <td colspan="2"><b>' . $this->l('Assign features to this product') . '</b></td> </tr> </table> <hr style="width:730px;"><br />'; // Header $nb_feature = Feature::nbFeatures(intval($cookie->id_lang)); echo ' <table border="0" cellpadding="0" cellspacing="0" class="table" style="width:600px;"> <tr> <th>' . $this->l('Features') . '</td> <th style="width:220px">' . $this->l('Value') . '</td> <th style="width:170px">' . $this->l('Customized') . '</td> </tr>'; if (!$nb_feature) { echo '<tr><td colspan="3" style="text-align:center;">' . $this->l('No features defined') . '</td></tr>'; } echo '</table>'; // Listing if ($nb_feature) { echo ' <table cellpadding="5" style="width:600px; margin-top:10px">'; foreach ($feature as $tab_features) { $current_item = false; $custom = false; $product_features = $obj->getFeatures(); foreach ($product_features as $tab_products) { if ($tab_products['id_feature'] == $tab_features['id_feature']) { $current_item = $tab_products['id_feature_value']; } } echo ' <tr> <td>' . $tab_features['name'] . '</td> <td style="width:220px"> <select name="feature_' . $tab_features['id_feature'] . '_value"> <option value="0">--- </option>'; $feature_values = FeatureValue::getFeatureValues($tab_features['id_feature']); foreach ($feature_values as $tab_values) { if (!$tab_values['custom']) { $value = FeatureValue::selectLang(FeatureValue::getFeatureValueLang($tab_values['id_feature_value']), intval($cookie->id_lang)); echo '<option value="' . $tab_values['id_feature_value'] . '"' . ($current_item == $tab_values['id_feature_value'] ? ' selected="selected"' : '') . '>' . substr($value, 0, 40) . (Tools::strlen($value) > 40 ? '...' : '') . ' </option>'; } else { $custom = true; } } echo ' </select> </td> <td style="width:170px">'; $tab_customs = array(); if ($custom) { $tab_customs = FeatureValue::getFeatureValueLang($current_item); } foreach ($languages as $language) { $custom_lang = FeatureValue::selectLang($tab_customs, $language['id_lang']); echo ' <div id="ccustom_' . $tab_features['id_feature'] . '_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;"> <input type="text" name="custom_' . $tab_features['id_feature'] . '_' . $language['id_lang'] . '" size="20" value="' . htmlentities(Tools::getValue('custom_' . $tab_features['id_feature'] . '_' . $language['id_lang'], $custom_lang), ENT_COMPAT, 'UTF-8') . '" /> </div>'; } $this->displayFlags($languages, $defaultLanguage, $ctab, 'ccustom_' . $tab_features['id_feature']); echo ' </td> </tr>'; } echo ' <tr> <td> </td> <td style="height:50px; " valign="bottom"><input type="submit" name="submitProductFeature" id="submitProductFeature" value="' . $this->l('Update features') . '" class="button" /></td> </tr>'; } echo '</table> <hr style="width:730px;"> <div style="text-align:center;"> <a href="index.php?tab=AdminFeatures&addfeature&token=' . Tools::getAdminToken('AdminFeatures' . intval(Tab::getIdFromClassName('AdminFeatures')) . intval($cookie->id_employee)) . '" onclick="return confirm(\'' . $this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false) . '\');"><img src="../img/admin/add.gif" alt="new_features" title="' . $this->l('Create new features') . '" /> ' . $this->l('Create new features') . '</a> </div>'; } else { echo '<b>' . $this->l('You must save this product before adding features') . '.</b>'; } }
/** * Footer * @param $params * @return mixed */ public function hookFooter($params) { if (Context::getContext()->controller->php_self == 'category') { // Lists of featured with thim order $this->context->smarty->assign(array('aFeatureLists' => Feature::getFeatures(Context::getContext()->language->id))); return $this->context->smarty->fetch($this->module_dir . 'views/templates/hook/footer.tpl'); } }