本文整理汇总了PHP中Feature::getFeatures方法的典型用法代码示例。如果您正苦于以下问题:PHP Feature::getFeatures方法的具体用法?PHP Feature::getFeatures怎么用?PHP Feature::getFeatures使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Feature
的用法示例。
在下文中一共展示了Feature::getFeatures方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContent
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);
}
示例2: getContent
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);
}
示例3: renderForm
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();
}
示例4: initFormFeatures
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();
}
示例5: displayForm
/**
* 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>';
}
示例6: displayForm
/**
* 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>';
}
示例7: renderForm
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();
}
示例8: initFormFeatureValue
/**
* 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);
}
示例9: renderForm
/**
* 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)));
}
示例10: deletePrestashopDefaultFeatures
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;
}
示例11: getContent
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;
}
示例12: generateFeaturesData
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);
}
示例13: initContentForFeatures
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"]}));
}
示例14: initFormFeatures
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();
}
示例15: getReadableFields
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;
}