Jump to content

piR-web

Members
  • Posts

    21
  • Joined

  • Last visited

Profile Information

  • Location
    Loire-Atlantique
  • First Name
    Pierre
  • Last Name
    BERNARD

piR-web's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Bonjour, Je suis sur Prestashop 1.6 et j'aimerais mettre un montant minimal de commande à 300 euros (jusqu'ici tout va bien) sauf si dans le panier un des produit à un prix unitaire inférieur à 1 euros. Cela doit se passer dans OrderOpcController.php /* Check minimal amount */ $currency = Currency::getCurrency((int)$this->context->cart->id_currency); $minimal_purchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'), $currency); if ($this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS) < $minimal_purchase) { return '<p class="warning">'.sprintf( Tools::displayError('A minimum purchase total of %1s (tax excl.) is required to validate your order, current purchase total is %2s (tax excl.).'), Tools::displayPrice($minimal_purchase, $currency), Tools::displayPrice($this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS), $currency) ).'</p>'; } Quelqu'un aurait-il une idée ? Merci
  2. Hi there, I have a problem with the redirection of free orders after cart validation for a guest. I would like to follow these orders via google analytics by redirecting them via order confirmation. For that, I wanted to change in /controllers/front/OrderController.php: // Bypass payment step if total is 0 if (($id_order = $this->_checkFreeOrder()) && $id_order) { if ($this->context->customer->is_guest) { $order = new Order((int)$id_order); $email = $this->context->customer->email; $this->context->customer->mylogout(); // If guest we clear the cookie for security reason Tools::redirect('index.php?controller=guest-tracking&id_order='.urlencode($order->reference).'&email='.urlencode($email)); } else { Tools::redirect('index.php?controller=history'); } } By : // Bypass payment step if total is 0 if (($id_order = $this->_checkFreeOrder()) && $id_order) { if ($this->context->customer->is_guest) { $order = new Order((int)$id_order); $email = $this->context->customer->email; $this->context->customer->mylogout(); // If guest we clear the cookie for security reason Tools::redirect('index.php?controller=order-confirmation&id_cart='.(int)$cart->id.'&id_module='.(int)$this->module->id.'&id_order='.$this->module->currentOrder.'&key='.$customer->secure_key); } else Tools::redirect('index.php?controller=history'); } The problem is that I am always redirected to guest-tracking. Does anyone have an idea? Thank you
  3. Bonjour, J'ai un problème avec la redirection des commandes gratuites après validation du panier pour un invité. Je voudrais suivre ces commandes via google analytics en les redirigeant via order-confirmation. Pour cela, j'ai voulu changer dans /controllers/front/OrderController.php : // Bypass payment step if total is 0 if (($id_order = $this->_checkFreeOrder()) && $id_order) { if ($this->context->customer->is_guest) { $order = new Order((int)$id_order); $email = $this->context->customer->email; $this->context->customer->mylogout(); // If guest we clear the cookie for security reason Tools::redirect('index.php?controller=guest-tracking&id_order='.urlencode($order->reference).'&email='.urlencode($email)); } else { Tools::redirect('index.php?controller=history'); } } Par : // Bypass payment step if total is 0 if (($id_order = $this->_checkFreeOrder()) && $id_order) { if ($this->context->customer->is_guest) { $order = new Order((int)$id_order); $email = $this->context->customer->email; $this->context->customer->mylogout(); // If guest we clear the cookie for security reason Tools::redirect('index.php?controller=order-confirmation&id_cart='.(int)$cart->id.'&id_module='.(int)$this->module->id.'&id_order='.$this->module->currentOrder.'&key='.$customer->secure_key); } else Tools::redirect('index.php?controller=history'); } Le problème est que je suis toujours redirigé vers guest-tracking. Quelqu'un aurait-il une idée ? Merci
  4. Hi there, I have a problem with the redirection of free orders after cart validation for a guest. I would like to follow these orders via google analytics by redirecting them via order confirmation. For that, I wanted to change in /controllers/front/OrderController.php: // Bypass payment step if total is 0 if (($id_order = $this->_checkFreeOrder()) && $id_order) { if ($this->context->customer->is_guest) { $order = new Order((int)$id_order); $email = $this->context->customer->email; $this->context->customer->mylogout(); // If guest we clear the cookie for security reason Tools::redirect('index.php?controller=guest-tracking&id_order='.urlencode($order->reference).'&email='.urlencode($email)); } else { Tools::redirect('index.php?controller=history'); } } By : // Bypass payment step if total is 0 if (($id_order = $this->_checkFreeOrder()) && $id_order) { if ($this->context->customer->is_guest) { $order = new Order((int)$id_order); $email = $this->context->customer->email; $this->context->customer->mylogout(); // If guest we clear the cookie for security reason Tools::redirect('index.php?controller=order-confirmation&id_cart='.(int)$cart->id.'&id_module='.(int)$this->module->id.'&id_order='.$this->module->currentOrder.'&key='.$customer->secure_key); } else Tools::redirect('index.php?controller=history'); } The problem is that I am always redirected to guest-tracking. Does anyone have an idea? Thank you
  5. Bonjour, J'ai un problème avec la redirection des commandes gratuites après validation du panier pour un invité. Je voudrais suivre ces commandes via google analytics en les redirigeant via order-confirmation. Pour cela, j'ai voulu changer dans /controllers/front/OrderController.php : // Bypass payment step if total is 0 if (($id_order = $this->_checkFreeOrder()) && $id_order) { if ($this->context->customer->is_guest) { $order = new Order((int)$id_order); $email = $this->context->customer->email; $this->context->customer->mylogout(); // If guest we clear the cookie for security reason Tools::redirect('index.php?controller=guest-tracking&id_order='.urlencode($order->reference).'&email='.urlencode($email)); } else { Tools::redirect('index.php?controller=history'); } } Par : // Bypass payment step if total is 0 if (($id_order = $this->_checkFreeOrder()) && $id_order) { if ($this->context->customer->is_guest) { $order = new Order((int)$id_order); $email = $this->context->customer->email; $this->context->customer->mylogout(); // If guest we clear the cookie for security reason Tools::redirect('index.php?controller=order-confirmation&id_cart='.(int)$cart->id.'&id_module='.(int)$this->module->id.'&id_order='.$this->module->currentOrder.'&key='.$customer->secure_key); } else Tools::redirect('index.php?controller=history'); } Le problème est que je suis toujours redirigé vers guest-tracking. Quelqu'un aurait-il une idée ? Merci
  6. Bonjour, Je viens d'intégrer un champ texte dans la table Specific Price et je souhaite mettre à jour ma base de donnée lorsque le champ est modifier : Voici le code que j'ai intégré mais il ne fonctionne pas : if(isset($_POST['marquage_promo'])) { $sql = "SELECT * FROM "._DB_PREFIX_."specific_price WHERE id_product=".(int)$id_product; $res=Db::getInstance()->ExecuteS($sql); $marquage_promo = $_POST['marquage_promo']; if (count($res)) { if ($marquage_promo) { $sql = "UPDATE "._DB_PREFIX_."specific_price SET marquage_promo=".$marquage_promo." WHERE id_product=".(int)$id_product; Db::getInstance()->Execute($sql); }else{ $sql = "DELETE mon_champ FROM "._DB_PREFIX_."specific_price WHERE id_product=".(int)$id_product; Db::getInstance()->Execute($sql); } }else{ $sql = "INSERT INTO "._DB_PREFIX_."specific_price (id_product,marquage_promo) VALUES (".(int)$id_product.",".$marquage_promo.")"; Db::getInstance()->Execute($sql); } } Pouvez-vous m'aider ? Merci beaucoup
  7. Bonjour; Tu as le droit de dire que c'est n'importe quoi mais laisse-moi t'expliquer ce que je veux faire... Peut-être que ça adoucira tes propos . Je souhaite créer des promotions qui s'affichent pendant une période déterminée avec un prix spécial, une quantité spéciale, et plusieurs champs qui ne doivent s'afficher que pendant cette période : - un champ "quantité" - un champ "marquage" - un champ "frais de port" - un champ "frais technique" Voir capture écran ci-dessous De plus je veux que cette période passée, le "prix normal" et la "quantité normale" soit de nouveau affiché sans les champs créés. De plus je souhaite que ces promotions soient ajoutées ou supprimées automatiquement de la catégorie promotion en fonction des dates et que ces promotions soient facilement gérables en lot via le store commander. Voilà, j'espère avoir été claire. Que me conseilles-tu? Merci
  8. Bonjour, Merci pour votre réponse. Mon but est d'ajouter ou supprimer automatiquement une catégorie promotion aux produits dont le prix promo est renseigné et que la date actuelle est comprise ente date_debut_promo et date_fin_promo. Ce sont des champs que j'ai ajouté au core. Que me conseillez-vous? Merci Cordialement
  9. Bonjour, Je voudrais créer une tache cron avec pour but d'ajouter ou supprimer une catégorie à un produit dont le prix promo est renseigné et que la date actuelle est comprise ente date_debut_promo et date_fin_promo. J'ai créé un fichier php avec : //Connect to the database $connection = mysql_connect($hostname, $username, $password); mysql_select_db($dbname, $connection); $product=new Product(intval($id_product)); $now = date("Y-m-d H:i:s"); if (!empty($product->prix_promo) && ($product->date_debut_promo!="0000-00-00 00:00:00" && $product->date_debut_promo <= $now) && ($product->date_fin_promo!="0000-00-00 00:00:00" && $now <= $product->date_fin_promo)) { $sql = "SELECT * FROM `"._DB_PREFIX_."category_product` WHERE id_category='113' AND id_product='".(int)$id_product."'"; $exist = Db::getInstance()->ExecuteS($sql); if(empty($exist[0]["id_product"])) { $sql = "SELECT MAX(position) AS max FROM "._DB_PREFIX_."category_product WHERE id_category='113'"; $res=Db::getInstance()->getRow($sql); $max=intval($res['max']); $sql = "INSERT INTO `"._DB_PREFIX_."category_product` (id_product,id_category,position) VALUES ('".(int)$id_product."','113','".(int)$max."')"; Db::getInstance()->Execute($sql); } } else { $sql = "DELETE FROM `"._DB_PREFIX_."category_product` WHERE `id_product`='".$id_product."' AND `id_category` = '113'"; Db::getInstance()->Execute($sql); } Je pense qu'il manque avant un select pour selectionner toutes les id-product de la table product et que pour chaque id_product il faut ajouter ou supprimer la categorie "113". Pouvez-vous m'aider ? Merci beaucoup
  10. Tout fonctionne à présent : if ($id_product = (int)Tools::getValue('id_product')) { $now = date('Y-m-d H:i:s'); $this->product = new Product($id_product, false, $this->context->language->id, $this->context->shop->id); if (($this->product->prix_promo) > 0 && ($this->product->date_debut_promo) <= date('Y-m-d H:i:s') && date('Y-m-d H:i:s') <= ($this->product->date_fin_promo)) { $this->product->addToCategories(113); } else { $this->product->deleteCategory(113); } $this->product = new Product($id_product, true, $this->context->language->id, $this->context->shop->id); } Par contre, je suis obligé de retourné sur le produit pour que les catégories soit ajouter ou supprimer. Je souhaiterais assigner automatiquement une catégorie à l'enregistrement du produit après remplis les champs les champs date_debut_promo et date_fin_promo. Y aurait-il une autre méthode pour que cela se fasse automatiquement? Quelle est le fichier a modifier ? Merci Cordialement
  11. La suppression de catégorie se fait mais pas l'ajout. if ($id_product = (int)Tools::getValue('id_product')) { $now = date_create('now')->format('Y-m-d H:i:s'); $this->product = new Product($id_product, false, $this->context->language->id, $this->context->shop->id); if ($this->product->prix_promo>0 && $this->product->date_debut_promo <= $now && $now <= $this->product->date_fin_promo) { $this->product->addToCategories[(113)]; } else { $this->product->deleteCategory(113); } $this->product = new Product($id_product, true, $this->context->language->id, $this->context->shop->id); } Aurais tu une idée?
  12. Effectivement, j'avais déjà fait la modif, plus d'erreur mais la catégorie n'est pas assigner automatiquement.
  13. Effectivement, erreur de débutant J'ai toujours une erreur 500 : Notice: Undefined variable: product in /override/controllers/front/ProductController.php on line 96 Fatal error: Call to a member function deleteCategory() on null in /override/controllers/front/ProductController.php on line 96
×
×
  • Create New...