$product) { if (Validate::isLoadedObject($product = new Product((int)$product))) { // foreach ($languages as $key => $language) { // if(isset($title[$product->id])){ // $product->name[$language['id_lang']] = $title[$product->id]; // } // if(isset($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]; // } // } if (isset($title[$product->id])) { $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]; } 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]; } if ($product->save()) { $nbProduct++; } else { $this->_html .= $product . " erreur"; } } else { $this->_html .= $product . " erreur"; } } $this->_html .= '
'. $nbProduct. ' produit(s) mis à jour avec succès
'; } } public function display() { 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 .= '

Edition rapide - '.$language->name.'

'; $this->_html .= '
'; $this->_html .= '
'; $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,$blocks); } else { $this->_html .= $product . " erreur"; } } $this->_html .= '
'; $this->_html .= '
'; $this->_html .= '
'; $this->_html .= ''; $this->_html .= ''; $this->_html .= '
'; $this->_html .= '
'; }else{ $this->_html .= "
Vous devez choisir des produits dans l'onglet Catalogue
"; } // TinyMCE global $cookie; $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"]); echo ' '; echo $this->_html; } public function displayFormProduct(Product $product, $blocks = array()) { $form = ''; $form .= '

'. $product->name .'

'; $form .= '
'; $form .= '
'; $form .= ''; $form .= ''; $form .= '

'; $form .= ''; $form .= ''; $form .= '

'; if (in_array('short_description',$blocks)) { $form .= ''; $form .= ''; $form .= '

'; } if (in_array('description',$blocks)) { $form .= ''; $form .= ''; $form .= '

'; } if (in_array('description_more',$blocks)) { $form .= ''; $form .= ''; $form .= '

'; } if (in_array('videos',$blocks)) { $form .= ''; $form .= ''; $form .= '

'; } if (in_array('description_delivery',$blocks)) { $form .= ''; $form .= ''; $form .= '

'; } $form .= '
'; $form .= '
'; return $form; } }