Merge branch 'ticket-adminProduct'
This commit is contained in:
commit
c0e5759f2d
@ -63,6 +63,9 @@ class AdminImport extends AdminTab
|
||||
'name' => array('AdminImport', 'createMultiLangField'),
|
||||
'description' => array('AdminImport', 'createMultiLangField'),
|
||||
'description_short' => array('AdminImport', 'createMultiLangField'),
|
||||
'description_more' => array('AdminImport', 'createMultiLangField'),
|
||||
'description_delivery' => array('AdminImport', 'createMultiLangField'),
|
||||
'videos' => array('AdminImport', 'createMultiLangField'),
|
||||
'meta_title' => array('AdminImport', 'createMultiLangField'),
|
||||
'meta_keywords' => array('AdminImport', 'createMultiLangField'),
|
||||
'meta_description' => array('AdminImport', 'createMultiLangField'),
|
||||
@ -165,6 +168,9 @@ class AdminImport extends AdminTab
|
||||
'quantity' => array('label' => $this->l('Quantity')),
|
||||
'description_short' => array('label' => $this->l('Short description')),
|
||||
'description' => array('label' => $this->l('Description')),
|
||||
'description_more' => array('label' => $this->l('Description More')),
|
||||
'description_delivery' => array('label' => $this->l('Description Delivery')),
|
||||
'videos' => array('label' => $this->l('Videos')),
|
||||
'tags' => array('label' => $this->l('Tags (x,y,z...)')),
|
||||
'meta_title' => array('label' => $this->l('Meta-title')),
|
||||
'meta_keywords' => array('label' => $this->l('Meta-keywords')),
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,70 @@
|
||||
<?php
|
||||
class Product extends ProductCore
|
||||
{
|
||||
public $description_more;
|
||||
public $description_delivery;
|
||||
public $videos;
|
||||
|
||||
/**
|
||||
* @Override
|
||||
*/
|
||||
protected $fieldsValidateLang = array(
|
||||
'meta_description' => 'isGenericName', 'meta_keywords' => 'isGenericName',
|
||||
'meta_title' => 'isGenericName', 'link_rewrite' => 'isLinkRewrite', 'name' => 'isCatalogName',
|
||||
'description' => 'isString', 'description_short' => 'isString', 'available_now' => 'isGenericName', 'available_later' => 'IsGenericName',
|
||||
'description_more' => 'isString','videos' => 'isString', 'description_delivery' => 'isString');
|
||||
|
||||
/**
|
||||
* @Override
|
||||
* Check then return multilingual fields for database interaction
|
||||
*
|
||||
* @return array Multilingual fields
|
||||
*/
|
||||
public function getTranslationsFieldsChild()
|
||||
{
|
||||
self::validateFieldsLang();
|
||||
|
||||
$fieldsArray = array('meta_description', 'meta_keywords', 'meta_title', 'link_rewrite', 'name', 'available_now', 'available_later');
|
||||
$fields = array();
|
||||
$languages = Language::getLanguages(false);
|
||||
$defaultLanguage = Configuration::get('PS_LANG_DEFAULT');
|
||||
foreach ($languages as $language)
|
||||
{
|
||||
$fields[$language['id_lang']]['id_lang'] = $language['id_lang'];
|
||||
$fields[$language['id_lang']][$this->identifier] = (int)($this->id);
|
||||
$fields[$language['id_lang']]['description'] = (isset($this->description[$language['id_lang']])) ? pSQL($this->description[$language['id_lang']], true) : '';
|
||||
$fields[$language['id_lang']]['description_short'] = (isset($this->description_short[$language['id_lang']])) ? pSQL($this->description_short[$language['id_lang']], true) : '';
|
||||
$fields[$language['id_lang']]['description_more'] = (isset($this->description_more[$language['id_lang']])) ? pSQL($this->description_more[$language['id_lang']], true) : '';
|
||||
$fields[$language['id_lang']]['videos'] = (isset($this->videos[$language['id_lang']])) ? pSQL($this->videos[$language['id_lang']], true) : '';
|
||||
$fields[$language['id_lang']]['description_delivery'] = (isset($this->description_delivery[$language['id_lang']])) ? pSQL($this->description_delivery[$language['id_lang']], true) : '';
|
||||
foreach ($fieldsArray as $field)
|
||||
{
|
||||
if (!Validate::isTableOrIdentifier($field))
|
||||
die(Tools::displayError());
|
||||
|
||||
/* Check fields validity */
|
||||
if (isset($this->{$field}[$language['id_lang']]) AND !empty($this->{$field}[$language['id_lang']]))
|
||||
$fields[$language['id_lang']][$field] = pSQL($this->{$field}[$language['id_lang']]);
|
||||
elseif (in_array($field, $this->fieldsRequiredLang))
|
||||
{
|
||||
if ($this->{$field} != '')
|
||||
$fields[$language['id_lang']][$field] = pSQL($this->{$field}[$defaultLanguage]);
|
||||
}
|
||||
else
|
||||
$fields[$language['id_lang']][$field] = '';
|
||||
}
|
||||
}
|
||||
return $fields;
|
||||
}
|
||||
|
||||
public function getCustomFields() {
|
||||
$customs_data = Db::getInstance()->getRow('
|
||||
SELECT `nc8`, `id_country`
|
||||
FROM `'._DB_PREFIX_.'product_customs`
|
||||
WHERE id_product = '.(int)$this->id
|
||||
);
|
||||
return $customs_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Override
|
||||
|
Loading…
Reference in New Issue
Block a user