royal38 Posted June 21, 2008 Share Posted June 21, 2008 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 Quote Link to comment Share on other sites More sharing options...
germ Posted June 22, 2008 Share Posted June 22, 2008 This might work: Bundled Products I really don't know anything about it, but it sounds like it might work for you. Quote If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there > Link to comment Share on other sites More sharing options...
royal38 Posted June 22, 2008 Author Share Posted June 22, 2008 Thanks a lot!! I will try this :lol: Quote Link to comment Share on other sites More sharing options...
royal38 Posted July 1, 2008 Author Share Posted July 1, 2008 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 ;) Quote Link to comment Share on other sites More sharing options...
spooks Posted July 1, 2008 Share Posted July 1, 2008 No, the error is in your install, you did`nt finish it, check database_tables.php Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
royal38 Posted July 1, 2008 Author Share Posted July 1, 2008 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 ;) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.