Jump to content

royal38

Members
  • Content count

    66
  • Joined

  • Last visited

Everything posted by royal38

  1. royal38

    Official PayPal IPN Support Thread

    I've found the problem. The invoice parameter is missing in the ipn process for 80% of order. Where can I correct this problem of invoice parameter which is missing? Thanks and best regards.
  2. royal38

    Official PayPal IPN Support Thread

    Hello, Now, 20% of IPN are received but 80% aren't. Can someone help me? Thanks
  3. royal38

    Official PayPal IPN Support Thread

    Hello, I have some problems with paypal IPN 2.1.0.0 since we upgrade to PHP 5.3. When there is paypal payment, the status of order doesn't update to "Payment clear". We have to validate the order manually. Can someone help me? Thanks and best regards. Fabien.
  4. royal38

    Bundled Products

    Hi all, I use this contribution for more than 1 year and it is great. But does someone find how to choose the slave products depending on the color chosen (attribute)? Thanks a lot ;)
  5. royal38

    NEW! Complete Order Editing Tool!

    Can you put the solution on this topic when you got it? Thanks a lot.
  6. royal38

    NEW! Complete Order Editing Tool!

    It is not really solved. I try something but I have to update the order 3 times to have the godd subtotal. <_< In catalog/admin/order_editor/order.php , I've add : $custom_query = tep_db_query("select sum(value) as cusval from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' and class like 'ot_custom%'"); $custom = tep_db_fetch_array($custom_query); $subval = $this->info['subtotal']; $sumcus = $custom['cusval']; $this->info['subtotal'] = $subval + $sumcus;// - $this->info['shipping_cost'];//$subval + $sumcus; Someone have a best solution? Thanks a lot
  7. royal38

    NEW! Complete Order Editing Tool!

    Hello, Can someone tell me how to add or substract the value of ot_custom_x to the subtotal? When I add a custom field, it's add the value to the total but not on the subtotal. Can someone help me to solve these? Thansk a lot.
  8. royal38

    NEW! Complete Order Editing Tool!

    Hello, I use the contrib order editor which is great but I have a little bug with it : Discount don't apply on subtotal, only on total. Because of that, tax and price excluding tax are wrong because there are based on the subtotal (in my version). As you can see, subtotal don't include the discount :angry: but is included in the total. :blink: I try all this afternoon to modify the file order.php which is in the file "order_editor", but I failed to apply "discount" which is a custom on the subtotal. I don't know how to apply discount on this code : Thanks a lot for your help. Bye ;)
  9. Hello, I use the contrib order editor which is great but I have a little bug with it : Discount don't apply on subtotal, only on total. Because of that, tax and price excluding tax are wrong because there are based on the subtotal. As you can see, subtotal don't include the discount :angry: but is included in the total. :blink: I try all this afternoon to modify the file order.php which is in the file "order_editor", but I failed to apply "discount" which is a custom on the subtotal. I don't know how to apply discount on this code : Thanks a lot for your help. Bye ;)
  10. No one? :huh: Thanks ^_^
  11. Hello, I use Bundled products contribution, and max quantity for bundled products is only 127. If I change the data type ( actually tinyint(4) ) to smallint(6), I will have some errors in your opinion? Thank a lot. ;)
  12. Hello, I want to go over 200 or 300... but not 32767... So can I get some errors if I change the type in the database? What means the (4) in "tinyint(4)"? Thanks a lot :)
  13. royal38

    Bundled products and paypal ipn

    Solved ;) In the new version, it's not in paypal_ipn.php but in ipn.php (which is in folder "ext") Bye
  14. royal38

    Bundled products and paypal ipn

    Hello, I try to install the contrib Bundled products, and to install it, I need to edit paypal_ipn.php I have to search this code in paypal_ipn.php for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { // Stock Update - Joao Correia if (STOCK_LIMITED == 'true') { if (DOWNLOAD_ENABLED == 'true') { $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename FROM " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa ON p.products_id=pa.products_id LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad ON pa.products_attributes_id=pad.products_attributes_id WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"; // Will work with only one option for downloadable products // otherwise, we have to build the query dynamically with a loop $products_attributes = $order->products[$i]['attributes']; if (is_array($products_attributes)) { $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'"; } $stock_query = tep_db_query($stock_query_raw); } else { $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); } if (tep_db_num_rows($stock_query) > 0) { $stock_values = tep_db_fetch_array($stock_query); // do not decrement quantities if products_attributes_filename exists if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) { $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty']; } else { $stock_left = $stock_values['products_quantity']; } tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) { tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); } } } The problem is that I haven't this code in my paypal_ipn.php . Can someone tell me what's the problem?? Here is my paypal ipn version : osCommerce PayPal IPN Module v2.2 For 2.2MS2 (14 jan 2007) Thanks a lot for your help ;)
  15. royal38

    Bundled products

    Hello, I've a problem with paypal ipn. I try to include this code in my paypal_ipn.php but I can't find this code which must be replaced! : for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { // Stock Update - Joao Correia if (STOCK_LIMITED == 'true') { if (DOWNLOAD_ENABLED == 'true') { $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename FROM " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa ON p.products_id=pa.products_id LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad ON pa.products_attributes_id=pad.products_attributes_id WHERE p.products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"; // Will work with only one option for downloadable products // otherwise, we have to build the query dynamically with a loop $products_attributes = $order->products[$i]['attributes']; if (is_array($products_attributes)) { $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'"; } $stock_query = tep_db_query($stock_query_raw); } else { $stock_query = tep_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); } if (tep_db_num_rows($stock_query) > 0) { $stock_values = tep_db_fetch_array($stock_query); // do not decrement quantities if products_attributes_filename exists if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) { $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty']; } else { $stock_left = $stock_values['products_quantity']; } tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); if ( ($stock_left < 1) && (STOCK_ALLOW_CHECKOUT == 'false') ) { tep_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'"); } } } Does someone have the same problem. Thanks a lot ;)
  16. royal38

    Bundled products

    Hello, First, sorry for my english :blush: I really need yout help to do my code working. I have a php file which is executed each day to request payment (7 days after order), for people who chooses bank transfer and have not paid. It cancels it and restock after 14 days if payment have not been received. It also cancels paypal pending payment after 1 day. Here is the code : <?php /* Contribution based on: osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com ******************************************************************************* * Relance et annulation automatique de commandes clients v1.4 * ******************************************************************************* * Ce script est à lancer tous les jours, manuellement ou à l'aide d'une tache * * cron (bien plus pratique) * * L'exécution de ce script permet de : * * - Relancer les clients n'ayant pas encore payés leur commande après x jours * * par rapport à la date de leur achat en leur envoyant un rappel par email * * dont le contenu est personnalisable * * - Annuler les commandes non réglées de plus de x jours par rapport à la * * date d'achat * * - Gérer 2 statuts de commande différents : "en attente virement" et "en * * attente chèque" * * - Remettre en stock les produits des commandes annulées * ******************************************************************************* * v1.0 : par MarcelPiano le 27 janvier 2008 * * Relance automatique tous les x jours des clients ayant une commande en * * attente de paiement * ******************************************************************************* * v1.1 : par Regne le 11 février 2008 * * Modif pour correction du lien commande dans le mail de relance * ******************************************************************************* * v1.2 : par Zardhoz le 14 février 2008 * * Modif du code pour : * * - Gérer 2 statuts de commande différents : "en attente virement" et "en * * attente chèque" * * - Annuler automatiquement les commandes passé x jours sans règlement à * * partir de la date de commande. * ******************************************************************************* * v1.3 par Ptitvasy le 22 février 2008 * * Modif du code pour : * * - Remettre en stock les produits des commandes annulées * ******************************************************************************* * v1.4 par Zardhoz le 26 février 2008 * * Modif du code pour : * * - Ajout de commentaires * * - Regroupement des paramètres modifiables pour une utilisation plus aisée * ******************************************************************************* */ include('includes/application_top.php'); //--------------------------------------------------------------------------------- // DEFINITION DU CONTENU DU MAIL DE RELANCE : // A MODIFIER EN FONCTION DE VOS BESOINS //--------------------------------------------------------------------------------- define('EMAIL_TEXT_SEPARATEUR', '------------------------------------------------------'); define('EMAIL_TEXT_SUBJECT', 'Votre commande est en attente'); define('EMAIL_TEXT_SUBJECT_P', 'Votre commande a été annulée'); define('EMAIL_TEXT_ORDER_NUMBER', 'Commande numéro :'); define('EMAIL_TEXT_INVOICE_URL', 'Facture détaillée :'); define('EMAIL_TEXT_DATE_ORDERED', 'Date de la commande :'); define('EMAIL_TEXT_COMMENTS_INTRO', 'Bonjour et merci d\'avoir choisi Bluecars.'); define('EMAIL_TEXT_COMMENTS_LIGNE1', 'Vous avez passé une commande il y a quelques jours et, sauf erreur de notre part, nous n\'avons toujours pas reçu votre réglement.'); define('EMAIL_TEXT_COMMENTS_LIGNE1P', 'Vous avez passé une commande il y a quelques jours et, sauf erreur de notre part, il semble que votre paiement par carte bleue n\'ait pas fonctionné.'); define('EMAIL_TEXT_COMMENTS_LIGNE2', 'Si vous venez d\'envoyer celui-ci, ou l\'avez envoyé depuis moins de 2 jours, ignorez ce mail.'); define('EMAIL_TEXT_COMMENTS_LIGNE2P', 'Votre commande a été automatiquement annulée, et nous vous invitons donc à réaliser une nouvelle commande.'); define('EMAIL_TEXT_COMMENTS_LIGNE3', 'Si vous souhaitez annuler votre commande, merci de nous en faire part en répondant à ce mail.'); define('EMAIL_TEXT_COMMENTS_LIGNE3P', 'Si vous avez deja effectué une nouvelle commande, ignorez ce mail.'); define('EMAIL_TEXT_COMMENTS_LIGNE4', 'Votre commande ne pourra être expédiée qu\'à réception de votre paiement, et à défaut de ce dernier, sera automatiquement annulée passé un délais de 14 jours à compter la date de commande.'); define('EMAIL_TEXT_COMMENTS_LIGNE5', 'Bluecars vous remercie de votre compréhension et de votre confiance.'); define('EMAIL_TEXT_END', 'A bientôt sur www.bluecars.net'); //--------------------------------------------------------------------------------- // PARAMETRES COMMUNS : // A MODIFIER EN FONCTION DE VOS BESOINS ET DES PARAMETRES DE VOTRE BOUTIQUE //--------------------------------------------------------------------------------- // Numéro du statut de commande annulée $annulation_statut = '7'; // Notification client par mail lors de la relance : 0=non / 1=oui $customer_notified_relance = '1'; // Notification client par mail lors de l'annulation de la commande : 0=non / 1=oui $customer_notified_annulation = '0'; //--------------------------------------------------------------------------------- // PAYEMENT PAR CHEQUE et VIREMENT : // A MODIFIER EN FONCTION DE VOS BESOINS ET DES PARAMETRES DE VOTRE BOUTIQUE //--------------------------------------------------------------------------------- // Numéro du statut de commande en attente chèque et virement $relance_statut_cheque = '1'; // Nombre de jours depuis commande avant relance automatique du client $relance_nombre_cheque = '7'; // Nombre de jours depuis commande avant annulation de commande $annulation_nombre_cheque = '14'; // Commentaire relance par mail $comments_relance_cheque = 'Relance par mail ce jour'; // Commentaire annulation commande $comments_annulation_cheque = 'Commande annulée'; //--------------------------------------------------------------------------------- // PAYEMENT PAR PAYPAL : // A MODIFIER EN FONCTION DE VOS BESOINS ET DES PARAMETRES DE VOTRE BOUTIQUE //--------------------------------------------------------------------------------- // Numéro du statut de commande verification paypal $relance_statut_virement = '4'; // Nombre de jours depuis commande avant relance automatique du client $relance_nombre_virement = '1'; // Nombre de jours depuis commande avant annulation de commande $annulation_nombre_virement = '1'; // Commentaire relance par mail $comments_relance_virement = 'Mail envoyé ce jour'; // Commentaire annulation commande $comments_annulation_virement = 'Commande annulée'; //--------------------------------------------------------------------------------- // RELANCE AUTOMATIQUE PAYEMENT PAR CHEQUE ET VIREMENT //--------------------------------------------------------------------------------- echo "Démarrage des relances de commandes en attente chèque et virement<br>"; // Test du champ orders.last_modified. Si le champs est vide, rempli avec la date de la commande $req_last = "select orders_id, last_modified, date_purchased FROM orders WHERE orders_status = $relance_statut_cheque and last_modified is NULL"; $resultat_last = mysql_query($req_last); while($l_last = mysql_fetch_array($resultat_last)){ tep_db_query("update orders set last_modified = date_purchased where orders_id = '" . $l_last['orders_id'] . "'"); } // Sélection des commandes en attente paiement par rapport a la date date de commande $req_relance = "select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address, o.orders_id, o.customers_id, o.last_modified, o.date_purchased, o.orders_status from " . TABLE_CUSTOMERS . " c, " . TABLE_ORDERS . " o where o.orders_status = $relance_statut_cheque and c.customers_id = o.customers_id and TO_DAYS(NOW()) - TO_DAYS(o.date_purchased) = $relance_nombre_cheque"; $resultat = mysql_query($req_relance); while($l = mysql_fetch_array($resultat)){ // Préparation et envoi du mail $check_status_query = tep_db_query("select customers_name, customers_id, customers_email_address, orders_status, date_purchased from orders where orders_id = '" . $l['orders_id'] . "'"); $check_status = tep_db_fetch_array($check_status_query); $num_com = $l['orders_id']; $email = STORE_NAME . "\n" . EMAIL_TEXT_SEPARATEUR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $l['orders_id'] . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $num_com, 'SSL', false) . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_short($l['date_purchased']) . "\n\n" . EMAIL_TEXT_COMMENTS_INTRO . "\n\n" . EMAIL_TEXT_COMMENTS_LIGNE1 . "\n\n" . EMAIL_TEXT_COMMENTS_LIGNE2 ."\n\n" . EMAIL_TEXT_COMMENTS_LIGNE3 . "\n\n" . EMAIL_TEXT_COMMENTS_LIGNE4 . "\n\n" . EMAIL_TEXT_COMMENTS_LIGNE5 . "\n\n" . EMAIL_TEXT_END; tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); // Mise à jour de la table orders pour ajout dans l'historique de la commande $customer_notified = $customer_notified_relance; $status = $relance_statut_cheque; $comments = $comments_relance_cheque; tep_db_query("update orders set last_modified = now() where orders_id = '" . $l['orders_id'] . "'"); tep_db_query("insert into orders_status_history (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . $l['orders_id'] . "', '" . tep_db_input($status) . "', now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments) . "')"); echo "x"; } echo "<br>Traitement terminé des relances de commandes en attente chèque et virement<br><br><br>"; // Stoppe pour 2 secondes sleep(2); //--------------------------------------------------------------------------------- // ANNULATION AUTOMATIQUE PAYEMENT PAR CHEQUE ET VIREMENT //--------------------------------------------------------------------------------- echo "Démarrage des annulations de commandes en attente chèque et virement<br>"; // Test du champ orders.last_modified. Si le champs est vide, rempli avec la date de la commande $req_last = "select orders_id, last_modified, date_purchased FROM orders WHERE orders_status = $relance_statut_cheque and last_modified is NULL"; $resultat_last = mysql_query($req_last); while($l_last = mysql_fetch_array($resultat_last)){ tep_db_query("update orders set last_modified = date_purchased where orders_id = '" . $l_last['orders_id'] . "'"); } // Sélection des commandes en attente paiement par rapport a la date date de commande $req_relance = "select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address, o.orders_id, o.customers_id, o.last_modified, o.date_purchased, o.orders_status from " . TABLE_CUSTOMERS . " c, " . TABLE_ORDERS . " o where o.orders_status = $relance_statut_cheque and c.customers_id = o.customers_id and TO_DAYS(NOW()) - TO_DAYS(o.date_purchased) = $annulation_nombre_cheque"; $resultat = mysql_query($req_relance); while($l = mysql_fetch_array($resultat)){ // Mise à jour de la table orders pour ajout dans l'historique de la commande et remise en stock des produits $customer_notified = $customer_notified_annulation; $status = $annulation_statut; $comments = $comments_annulation_cheque; tep_db_query("update orders set last_modified = now() where orders_id = '" . $l['orders_id'] . "'"); tep_db_query("update orders set orders_status = '" . tep_db_input($status) . "' where orders_id = '" . $l['orders_id'] . "'"); tep_db_query("insert into orders_status_history (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . $l['orders_id'] . "', '" . tep_db_input($status) . "', now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments) . "')"); $proannule_query = tep_db_query("select products_id, products_quantity from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . $l['orders_id'] . "'"); while ($proannule = tep_db_fetch_array($proannule_query)) { tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity + " . $proannule['products_quantity'] . ", products_ordered = products_ordered - " . $proannule['products_quantity'] . " where products_id = '" . (int)$proannule['products_id'] . "'"); } echo "x"; } echo "<br>Traitement terminé des annulations de commandes en attente chèque et virement<br><br><br>"; //--------------------------------------------------------------------------------- // RELANCE AUTOMATIQUE PAYEMENT PAR PAYPAL //--------------------------------------------------------------------------------- echo "Démarrage des relances de commandes en attente de paiement paypal<br>"; // Test du champ orders.last_modified. Si le champs est vide, rempli avec la date de la commande $req_last = "select orders_id, last_modified, date_purchased FROM orders WHERE orders_status = $relance_statut_virement and last_modified is NULL"; $resultat_last = mysql_query($req_last); while($l_last = mysql_fetch_array($resultat_last)){ tep_db_query("update orders set last_modified = date_purchased where orders_id = '" . $l_last['orders_id'] . "'"); } // Sélection des commandes en attente paiement par rapport a la date date de commande $req_relance = "select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address, o.orders_id, o.customers_id, o.last_modified, o.date_purchased, o.orders_status from " . TABLE_CUSTOMERS . " c, " . TABLE_ORDERS . " o where o.orders_status = $relance_statut_virement and c.customers_id = o.customers_id and TO_DAYS(NOW()) - TO_DAYS(o.date_purchased) = $relance_nombre_virement"; $resultat = mysql_query($req_relance); while($l = mysql_fetch_array($resultat)){ // Préparation et envoi du mail $check_status_query = tep_db_query("select customers_name, customers_id, customers_email_address, orders_status, date_purchased from orders where orders_id = '" . $l['orders_id'] . "'"); $check_status = tep_db_fetch_array($check_status_query); $num_com = $l['orders_id']; $email = STORE_NAME . "\n" . EMAIL_TEXT_SEPARATEUR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $l['orders_id'] . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $num_com, 'SSL', false) . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_short($l['date_purchased']) . "\n\n" . EMAIL_TEXT_COMMENTS_INTRO . "\n\n" . EMAIL_TEXT_COMMENTS_LIGNE1P . "\n\n" . EMAIL_TEXT_COMMENTS_LIGNE2P . "\n\n" . EMAIL_TEXT_COMMENTS_LIGNE3P ."\n\n" . EMAIL_TEXT_COMMENTS_LIGNE5 . "\n\n" . EMAIL_TEXT_END; tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT_P, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); // Mise à jour de la table orders pour ajout dans l'historique de la commande $customer_notified = $customer_notified_relance; $status = $relance_statut_virement; $comments = $comments_relance_virement; tep_db_query("update orders set last_modified = now() where orders_id = '" . $l['orders_id'] . "'"); tep_db_query("insert into orders_status_history (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . $l['orders_id'] . "', '" . tep_db_input($status) . "', now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments) . "')"); echo "x"; } echo "<br>Traitement terminé des relances de commandes en attente de paiement paypal<br><br><br>"; // Stoppe pour 2 secondes sleep(2); //--------------------------------------------------------------------------------- // ANNULATION AUTOMATIQUE PAYEMENT PAR PAYPAL //--------------------------------------------------------------------------------- echo "Démarrage des annulations de commandes en attente de paiement paypal<br>"; // Test du champ orders.last_modified. Si le champs est vide, rempli avec la date de la commande $req_last = "select orders_id, last_modified, date_purchased FROM orders WHERE orders_status = $relance_statut_virement and last_modified is NULL"; $resultat_last = mysql_query($req_last); while($l_last = mysql_fetch_array($resultat_last)){ tep_db_query("update orders set last_modified = date_purchased where orders_id = '" . $l_last['orders_id'] . "'"); } // Sélection des commandes en attente paiement par rapport a la date date de commande $req_relance = "select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address, o.orders_id, o.customers_id, o.last_modified, o.date_purchased, o.orders_status from " . TABLE_CUSTOMERS . " c, " . TABLE_ORDERS . " o where o.orders_status = $relance_statut_virement and c.customers_id = o.customers_id and TO_DAYS(NOW()) - TO_DAYS(o.date_purchased) = $annulation_nombre_virement"; $resultat = mysql_query($req_relance); while($l = mysql_fetch_array($resultat)){ // Mise à jour de la table orders pour ajout dans l'historique de la commande et remise en stock des produits $customer_notified = $customer_notified_annulation; $status = $annulation_statut; $comments = $comments_annulation_virement; tep_db_query("update orders set last_modified = now() where orders_id = '" . $l['orders_id'] . "'"); tep_db_query("update orders set orders_status = '" . tep_db_input($status) . "' where orders_id = '" . $l['orders_id'] . "'"); tep_db_query("insert into orders_status_history (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . $l['orders_id'] . "', '" . tep_db_input($status) . "', now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments) . "')"); $proannule_query = tep_db_query("select products_id, products_quantity from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . $l['orders_id'] . "'"); while ($proannule = tep_db_fetch_array($proannule_query)) { tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity + " . $proannule['products_quantity'] . ", products_ordered = products_ordered - " . $proannule['products_quantity'] . " where products_id = '" . (int)$proannule['products_id'] . "'"); } echo "x"; } echo "<br>Traitement terminé des annulations de commandes en attente de paiement paypal<br><br><br>"; ?> This file is great but I also install the contrib Bundle 1.5.1 because I have some product which contain other product. :rolleyes: But now I have a problem with the automatic file which cancel and restock orders which have not been paid. Here is a function in Bundle 1.5.1 (admin/functions/general.php) which restock bundle products when an order is deleted. I'm sure it can be adapted in the automatic file. Here is the function : function tep_remove_order($order_id, $restock = false) { if ($restock == 'on') { $order_query = tep_db_query("select products_id, products_quantity from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'"); while ($order = tep_db_fetch_array($order_query)) { $is_bundle = 'no'; $product_bundle_query = tep_db_query("select subproduct_id, subproduct_qty from " . TABLE_PRODUCTS_BUNDLES . ", " . TABLE_PRODUCTS . " where bundle_id = '" . (int)$order['products_id'] . "' and products_id = '" . (int)$order['products_id'] . "' and products_bundle = 'yes'"); while ($product_bundle_data = tep_db_fetch_array($product_bundle_query)) { $is_bundle = 'yes'; tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity + " . $product_bundle_data['subproduct_qty']*$order['products_quantity'] . ", products_ordered = products_ordered - " . $product_bundle_data['subproduct_qty']*$order['products_quantity'] . " where products_id = '" . (int)$product_bundle_data['subproduct_id'] . "'"); } if ($is_bundle == 'no') { tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity + " . $order['products_quantity'] . ", products_ordered = products_ordered - " . $order['products_quantity'] . " where products_id = '" . (int)$order['products_id'] . "'"); } } } tep_db_query("delete from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'"); tep_db_query("delete from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'"); tep_db_query("delete from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "'"); tep_db_query("delete from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . (int)$order_id . "'"); tep_db_query("delete from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "'"); } So I try to do this in my automatic file :D <?php /* Contribution based on: osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com ******************************************************************************* * Relance et annulation automatique de commandes clients v1.4 * ******************************************************************************* * Ce script est à lancer tous les jours, manuellement ou à l'aide d'une tache * * cron (bien plus pratique) * * L'exécution de ce script permet de : * * - Relancer les clients n'ayant pas encore payés leur commande après x jours * * par rapport à la date de leur achat en leur envoyant un rappel par email * * dont le contenu est personnalisable * * - Annuler les commandes non réglées de plus de x jours par rapport à la * * date d'achat * * - Gérer 2 statuts de commande différents : "en attente virement" et "en * * attente chèque" * * - Remettre en stock les produits des commandes annulées * ******************************************************************************* * v1.0 : par MarcelPiano le 27 janvier 2008 * * Relance automatique tous les x jours des clients ayant une commande en * * attente de paiement * ******************************************************************************* * v1.1 : par Regne le 11 février 2008 * * Modif pour correction du lien commande dans le mail de relance * ******************************************************************************* * v1.2 : par Zardhoz le 14 février 2008 * * Modif du code pour : * * - Gérer 2 statuts de commande différents : "en attente virement" et "en * * attente chèque" * * - Annuler automatiquement les commandes passé x jours sans règlement à * * partir de la date de commande. * ******************************************************************************* * v1.3 par Ptitvasy le 22 février 2008 * * Modif du code pour : * * - Remettre en stock les produits des commandes annulées * ******************************************************************************* * v1.4 par Zardhoz le 26 février 2008 * * Modif du code pour : * * - Ajout de commentaires * * - Regroupement des paramètres modifiables pour une utilisation plus aisée * ******************************************************************************* */ include('includes/application_top.php'); //--------------------------------------------------------------------------------- // DEFINITION DU CONTENU DU MAIL DE RELANCE : // A MODIFIER EN FONCTION DE VOS BESOINS //--------------------------------------------------------------------------------- define('EMAIL_TEXT_SEPARATEUR', '------------------------------------------------------'); define('EMAIL_TEXT_SUBJECT', 'Votre commande est en attente'); define('EMAIL_TEXT_SUBJECT_P', 'Votre commande a été annulée'); define('EMAIL_TEXT_ORDER_NUMBER', 'Commande numéro :'); define('EMAIL_TEXT_INVOICE_URL', 'Facture détaillée :'); define('EMAIL_TEXT_DATE_ORDERED', 'Date de la commande :'); define('EMAIL_TEXT_COMMENTS_INTRO', 'Bonjour et merci d\'avoir choisi Bluecars.'); define('EMAIL_TEXT_COMMENTS_LIGNE1', 'Vous avez passé une commande il y a quelques jours et, sauf erreur de notre part, nous n\'avons toujours pas reçu votre réglement.'); define('EMAIL_TEXT_COMMENTS_LIGNE1P', 'Vous avez passé une commande il y a quelques jours et, sauf erreur de notre part, il semble que votre paiement par carte bleue n\'ait pas fonctionné.'); define('EMAIL_TEXT_COMMENTS_LIGNE2', 'Si vous venez d\'envoyer celui-ci, ou l\'avez envoyé depuis moins de 2 jours, ignorez ce mail.'); define('EMAIL_TEXT_COMMENTS_LIGNE2P', 'Votre commande a été automatiquement annulée, et nous vous invitons donc à réaliser une nouvelle commande.'); define('EMAIL_TEXT_COMMENTS_LIGNE3', 'Si vous souhaitez annuler votre commande, merci de nous en faire part en répondant à ce mail.'); define('EMAIL_TEXT_COMMENTS_LIGNE3P', 'Si vous avez deja effectué une nouvelle commande, ignorez ce mail.'); define('EMAIL_TEXT_COMMENTS_LIGNE4', 'Votre commande ne pourra être expédiée qu\'à réception de votre paiement, et à défaut de ce dernier, sera automatiquement annulée passé un délais de 14 jours à compter la date de commande.'); define('EMAIL_TEXT_COMMENTS_LIGNE5', 'Bluecars vous remercie de votre compréhension et de votre confiance.'); define('EMAIL_TEXT_END', 'A bientôt sur www.bluecars.net'); //--------------------------------------------------------------------------------- // PARAMETRES COMMUNS : // A MODIFIER EN FONCTION DE VOS BESOINS ET DES PARAMETRES DE VOTRE BOUTIQUE //--------------------------------------------------------------------------------- // Numéro du statut de commande annulée $annulation_statut = '7'; // Notification client par mail lors de la relance : 0=non / 1=oui $customer_notified_relance = '1'; // Notification client par mail lors de l'annulation de la commande : 0=non / 1=oui $customer_notified_annulation = '0'; //--------------------------------------------------------------------------------- // PAYEMENT PAR CHEQUE et VIREMENT : // A MODIFIER EN FONCTION DE VOS BESOINS ET DES PARAMETRES DE VOTRE BOUTIQUE //--------------------------------------------------------------------------------- // Numéro du statut de commande en attente chèque et virement $relance_statut_cheque = '1'; // Nombre de jours depuis commande avant relance automatique du client $relance_nombre_cheque = '7'; // Nombre de jours depuis commande avant annulation de commande $annulation_nombre_cheque = '14'; // Commentaire relance par mail $comments_relance_cheque = 'Relance par mail ce jour'; // Commentaire annulation commande $comments_annulation_cheque = 'Commande annulée'; //--------------------------------------------------------------------------------- // PAYEMENT PAR PAYPAL : // A MODIFIER EN FONCTION DE VOS BESOINS ET DES PARAMETRES DE VOTRE BOUTIQUE //--------------------------------------------------------------------------------- // Numéro du statut de commande verification paypal $relance_statut_virement = '4'; // Nombre de jours depuis commande avant relance automatique du client $relance_nombre_virement = '1'; // Nombre de jours depuis commande avant annulation de commande $annulation_nombre_virement = '1'; // Commentaire relance par mail $comments_relance_virement = 'Mail envoyé ce jour'; // Commentaire annulation commande $comments_annulation_virement = 'Commande annulée'; //--------------------------------------------------------------------------------- // RELANCE AUTOMATIQUE PAYEMENT PAR CHEQUE ET VIREMENT //--------------------------------------------------------------------------------- echo "Démarrage des relances de commandes en attente chèque et virement<br>"; // Test du champ orders.last_modified. Si le champs est vide, rempli avec la date de la commande $req_last = "select orders_id, last_modified, date_purchased FROM orders WHERE orders_status = $relance_statut_cheque and last_modified is NULL"; $resultat_last = mysql_query($req_last); while($l_last = mysql_fetch_array($resultat_last)){ tep_db_query("update orders set last_modified = date_purchased where orders_id = '" . $l_last['orders_id'] . "'"); } // Sélection des commandes en attente paiement par rapport a la date date de commande $req_relance = "select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address, o.orders_id, o.customers_id, o.last_modified, o.date_purchased, o.orders_status from " . TABLE_CUSTOMERS . " c, " . TABLE_ORDERS . " o where o.orders_status = $relance_statut_cheque and c.customers_id = o.customers_id and TO_DAYS(NOW()) - TO_DAYS(o.date_purchased) = $relance_nombre_cheque"; $resultat = mysql_query($req_relance); while($l = mysql_fetch_array($resultat)){ // Préparation et envoi du mail $check_status_query = tep_db_query("select customers_name, customers_id, customers_email_address, orders_status, date_purchased from orders where orders_id = '" . $l['orders_id'] . "'"); $check_status = tep_db_fetch_array($check_status_query); $num_com = $l['orders_id']; $email = STORE_NAME . "\n" . EMAIL_TEXT_SEPARATEUR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $l['orders_id'] . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $num_com, 'SSL', false) . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_short($l['date_purchased']) . "\n\n" . EMAIL_TEXT_COMMENTS_INTRO . "\n\n" . EMAIL_TEXT_COMMENTS_LIGNE1 . "\n\n" . EMAIL_TEXT_COMMENTS_LIGNE2 ."\n\n" . EMAIL_TEXT_COMMENTS_LIGNE3 . "\n\n" . EMAIL_TEXT_COMMENTS_LIGNE4 . "\n\n" . EMAIL_TEXT_COMMENTS_LIGNE5 . "\n\n" . EMAIL_TEXT_END; tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); // Mise à jour de la table orders pour ajout dans l'historique de la commande $customer_notified = $customer_notified_relance; $status = $relance_statut_cheque; $comments = $comments_relance_cheque; tep_db_query("update orders set last_modified = now() where orders_id = '" . $l['orders_id'] . "'"); tep_db_query("insert into orders_status_history (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . $l['orders_id'] . "', '" . tep_db_input($status) . "', now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments) . "')"); echo "x"; } echo "<br>Traitement terminé des relances de commandes en attente chèque et virement<br><br><br>"; // Stoppe pour 2 secondes sleep(2); //--------------------------------------------------------------------------------- // ANNULATION AUTOMATIQUE PAYEMENT PAR CHEQUE ET VIREMENT //--------------------------------------------------------------------------------- echo "Démarrage des annulations de commandes en attente chèque et virement<br>"; // Test du champ orders.last_modified. Si le champs est vide, rempli avec la date de la commande $req_last = "select orders_id, last_modified, date_purchased FROM orders WHERE orders_status = $relance_statut_cheque and last_modified is NULL"; $resultat_last = mysql_query($req_last); while($l_last = mysql_fetch_array($resultat_last)){ tep_db_query("update orders set last_modified = date_purchased where orders_id = '" . $l_last['orders_id'] . "'"); } // Sélection des commandes en attente paiement par rapport a la date date de commande $req_relance = "select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address, o.orders_id, o.customers_id, o.last_modified, o.date_purchased, o.orders_status from " . TABLE_CUSTOMERS . " c, " . TABLE_ORDERS . " o where o.orders_status = $relance_statut_cheque and c.customers_id = o.customers_id and TO_DAYS(NOW()) - TO_DAYS(o.date_purchased) = $annulation_nombre_cheque"; $resultat = mysql_query($req_relance); while($l = mysql_fetch_array($resultat)){ // Mise à jour de la table orders pour ajout dans l'historique de la commande et remise en stock des produits $customer_notified = $customer_notified_annulation; $status = $annulation_statut; $comments = $comments_annulation_cheque; tep_db_query("update orders set last_modified = now() where orders_id = '" . $l['orders_id'] . "'"); tep_db_query("update orders set orders_status = '" . tep_db_input($status) . "' where orders_id = '" . $l['orders_id'] . "'"); tep_db_query("insert into orders_status_history (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . $l['orders_id'] . "', '" . tep_db_input($status) . "', now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments) . "')"); //Code que j'ai rajouté $order_query = tep_db_query("select products_id, products_quantity from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'"); while ($order = tep_db_fetch_array($order_query)) { $is_bundle = 'no'; $product_bundle_query = tep_db_query("select subproduct_id, subproduct_qty from " . TABLE_PRODUCTS_BUNDLES . ", " . TABLE_PRODUCTS . " where bundle_id = '" . (int)$order['products_id'] . "' and products_id = '" . (int)$order['products_id'] . "' and products_bundle = 'yes'"); while ($product_bundle_data = tep_db_fetch_array($product_bundle_query)) { $is_bundle = 'yes'; tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity + " . $product_bundle_data['subproduct_qty']*$order['products_quantity'] . ", products_ordered = products_ordered - " . $product_bundle_data['subproduct_qty']*$order['products_quantity'] . " where products_id = '" . (int)$product_bundle_data['subproduct_id'] . "'"); } if ($is_bundle == 'no') { tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity + " . $order['products_quantity'] . ", products_ordered = products_ordered - " . $order['products_quantity'] . " where products_id = '" . (int)$order['products_id'] . "'"); } } echo "x"; } echo "<br>Traitement terminé des annulations de commandes en attente chèque et virement<br><br><br>"; //--------------------------------------------------------------------------------- // RELANCE AUTOMATIQUE PAYEMENT PAR PAYPAL //--------------------------------------------------------------------------------- echo "Démarrage des relances de commandes en attente de paiement paypal<br>"; // Test du champ orders.last_modified. Si le champs est vide, rempli avec la date de la commande $req_last = "select orders_id, last_modified, date_purchased FROM orders WHERE orders_status = $relance_statut_virement and last_modified is NULL"; $resultat_last = mysql_query($req_last); while($l_last = mysql_fetch_array($resultat_last)){ tep_db_query("update orders set last_modified = date_purchased where orders_id = '" . $l_last['orders_id'] . "'"); } // Sélection des commandes en attente paiement par rapport a la date date de commande $req_relance = "select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address, o.orders_id, o.customers_id, o.last_modified, o.date_purchased, o.orders_status from " . TABLE_CUSTOMERS . " c, " . TABLE_ORDERS . " o where o.orders_status = $relance_statut_virement and c.customers_id = o.customers_id and TO_DAYS(NOW()) - TO_DAYS(o.date_purchased) = $relance_nombre_virement"; $resultat = mysql_query($req_relance); while($l = mysql_fetch_array($resultat)){ // Préparation et envoi du mail $check_status_query = tep_db_query("select customers_name, customers_id, customers_email_address, orders_status, date_purchased from orders where orders_id = '" . $l['orders_id'] . "'"); $check_status = tep_db_fetch_array($check_status_query); $num_com = $l['orders_id']; $email = STORE_NAME . "\n" . EMAIL_TEXT_SEPARATEUR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $l['orders_id'] . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $num_com, 'SSL', false) . "\n" . EMAIL_TEXT_DATE_ORDERED . ' ' . tep_date_short($l['date_purchased']) . "\n\n" . EMAIL_TEXT_COMMENTS_INTRO . "\n\n" . EMAIL_TEXT_COMMENTS_LIGNE1P . "\n\n" . EMAIL_TEXT_COMMENTS_LIGNE2P . "\n\n" . EMAIL_TEXT_COMMENTS_LIGNE3P ."\n\n" . EMAIL_TEXT_COMMENTS_LIGNE5 . "\n\n" . EMAIL_TEXT_END; tep_mail($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT_P, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); // Mise à jour de la table orders pour ajout dans l'historique de la commande $customer_notified = $customer_notified_relance; $status = $relance_statut_virement; $comments = $comments_relance_virement; tep_db_query("update orders set last_modified = now() where orders_id = '" . $l['orders_id'] . "'"); tep_db_query("insert into orders_status_history (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . $l['orders_id'] . "', '" . tep_db_input($status) . "', now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments) . "')"); echo "x"; } echo "<br>Traitement terminé des relances de commandes en attente de paiement paypal<br><br><br>"; // Stoppe pour 2 secondes sleep(2); //--------------------------------------------------------------------------------- // ANNULATION AUTOMATIQUE PAYEMENT PAR PAYPAL //--------------------------------------------------------------------------------- echo "Démarrage des annulations de commandes en attente de paiement paypal<br>"; // Test du champ orders.last_modified. Si le champs est vide, rempli avec la date de la commande $req_last = "select orders_id, last_modified, date_purchased FROM orders WHERE orders_status = $relance_statut_virement and last_modified is NULL"; $resultat_last = mysql_query($req_last); while($l_last = mysql_fetch_array($resultat_last)){ tep_db_query("update orders set last_modified = date_purchased where orders_id = '" . $l_last['orders_id'] . "'"); } // Sélection des commandes en attente paiement par rapport a la date date de commande $req_relance = "select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address, o.orders_id, o.customers_id, o.last_modified, o.date_purchased, o.orders_status from " . TABLE_CUSTOMERS . " c, " . TABLE_ORDERS . " o where o.orders_status = $relance_statut_virement and c.customers_id = o.customers_id and TO_DAYS(NOW()) - TO_DAYS(o.date_purchased) = $annulation_nombre_virement"; $resultat = mysql_query($req_relance); while($l = mysql_fetch_array($resultat)){ // Mise à jour de la table orders pour ajout dans l'historique de la commande et remise en stock des produits $customer_notified = $customer_notified_annulation; $status = $annulation_statut; $comments = $comments_annulation_virement; tep_db_query("update orders set last_modified = now() where orders_id = '" . $l['orders_id'] . "'"); tep_db_query("update orders set orders_status = '" . tep_db_input($status) . "' where orders_id = '" . $l['orders_id'] . "'"); tep_db_query("insert into orders_status_history (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . $l['orders_id'] . "', '" . tep_db_input($status) . "', now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments) . "')"); //Code que j'ai rajouté $order_query = tep_db_query("select products_id, products_quantity from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'"); while ($order = tep_db_fetch_array($order_query)) { $is_bundle = 'no'; $product_bundle_query = tep_db_query("select subproduct_id, subproduct_qty from " . TABLE_PRODUCTS_BUNDLES . ", " . TABLE_PRODUCTS . " where bundle_id = '" . (int)$order['products_id'] . "' and products_id = '" . (int)$order['products_id'] . "' and products_bundle = 'yes'"); while ($product_bundle_data = tep_db_fetch_array($product_bundle_query)) { $is_bundle = 'yes'; tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity + " . $product_bundle_data['subproduct_qty']*$order['products_quantity'] . ", products_ordered = products_ordered - " . $product_bundle_data['subproduct_qty']*$order['products_quantity'] . " where products_id = '" . (int)$product_bundle_data['subproduct_id'] . "'"); } if ($is_bundle == 'no') { tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity + " . $order['products_quantity'] . ", products_ordered = products_ordered - " . $order['products_quantity'] . " where products_id = '" . (int)$order['products_id'] . "'"); } } echo "x"; } echo "<br>Traitement terminé des annulations de commandes en attente de paiement paypal<br><br><br>"; ?> But it doesn't work. I have no error but bundle product are not restocked. Can someone help me to do this code working fine? Thanks a lot ;) ;) ;)
  17. royal38

    NEW! Complete Order Editing Tool!

    You don't have to click on a button to update. It's ajax technology = Automatic update
  18. Hello, I have some product which contain other product. For example, the product A contains : 2 products B + 3 products C. Do you know a contribution that drop 2 products B of "product B inventory" and 3 products C of "product C inventory" when a produtct A is buy? Thanks for your help, and sorry for my bad english. ;) :D
  19. Yes you are right ;) I forgot to define table name in the database file :blush: Last question. I have an automatic Cron task that restock and cancel prending orders < 14 days. Here is the task : <?php include('includes/application_top.php'); //--------------------------------------------------------------------------------- // PARAMETRES COMMUNS : // A MODIFIER EN FONCTION DE VOS BESOINS ET DES PARAMETRES DE VOTRE BOUTIQUE //--------------------------------------------------------------------------------- // Numéro du statut de commande annulée $annulation_statut = '7'; // Notification client par mail lors de l'annulation de la commande : 0=non / 1=oui $customer_notified_annulation = '0'; //--------------------------------------------------------------------------------- // PAYEMENT PAR CHEQUE et VIREMENT : // A MODIFIER EN FONCTION DE VOS BESOINS ET DES PARAMETRES DE VOTRE BOUTIQUE //--------------------------------------------------------------------------------- // Numéro du statut de commande en attente chèque et virement $relance_statut_cheque = '1'; // Nombre de jours depuis commande avant annulation de commande $annulation_nombre_cheque = '14'; // Commentaire annulation commande $comments_annulation_cheque = 'Commande annulée'; //--------------------------------------------------------------------------------- // ANNULATION AUTOMATIQUE PAYEMENT PAR CHEQUE ET VIREMENT //--------------------------------------------------------------------------------- echo "Démarrage des annulations de commandes en attente chèque et virement<br>"; // Test du champ orders.last_modified. Si le champs est vide, rempli avec la date de la commande $req_last = "select orders_id, last_modified, date_purchased FROM orders WHERE orders_status = $relance_statut_cheque and last_modified is NULL"; $resultat_last = mysql_query($req_last); while($l_last = mysql_fetch_array($resultat_last)){ tep_db_query("update orders set last_modified = date_purchased where orders_id = '" . $l_last['orders_id'] . "'"); } // Sélection des commandes en attente paiement par rapport a la date date de commande $req_relance = "select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address, o.orders_id, o.customers_id, o.last_modified, o.date_purchased, o.orders_status from " . TABLE_CUSTOMERS . " c, " . TABLE_ORDERS . " o where o.orders_status = $relance_statut_cheque and c.customers_id = o.customers_id and TO_DAYS(NOW()) - TO_DAYS(o.date_purchased) = $annulation_nombre_cheque"; $resultat = mysql_query($req_relance); while($l = mysql_fetch_array($resultat)){ // Mise à jour de la table orders pour ajout dans l'historique de la commande et remise en stock des produits $customer_notified = $customer_notified_annulation; $status = $annulation_statut; $comments = $comments_annulation_cheque; tep_db_query("update orders set last_modified = now() where orders_id = '" . $l['orders_id'] . "'"); tep_db_query("update orders set orders_status = '" . tep_db_input($status) . "' where orders_id = '" . $l['orders_id'] . "'"); tep_db_query("insert into orders_status_history (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . $l['orders_id'] . "', '" . tep_db_input($status) . "', now(), '" . tep_db_input($customer_notified) . "', '" . tep_db_input($comments) . "')"); $proannule_query = tep_db_query("select products_id, products_quantity from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . $l['orders_id'] . "'"); while ($proannule = tep_db_fetch_array($proannule_query)) { tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity + " . $proannule['products_quantity'] . ", products_ordered = products_ordered - " . $proannule['products_quantity'] . " where products_id = '" . (int)$proannule['products_id'] . "'"); } echo "x"; } echo "<br>Traitement terminé des annulations de commandes en attente chèque et virement<br><br><br>"; ?> How to update inventory for bundles product and not the master product?? Thanks a lot for your help ;)
  20. Hi, This contribution is great but I have a problem when I try to delete an order in the admin. After clicking "Delete", I have this error : 1146 - Table 'mydatabase.TABLE_PRODUCTS_BUNDLES' doesn't exist select subproduct_id, subproduct_qty from TABLE_PRODUCTS_BUNDLES, products where bundle_id = '196' and products_id = '196' and products_bundle = 'yes' [TEP STOP] I don't understand because the table product_bundles exist : I think the problem is in this function of admin/functions/general.php function tep_remove_order($order_id, $restock = false) { if ($restock == 'on') { $order_query = tep_db_query("select products_id, products_quantity from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'"); while ($order = tep_db_fetch_array($order_query)) { $is_bundle = 'no'; $product_bundle_query = tep_db_query("select subproduct_id, subproduct_qty from " . TABLE_PRODUCTS_BUNDLES . ", " . TABLE_PRODUCTS . " where bundle_id = '" . (int)$order['products_id'] . "' and products_id = '" . (int)$order['products_id'] . "' and products_bundle = 'yes'"); while ($product_bundle_data = tep_db_fetch_array($product_bundle_query)) { $is_bundle = 'yes'; tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity + " . $product_bundle_data['subproduct_qty']*$order['products_quantity'] . ", products_ordered = products_ordered - " . $product_bundle_data['subproduct_qty']*$order['products_quantity'] . " where products_id = '" . (int)$product_bundle_data['subproduct_id'] . "'"); } if ($is_bundle == 'no') { tep_db_query("update " . TABLE_PRODUCTS . " set products_quantity = products_quantity + " . $order['products_quantity'] . ", products_ordered = products_ordered - " . $order['products_quantity'] . " where products_id = '" . (int)$order['products_id'] . "'"); } } } tep_db_query("delete from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'"); tep_db_query("delete from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'"); tep_db_query("delete from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "'"); tep_db_query("delete from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . (int)$order_id . "'"); tep_db_query("delete from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "'"); } Can someone help me? Thanks a lot ;)
  21. Thanks a lot!! I will try this :lol:
  22. royal38

    NEW! Complete Order Editing Tool!

    Hello ;) This contribution is great :D but I've a little bug with it. :( Here the code of edit_orders.php and edit_orders_add_product.php When I edit an order and I add a product, a popup opens (all is ok here) : Popup's url : When the first product have been added (green), the popup go to the beginning to add an other product and the url is : And here is the bug :huh: . I can't open the combo box to add a new product. I have to close the popup and reopen it to add an other product. :blink: Someone know what is the problem? I think the problem is here but i'm not sure (edit_orders_add_product.php) : // Unset selected product & category $add_product_categories_id = 0; $add_product_products_id = 0; tep_redirect(tep_href_link(FILENAME_ORDERS_EDIT_ADD_PRODUCT, 'oID=' . $oID . '&step=1&submitForm=yes')); break; } } Thanks a lot for your help ;)
  23. Hello, I've installed "order editor" and this contrib is great!! I also use "step by step manual order entry". When I edit an order, I have an error when I add a product in the order : Here is the error : Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/xxxxxxxx/public_html/adminxxxxx/edit_orders.php on line 423 Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/xxxxxxxxx/public_html/adminxxxxx/edit_orders.php on line 423 Warning: Cannot modify header information - headers already sent by (output started at /home/xxxxxxx/public_html/adminxxxxxx/edit_orders.php:423) in /home/xxxxxxxx/public_html/adminxxxxx/includes/functions/general.php on line 86 Line 423 of edit_orders.php : if ( (!in_array($ot_class, $written_ot_totals_array)) && (!in_array($ot_title, $written_ot_titles_array)) && (tep_not_null($ot_value)) && (tep_not_null($ot_title)) && ($ot_class != 'ot_tax') && ($ot_class != 'ot_loworderfee') ) { //7 Large code : } elseif ($new_ot_total) { //also within 6 $order->info['total'] += ($order_totals[$i]['value']*(-1)); $current_ot_totals_array[] = $order_totals[$i]['code']; $written_ot_totals_array[] = $ot_class; $written_ot_titles_array[] = $ot_title; }//end 6 }//end 4 } elseif ( (tep_not_null($ot_value)) && (tep_not_null($ot_title)) ) { // this modifies if (!strstr($ot_class, 'ot_custom')) { //3 $new_order_totals[] = array('title' => $ot_title, 'text' => $currencies->format($ot_value, true, $order->info['currency'], $order->info['currency_value']), 'value' => $ot_value, 'code' => 'ot_custom_' . $j, 'sort_order' => $j); $order->info['total'] += $ot_value; $written_ot_totals_array[] = $ot_class; $written_ot_titles_array[] = $ot_title; $j++; } //end 3 //save ot_skippy from certain annihilation if ( (!in_array($ot_class, $written_ot_totals_array)) && (!in_array($ot_title, $written_ot_titles_array)) && (tep_not_null($ot_value)) && (tep_not_null($ot_title)) && ($ot_class != 'ot_tax') && ($ot_class != 'ot_loworderfee') ) { //7 //this is supposed to catch the oddball components that don't show up in $order_totals $new_order_totals[] = array( 'title' => $ot_title, 'text' => $currencies->format($ot_value, true, $order->info['currency'], $order->info['currency_value']), 'value' => $ot_value, 'code' => $ot_class, 'sort_order' => $j); //$current_ot_totals_array[] = $order_totals[$i]['code']; //$current_ot_titles_array[] = $order_totals[$i]['title']; $written_ot_totals_array[] = $ot_class; $written_ot_titles_array[] = $ot_title; $j++; } //end 7 Line 86 of general.php. header('Location: ' . $url); Large code // Redirect to another page or site function tep_redirect($url) { global $logger; if ( (strstr($url, "\n") != false) || (strstr($url, "\r") != false) ) { tep_redirect(tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false)); } header('Location: ' . $url); if (STORE_PAGE_PARSE_TIME == 'true') { if (!is_object($logger)) $logger = new logger; $logger->timer_stop(); } exit; } //// I have an error but information are updated! Can you help me please? Thanks a lot ;)
  24. Hello :) , I have a problem with the contribution Step-By-Step Manual Order Entry When I try to edit an order created in the admin, I have no problem, total is good. :lol: But when I try to edit an order which is made on the website, total is wrong (total is only the cost of shipping :blink: ) I think there is a problem in edit_orders.php : edit_orders.txt Here is what I have in the admin when I edit an order made on the website : And here is what I see when I edit an order created in the admin with the contribution : You can see there is sub-total on the 2nd pictures and not on the 1st. Is it the problem? Thanks for your help :) :thumbsup:
  25. royal38

    [CONTRIBUTION] PDF Customer Invoice

    HI MindTwist :thumbsup: I try your code and I have this error : Parse error: syntax error, unexpected T_BOOLEAN_OR in /home/xxxxxx/public_html/account_history_info.php on line 235 Thanks :thumbsup:
×