I am currently intergrating vendors email for RC3 all works well and this will be another mod ported to work with RC3.
But after testing this mod would it not be better to move the code to the catalog side at the moment vendors email gets sent out only after you update the order status to processing by admin side which is fine but I would like to hack this mod and make it automatied so lets say we go on hoilday for a week and we want to put our shop on auto pilot.
can we move this code to checkout success or order process and enable product order sent to product manaufacure as soon as the order has completed as successfull purchase. Can we check to make sure that payments have been made successfully before vendors email gets sent for that order and may be create new order status name to vendor_ordered and get the code to change the status once email has been sent.
I have searched high and low and on come agross this code from osc forums but this did not work for me may be PHP guys can shed some light so I can get this hack successfully working and released to RC3 users.
Many Thanks
Automotiveuk
Code checkout_process.php
------------------------------------------------------------
// send emails to other people
if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
}
//vendors email begin
// Get the delivery address
$delivery_address_query = tep_db_query("select distinct delivery_company, delivery_name, delivery_street_address, delivery_city, delivery_state, delivery_postcode from " . TABLE_ORDERS . " where orders_id='" . $insert_id ."'");
$delivery_address_list = tep_db_fetch_array($delivery_address_query);
//find out what shipping methods the customer chose
$shipping_method_query = tep_db_query("select title from " . TABLE_ORDERS_TOTAL . " where orders_id='" . $insert_id . "' and class = 'ot_shipping'");
$shipping_method = tep_db_fetch_array($shipping_method_query);
$vendors_email_query = tep_db_query("select distinct o.orders_id, v.vendors_id, v.vendors_name, v.vendors_email, v.vendors_contact, v.vendor_add_info, v.vendor_street, v.vendor_city, v.vendor_state, v.vendors_zipcode, v.vendor_country, v.account_number, o.products_id, o.orders_products_id FROM " . TABLE_VENDORS . " v, " . TABLE_ORDERS_PRODUCTS . " o, " . TABLE_PRODUCTS . " p where p.vendors_id=v.vendors_id and o.products_id=p.products_id and o.orders_id='" . $insert_id . "' and v.vendors_send_email=1 GROUP BY vendors_id");
while ($vendors_email_list= tep_db_fetch_array($vendors_email_query)) {
$order_number='" . $insert_id . "';
$the_email=$vendors_email_list['vendors_email'];
$the_name=$vendors_email_list['vendors_name'];
$the_contact=$vendors_email_list['vendors_contact'];
$email= $the_contact . ' <br>' . $the_name . '<br>' . $the_email . '<br>' .
$vendors_email_list['vendor_street'] .'<br>' .
$vendors_email_list['vendor_city'] .', ' .
$vendors_email_list['vendor_state'] .' ' .
$vendors_email_list['vendors_zipcode'] . ' ' . $vendors_email_list['vendor_country'] . '<br>' . "\n" . EMAIL_SEPARATOR . "\n" . 'Special Comments or Instructions: ' . $vendors_email_list['vendor_add_info'] .'' . "\n" . EMAIL_SEPARATOR . "\n" . 'From: ' . STORE_OWNER . "\n" . STORE_NAME_ADDRESS . "\n" . 'Accnt #: ' . $vendors_email_list['account_number'] . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" . EMAIL_SEPARATOR . "\n" . '<br>';
// Get all the products to be included in the email
$vendors_email_products_query = tep_db_query("select distinct o.orders_id, o.orders_products_id, v.vendors_id, p.vendors_prod_comments, o.products_name, p.vendors_prod_id, o.products_model, o.products_id, o.products_quantity, p.vendors_product_price, o.orders_products_id FROM " . TABLE_VENDORS . " v, " . TABLE_ORDERS_PRODUCTS . " o, " . TABLE_PRODUCTS . " p where p.vendors_id=v.vendors_id and v.vendors_id='" . $vendors_email_list['vendors_id'] . "' and o.products_id=p.products_id and o.orders_id='" . $insert_id . "' order by o.products_name");
$email = $email . '<table width="75%" border=1 cellspacing="0" cellpadding="3">
<tr><td>Qty:</td><td>Product Name:</td><td>Item Code/Number:</td><td>Product Model:</td><td>Per Unit Price:</td><td>Item Comments: </td></tr>';
while ($vendors_email_products= tep_db_fetch_array($vendors_email_products_query)) {
$product_attribs ='';
$vendors_email_products_attrib_query = tep_db_query("SELECT products_options, products_options_values FROM " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " WHERE 1 AND orders_products_id = '" . $vendors_email_products['orders_products_id'] . "'");
while ($vendors_email_products_attribs = tep_db_fetch_array($vendors_email_products_attrib_ query)) {
$product_attribs .= $vendors_email_products_attribs['products_options'] . ': ' . $vendors_email_products_attribs['products_options_values'] . '<br>';
}
$email = $email . '<tr><td> ' . $vendors_email_products['products_quantity'] .
'</td><td> ' . $vendors_email_products['products_name'] . '<br>' . $product_attribs .
'</td><td> ' . $vendors_email_products['vendors_prod_id'] .
'</td><td> ' . $vendors_email_products['products_model'] .
'</td><td> ' . $vendors_email_products['vendors_product_price'] . '</td><td>' .
$vendors_email_products['vendors_prod_comments'] . '</td></tr>';
}
$email = $email . '</table><br>';
//send the email
tep_mail($the_name, $the_email, EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id , $email . '<br>', STORE_NAME, STORE_OWNER_EMAIL_ADDRESS) ;
}
//vendors_email end
// LINE ADDED: MOD - OSC-AFFILIATE
require(DIR_WS_INCLUDES . 'affiliate_checkout_process.php');
// START HTML Invoice
}
// END HTML Invoice
// load the after_process function from the payment modules
$payment_modules->after_process();
$cart->reset(true);





LinkBack URL
About LinkBacks






Bookmarks