diff --git a/adm/tabs/AdminProducts.php b/adm/tabs/AdminProducts.php
index e39153d4..be55e100 100755
--- a/adm/tabs/AdminProducts.php
+++ b/adm/tabs/AdminProducts.php
@@ -251,16 +251,16 @@ class AdminProducts extends AdminTab
// Position mise à 0
Db::getInstance()->Execute('
UPDATE `'._DB_PREFIX_.'category_product`
- SET `position` = 0
+ SET `position` = 0
WHERE `id_category` = '.(int)$this->_category->id
);
if (Tools::isSubmit('reorderproduct')) {
- // Récupération de tous les produits de la catégorie ordonée
+ // Récupération de tous les produits de la catégorie ordonée
// selon la position de la sous-catégorie puis de la position dans la sous catégorie et sinon par id_product
$first_products = Db::getInstance()->ExecuteS('
SELECT cp.*
- FROM `'._DB_PREFIX_.'category_product` cp
+ FROM `'._DB_PREFIX_.'category_product` cp
LEFT JOIN `'._DB_PREFIX_.'category` c ON (c.id_parent = cp.id_category)
LEFT JOIN `'._DB_PREFIX_.'category_product` cp2 ON (cp2.id_category = c.id_category AND cp2.id_product=cp.id_product)
RIGHT JOIN `'._DB_PREFIX_.'product` p ON (p.id_product=cp.id_product)
@@ -271,20 +271,20 @@ class AdminProducts extends AdminTab
');
$second_products = Db::getInstance()->ExecuteS('
SELECT cp.*
- FROM `'._DB_PREFIX_.'category_product` cp
+ FROM `'._DB_PREFIX_.'category_product` cp
RIGHT JOIN `'._DB_PREFIX_.'product` p ON (p.id_product=cp.id_product)
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product=p.id_product AND pl.`id_lang` = 1)
WHERE cp.id_category ='.(int)$this->_category->id.'
- AND cp.id_product NOT IN
+ AND cp.id_product NOT IN
(
SELECT cp2.id_product
- FROM `'._DB_PREFIX_.'category_product` cp2
+ FROM `'._DB_PREFIX_.'category_product` cp2
WHERE cp2.id_category IN
(
SELECT id_category
FROM `'._DB_PREFIX_.'category`
WHERE id_parent ='.(int)$this->_category->id.'
- )
+ )
)
ORDER BY pl.`name`
');
@@ -294,7 +294,7 @@ class AdminProducts extends AdminTab
} else {
$products = Db::getInstance()->ExecuteS('
SELECT cp.*
- FROM `'._DB_PREFIX_.'category_product` cp
+ FROM `'._DB_PREFIX_.'category_product` cp
RIGHT JOIN `'._DB_PREFIX_.'product` p ON (p.id_product=cp.id_product)
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product=p.id_product AND pl.`id_lang` = 1)
WHERE cp.id_category ='.(int)$this->_category->id.'
@@ -309,7 +309,7 @@ class AdminProducts extends AdminTab
}
Db::getInstance()->Execute('
UPDATE `'._DB_PREFIX_.'category_product`
- SET `position` = '. (int)($key) .'
+ SET `position` = '. (int)($key) .'
WHERE `id_product` = '.(int)($product['id_product']).'
AND `id_category`='.(int)$this->_category->id
);
@@ -1132,7 +1132,7 @@ class AdminProducts extends AdminTab
elseif (isset($_FILES['image_product']['tmp_name']) AND $_FILES['image_product']['tmp_name'] != NULL)
$this->copySingleImage($product->id, $image->id, $_FILES['image_product'], $method);
}
-
+
if (isset($image) AND Validate::isLoadedObject($image) AND !file_exists(_PS_PROD_IMG_DIR_.$image->getExistingImgPath().'.'.$image->image_format))
$image->delete();
if (sizeof($this->_errors))
@@ -1145,8 +1145,8 @@ class AdminProducts extends AdminTab
/* Adding new product images */
elseif (isset($_FILES['image_product']['name']) && is_array($_FILES['image_product']['name'])) {
-
- // ensure there is actually any file to process
+
+ // ensure there is actually any file to process
$has_any_file = false;
foreach ($_FILES['image_product']['name'] as $value) {
$has_any_file = $has_any_file || !empty($value);
@@ -1160,7 +1160,7 @@ class AdminProducts extends AdminTab
// reorganise the array into an indexed array
$images_product = [];
for ($i=sizeof($_FILES['image_product']['name']); $i>0; $i--) {
-
+
$images_product[] = [
'name' => '',
'type' => '',
@@ -1173,14 +1173,14 @@ class AdminProducts extends AdminTab
foreach ($_FILES['image_product'] as $key => $array_values) {
- $i=0;
+ $i=0;
foreach ($array_values as $value) {
$images_product[$i][$key] = $value;
$i++;
}
}
-
+
if (!Validate::isLoadedObject($product)) {
$this->_errors[] = Tools::displayError('Cannot add image because product add failed.');
}
@@ -1243,8 +1243,8 @@ class AdminProducts extends AdminTab
return $success;
}
-
- }
+
+ }
}
public function uploadImageZip($product)
@@ -1368,7 +1368,7 @@ class AdminProducts extends AdminTab
@unlink($tmpName);
Module::hookExec('watermark', array('id_image' => $id_image, 'id_product' => $id_product));
- }
+ }
}
/**
@@ -1533,13 +1533,13 @@ class AdminProducts extends AdminTab
$preview_url .= 'adtoken='.$token.'&ad='.$admin_dir;
}
Tools::redirectAdmin($preview_url);
- }
+ }
// Save and stay on same form
- elseif (Tools::isSubmit('submitAdd'.$this->table.'AndStay')
- OR ($id_image AND $id_image !== true))
+ elseif (Tools::isSubmit('submitAdd'.$this->table.'AndStay')
+ OR ($id_image AND $id_image !== true))
{
// Save and stay on same form
- if (Tools::isSubmit('submitAdd'.$this->table.'AndStay'))
+ if (Tools::isSubmit('submitAdd'.$this->table.'AndStay'))
{
Tools::redirectAdmin($currentIndex.'&id_product='.$object->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&addproduct&conf=4&tabs='.(int)(Tools::getValue('tabs')).'&token='.($token ? $token : $this->token));
}
@@ -1815,6 +1815,7 @@ class AdminProducts extends AdminTab
echo ' Description courte ';
echo ' Bon à savoir ';
echo ' Les plus ';
+ echo ' Commentaires (braderie) ';
echo ' Vidéos ';
echo ' Livraison ';
@@ -3404,6 +3405,16 @@ class AdminProducts extends AdminTab
echo '
';
+ echo '
+
+
+
+
'.$this->l('Comments :').'
+
';
+ foreach ($this->_languages as $language)
+ echo '
+
+
';
echo '
diff --git a/modules/braderie/AdminBraderie.php b/modules/braderie/AdminBraderie.php
index 58a595a8..fc345671 100644
--- a/modules/braderie/AdminBraderie.php
+++ b/modules/braderie/AdminBraderie.php
@@ -1,344 +1,406 @@
_html .= '';
+ $this->_html .= '';
- $id_category = Tools::getValue('id_category', 1);
- $id_product = Tools::getValue('id_product', false);
+ $id_category = Tools::getValue('id_category', 1);
+ $id_product = Tools::getValue('id_product', false);
- $db = Db::getInstance();
- /*$sql_category = '
- SELECT * FROM `'._DB_PREFIX_.'privatesale` ps
- LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON ps.`id_category` = cl.`id_category`
- WHERE ps.`braderie` = 1
- AND cl.`id_lang` = '.(int) $cookie->id_lang;*/
- $sql_category = '
- SELECT c.`id_category`, cl.`name` FROM `'._DB_PREFIX_.'category` c
- LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`
- WHERE c.`id_parent` = 1
- AND cl.`id_lang` = '.(int) $cookie->id_lang.'
- ORDER BY c.`id_category` DESC';
- $categories = $db->ExecuteS($sql_category);
+ $db = Db::getInstance();
+ /*$sql_category = '
+ SELECT * FROM `'._DB_PREFIX_.'privatesale` ps
+ LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON ps.`id_category` = cl.`id_category`
+ WHERE ps.`braderie` = 1
+ AND cl.`id_lang` = '.(int) $cookie->id_lang;*/
+ $sql_category = '
+ SELECT c.`id_category`, cl.`name` FROM `'._DB_PREFIX_.'category` c
+ LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`
+ WHERE c.`id_parent` = 1
+ AND cl.`id_lang` = '.(int) $cookie->id_lang.'
+ ORDER BY c.`id_category` DESC';
+ $categories = $db->ExecuteS($sql_category);
- $ids_categories = array();
- foreach ($categories as $key => $category) {
- $ids_categories[] = (int) $category["id_category"];
- }
+ $ids_categories = array();
+ foreach ($categories as $key => $category) {
+ $ids_categories[] = (int) $category["id_category"];
+ }
- $small_titles = array();
- foreach (Db::getInstance()->executeS('
- SELECT ex.`value`, ps.`id_category`
- FROM `'._DB_PREFIX_.'privatesale_extrafield_sale` ex
- LEFT JOIN `'._DB_PREFIX_.'privatesale` ps on ex.`id_sale` = ps.`id_sale`
- LEFT JOIN `'._DB_PREFIX_.'category` c on c.`id_category` = ps.`id_category`
- WHERE ex.`id_field` = 1
- AND ex.`id_lang` = '. (int) $cookie->id_lang.'
- AND c.`id_category` IN ('.implode(',', $ids_categories).')
- ') as $key => $data) {
- $small_titles[(int) $data['id_category']] = $data['value'];
- }
+ $small_titles = array();
+ foreach (Db::getInstance()->executeS('
+ SELECT ex.`value`, ps.`id_category`
+ FROM `'._DB_PREFIX_.'privatesale_extrafield_sale` ex
+ LEFT JOIN `'._DB_PREFIX_.'privatesale` ps on ex.`id_sale` = ps.`id_sale`
+ LEFT JOIN `'._DB_PREFIX_.'category` c on c.`id_category` = ps.`id_category`
+ WHERE ex.`id_field` = 1
+ AND ex.`id_lang` = '. (int) $cookie->id_lang.'
+ AND c.`id_category` IN ('.implode(',', $ids_categories).')
+ ') as $key => $data) {
+ $small_titles[(int) $data['id_category']] = $data['value'];
+ }
- $this->_html .= $this->_buildHtmlCategoryBlock($categories, $small_titles);
+ $this->_html .= $this->_buildHtmlCategoryBlock($categories, $small_titles);
- $this->_html .= '';
- $this->_html .= '';
- $this->_html .= '';
+ $this->_html .= '';
- echo $this->_html;
- }
+ });
+ ';
+ $iso = Language::getIsoById((int)($cookie->id_lang));
+ $isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en');
+ $ad = dirname($_SERVER["PHP_SELF"]);
+ $this->_html.= '
+
+
+
+ ';
+ echo $this->_html;
+ }
- private function _buildHtmlCategoryBlock($categories, $small_titles)
- {
- global $cookie;
+ private function _buildHtmlCategoryBlock($categories, $small_titles)
+ {
+ global $cookie;
- $token = Tools::getAdminToken('AdminBraderie'.(int)(Tab::getIdFromClassName('AdminBraderie')).(int)($cookie->id_employee));
+ $token = Tools::getAdminToken('AdminBraderie'.(int)(Tab::getIdFromClassName('AdminBraderie')).(int)($cookie->id_employee));
- $html = '
-
- ';
+ return $html;
+ }
}
diff --git a/modules/braderie/ajax.php b/modules/braderie/ajax.php
index 339ad38a..0766a603 100644
--- a/modules/braderie/ajax.php
+++ b/modules/braderie/ajax.php
@@ -59,7 +59,7 @@ function getProductId()
}
$result = Db::getInstance()->getRow('
- SELECT p.`id_product`, p.`reference`, pl.`name`, i.`id_image`
+ SELECT p.`id_product`, p.`reference`, pl.`name`, pl.`description_comment` as comments, i.`id_image`
FROM `'._DB_PREFIX_.'product` p
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product`)
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
@@ -71,7 +71,7 @@ function getProductId()
if (empty($result)) {
$result = Db::getInstance()->getRow('
- SELECT pa.*, pl.`name`, p.`reference` as product_reference, al.`name` as attribute_name, ia.`id_image` as id_image_attribute, i.`id_image`
+ SELECT pa.*, pl.`name`, pl.`description_comment` as comments, p.`reference` as product_reference, al.`name` as attribute_name, ia.`id_image` as id_image_attribute, i.`id_image`
FROM `'._DB_PREFIX_.'product_attribute` pa
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = pa.`id_product`)
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product`)
@@ -183,6 +183,8 @@ function addToSellout()
return Tools::displayError('L\'emplacement n\'est pas valide');
}
+ $comment = Tools::getValue('comment', false);
+
//$category_name = Tools::getValue('category_name', false);
//$product_name = Tools::getValue('product_name', false);
$ean13 = Tools::getValue('ean', false);
@@ -199,17 +201,6 @@ function addToSellout()
$languages = Language::getLanguages(false);
foreach ($languages as $key => $language) {
- /*if(!$category_name) {
- $category_name = Db::getInstance()->getRow('
- SELECT cl.`name`
- FROM `'._DB_PREFIX_.'category_lang` cl
- LEFT JOIN `'._DB_PREFIX_.'privatesale` ps ON (ps.`id_category` = cl.`id_category`)
- LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` pps ON (pps.`id_sale` = ps.`id_sale`)
- WHERE pps.`id_product` = '.(int)$id_product_old.'
- AND cl.`id_lang` = '.(int)$language['id_lang']
- );
- $category_name = $category_name['name'];
- }*/
// récupération de la catégorie originale (nom de la première catégorie)
$category_name = Db::getInstance()->getRow('
@@ -267,6 +258,9 @@ function addToSellout()
}
$product->id_category_default = (int)$category;
+ if ($comment) {
+ $product->description_comment[2] = $comment;
+ }
if ($product->add()) {
if (!$id_attribute) {
@@ -283,28 +277,12 @@ function addToSellout()
$product->UpdateCategories(array((int)$category,(int)$parent_category));
- /*$max_position = Db::getInstance()->getValue("SELECT MAX(cp.`position`) AS max FROM `"._DB_PREFIX_."category_product` cp WHERE cp.`id_category`=" . (int)$category);
- $add_category = Db::getInstance()->Execute("INSERT INTO `"._DB_PREFIX_."category_product` (`id_product`, `id_category`, `position`)
- VALUES (
- '". $product->id ."',
- '". (int)$category ."',
- '". (int)($max_position + 1 ) ."'
- )");
-
- $max_position_in_parent = Db::getInstance()->getValue("SELECT MAX(cp.`position`) AS max FROM `"._DB_PREFIX_."category_product` cp WHERE cp.`id_category`=" . (int)$parent_category);
- $add_parent_category = Db::getInstance()->Execute("INSERT INTO `"._DB_PREFIX_."category_product` (`id_product`, `id_category`, `position`)
- VALUES (
- '". $product->id ."',
- '". (int)$parent_category ."',
- '". (int)($max_position_in_parent + 1 ) ."'
- )");*/
-
if ($product->hasAttributes())
Product::updateDefaultAttribute($product->id);
Image::duplicateProductImages($id_product_old, $product->id, $combinationImages);
}
- return Tools::displayError('Le produit à été mis dans la braderie');
+ return Tools::displayError('Le produit ajoute dans la braderie');
}
function pSQLArray($data)
diff --git a/modules/bulkupdate/AdminEditFast.php b/modules/bulkupdate/AdminEditFast.php
index aa5037c1..13265c3e 100644
--- a/modules/bulkupdate/AdminEditFast.php
+++ b/modules/bulkupdate/AdminEditFast.php
@@ -8,16 +8,17 @@ class AdminEditFast extends AdminTab {
public function postProcess(){
if (Tools::isSubmit('submitEditFast')){
- $products = json_decode(Tools::getValue('id_product'), 0);
- $title = Tools::getValue('title');
- $short_description = Tools::getValue('short_description', array());
- $description = Tools::getValue('description', array());
- $description_more = Tools::getValue('description_more', array());
+ $products = json_decode(Tools::getValue('id_product'), 0);
+ $title = Tools::getValue('title');
+ $short_description = Tools::getValue('short_description', array());
+ $description = Tools::getValue('description', array());
+ $description_more = Tools::getValue('description_more', array());
+ $description_comment = Tools::getValue('description_comment', array());
$description_delivery = Tools::getValue('description_delivery', array());
- $videos = Tools::getValue('videos', array());
- $reference = Tools::getValue('reference');
- $id_lang_fast = Tools::getValue('id_lang_fast');
- $nbProduct = 0;
+ $videos = Tools::getValue('videos', array());
+ $reference = Tools::getValue('reference');
+ $id_lang_fast = Tools::getValue('id_lang_fast');
+ $nbProduct = 0;
foreach ($products as $key => $product) {
if (Validate::isLoadedObject($product = new Product((int)$product))) {
@@ -26,7 +27,7 @@ class AdminEditFast extends AdminTab {
// $product->name[$language['id_lang']] = $title[$product->id];
// }
// if(isset($short_description[$product->id])){
- // $product->description_short[$language['id_lang']] = $short_description[$product->id];
+ // $product->description_short[$language['id_lang']] = $short_description[$product->id];
// }
// if(isset($description[$product->id])){
// $product->description[$language['id_lang']] = $description[$product->id];
@@ -36,7 +37,7 @@ class AdminEditFast extends AdminTab {
$product->name[(int) $id_lang_fast] = $title[$product->id];
}
if (isset($short_description[$product->id])) {
- $product->description_short[(int) $id_lang_fast] = $short_description[$product->id];
+ $product->description_short[(int) $id_lang_fast] = $short_description[$product->id];
}
if(isset($description[$product->id])){
$product->description[(int) $id_lang_fast] = $description[$product->id];
@@ -44,6 +45,9 @@ class AdminEditFast extends AdminTab {
if(isset($description_more[$product->id])){
$product->description_more[(int) $id_lang_fast] = $description_more[$product->id];
}
+ if(isset($description_comment[$product->id])){
+ $product->description_comment[(int) $id_lang_fast] = $description_comment[$product->id];
+ }
if(isset($description_delivery[$product->id])){
$product->description_delivery[(int) $id_lang_fast] = $description_delivery[$product->id];
}
@@ -57,7 +61,7 @@ class AdminEditFast extends AdminTab {
if ($product->save()) {
$nbProduct++;
} else {
- $this->_html .= $product . " erreur";
+ $this->_html .= $product . " erreur";
}
} else {
$this->_html .= $product . " erreur";
@@ -78,6 +82,7 @@ class AdminEditFast extends AdminTab {
'short_description',
'description',
'description_more',
+ 'description_comment',
'description_delivery',
'videos'
);
@@ -103,7 +108,7 @@ class AdminEditFast extends AdminTab {
$this->_html .= '';
$this->_html .= '';
$this->_html .= '';
-
+
}else{
$this->_html .= "
Vous devez choisir des produits dans l'onglet Catalogue
";
}
@@ -119,7 +124,7 @@ class AdminEditFast extends AdminTab {
var pathCSS = \''._THEME_CSS_DIR_.'\' ;
var ad = \''.$ad.'\' ;
-
+
@@ -160,6 +165,11 @@ class AdminEditFast extends AdminTab {
$form .= '';
$form .= '