bhbilbao 1 Posted December 20, 2010 (edited) Need help with this contribution from 6 Nov 2006. http://addons.oscommerce.com/info/4641 I searched for the original post , but there is nothing: http://forums.oscommerce.com/index.php?showtopic=235395 The problem is when sending emails. Sends all Requested products to all customers, independent that the customer select it or not. The problem are queries, i don´t know how could be the correct maner. case 'email': $purchase_customer_query = tep_db_query("select distinct customers_id from purchase where notify=0"); while ($purchase_customer = tep_db_fetch_array($purchase_customer_query)){ $purchase_query = tep_db_query("select pch.purchase_id, pch.customer_name, pch.language, pch.products_id, pch.product_model, pch.product_name, pch.quantity from purchase pch left join products p using (products_id) where pch.notify = '0' and p.products_quantity >= pch.quantity and p.products_status = '1'"); $purchase_count_query = tep_db_query("select count(*) as item_no from purchase pch left join products p using (products_id) where pch.notify = '0' and p.products_quantity >= pch.quantity and p.products_status = '1'"); $purchase_count = tep_db_fetch_array($purchase_count_query); $customer_email_query = tep_db_query("select customers_email_address from customers where customers_id='".$purchase_customer['customers_id']."'"); $customer_email = tep_db_fetch_array($customer_email_query); $purchase = tep_db_fetch_array($purchase_query); Edited December 20, 2010 by bhbilbao Share this post Link to post Share on other sites