Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Multi_Vendor_Shipping new thread


blucollarguy

Recommended Posts

I think that I have a solution to the "checkout without shipping" bug that will work in all cases. Please try this in your setup and let me know how it works. If you have code that bypasses checkout_shipping.php completely for virtual products, you'll need to bypass this code as well. This should go in the top of checkout_payment.php (near the existing test for shipping method is probably logical.)

// MVS
//if a shipping method has not been selected for all vendors, redirect the customer to the shipping method selection page
 if (SELECT_VENDOR_SHIPPING == 'true') { // This test only works under MVS
if (!is_array ($shipping['vendor']) || count ($shipping['vendor']) != count ($cart->vendor_shipping)) { // No shipping selected or not all selected
  tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, 'error_message=' . ERROR_NO_SHIPPING_SELECTED_SELECTED . ERROR_NO_SHIPPING_SELECTED_SELECTED_MORE, 'SSL'));
} 
 }
// MVS end

You need Craig's error code language definitions as well, or make up your own.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

@ bluecollarguy and kymation

 

 

Hello Craig, hello Jim

 

I have a problem:

 

Automatic "catalog"-vendor E-Mail doesn?t work.

 

Possible reason:

 

In "ceckout_process.php" on Line 380:

 

tep_db_query("update " . TABLE_ORDERS_VENDORS . " set order_sent = '" . tep_db_input($vendor_order_sent) . "' where orders_id = '" . (int)$oID . "' and vendors_id = '" . (int)$vendors_id . "'");

 

there is a update query to a table called "TABLE_ORDERS_VENDORS" which I can?t find.

 

No define-entry in "database_tables.php"!

 

I was trying to embed the code (definition + call of function "vendors_email") from "admin/orders.php", which works nicely by the way , in "checkout_process.php", but still get no automatic "catalog"-vendor E-Mail.

 

So I?m stuck (again).

 

 

As this problem does not occure on your "test-site" it must have already been fixed for the next release I assume.

 

So it would be great if you could post me a copy of your fixed checkout_process.php.

 

 

Thanks in advance for your help.

 

Mike

Link to comment
Share on other sites

@ bluecollarguy and kymation

Hello Craig, hello Jim

 

I have a problem:

 

Automatic "catalog"-vendor E-Mail doesn?t work.

 

Possible reason:

 

In "ceckout_process.php" on Line 380:

 

tep_db_query("update " . TABLE_ORDERS_VENDORS . " set order_sent = '" . tep_db_input($vendor_order_sent) . "' where orders_id = '" . (int)$oID . "' and vendors_id = '" . (int)$vendors_id . "'");

 

there is a update query to a table called "TABLE_ORDERS_VENDORS" which I can?t find.

No define-entry in "database_tables.php"!

 

I was trying to embed the code (definition + call of function "vendors_email") from "admin/orders.php", which works nicely by the way , in "checkout_process.php", but still get no automatic "catalog"-vendor E-Mail.

 

So I?m stuck (again).

As this problem does not occure on your "test-site" it must have already been fixed for the next release I assume.

 

So it would be great if you could post me a copy of your fixed checkout_process.php.

Thanks in advance for your help.

 

Mike

I can't find any of the versions on my test and developement sites that have that call "TABLE_ORDERS_VENDORS", so I'm not sure where it came from, it should be "TABLE_ORDERS_SHIPPING", and then from the RC4 release(RC5 was as "unofficial" release), in catalog/includes/database_tables.php, add:

//MVS Start
 define('TABLE_ORDERS_SHIPPING','orders_shipping');
 define('TABLE_VENDORS', 'vendors');
 define('TABLE_VENDOR_CONFIGURATION', 'vendor_configuration');
 define('TABLE_VENDOR_CONFIGURATION_GROUP','vendor_configuration_group');
//MVS End

This will define the table you are missing, if you missed this, you might want to double check the rest of your edits to be sure there is nothing else you missed.

 

Craig :)

Happy Coding!

Craig Garrison Sr

Anything worth having, is worth working for.

Multi Vendor Shipping V1.1 Demo Catalog

3 Vendors, each category, "buy" a product from each category to see how MVS works during checkout.

Multi Vendor Shipping V1.1 Demo Admin

login: [email protected]

pass: mvs_demo

MVS Thread:

Multi-Vendor Shipping

My contribs:

Download Multi Vendor Shipping V1.1

Vendor Email

Vendor Info in easypopulate

EZ Price Updater

And more to come!

Link to comment
Share on other sites

I can't find any of the versions on my test and developement sites that have that call "TABLE_ORDERS_VENDORS", so I'm not sure where it came from, it should be "TABLE_ORDERS_SHIPPING", and then from the RC4 release(RC5 was as "unofficial" release), in catalog/includes/database_tables.php, add:
//MVS Start
 define('TABLE_ORDERS_SHIPPING','orders_shipping');
 define('TABLE_VENDORS', 'vendors');
 define('TABLE_VENDOR_CONFIGURATION', 'vendor_configuration');
 define('TABLE_VENDOR_CONFIGURATION_GROUP','vendor_configuration_group');
//MVS End

This will define the table you are missing, if you missed this, you might want to double check the rest of your edits to be sure there is nothing else you missed.

 

Craig :)

TABLE_ORDERS_VENDORS can be found in the Catalog_Install.txt.

======================

Multi Vendor Shipping

Version: MVS 0.9RC4

Dated: June 01, 2005

======================

 

I would suppose there are quite a few who have this in their code, since it came with the release. I will need to make the change to TABLE_ORDERS_SHIPPING as well. Thanks for the catch.

Link to comment
Share on other sites

To Craig

 

Thanks for your quick answer but it doesn't work even with the change to "TABLE_ORDERS_SHIPPING".

 

Here are the functions + calls in "checkout_process.php" and "orders.php".

 

 

-------------------------------------------------------------------------------------------------

 

Implementation of function "vendors_email" in "checkout_process.php" / RC4 (RC5 --> identical)

 

-----------------------------------------------------------------------------------------------------

 

//Vendor Email Start

function vendors_email($vendors_id, $oID, $status, $vendor_order_sent) {

  $vendor_order_sent =  false;
  $debug='no';
  $vendor_order_sent = 'no';
  $index2 = 0;

	  //let's get the Vendors
		  $vendor_data_query = tep_db_query("select 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, v.vendors_status_send, os.shipping_module, os.shipping_method, os.shipping_cost, os.shipping_tax, os.vendor_order_sent from " . TABLE_VENDORS . " v,  " . TABLE_ORDERS_SHIPPING . " os where v.vendors_id=os.vendors_id and v.vendors_id='" . $vendors_id . "' and os.orders_id='" . (int)$oID . "' and v.vendors_status_send='" . $status . "'");
	   while ($vendor_order = tep_db_fetch_array($vendor_data_query)) {
$vendor_products[$index2] = array('Vid' => $vendor_order['vendors_id'],
						 'Vname' => $vendor_order['vendors_name'],
						 'Vemail' => $vendor_order['vendors_email'],
						 'Vcontact' => $vendor_order['vendors_contact'],
						 'Vaccount' => $vendor_order['account_number'],
						 'Vstreet' => $vendor_order['vendor_street'],
						 'Vcity' => $vendor_order['vendor_city'],
						 'Vstate' => $vendor_order['vendor_state'],
						 'Vzipcode' => $vendor_order['vendors_zipcode'],
						 'Vcountry' => $vendor_order['vendor_country'],
						 'Vaccount' => $vendor_order['account_number'],
			 'Vinstructions' => $vendor_order['vendor_add_info'],
						 'Vmodule' => $vendor_order['shipping_module'],
			 'Vmethod' => $vendor_order['shipping_method']);
if ($debug == 'yes') {
echo 'The vendor query: ' . $vendor_order['vendors_id'] . '<br>';
  }
							   $index = 0;
$vendor_orders_products_query = tep_db_query("select o.orders_id, o.orders_products_id, o.products_model, o.products_id, o.products_quantity, o.products_name, p.vendors_id,  p.vendors_prod_comments, p.vendors_prod_id, p.vendors_product_price from " . TABLE_ORDERS_PRODUCTS . " o, " . TABLE_PRODUCTS . " p where p.vendors_id='" . (int)$vendor_order['vendors_id'] . "' and o.products_id=p.products_id and o.orders_id='" . $oID . "' order by o.products_name");
	while ($vendor_orders_products = tep_db_fetch_array($vendor_orders_products_query)) {
  $vendor_products[$index2]['vendor_orders_products'][$index] = array(
								  'Pqty' => $vendor_orders_products['products_quantity'],
								  'Pname' => $vendor_orders_products['products_name'],
								  'Pmodel' => $vendor_orders_products['products_model'],
								  'Pprice' => $vendor_orders_products['products_price'],
								  'Pvendor_name' => $vendor_orders_products['vendors_name'],
								  'Pcomments' => $vendor_orders_products['vendors_prod_comments'],
								  'PVprod_id' => $vendor_orders_products['vendors_prod_id'],
								  'PVprod_price' => $vendor_orders_products['vendors_product_price'],
								  'spacer' => '-');
							   //MVS end
			   if ($debug == 'yes') {
echo 'The products query: ' . $vendor_orders_products['products_name'] . '<br>';
}
	$subindex = 0;
  $vendor_attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$oID . "' and orders_products_id = '" . (int)$vendor_orders_products['orders_products_id'] . "'");
	if (tep_db_num_rows($vendor_attributes_query)) {
	  while ($vendor_attributes = tep_db_fetch_array($vendor_attributes_query)) {
	  $vendor_products[$index2]['vendor_orders_products'][$index]['vendor_attributes'][$subindex] = array('option' => $vendor_attributes['products_options'],
																 'value' => $vendor_attributes['products_options_values'],
																 'prefix' => $vendor_attributes['price_prefix'],
																 'price' => $vendor_attributes['options_values_price']);

		$subindex++;
	  }
	}
	$index++;
  }
 $index2++;
// let's build the email
  // 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='" . $oID ."'");
 $vendor_delivery_address_list = tep_db_fetch_array($delivery_address_query);

if ($debug == 'yes') {
echo 'The number of vendors: ' . sizeof($vendor_products) . '<br>';
 }
$email='';
for ($l=0, $m=sizeof($vendor_products); $l<$m; $l++) {

$vendor_country = tep_get_country_name($vendor_products[$l]['Vcountry']);
$order_number= $oID;
$vendors_id=$vendor_products[$l]['Vid'];
$the_email=$vendor_products[$l]['Vemail'];
$the_name=$vendor_products[$l]['Vname'];
$the_contact=$vendor_products[$l]['Vcontact'];
$email=  '<b>To: ' . $the_contact . '  <br>' . $the_name . '<br>' . $the_email . '<br>' .
$vendor_products[$l]['Vstreet'] .'<br>' .
$vendor_products[$l]['Vcity'] .', ' .
$vendor_products[$l]['Vstate'] .'  ' .
$vendor_products[$l]['Vzipcode'] . ' ' . $vendor_country . '<br>' . '<br>' . EMAIL_SEPARATOR . '<br>' . 'Special Comments or Instructions:  ' . $vendor_products[$l]['Vinstructions'] .'<br>' . '<br>' . EMAIL_SEPARATOR . '<br>' . 'From: ' . STORE_OWNER . '<br>' . STORE_NAME_ADDRESS . '<br>' . 'Accnt #: ' . $vendor_products[$l]['Vaccount'] . '<br>' . EMAIL_SEPARATOR . '<br>' . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . '<br>' .  EMAIL_SEPARATOR . '<br>' . '<br> Shipping Method: ' .  $vendor_products[$l]['Vmodule'] . ' -- '  .  $vendor_products[$l]['Vmethod'] .  '<br>' .  EMAIL_SEPARATOR . '<br>' . '<br>Dropship deliver to:<br>' .
$vendor_delivery_address_list['delivery_company'] .'<br>' .
$vendor_delivery_address_list['delivery_name'] .'<br>' .
$vendor_delivery_address_list['delivery_street_address'] .'<br>' .
$vendor_delivery_address_list['delivery_city'] .', ' .
$vendor_delivery_address_list['delivery_state'] . ' ' . $vendor_delivery_address_list['delivery_postcode'] . '<br><br>';
$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>';
	   for ($i=0, $n=sizeof($vendor_products[$l]['vendor_orders_products']); $i<$n; $i++) {
  $product_attribs ='';
  if (isset($vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes']) && (sizeof($vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes']) > 0)) {

	for ($j = 0, $k = sizeof($vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes']); $j < $k; $j++) {
	 $product_attribs .= '  ' . $vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes'][$j]['option'] . ': ' .  $vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes'][$j]['value'] . '<br>';
	}
	}
	$email = $email . '<tr><td> ' . $vendor_products[$l]['vendor_orders_products'][$i]['Pqty'] .
 '</td><td> ' . $vendor_products[$l]['vendor_orders_products'][$i]['Pname'] . '<br>  <i>Option<br> ' . $product_attribs .
 '</td><td> ' . $vendor_products[$l]['vendor_orders_products'][$i]['PVprod_id'] .
 '</td><td> ' . $vendor_products[$l]['vendor_orders_products'][$i]['Pmodel'] .
 '</td><td> ' . $vendor_products[$l]['vendor_orders_products'][$i]['PVprod_price'] . '</td><td>' .
 $vendor_products[$l]['vendor_orders_products'][$i]['Pcomments'] . '</b></td></tr>';

  }
}
$email = $email . '</table><br><HR><br>';

tep_mail($the_name, $the_email, EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID ,  $email .  '<br>', STORE_NAME, STORE_OWNER_EMAIL_ADDRESS) ;
 $vendor_order_sent = 'yes';




 tep_db_query("update " . TABLE_ORDERS_VENDORS . " set order_sent = '" . tep_db_input($vendor_order_sent) . "' where orders_id = '" . (int)$oID . "'  and vendors_id = '" . (int)$vendors_id . "'");



 if ($debug == 'yes') {
	   echo 'The $email(including headers:<br>Vendor Email Addy' . $the_email . '<br>Vendor Name' . $the_name . '<br>Vendor Contact' . $the_contact . '<br>Body--<br>' . $email . '<br>';
	   }
 }

 return true;
}
//Vendor Email End

 

********************************************************************************

*********************************

 

---------> "vendors_email"-function call on line 448:

 

------------------------------------------------------------------------------------------------------------------

 //Vendors email check status begin
if (SELECT_VENDOR_EMAIL_WHEN == 'Catalog' || SELECT_VENDOR_EMAIL_WHEN == 'Both') {
		 if (isset($status)) {
 $order_sent_query = tep_db_query("select vendor_order_sent, vendors_id from " . TABLE_ORDERS_SHIPPING . " where orders_id = '" . $insert_id . "'");
   while ($order_sent_data = tep_db_fetch_array($order_sent_query)) {
 $order_sent_ckeck = $order_sent_data['vendor_order_sent'];
 $vendors_id = $order_sent_data['vendors_id'];
//   echo $order_sent_check . ' The order sent check<br>';
//		  echo $insert_id . 'The order number<br>';
  if ($order_sent_ckeck == 'no') {
	 $status='';
	 $oID=$insert_id;
	 $vendor_order_sent = false;
	 $status=$order->info['order_status'];


	 vendors_email($vendors_id, $oID, $status, $vendor_order_sent);				 


		}// if order check
	  }// while
	}// if isset
	 //  echo 'Email sent? ' . $vendor_order_sent . '<br>';
 }// if enabled
	 //Vendors email check status end  This is the last mod to make, your done

 

********************************************************************************

*********************************************

 

Implementation of function "vendors_email" in "/admin/orders.php" / RC4 (RC5 --> identical)

 

-----------------------------------------------------------------------------------------------------

//Vendor Email Start
function vendors_email($vendors_id, $oID, $status, $vendor_order_sent) {
   $vendor_order_sent =  false;
  $debug='no';
  $vendor_order_sent = 'no';
$index2 = 0;
		  //let's get the Vendors
		  $vendor_data_query = tep_db_query("select 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, v.vendors_status_send, os.shipping_module, os.shipping_method, os.shipping_cost, os.shipping_tax, os.vendor_order_sent from " . TABLE_VENDORS . " v,  " . TABLE_ORDERS_SHIPPING . " os where v.vendors_id=os.vendors_id and v.vendors_id='" . $vendors_id . "' and os.orders_id='" . (int)$oID . "' and v.vendors_status_send='" . $status . "'");
	   while ($vendor_order = tep_db_fetch_array($vendor_data_query)) {
$vendor_products[$index2] = array('Vid' => $vendor_order['vendors_id'],
						 'Vname' => $vendor_order['vendors_name'],
						 'Vemail' => $vendor_order['vendors_email'],
						 'Vcontact' => $vendor_order['vendors_contact'],
						 'Vaccount' => $vendor_order['account_number'],
						 'Vstreet' => $vendor_order['vendor_street'],
						 'Vcity' => $vendor_order['vendor_city'],
						 'Vstate' => $vendor_order['vendor_state'],
						 'Vzipcode' => $vendor_order['vendors_zipcode'],
						 'Vcountry' => $vendor_order['vendor_country'],
						 'Vaccount' => $vendor_order['account_number'],							   'Vinstructions' => $vendor_order['vendor_add_info'],
						 'Vmodule' => $vendor_order['shipping_module'],							   'Vmethod' => $vendor_order['shipping_method']);
if ($debug == 'yes') {
echo 'The vendor query: ' . $vendor_order['vendors_id'] . '<br>';
  }
							   $index = 0;
$vendor_orders_products_query = tep_db_query("select o.orders_id, o.orders_products_id, o.products_model, o.products_id, o.products_quantity, o.products_name, p.vendors_id,  p.vendors_prod_comments, p.vendors_prod_id, p.vendors_product_price from " . TABLE_ORDERS_PRODUCTS . " o, " . TABLE_PRODUCTS . " p where p.vendors_id='" . (int)$vendor_order['vendors_id'] . "' and o.products_id=p.products_id and o.orders_id='" . $oID . "' order by o.products_name");
	while ($vendor_orders_products = tep_db_fetch_array($vendor_orders_products_query)) {
  $vendor_products[$index2]['vendor_orders_products'][$index] = array(
								  'Pqty' => $vendor_orders_products['products_quantity'],
								  'Pname' => $vendor_orders_products['products_name'],
								  'Pmodel' => $vendor_orders_products['products_model'],
								  'Pprice' => $vendor_orders_products['products_price'],
								  'Pvendor_name' => $vendor_orders_products['vendors_name'],
								  'Pcomments' => $vendor_orders_products['vendors_prod_comments'],
								  'PVprod_id' => $vendor_orders_products['vendors_prod_id'],
								  'PVprod_price' => $vendor_orders_products['vendors_product_price'],
								  'spacer' => '-');
							   //MVS end
			   if ($debug == 'yes') {
echo 'The products query: ' . $vendor_orders_products['products_name'] . '<br>';
}
	$subindex = 0;
  $vendor_attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$oID . "' and orders_products_id = '" . (int)$vendor_orders_products['orders_products_id'] . "'");
	if (tep_db_num_rows($vendor_attributes_query)) {
	  while ($vendor_attributes = tep_db_fetch_array($vendor_attributes_query)) {
	  $vendor_products[$index2]['vendor_orders_products'][$index]['vendor_attributes'][$subindex] = array('option' => $vendor_attributes['products_options'],
																 'value' => $vendor_attributes['products_options_values'],
																 'prefix' => $vendor_attributes['price_prefix'],
																 'price' => $vendor_attributes['options_values_price']);

		$subindex++;
	  }
	}
	$index++;
  }
 $index2++;
// let's build the email
  // 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='" . $oID ."'");
 $vendor_delivery_address_list = tep_db_fetch_array($delivery_address_query);

if ($debug == 'yes') {
echo 'The number of vendors: ' . sizeof($vendor_products) . '<br>';
 }
$email='';
for ($l=0, $m=sizeof($vendor_products); $l<$m; $l++) {

$vendor_country = tep_get_country_name($vendor_products[$l]['Vcountry']);
$order_number= $oID;
$vendors_id=$vendor_products[$l]['Vid'];
$the_email=$vendor_products[$l]['Vemail'];
$the_name=$vendor_products[$l]['Vname'];
$the_contact=$vendor_products[$l]['Vcontact'];
$email=  '<b>To: ' . $the_contact . '  <br>' . $the_name . '<br>' . $the_email . '<br>' .
$vendor_products[$l]['Vstreet'] .'<br>' .
$vendor_products[$l]['Vcity'] .', ' .
$vendor_products[$l]['Vstate'] .'  ' .
$vendor_products[$l]['Vzipcode'] . ' ' . $vendor_country . '<br>' . '<br>' . EMAIL_SEPARATOR . '<br>' . 'Special Comments or Instructions:  ' . $vendor_products[$l]['Vinstructions'] .'<br>' . '<br>' . EMAIL_SEPARATOR . '<br>' . 'From: ' . STORE_OWNER . '<br>' . STORE_NAME_ADDRESS . '<br>' . 'Accnt #: ' . $vendor_products[$l]['Vaccount'] . '<br>' . EMAIL_SEPARATOR . '<br>' . EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID . '<br>' .  EMAIL_SEPARATOR . '<br>' . '<br> Shipping Method: ' .  $vendor_products[$l]['Vmodule'] . ' -- '  .  $vendor_products[$l]['Vmethod'] .  '<br>' .  EMAIL_SEPARATOR . '<br>' . '<br>Dropship deliver to:<br>' .
$vendor_delivery_address_list['delivery_company'] .'<br>' .
$vendor_delivery_address_list['delivery_name'] .'<br>' .
$vendor_delivery_address_list['delivery_street_address'] .'<br>' .
$vendor_delivery_address_list['delivery_city'] .', ' .
$vendor_delivery_address_list['delivery_state'] . ' ' . $vendor_delivery_address_list['delivery_postcode'] . '<br><br>';
$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>';
	   for ($i=0, $n=sizeof($vendor_products[$l]['vendor_orders_products']); $i<$n; $i++) {
  $product_attribs ='';
  if (isset($vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes']) && (sizeof($vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes']) > 0)) {

	for ($j = 0, $k = sizeof($vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes']); $j < $k; $j++) {
	 $product_attribs .= '  ' . $vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes'][$j]['option'] . ': ' .  $vendor_products[$l]['vendor_orders_products'][$i]['vendor_attributes'][$j]['value'] . '<br>';
	}
	}
	$email = $email . '<tr><td> ' . $vendor_products[$l]['vendor_orders_products'][$i]['Pqty'] .
 '</td><td> ' . $vendor_products[$l]['vendor_orders_products'][$i]['Pname'] . '<br>  <i>Option<br> ' . $product_attribs .
 '</td><td> ' . $vendor_products[$l]['vendor_orders_products'][$i]['PVprod_id'] .
 '</td><td> ' . $vendor_products[$l]['vendor_orders_products'][$i]['Pmodel'] .
 '</td><td> ' . $vendor_products[$l]['vendor_orders_products'][$i]['PVprod_price'] . '</td><td>' .
 $vendor_products[$l]['vendor_orders_products'][$i]['Pcomments'] . '</b></td></tr>';

  }
}
$email = $email . '</table><br><HR><br>';


/*		 Purely Experimental, Use at your own risk
if ($vendors_email_list['vendors_id'] == 1) {
 $order_number = $oID;
 $product_codes = $vendors_email_products['vendors_prod_id'] . $vendors_email_products['products_model'];
 $p_name = $vendors_email_products['customers_name'];
 $p_email = $vendors_email_products['customers_email_address'];
 $url = 'http://newfedora/3/admin/post_vendor_order.php';
 $request_string .= 'order_number=' . $oID;
 $request_string .= 'product_codes=' . $product_codes;
 $request_string .= 'customer_name=' . $p_name;
 $request_string .= 'customer_email=' . $p_email;
//  echo  'The string of data: ' . $request_string . '<br>';

header ("Location: http://newfedora/3/admin/post_vendor_order.php?order_number=".$order_number."&product_codes=".$product_codes."&p_name=".$p_name."&p_email=".$p_email);

$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $url);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_HEADER, 0);
	curl_setopt($ch, CURLOPT_INFILESIZE, strlen($request_string));
	curl_setopt($ch, CURLOPT_POST, 0);
	curl_setopt($ch, CURLOPT_POSTFIELDS, $request_string);
	curl_setopt($ch, CURLOPT_TIMEOUT, (int)$timeout);
	//$response = curl_exec ($ch);
	curl_close ($ch);
 //   echo  'The string after the curl: ' . $ch . '<br>';

	$vendor_order_sent = true;
}
  */
tep_mail($the_name, $the_email, EMAIL_TEXT_ORDER_NUMBER . ' ' . $oID ,  $email .  '<br>', STORE_NAME, STORE_OWNER_EMAIL_ADDRESS) ;
 $vendor_order_sent = true;

if ($debug == 'yes') {
	   echo 'The $email(including headers:<br>Vendor Email Addy' . $the_email . '<br>Vendor Name' . $the_name . '<br>Vendor Contact' . $the_contact . '<br>Body--<br>' . $email . '<br>';
	   }

	if ($vendor_order_sent == true) {
	 tep_db_query("update " . TABLE_ORDERS_SHIPPING . " set vendor_order_sent = 'yes' where orders_id = '" . (int)$oID . "'");
}
// header ("Location: http://newfedora/3/admin/orders.php?page=1&oID=" . $oID . "&action=edit");
 }

return true;
}

//vendors_email end, but there is more to do, keep looking
//MVS End

 

********************************************************************************

*********************************

 

---------> "vendors_email"-function call on line 209 "orders.php":

 

-----------------------------------------------------------------------------------------------------------------

  //MVS and Vendor Email begin
	  if (SELECT_VENDOR_EMAIL_WHEN == 'Admin' || SELECT_VENDOR_EMAIL_WHEN == 'Both') {

	 if (isset($status)) {
	 $order_sent_query = tep_db_query("select vendor_order_sent, vendors_id from " . TABLE_ORDERS_SHIPPING . " where orders_id = '" . $oID . "'");
  while  ($order_sent_data = tep_db_fetch_array($order_sent_query)) {
 $order_sent_ckeck = $order_sent_data['vendor_order_sent'];
 $vendors_id = $order_sent_data['vendors_id'];
	if ($order_sent_ckeck == 'no') {
	 $vendor_order_sent = false;
	 vendors_email($vendors_id, $oID, $status, $vendor_order_sent);
		}//if
	  }//while
	}//isset
	 //  echo 'Email sent? ' . $vendor_order_sent . '<br>';
	 //Vendors email check status end, but there is more

   }
	 //Vendors email check status end

 

********************************************************************************

*********************************

 

 

When I compare the functions + calls in "checkout_process.php and "orders.php" I see a couple of differences in the code.

 

I tried to move the whole function + call from "orders.php" (which works well) to checkout_process.php again (with a change in the "SELECT_VENDOR_EMAIL_WHEN" - condition of course), but still get no "catalog"-Vendor-mail.

 

 

So I think it can't be that easy.

 

I'm sure there are also a couple of other things to change.

 

 

If possible please post the solution (code from checkout_process.php) from your site http://www.blucollarsales.com/osc/ which works well.

 

Thanks in advance for your help.

 

Mike

Link to comment
Share on other sites

Would installing this package let me specify certain items as eligible for a specific shipping method and others not? As I have OsC set up now, everything works as it should except for flat rate stuff.. I want to be able to allow flat rate postage on specific items, but disable it on others (And disable it for all orders that contain a non-allowed item). Any tips?

Link to comment
Share on other sites

Mike, did "configure" when the emails will be sent? In your Admin, go to Shipping/Packaging, and see the options, this should be all in the "readme".

 

Let us know what you find, Craig :)

Happy Coding!

Craig Garrison Sr

Anything worth having, is worth working for.

Multi Vendor Shipping V1.1 Demo Catalog

3 Vendors, each category, "buy" a product from each category to see how MVS works during checkout.

Multi Vendor Shipping V1.1 Demo Admin

login: [email protected]

pass: mvs_demo

MVS Thread:

Multi-Vendor Shipping

My contribs:

Download Multi Vendor Shipping V1.1

Vendor Email

Vendor Info in easypopulate

EZ Price Updater

And more to come!

Link to comment
Share on other sites

Would installing this package let me specify certain items as eligible for a specific shipping method and others not? As I have OsC set up now, everything works as it should except for flat rate stuff.. I want to be able to allow flat rate postage on specific items, but disable it on others (And disable it for all orders that contain a non-allowed item). Any tips?

MVS would allow you to exclude the items that you want to from flat rate shipping, but not the entire order. Your customers would be able to select flat rate shipping for the allowed items, and separately select whatever shipping method(s) you allow for the other items.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

MVS would allow you to exclude the items that you want to from flat rate shipping, but not the entire order. Your customers would be able to select flat rate shipping for the allowed items, and separately select whatever shipping method(s) you allow for the other items.

 

Regards

Jim

 

Ah, I see.. Mmm, doesn't quite do what I want then.. damn.. I suppose I'll have to figure this one out on my own then :( If anyone has any tips.. I'm all ears :D

Link to comment
Share on other sites

Mike, did "configure" when the emails will be sent? In your Admin, go to Shipping/Packaging, and see the options, this should be all in the "readme".

 

Let us know what you find, Craig :)

 

Yes, I did.

 

Enable Vendor Shipping -----------> true

Use Optional Confirmation Email -----------> false

When to send the Vendor Email -----------> Catalog

 

 

So long

 

Mike

Link to comment
Share on other sites

GOT it!

 

For all RC4 and RC5 users.

 

Here is the solution to get automatic-"CATALOG" or "CATALOG + BOTH"- vendor-email working.

 

 

-------------------------------------------------

 

in checkout_process.php on line 380

 

 

FIND:

 

tep_db_query("update " . TABLE_ORDERS_VENDORS . " set order_sent = '" . tep_db_input($vendor_order_sent) . "' where orders_id = '" . (int)$oID . "' and vendors_id = '" . (int)$vendors_id . "'");

 

REPLACE WITH:

 

 

tep_db_query("update " . TABLE_ORDERS_SHIPPING . " set vendor_order_sent = '" . tep_db_input($vendor_order_sent) . "' where orders_id = '" . (int)$oID . "' and vendors_id = '" . (int)$vendors_id . "'");

 

 

---------------------------------------------

 

 

same file on line 434

 

FIND:

 

if (SELECT_VENDOR_EMAIL_WHEN == 'Catalog' || SELECT_VENDOR_EMAIL_WHEN == 'Both') {

 

ADD BELOW:

 

$status=$order->info['order_status'];

 

 

------------------------------------------

 

 

Found it in "RC4_mvs_update-instructions.txt" !!!!.

 

 

So long

 

 

Mike

Link to comment
Share on other sites

GOT it!

 

For all RC4 and RC5 users.

 

Here is the solution to get automatic-"CATALOG" or "CATALOG + BOTH"- vendor-email working.

 

So long

 

Mike

 

You are the man!

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

Greetings to Craig and Jim!

 

My thoughts have turned again to limiting rates returned by UPS depending on Time in Transit results. I asked JanZ for guidance as Jan is the resident expert in all things UPS XML, however I'm still really not sure where I'm going. Based on Jan's info I've got something like this:

 

if $transitTimeGround["days"] == "1" 
{ 
//this cannot possibly be right 
(exclude_choices(Next Day Air, $vendors_id)) && (exclude_choices(2nd Day Air, $vendors_id)) 
} 
elseif $transitTimeGround["days"] == "2"
{ 
//this cannot possibly be right either 
(exclude_choices(2nd Day Air, $vendors_id) 
} else { 
//likewise 
(exclude_choices(Ground, $vendors_id) }

 

One major problem facing me here is that I don't understand how exclude_choices works or how to write this so that the module will know what I'm talking about.

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

Stew

 

The exclude_choices method is only a test to see if the choice is matched. It returns True if there is a match or False if not. See line 350 of upsxml.php:

				if (!exclude_choices($type, $vendors_id)) continue;

So you would need to add a line or two, something like this:

				if (!exclude_choices($type, $vendors_id)) continue;
			if $transitTimeGround["days"] == "1" {
			  if (!exclude_choices('Next Day Air', $vendors_id)) continue;
			  if (!exclude_choices('2nd Day Air', $vendors_id)) continue;
			}

Not tested, not even seriously sanity checked, but you should get the idea.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Stew

 

The exclude_choices method is only a test to see if the choice is matched. It returns True if there is a match or False if not. See line 350 of upsxml.php:

				if (!exclude_choices($type, $vendors_id)) continue;

So you would need to add a line or two, something like this:

				if (!exclude_choices($type, $vendors_id)) continue;
			if $transitTimeGround["days"] == "1" {
			  if (!exclude_choices('Next Day Air', $vendors_id)) continue;
			  if (!exclude_choices('2nd Day Air', $vendors_id)) continue;
			}

Not tested, not even seriously sanity checked, but you should get the idea.

 

Regards

Jim

 

Maybe something more like

 

if (!exclude_choices($type, $vendors_id)) continue;
			 if ($transitTimeGround["days"] == "1") {
exclude_choices('Next Day Air', $vendors_id);
exclude_choices('2nd Day Air', $vendors_id);
}

 

??

 

I'm not sure $transitTimeGround is the correct variable to use either.

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

Maybe something more like

 

if (!exclude_choices($type, $vendors_id)) continue;
			 if ($transitTimeGround["days"] == "1") {
exclude_choices('Next Day Air', $vendors_id);
exclude_choices('2nd Day Air', $vendors_id);
}

 

??

 

I'm not sure $transitTimeGround is the correct variable to use either.

exclude_choices() returns true or false depending on the result of the test. If it is just called by itself it will do nothing. You need to use it in an If statement (or some kind of select) to actually do something. I was assuming that $transitTimeGround was your variable, as I don't see it anywhere in the code. You would have to get this determined before making the test.

 

Regards

Jim

Edited by kymation

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

exclude_choices() returns true or false depending on the result of the test. If it is just called by itself it will do nothing. You need to use it in an If statement (or some kind of select) to actually do something. I was assuming that $transitTimeGround was your variable, as I don't see it anywhere in the code. You would have to get this determined before making the test.

 

Regards

Jim

 

Ok- Jan has shown me the correct variable to use for transit time.

 

Right now I've got

 

if (!exclude_choices($type, $vendors_id)) continue;
			 if ($this->servicesTimeintransit['UPS Ground']['days'] == "1") {
if (!exclude_choices('MODULE_SHIPPING_UPSXML_SERVICE_CODE_US_ORIGIN_01', $vendors_id)) continue;
}

 

but that causes no rates to be returned at all. If I use 'Next Day Air' instead of the "MODULE" string then all rates are returned as normal. Putting a number such as '01' there also results in no rates being displayed.

 

So I'm getting a result, but not the one I was looking for. :)

 

My impulse is to use exclude_choices as a command, because it seems like that's what I'm trying to do, tell the module to not do something based on what the transit time is.

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

From looking at the exclude_choices method, it's designed to deal with the text version of the shipping method. You need to get the exact text or it should just be ignored. I see no reason why it would remove all of the returned options. Perhaps ypui have some other error?

 

In your example code, MODULE_SHIPPING_UPSXML_SERVICE_CODE_US_ORIGIN_01 is a constant, so that would be used without the single quotes:

if (!exclude_choices(MODULE_SHIPPING_UPSXML_SERVICE_CODE_US_ORIGIN_01, $vendors_id)) continue;

That constant evaluates to 'UPS Next Day Air' and should give the same result.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

But doesn't the use of an if statement like

if (!exclude_choices(MODULE_SHIPPING_UPSXML_SERVICE_CODE_US_ORIGIN_01, $vendors_id)) continue;

tell the module something other than what we're trying to do?

 

It just seems to me that what that statement means is that if you're not excluding that particular service, then you can continue. Which would explain why, depending on how it's written, the result is sometimes to have no rates returned.

 

An if statement is a check to see if certain parameters are being met, correct? But the check in this case is performed by

				 if ($this->servicesTimeintransit['UPS Ground']['days'] == "1")

- once we know the result of this, we don't need to do any further checks, we just need to execute certain commands.

 

How to write those commands, that is the question....

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

The problem is that exclude_choices() is not a command; it's a test. It's on the order of ($foo == $bar). You need to evaluate the result or nothing will happen. Since my example seems to be having problems, try the positive case:

if (exclude_choices(MODULE_SHIPPING_UPSXML_SERVICE_CODE_US_ORIGIN_01, $vendors_id)) break;

See if that works for you. If not, I may have to dig into the code a bit more.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

The problem is that exclude_choices() is not a command; it's a test. It's on the order of ($foo == $bar). You need to evaluate the result or nothing will happen. Since my example seems to be having problems, try the positive case:

if (exclude_choices(MODULE_SHIPPING_UPSXML_SERVICE_CODE_US_ORIGIN_01, $vendors_id)) break;

See if that works for you. If not, I may have to dig into the code a bit more.

 

Regards

Jim

 

I tried that as well as

 

if (exclude_choices('Next Day Air', $vendors_id)) break;

 

and no rates were returned at all.

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

Incidentally, I understand now that exclude_choices is a test; that's why I don't understand why we would want to use it in this case. To me, the test is done by

if ($this->servicesTimeintransit['UPS Ground']['days'] == "1") {

- once we have the results of this test, pass/fail, then we can conduct business depending on the results. In my head, at least (I'm not quite to the point of thinking in PHP 24/7!), another check at this point is redundant. That's why I was trying to use exclude_choices as a command, because a command is what it seems would be necessary at that point in the code.

Edited by djmonkey1

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

You could certainly do this another way. Your test has determined that ground shipping is supposed to be one day, so you can exclude all other shipping methods. How you do that exclusion is up to you. You can use the existing function, write a new one, or just code it all inline. A function makes sense to me, since you need to do this multiple times, but it's your choice how you want to do this.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

You could certainly do this another way. Your test has determined that ground shipping is supposed to be one day, so you can exclude all other shipping methods. How you do that exclusion is up to you. You can use the existing function, write a new one, or just code it all inline. A function makes sense to me, since you need to do this multiple times, but it's your choice how you want to do this.

 

Regards

Jim

 

exclude_choices operates as this sort of function? You're the expert, not me, I'm just trying to understand what is happening, or what is supposed to be happening.

 

Thanks,

Stew

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...