';
// select root category
$input = array(
'type' => 'select2',
'label' => $this->l('Root category'),
'label-class' => 'text-left',
'select-class' => 'text-left',
'name' => 'id_category',
'options' => $id_category_options,
);
echo $helperForm->generateInput($input);
echo '
';
// title
$input = array(
'type' => 'text',
'label' => $this->l('Title'),
// 'label-class' => 'col-md-2',
// 'input-class' => 'col-md-8',
'disabled' => true,
'name' => 'title',
'help' => $this->l('This value is set by the name of the root category for this sale.'),
'default' => ($this->cursale!==NULL? $categories_ordered[$this->cursale->id_category]['name']: (in_array($categories[0]['id_category'], $used_categories)? '': $categories[0]['name'])),
);
echo $helperForm->generateInput($input);
echo '
';
// Alias
$input = array(
'type' => 'text',
'label' => $this->l('Alias'),
// 'label-class' => 'col-md-2',
// 'input-class' => 'col-md-8',
'disabled' => true,
'name' => 'alias',
'help' => $this->l('This value is set by the alias of the root category for this sale.'),
'default' => ($this->cursale!==NULL? $categories_ordered[$this->cursale->id_category]['link_rewrite']: (in_array($categories[0]['id_category'], $used_categories)? '': $categories[0]['link_rewrite'])),
);
echo $helperForm->generateInput($input);
echo '
';
// Date start
$input = array(
'type' => 'simpleDate',
'id' => 'date_start',
'name' => 'date_start',
'label' => $this->l('Start date'),
// 'label-class' => 'control-label col-md-2',
// 'input-class' => 'col-md-7',
'after' => '
',
'value' => ($this->cursale!==NULL? $this->cursale->date_start: ''),
'required' => true,
);
echo $helperForm->generateInput($input);
echo '
';
// Date end
$input = array(
'type' => 'simpleDate',
'id' => 'date_end',
'name' => 'date_end',
'label' => $this->l('End date'),
// 'label-class' => 'control-label col-md-2',
// 'input-class' => 'col-md-7',
'after' => '
',
'value' => ($this->cursale!==NULL? $this->cursale->date_end: ''),
'required' => true,
);
echo $helperForm->generateInput($input);
echo '
';
echo '
';
// Status
$input = array(
'type' => 'switch',
'name' => 'enabled',
'label' => $this->l('Active :'),
// 'label_on' => '
',
// 'label_off' => '
',
'label-class' => 'col-sm-8',
'input-class' => 'col-sm-4',
'default' => ($this->cursale!==NULL?($this->cursale->enabled==0?0:1):0),
'checked' => ($this->cursale!==NULL?($this->cursale->enabled==0?0:1):0),
'required' => true,
);
echo $helperForm->generateInput($input);
echo '
';
// Display
$input = array(
'type' => 'switch',
'name' => 'logout',
'label' => $this->l('Affichage non inscrits :'),
// 'label_on' => '
',
// 'label_off' => '
',
'label-class' => 'col-sm-8',
'input-class' => 'col-sm-4',
'default' => ($this->cursale!==NULL?($this->cursale->logout==0?0:1):0),
'checked' => ($this->cursale!==NULL?($this->cursale->logout==0?0:1):0),
'required' => true,
);
echo $helperForm->generateInput($input);
echo '
';
// Public
$input = array(
'type' => 'switch',
'name' => 'pub',
'label' => $this->l('Public sale:'),
// 'label_on' => '
',
// 'label_off' => '
',
'label-class' => 'col-sm-8',
'input-class' => 'col-sm-4',
'default' => ($this->cursale!==NULL?($this->cursale->pub==0?0:1):0),
'checked' => ($this->cursale!==NULL?($this->cursale->pub==0?0:1):0),
'required' => true,
);
echo $helperForm->generateInput($input);
echo '
';
// Braderie
$input = array(
'type' => 'switch',
'name' => 'braderie',
'label' => $this->l('Braderie :'),
// 'label_on' => '
',
// 'label_off' => '
',
'label-class' => 'col-sm-8',
'input-class' => 'col-sm-4',
'default' => ($this->cursale!==NULL?($this->cursale->braderie==0?0:1):0),
'checked' => ($this->cursale!==NULL?($this->cursale->braderie==0?0:1):0),
'required' => true,
);
echo $helperForm->generateInput($input);
echo '
';
// Featured
$input = array(
'type' => 'switch',
'name' => 'featured',
'label' => $this->l('Featured sale:'),
// 'label_on' => '
',
// 'label_off' => '
',
'label-class' => 'col-sm-8',
'input-class' => 'col-sm-4',
'default' => ($this->cursale!==NULL?($this->cursale->featured==0?0:1):0),
'checked' => ($this->cursale!==NULL?($this->cursale->featured==0?0:1):0),
'required' => true,
);
echo $helperForm->generateInput($input);
echo '
';
// New
$input = array(
'type' => 'switch',
'name' => 'new',
'label' => $this->l('Nouveau :'),
// 'label_on' => '
',
// 'label_off' => '
',
'label-class' => 'col-sm-8',
'input-class' => 'col-sm-4',
'default' => ($this->cursale!==NULL?($this->cursale->new==0?0:1):0),
'checked' => ($this->cursale!==NULL?($this->cursale->new==0?0:1):0),
'required' => true,
);
echo $helperForm->generateInput($input);
echo '
';
// Newsletter
$input = array(
'type' => 'switch',
'name' => 'forward_news',
'label' => $this->l('Mise en avant Newsletter :'),
// 'label_on' => '
',
// 'label_off' => '
',
'label-class' => 'col-sm-8',
'input-class' => 'col-sm-4',
'default' => ($this->cursale!==NULL?($this->cursale->forward_news==0?0:1):0),
'checked' => ($this->cursale!==NULL?($this->cursale->forward_news==0?0:1):0),
'required' => true,
);
echo $helperForm->generateInput($input);
echo '
';
// Shipping only fr
$input = array(
'type' => 'switch',
'name' => 'shipping_fr',
'label' => $this->l('Livraison seulement en France :'),
// 'label_on' => '
',
// 'label_off' => '
',
'label-class' => 'col-sm-8',
'input-class' => 'col-sm-4',
'default' => ($this->cursale!==NULL?($this->cursale->shipping_fr==0?0:1):0),
'checked' => ($this->cursale!==NULL?($this->cursale->shipping_fr==0?0:1):0),
'required' => true,
);
echo $helperForm->generateInput($input);
echo '
';
$id_employee_options = array();
foreach(Employee::getEmployees() as $e) {
$id_employee_options[(int)$e['id_employee']] = array(
'label' => $e['name'],
'value' => (int) $e['id_employee']
);
if($this->cursale!==NULL && $this->cursale->id_employee==$e['id_employee']){
$id_employee_options[(int)$e['id_employee']]['selected'] = true;
}
}
// Employee manager
$input = array(
'type' => 'select2',
'label' => $this->l('Sale manager:'),
'label-class' => 'text-left',
'select-class' => 'text-left',
'name' => 'id_employee',
'options' => $id_employee_options,
'required' => true,
);
echo $helperForm->generateInput($input);
echo '
';
$id_delay_options = array(
array(
'label' => $this->l('Livraison classique'),
'value' => 1,
'selected' => ($this->cursale!==NULL && $this->cursale->delivery_delay== 1?true:false)
),
array(
'label' => $this->l('Livraison 48h'),
'value' => 2,
'selected' => ($this->cursale!==NULL && $this->cursale->delivery_delay== 2?true:false)
),
array(
'label' => $this->l('Livraison 7 Jours'),
'value' => 3,
'selected' => ($this->cursale!==NULL && $this->cursale->delivery_delay== 3?true:false)
),
array(
'label' => $this->l('Livraison 10 Jours'),
'value' => 4,
'selected' => ($this->cursale!==NULL && $this->cursale->delivery_delay== 4?true:false)
),
array(
'label' => $this->l('Livraison Noel'),
'value' => 5,
'selected' => ($this->cursale!==NULL && $this->cursale->delivery_delay== 5?true:false)
),
array(
'label' => $this->l('Produit Star'),
'value' => 6,
'selected' => ($this->cursale!==NULL && $this->cursale->delivery_delay== 6?true:false)
),
array(
'label' => $this->l('Livraison 72h'),
'value' => 7,
'selected' => ($this->cursale!==NULL && $this->cursale->delivery_delay== 7?true:false)
),
array(
'label' => $this->l('Livraison 48h Noel'),
'value' => 8,
'selected' => ($this->cursale!==NULL && $this->cursale->delivery_delay== 8?true:false)
),
);
// Delivery delay
$input = array(
'type' => 'select2',
'label' => $this->l('Délai de livraison :'),
'label-class' => 'text-left',
'select-class' => 'text-left',
'name' => 'delivery_delay',
'options' => $id_delay_options,
'required' => true,
);
echo $helperForm->generateInput($input);
echo '
';
$id_group_options = array();
foreach(Db::getInstance()->ExecuteS('
SELECT l.`id_group`, l.`name`'.($this->cursale !== NULL? ', (
SELECT IFNULL(g.`id_sale`, NULL) FROM `'._DB_PREFIX_.'privatesale_group` g WHERE l.`id_group` = g.`id_group` AND g.`id_sale` = '.$this->cursale->id.'
) AS `id_sale`': '').'
FROM `'._DB_PREFIX_.'group_lang` l
WHERE l.`id_lang` = '.$cookie->id_lang
) as $group) {
$id_group_options[(int)$group['id_group']] = array(
'label' => $group['name'],
'value' => (int) $group['id_group']
);
if(isset($group['id_sale']) && $group['id_sale'] !== NULL){
$id_group_options[(int)$group['id_group']]['selected'] = true;
}
if(!isset($this->cursale->id) && $group['id_group'] == 1){
$id_group_options[(int)$group['id_group']]['selected'] = true;
}
}
// Group
$input = array(
'type' => 'select2',
'label' => $this->l('Groups:'),
'label-class' => 'text-left',
'select-class' => 'text-left',
'name' => 'm_groups[]',
'id' => 'm_groups',
'option_all' => true,
'option_clear' => true,
'options' => $id_group_options,
'multiple' => true,
'placeholder' => $this->l('Select one or more groups...'),
'required' => true,
);
echo $helperForm->generateInput($input);
echo '
';
$id_version_options = array(
array(
'label'=> 'fr',
'value'=>'fr',
'selected'=>false,
),
array(
'label'=>'es',
'value'=>'es',
'selected'=>false,
),
);
foreach($id_version_options as &$version) {
if(isset($this->cursale->id) && in_array($version['value'], $this->cursale->versions)){
$version['selected'] = true;
}
if(!isset($this->cursale->id) && $version['value'] == 'fr') {
$version['selected'] = true;
}
}
// Version
$input = array(
'type' => 'select2',
'label' => $this->l('Versions :'),
'label-class' => 'text-left',
'select-class' => 'text-left',
'name' => 'm_versions[]',
'id' => 'm_versions',
'option_all' => true,
'option_clear' => true,
'options' => $id_version_options,
'multiple' => true,
'placeholder' => $this->l('Select one or more versions...'),
'required' => true,
);
echo $helperForm->generateInput($input);
echo '
';
$id_country_options = array();
$id_country_options[0] = array(
'label' => 'Choisir...',
'value' => (int) 0
);
foreach (Country::getCountries($cookie->id_lang, false) as $country) {
$id_country_options[(int)$country['id_country']] = array(
'label' => $country['name'],
'value' => (int) $country['id_country']
);
if($this->cursale!==NULL && $this->cursale->id_country==$country['id_country']){
$id_country_options[(int)$country['id_country']]['selected'] = true;
}
}
// country
$input = array(
'type' => 'select2',
'label' => $this->l('Pays de la Vente :'),
'label-class' => 'text-left',
'select-class' => 'text-left',
'name' => 'id_country',
'options' => $id_country_options,
'required' => true,
);
echo $helperForm->generateInput($input);
echo '
';
// if(Configuration::get('PRIVATESALES_CARRIERFENCE')) {
$carriers = Db::getInstance()->ExecuteS('
SELECT c.`id_carrier`, IF(c.`name` = "0", "'.Configuration::get('PS_SHOP_NAME').'", c.`name`) AS `name`'.($this->cursale !== NULL? ', (
SELECT IFNULL(p.`id_sale`, NULL) FROM `'._DB_PREFIX_.'privatesale_carrier` p WHERE c.`id_carrier` = p.`id_carrier` AND p.`id_sale` = '.$this->cursale->id.'
) AS `id_sale`': '').'
FROM `'._DB_PREFIX_.'carrier` c
WHERE c.`deleted` != 1
');
$carriers_default = Configuration::get('ANT_CARRIERS_SOCOL').','.Configuration::get('ANT_CARRIERS_MR');
$carriers_default = explode(',',Configuration::get('ANT_CARRIERS_SOCOL').','.Configuration::get('ANT_CARRIERS_MR'));
$carriers_dom = explode(',',Configuration::get('ANT_CARRIER_DOM'));
$carriers_drop = explode(',',Configuration::get('ANT_CARRIER_DROP'));
$id_carrier_options = array();
foreach ($carriers as $carrier) {
$id_carrier_options[$carrier['id_carrier']] = array(
'label' => $carrier['name'],
'value' => $carrier['id_carrier']
);
if(Tools::getIsset('edit') && (isset($carrier['id_sale']) && $carrier['id_sale'] !== NULL)) {
$id_carrier_options[$carrier['id_carrier']]['selected'] = true;
} elseif (!Tools::getIsset('edit') && in_array($carrier['id_carrier'], $carriers_default)) {
$id_carrier_options[$carrier['id_carrier']]['selected'] = true;
}
}
// Carriers
$input = array(
'type' => 'select2',
'label' => $this->l('Carriers :'),
'label-class' => 'text-left',
'select-class' => 'text-left',
'name' => 'm_carriers[]',
'id' => 'm_carriers',
'option_all' => true,
'option_clear' => true,
'options' => $id_carrier_options,
'multiple' => true,
'placeholder' => $this->l('Select one or more carriers...'),
'required' => true,
'buttons' => array(
array(
'label' => 'Classic',
'value' => '"'.implode('","',$carriers_default).'"',
'class' => 'defaut_for_',
),
array(
'label' => 'Dom',
'value' => '"'.implode('","',$carriers_dom).'"',
'class' => 'dom_for_',
),
array(
'label' => 'Dropshipping',
'value' => '"'.implode('","',$carriers_drop).'"',
'class' => 'drop_for_',
),
),
);
echo $helperForm->generateInput($input);
echo '
';
// Description
$input = array(
'type' => 'textarea',
'label' => $this->l('Description:'),
'lang' => true,
'name' => 'description',
'id' => 'description',
'required' => true,
'languages' => $this->_languages,
'id_langs' => $divLangName,
'link_flag_img' => '../img/l/',
'default' => ($this->cursale !== NULL?$this->cursale->description:'')
);
echo $helperForm->generateInput($input);
echo '
';
// Video
$input = array(
'type' => 'text',
'label' => $this->l('Video:'),
'lang' => true,
'name' => 'video',
'id' => 'video',
'required' => true,
'languages' => $this->_languages,
'id_langs' => $divLangName,
'link_flag_img' => '../img/l/',
'default' => ($this->cursale !== NULL?$this->cursale->video:'')
);
echo $helperForm->generateInput($input);
echo '
';
Module::hookExec('privatesales_edit', array('sale' => $this->cursale));
echo '