Search the Community
Showing results for tags 'prestashop 1.7.7.2'.
-
Bonjour à tous, Dans le cadre d'un développement d'un module qui a pour but d'uploader une vidéo (voir image 1) ou d'insérer un lien d'une vidéo youtube (voir image 2) pour un produit donné. Le problème rencontré se situe au niveau de l'upload de la vidéo. J'obtiens le message d'erreur suivant : Ci-dessous le code récupéré directement dans le navigateur : <form name="form" id="form" method="post" class="form-horizontal product-page row justify-content-md-center" novalidate="novalidate" action="#" enctype="multipart/form-data"> .................................................................................. <div id="module_videoproduit" class="module-render-container module-videoproduit" style=""> <div> <div class="row test"> <div class="col-md-12"> <p class="subtitle"> Veuillez remplir les informations concernant la vidéo de votre produit </p> <div class="row"> <div class="form-group col-md-4"> <select name="choix" class="form-control" id="choix"> <option value="0"> </option> <option value="1"> Youtube </option> <option value="2"> Télécharger via votre ordinateur </option> </select> </div> </div> <div class="row" id="bloc-youtube" style="display: none;"> <div class="form-group col-md-4"> <input name="youtube" type="text" class="form-control" placeholder="Merci de saisir une url d'une vidéo youtube"> </div> </div> <div class="row" id="bloc-upload" style=""> <div class="form-group col-md-4"> <input name="upload" type="file" class="form-control"> </div> </div> </div> </div> <script> $('#bloc-youtube, #bloc-upload').hide(); $("#choix").change(function() { if($(this).val()=="1") { $('#bloc-upload').hide(); $('#bloc-youtube').show(); } else if($(this).val()=="2") { $('#bloc-youtube').hide(); $('#bloc-upload').show(); } else { $('#bloc-youtube, #bloc-upload').hide(); } }); </script> </div> </div> </div> .................................................................................. <div class="js-spinner spinner hide btn-primary-reverse onclick mr-1 btn"></div> <div class="btn-group hide dropdown"> <button class="btn btn-primary js-btn-save ml-3" type="submit"> <span>Enregistrer</span> </button> <button class="btn btn-primary dropdown-toggle dropdown-toggle-split" type="button" id="dropdownMenu" data-toggle="dropdown" aria-expanded="false"> <span class="sr-only">Toggle Dropdown</span> </button> .................................................................................. </div> </div> </div> </form> Pour finir, voici le code PHP permettant l'enregistrement en base et du document : public function hookActionProductUpdate($params) { $id_product = $params['id_product']; $choix = Tools::getValue('choix'); $chemin = ""; if($choix=="1") { $chemin = Tools::getValue('youtube'); } else { require_once(_PS_CLASS_DIR_ . 'Uploader.php'); $savePath = dirname(__FILE__) . '/views/img/'; $uploader = new Uploader('upload'); $file = $uploader->setSavePath($savePath) ->setAcceptTypes(['.mp4']) ->process(); // var_dump($file); $chemin = ltrim(str_replace($savePath, '', $file[0]['save_path']), '/'); } // var_dump($chemin); require_once _PS_MODULE_DIR_.'videoproduit/classes/VideoProduitCustomProduct.php'; $customProduct = VideoProduitCustomProduct::getByIdProduct((int) $id_product); $customProduct->id_product = (int) $id_product; $customProduct->choix = $choix; $customProduct->chemin = $chemin; $customProduct->save(); } Voici la classe "VideoProduitCustomProduct" : <?php /** * 2007-2020 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2020 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ /** * Class ColissimoCustomProduct */ class VideoProduitCustomProduct extends ObjectModel { /** @var int $id_video */ // public $id_video; /** @var int $id_product */ public $id_product; /** @var int $choix */ public $choix; /** @var string $chemin */ public $chemin; /** @var array $definition */ public static $definition = array( 'table' => 'video', 'primary' => 'id_video', 'fields' => array( 'id_product' => array('type' => self::TYPE_INT, 'required' => true), 'choix' => array('type' => self::TYPE_INT, 'required' => true), 'chemin' => array('type' => self::TYPE_STRING, 'required' => true, 'size' => 255), ), ); /** * @param int $idProduct * @return VideoProduitCustomProduct * @throws PrestaShopDatabaseException * @throws PrestaShopException */ public static function getByIdProduct($id_product) { $dbQuery = new DbQuery(); $dbQuery->select('id_video') ->from('video') ->where('id_product = '.(int) $id_product); $id = Db::getInstance(_PS_USE_SQL_SLAVE_) ->getValue($dbQuery); return new self((int) $id); } } A noter, lorsque je modifie le code PHP de la méthode "hookActionProductUpdate" de la manière suivante [Ajout du var_dump($file)) : public function hookActionProductUpdate($params) { $id_product = $params['id_product']; $choix = Tools::getValue('choix'); $chemin = ""; if($choix=="1") { $chemin = Tools::getValue('youtube'); } else { require_once(_PS_CLASS_DIR_ . 'Uploader.php'); $savePath = dirname(__FILE__) . '/views/img/'; $uploader = new Uploader('upload'); $file = $uploader->setSavePath($savePath) ->setAcceptTypes(['.mp4']) ->process(); var_dump($file); $chemin = ltrim(str_replace($savePath, '', $file[0]['save_path']), '/'); } // var_dump($chemin); require_once _PS_MODULE_DIR_.'videoproduit/classes/VideoProduitCustomProduct.php'; $customProduct = VideoProduitCustomProduct::getByIdProduct((int) $id_product); $customProduct->id_product = (int) $id_product; $customProduct->choix = $choix; $customProduct->chemin = $chemin; $customProduct->save(); } Voici ce que j'obtiens : Quelqu'un a-t-il une idée pourquoi mon champ d'upload n'est pas pris en compte dans le code reçu lors de l'enregistrement ? Merci par avance pour votre aide. Cordialement, Loïc V.
-
Good day, I would like to ask you for help with our e-shop. Some time ago, we started having problems with updating our products in the Back Office specifically if we wanted to add some customizations or edit combinations. The version of Prestashop was 1.7.3. Last week we decided to update the system to version 1.7.7.2. We updated the system via 1-Click Upgrade. The update went smoothly, but the problem persisted. In addition, another problem has occurred, namely that no new products can be created at this time. I was provided with information to turn off a list of modules that affect product updates. I turned off these modules, but that didn't help either. Can you help us with this? If you want I can send you information about the server and database and a preview of what error will appear after clicking the save option in the Network and Console tab in Google Chrome.) and if if necessary I can provide error logs. Thank you in advance for answer. Sincerely Matej
-
Dobrý deň, obraciam sa na toto fórum s prosbou o pomoc s našim e-shopom. V systéme sme pred nejakým časom začali mať problém s tým, že sa nám nechceli aktualizovať produkty, ak sme tam chceli pridať nejaké prispôsobenie alebo upraviť kombinácie. Prestashop bežal vo verzii 1.7.3. Minulý týždeň sme sa rozhodli aktualizovať systém na verziu 1.7.7.2. Systém sme aktualizovali prostredníctvom 1-Click Upgrade. Aktualizácia prebehla bez problémov avšak problém stále zotrval. Naviac sa vyskytol ďalší problém a to ten, že sa momentálne nedajú vytvárať žiadne nové produkty. Bola mi poskytnutá informácia, aby som vypol určitý zoznam modul, ktoré majú vplyv na aktualizáciu produktu. Tieto moduly som vypol avšak ani to nepomohlo. Vedel by nám s týmto problémom niekto pomôcť ? (V prílohe Vám posielam informácie o serveri a databáze a náhľad aká chyba sa zobrazí po kliknutí na možnosť uložiť v karte Network a Console.) V prípade potreby dodám aj error logy Za odpoveď vopred ďakujem.
- 1 reply
-
- product update
- product combinations
-
(and 1 more)
Tagged with:
-
Dobrý deň, obraciam sa na toto fórum s prosbou o pomoc s našim e-shopom. V systéme sme pred nejakým časom začali mať problém s tým, že sa nám nechceli aktualizovať produkty, ak sme tam chceli pridať nejaké prispôsobenie alebo upraviť kombinácie. Prestashop bežal vo verzii 1.7.3. Minulý týždeň sme sa rozhodli aktualizovať systém na verziu 1.7.7.2. Systém sme aktualizovali prostredníctvom 1-Click Upgrade. Aktualizácia prebehla bez problémov avšak problém stále zotrval. Naviac sa vyskytol ďalší problém a to ten, že sa momentálne nedajú vytvárať žiadne nové produkty. Bola mi poskytnutá informácia, aby som vypol určitý zoznam modul, ktoré majú vplyv na aktualizáciu produktu. Tieto moduly som vypol avšak ani to nepomohlo. Vedel by nám s týmto problémom niekto pomôcť ? (V prílohe Vám posielam informácie o serveri a databáze a náhľad aká chyba sa zobrazí po kliknutí na možnosť uložiť v karte Network a Console.) V prípade potreby dodám aj error logy Za odpoveď vopred ďakujem.
-
- aktualizácia produktu
- prestashop 1.7.7.2
-
(and 1 more)
Tagged with:
-
Hi all guys, I have a problem with my store when creating a new account - Link to page: - PS Version: 1.7.7.2 By completing the form and clicking Submit, the page is simply updated but registration does not take place. I'm going crazy to solve the problem but I can't find solutions, can you help me?