fix conflicts

This commit is contained in:
Marion Muszynski 2016-07-06 12:38:35 +02:00
commit 200ab432b5
2 changed files with 3257 additions and 3216 deletions

View File

@ -180,11 +180,12 @@ class AdminProducts extends AdminTab
if (Tools::isSubmit('editProduct')) {
global $cookie, $currentIndex;
$products = Tools::getValue('productBox');
$blocks = Tools::getValue('blocks');
$id_lang_fast = Tools::getValue('id_lang_fast');
$redirect = "/adm/index.php?tab=AdminEditFast";
$token_redirect = Tools::getAdminToken('AdminEditFast'.(int)(Tab::getIdFromClassName('AdminEditFast')).(int)($cookie->id_employee));
Tools::redirectAdmin($redirect . "&id_product=". json_encode($products)."&id_lang_fast=".(int) $id_lang_fast."&token=". $token_redirect);
Tools::redirectAdmin($redirect . "&id_product=". json_encode($products)."&id_lang_fast=".(int) $id_lang_fast."&blocks=". json_encode($blocks)."&token=". $token_redirect);
}
if (Tools::isSubmit('addCategoryProduct')) {

View File

@ -10,8 +10,11 @@ class AdminEditFast extends AdminTab {
if (Tools::isSubmit('submitEditFast')){
$products = json_decode(Tools::getValue('id_product'), 0);
$title = Tools::getValue('title');
$short_description = Tools::getValue('short_description');
$description = Tools::getValue('description');
$short_description = Tools::getValue('short_description', array());
$description = Tools::getValue('description', array());
$description_more = Tools::getValue('description_more', 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;
@ -38,6 +41,15 @@ class AdminEditFast extends AdminTab {
if(isset($description[$product->id])){
$product->description[(int) $id_lang_fast] = $description[$product->id];
}
if(isset($description_more[$product->id])){
$product->description_more[(int) $id_lang_fast] = $description_more[$product->id];
}
if(isset($description_delivery[$product->id])){
$product->description_delivery[(int) $id_lang_fast] = $description_delivery[$product->id];
}
if(isset($videos[$product->id])){
$product->videos[(int) $id_lang_fast] = $videos[$product->id];
}
if(isset($reference[$product->id])){
$product->reference = $reference[$product->id];
}
@ -62,16 +74,24 @@ class AdminEditFast extends AdminTab {
global $cookie;
$id_lang = Tools::getValue('id_lang_fast', $cookie->id_lang);
$language = new Language($id_lang);
$default_blocks = array(
'short_description',
'description',
'description_more',
'description_delivery',
'videos'
);
if (Tools::getIsset('id_product')) {
$this->_html .= '<h2>Edition rapide - '.$language->name.'</h2>';
$this->_html .= '<form method="POST" action="">';
$this->_html .= '<div id="accordion">';
$products = json_decode(Tools::getValue('id_product'));
$blocks = Tools::getIsset('blocks')? json_decode(Tools::getValue('blocks')) : $default_blocks;
foreach ($products as $key => $product) {
if (Validate::isLoadedObject($product = new Product((int)$product, FALSE, $id_lang) )) {
$this->_html .= self::displayFormProduct($product);
$this->_html .= self::displayFormProduct($product,$blocks);
} else {
$this->_html .= $product . " erreur";
}
@ -113,7 +133,7 @@ class AdminEditFast extends AdminTab {
echo $this->_html;
}
public function displayFormProduct(Product $product) {
public function displayFormProduct(Product $product, $blocks = array()) {
$form = '';
$form .= '<h3>'. $product->name .'</h3>';
$form .= '<div>';
@ -124,12 +144,32 @@ class AdminEditFast extends AdminTab {
$form .= '<label>Reference</label>';
$form .= '<input type="text" name="reference['.(int)$product->id.']" value="'.$product->reference.'" size="70" />';
$form .= '<br /><br />';
if (in_array('short_description',$blocks)) {
$form .= '<label>Description courte</label>';
$form .= '<textarea name="short_description['. (int) $product->id.']" class="rte" id="" cols="10" rows="10">'.$product->description_short.'</textarea>';
$form .= '<br /><br />';
$form .= '<label>Description longue</label>';
}
if (in_array('description',$blocks)) {
$form .= '<label>Bon à savoir</label>';
$form .= '<textarea name="description['. (int) $product->id.']" class="rte" id="" cols="10" rows="10">'.$product->description.'</textarea>';
$form .= '<br /><br />';
}
if (in_array('description_more',$blocks)) {
$form .= '<label>Les plus</label>';
$form .= '<textarea name="description_more['. (int) $product->id.']" class="rte" id="" cols="10" rows="10">'.$product->description_more.'</textarea>';
$form .= '<br /><br />';
}
if (in_array('videos',$blocks)) {
$form .= '<label>Videos</label>';
$form .= '<textarea name="videos['. (int) $product->id.']" class="rte" id="" cols="10" rows="10">'.$product->videos.'</textarea>';
$form .= '<br /><br />';
}
if (in_array('description_delivery',$blocks)) {
$form .= '<label>Livraison</label>';
$form .= '<textarea name="description_delivery['. (int) $product->id.']" class="rte" id="" cols="10" rows="10">'.$product->description_delivery.'</textarea>';
$form .= '<br /><br />';
}
$form .= '</fieldset>';
$form .= '</div>';