Jump to content
blucollarguy

Multi_Vendor_Shipping new thread

Recommended Posts

Another user had posted recently the same problem, he discovered there was a problem with his mysql version, read back several pages(2 or 3, maybe 4) and you should find his posts.

 

Craig :)

 

Craig, Thanks for the help, I really appreciate it. I took a look at the mySQL version (ver. 4.1.14) and his situation doesn't appear to apply to mine. I still think it's an environment issue though. The only problem is that I am unable to save changes to settings in the modules. this goes for shipping modules, credit card modules, etc. I'm not seeing a problem in the error log, and the HTML form appears to be posting fine. We have another version of osCommerce w/ MVS running on a different server and it works with no problems. Is there anything else you can think of that may be the cause of this problem? Thanks again!!!:)

Share this post


Link to post
Share on other sites
Craig, Thanks for the help, I really appreciate it. I took a look at the mySQL version (ver. 4.1.14) and his situation doesn't appear to apply to mine. I still think it's an environment issue though. The only problem is that I am unable to save changes to settings in the modules. this goes for shipping modules, credit card modules, etc. I'm not seeing a problem in the error log, and the HTML form appears to be posting fine. We have another version of osCommerce w/ MVS running on a different server and it works with no problems. Is there anything else you can think of that may be the cause of this problem? Thanks again!!!:)

Check your php settings, depending on your server, you may have a number of things you can do. It's hard to say exactly what, but you can play with it a bit and see what you can get.

 

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: webmaster@blucollarsales.com

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!

Share this post


Link to post
Share on other sites
Check your php settings, depending on your server, you may have a number of things you can do. It's hard to say exactly what, but you can play with it a bit and see what you can get.

 

Craig :)

 

 

You were right Craig, I compared my php.ini on both servers and found magic_quotes_gpc needs to be on.

Thanks again for your help and your work on this great contribution. :lol:

Share this post


Link to post
Share on other sites
Hi Everyone,

I'm having trouble making the settings in the Vendor Shipping Module stay when I try to update them. I have installed the UPS module, and then after I click edit, I enter in my settings and click update. The problem is, once I do that the settings revert back to the default. I have tried numerous times, all with the same result. I was hoping you guys could help me out, and tell me where/how to correct this.

thanks in advance:-D

 

Hi there,

 

the problem with module updates not saving the settings are a bug in OsC 060817.

 

I you have the 060817 version of OsC, you really need to apply this fix, it is an absolute must so if you haven't yet, please do this before trying anything else.

 

It is a simple one line fix to two files,

catalog/admin/includes/functions/compatibility.php

catalog/includes/functions/compatibility.php

 

Here it is again exactly as posted previously by Bill Kellum:

 

1. Open the catalog/admin/includes/functions/compatibility.php.

2. At the end of the “do_magic_quotes_gpc” routine, add the following code:

 

reset($ar);

 

It will end up looking like this:

 

function do_magic_quotes_gpc(&$ar) {
if (!is_array($ar)) return false;
while (list($key, $value) = each($ar)) {
if (is_array($ar[$key])) {
do_magic_quotes_gpc($ar[$key]);
} else {
$ar[$key] = addslashes($value);
}
}
reset($ar);
}

 

Good luck !.

Share this post


Link to post
Share on other sites

Hi we are a new company building an ecommerce site. We need our cart to handle multiple drop shippers, at multiple locations, to coordinate shipments to single and mutiple recipients via FedEx . Are you aware of an osCommeerce solution?

Thanks,

Cecil Hollingsworth

Share this post


Link to post
Share on other sites
Hi we are a new company building an ecommerce site. We need our cart to handle multiple drop shippers, at multiple locations, to coordinate shipments to single and mutiple recipients via FedEx . Are you aware of an osCommeerce solution?

Thanks,

Cecil Hollingsworth

 

That sounds exactly like what Multi Vendor Shipping was designed to accomplish.


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.

Share this post


Link to post
Share on other sites

Hey guys,

 

Does anyone have the code for merging MVS with PayPal WPP for checkout_shipping.php? There's a few mentions of posts a few pages back (the code you can view in this post ) but no actual code has been pasted that I can see. I have also tried PMing the peopl but no reponse yet. If anyone has this working, would they please mind copying the modified code here for me?

 

Thank you for your time and consideration

Edited by MSP

Share this post


Link to post
Share on other sites
Hey guys,

 

Does anyone have the code for merging MVS with PayPal WPP for checkout_shipping.php? There's a few mentions of posts a few pages back (the code you can view in this post ) but no actual code has been pasted that I can see. I have also tried PMing the peopl but no reponse yet. If anyone has this working, would they please mind copying the modified code here for me?

 

Thank you for your time and consideration

 

Here's the first 234 lines of the file that I have with the two working together. Note that it was written from WPP v0.5; if there have been any revisions to the code in checkout_shipping.php since then they won't necessarily be reflected here.

<?php
  /*
 $Id: checkout_shipping.php,v 1.16 2003/06/09 23:03:53 hpdl Exp $
 Modified for MVS 2005/03/13 jck
 Modified for Brian Burtons's WPP v0.5
 Modified for Zero Weight Skips Shipping

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
  */

 require('includes/application_top.php');
 require('includes/classes/http_client.php');

  // if the customer is not logged on, redirect them to the login page
 if (!tep_session_is_registered('customer_id')) {
   $navigation->set_snapshot();
   tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
 }

  // if there is nothing in the customers cart, redirect them to the shopping cart page
 if ($cart->count_contents() < 1) {
   tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
 }

  // if no shipping destination address was selected, use the customers own address as default
 if (!tep_session_is_registered('sendto')) {
   tep_session_register('sendto');
   $sendto = $customer_default_address_id;
 } else {

  // verify the selected shipping address
   $check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$sendto . "'");
   $check_address = tep_db_fetch_array($check_address_query);

   if ($check_address['total'] != '1') {
	 $sendto = $customer_default_address_id;
	 if (tep_session_is_registered('shipping')) tep_session_unregister('shipping');
   }
 }

 require(DIR_WS_CLASSES . 'order.php');
 $order = new order;

  // register a random ID in the session to check throughout the checkout procedure
  // against alterations in the shopping cart contents
 if (!tep_session_is_registered('cartID')) tep_session_register('cartID');
 $cartID = $cart->cartID;

  // if the order contains only virtual products, forward the customer to the billing page as
  // a shipping address is not needed
  // This section commented out for Zero Weight Skips Shipping
  /*
 if ($order->content_type == 'virtual') {
   if (!tep_session_is_registered('shipping')) tep_session_register('shipping');
   $shipping = false;
   $sendto = false;
   tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
 }
 */

//MVS Start
 if (SELECT_VENDOR_SHIPPING == 'true') {
   include(DIR_WS_CLASSES . 'vendor_shipping.php');
   $shipping_modules = new shipping;
 } else {
   include(DIR_WS_CLASSES . 'shipping.php');
   $shipping_modules = new shipping;
   $total_weight = $cart->show_weight();
   $cost = $cart->show_total();
   $total_count = $cart->count_contents();
 }
  //MVS End


  //---PayPal WPP Modification START ---//
 if (tep_paypal_wpp_enabled()) {
   $ec_enabled = true;
 } else {
   $ec_enabled = false;
 }

 if ($ec_enabled) {
   if (isset($_GET['ec_cancel']) || (tep_session_is_registered('paypal_ec_token') && !tep_session_is_registered('paypal_ec_payer_id') && !tep_session_is_registered('paypal_ec_payer_info'))) {
	 if (tep_session_is_registered('paypal_ec_temp')) tep_session_unregister('paypal_ec_temp');
	 if (tep_session_is_registered('paypal_ec_token')) tep_session_unregister('paypal_ec_token');
	 if (tep_session_is_registered('paypal_ec_payer_id')) tep_session_unregister('paypal_ec_payer_id');
	 if (tep_session_is_registered('paypal_ec_payer_info')) tep_session_unregister('paypal_ec_payer_info');
   }

   $show_payment_page = false;

   $config_query = tep_db_query("SELECT configuration_value FROM " . TABLE_CONFIGURATION . " WHERE configuration_key = 'MODULE_PAYMENT_PAYPAL_DP_DISPLAY_PAYMENT_PAGE' LIMIT 1");
   if (tep_db_num_rows($config_query) > 0) {
	 $config_result = tep_db_fetch_array($config_query);
	 if ($config_result['configuration_value'] == 'Yes') {
	   $show_payment_page = true;
	 }
   }

   $ec_checkout = true;
   if (!tep_session_is_registered('paypal_ec_token') && !tep_session_is_registered('paypal_ec_payer_id') && !tep_session_is_registered('paypal_ec_payer_info')) { 
	 $ec_checkout = false;
	 $show_payment_page = true;
   } else {
	 if (!tep_session_is_registered('payment')) tep_session_register('payment');
	 $payment = 'paypal_wpp';
   }
 }
  //---PayPal WPP Modification END ---//

  // process the selected shipping method
 if ( isset($HTTP_POST_VARS['action']) && ($HTTP_POST_VARS['action'] == 'process') ) {
   if (!tep_session_is_registered('comments')) tep_session_register('comments');
   if (tep_not_null($HTTP_POST_VARS['comments'])) {
	 $comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);
   }

   if (!tep_session_is_registered('shipping')) tep_session_register('shipping');

  //MVS Start
  if (SELECT_VENDOR_SHIPPING == 'true') {
	 $total_shipping_cost = 0;
	 $shipping_title = MULTIPLE_SHIP_METHODS_TITLE;
	 $vendor_shipping = $cart->vendor_shipping;
	 $shipping = array();
	 foreach ($vendor_shipping as $vendor_id => $vendor_data) {
	   $products_shipped = $_POST['products_' . $vendor_id];
	   $products_array = explode ("_", $products_shipped); 

	   $shipping_data = $_POST['shipping_' . $vendor_id];
	   $shipping_array = explode ("_", $shipping_data); 
	   $module = $shipping_array[0]; 
	   $method = $shipping_array[1];
	   $ship_tax = $shipping_array[2]; 

	   if ( is_object($module) || ($module == 'free') ) {
		 if ($module == 'free') {
		   $quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;
		   $quote[0]['methods'][0]['cost'] = '0';
		 } else {
		   $total_weight = $vendor_shipping[$vendor_id]['weight'];
		   $shipping_weight = $total_weight;
		   $cost = $vendor_shipping[$vendor_id]['cost'];
		   $total_count = $vendor_shipping[$vendor_id]['qty'];
		   $quote = $shipping_modules->quote($method, $module, $vendor_id);

		 }
		 if (isset($quote['error'])) {
		   tep_session_unregister('shipping');
		 } else {
		   if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) {
			 $output[$vendor_id] = array('id' => $module . '_' . $method,
										 'title' => $quote[0]['methods'][0]['title'],
										 'ship_tax' => $ship_tax,
										 'products' => $products_array,
										 'cost' => $quote[0]['methods'][0]['cost']
										);
			 $total_ship_tax += $ship_tax;
			 $total_shipping_cost += $quote[0]['methods'][0]['cost'];
		   }//if isset
		 }//if isset
	   }//if is_object
	 }//foreach
	 if ($free_shipping == true) {
	   $shipping_title = $quote[0]['module'];
	 } elseif (count($output) <2) {
	   $shipping_title = $quote[0]['methods'][0]['title'];
	 }
	 $shipping = array('id' => $shipping,
					   'title' => $shipping_title,
					   'cost' => $total_shipping_cost,
					   'shipping_tax_total' => $total_ship_tax,
					   'vendor' => $output
					  );

   } else {
  //MVS End
	 if ( (isset($HTTP_POST_VARS['shipping'])) && (strpos($HTTP_POST_VARS['shipping'], '_')) ) {
	   $shipping = $HTTP_POST_VARS['shipping'];

	   list($module, $method) = explode('_', $shipping);
	   if ( is_object($module) || ($shipping == 'free_free') ) {
		 if ($shipping == 'free_free') {
		   $quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;
		   $quote[0]['methods'][0]['cost'] = '0';
		 } else {
		   $quote = $shipping_modules->quote($method, $module);
		 }
		 //MVS Start
	   }
  //MVS End
		 if (isset($quote['error'])) {
		   tep_session_unregister('shipping');
		 } else {
		   if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) {
			 $shipping = array('id' => $shipping,
							   'title' => (($free_shipping == true) ?  $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')'),
							   'cost' => $quote[0]['methods'][0]['cost']);

			//---PayPal WPP Modification START ---//
						   if ($show_payment_page || !$ec_enabled) {
							   tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
						   } else {
							   tep_redirect(tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'));
						   }
  //---PayPal WPP Modification END ---//
		   }
		 }
	   } else {
		 tep_session_unregister('shipping');
	   }
  //MVS Start
   }
   //---PayPal WPP Modification START ---//
		   if ($show_payment_page || !$ec_enabled) {
			   tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));
		   } else {
			   tep_redirect(tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'));
		   }
  //---PayPal WPP Modification END ---//
   exit;
 }
  //MVS End

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SHIPPING);

 $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
 $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
  ?>


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.

Share this post


Link to post
Share on other sites
Hi there,

 

the problem with module updates not saving the settings are a bug in OsC 060817.

 

I you have the 060817 version of OsC, you really need to apply this fix, it is an absolute must so if you haven't yet, please do this before trying anything else.

 

It is a simple one line fix to two files,

catalog/admin/includes/functions/compatibility.php

catalog/includes/functions/compatibility.php

 

Here it is again exactly as posted previously by Bill Kellum:

 

1. Open the catalog/admin/includes/functions/compatibility.php.

2. At the end of the “do_magic_quotes_gpc” routine, add the following code:

 

reset($ar);

 

It will end up looking like this:

 

function do_magic_quotes_gpc(&$ar) {
if (!is_array($ar)) return false;
while (list($key, $value) = each($ar)) {
if (is_array($ar[$key])) {
do_magic_quotes_gpc($ar[$key]);
} else {
$ar[$key] = addslashes($value);
}
}
reset($ar);
}

 

Good luck !.

 

 

Hey cliff

 

You are right i did not have the reset($ar); in my code I, thought because I downloaded from the osC site the 2.2 I was getting it bug free.

This is good info, is there a bug list or something so I can see if I have any others?? why don't they fix this for the os 2.2 download.

Thanks again this really helps!!!

Share this post


Link to post
Share on other sites
Does anyone have Paypal IPN working for MVS? Please, I'm REALLY desperate about this.

 

Are you asking about the OSC PayPal IPN contrib or the one that comes with OSC?

 

Gary

Share this post


Link to post
Share on other sites

@gmltw: Nevermind, I solved it the easy/cheap way. I use the Paypal Autoreturn feature to get my customers back to the site and complete the order ;)

 

I have another question related to MVS:

 

How do I show the total shipping fees on the Order Confirmation page?

Share this post


Link to post
Share on other sites

OK, I am having a little trouble figuring out where I change the standard of measurement. I have looked everywhere I could think of to try and figure out where it is being set. I have looked in every language file in the vendor shipping modules, I have searched my entire database in MySQL for the term that is showing up and I have physically looked through any table that seemed to be associated with vendor shipping. I did a site wide search through every file in my code (local side) with Dream Weaver's Find and Replace and I still have not found it. Not to mention that the only thing I can find in the forums that relates to this sends me to the places I have already looked. I hope someone can help me out here.

 

The problem is, when you get to checkout_shipping.php during the checkout process it is showing the weight in kg instead of lb. . Only with the products from the vendor that is using the standard rates shipping module (previously known as zones). I understand that it is not really pounds or kg or anything, it's just a number that is pulled from the product's data from where you have entered it's weight in the admin products page. That doesn't make it any less confusing for the customer for me to know that and doesn't make it look any more professional to be displaying the incorrect weight. It needs to display correctly and I can not find where to change it. I have spent the better part of three days trying to find this on my own. I have added the standard rates shipping module for MVS. The zones module that came with MVS was not working at all until I added the standard rates module (which replaces the zones module). This seems to be where the problem is. Does anyone have any ideas?

 

In addition to this, the handling fee is not being added to the zones shipping price. I am sure (well, maybe not so sure) this is a separate issue but since I was posting this I thought I would throw this one in as well. :-"

 

Thanks!

 

Gary

Share this post


Link to post
Share on other sites
@gmltw: Nevermind, I solved it the easy/cheap way. I use the Paypal Autoreturn feature to get my customers back to the site and complete the order ;)

 

I have another question related to MVS:

 

How do I show the total shipping fees on the Order Confirmation page?

 

jangoF: You should double check to be sure that if a customer leaves the PayPal area without returning to your site that you still get a notice of payment and your order processes. I think I remember reading a few places where people were having a problem with that.

 

The OSC PayPal IPN contrib http://www.oscommerce.com/community/contributions,2679 was really easy to install (well documented, and very few if any (can't remember specifics) modifications to the store files) and took care of all of the problems I was having with PayPal including the customer not returning to your store issue. Just an FYI.

 

I don't know about the shipping totals. I would like to know about that as well. I think there may be a contrib/mod for that. Not sure though.

 

Gary

Share this post


Link to post
Share on other sites

I cant seem to find any info on this....but I thought that the vendor would get an auto email when someone orders something from them - how ever I seem to have to send it manually - is that correct? Have I cocked something up?

 

Thanks

 

Stuart

Share this post


Link to post
Share on other sites
I cant seem to find any info on this....but I thought that the vendor would get an auto email when someone orders something from them - how ever I seem to have to send it manually - is that correct? Have I cocked something up?

 

Thanks

 

Stuart

Did you set the Vendor to "send emails" in the Vendor admin page, and set the "status" for when the email would be sent to the proper status?

 

If you've done those things and it still doesn't work, then you will need to check your edits in "checkout_process.php", that's where the emails are built and sent.

 

Good luck, 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: webmaster@blucollarsales.com

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!

Share this post


Link to post
Share on other sites

I really hate to repost but I think that sometimes a post can get lost in the shuffle. I want repost this again, promise.

Gary

OK, I am having a little trouble figuring out where I change the standard of measurement. I have looked everywhere I could think of to try and figure out where it is being set. I have looked in every language file in the vendor shipping modules, I have searched my entire database in MySQL for the term that is showing up and I have physically looked through any table that seemed to be associated with vendor shipping. I did a site wide search through every file in my code (local side) with Dream Weaver's Find and Replace and I still have not found it. Not to mention that the only thing I can find in the forums that relates to this sends me to the places I have already looked. I hope someone can help me out here.

 

The problem is, when you get to checkout_shipping.php during the checkout process it is showing the weight in kg instead of lb. . Only with the products from the vendor that is using the standard rates shipping module (previously known as zones). I understand that it is not really pounds or kg or anything, it's just a number that is pulled from the product's data from where you have entered it's weight in the admin products page. That doesn't make it any less confusing for the customer for me to know that and doesn't make it look any more professional to be displaying the incorrect weight. It needs to display correctly and I can not find where to change it. I have spent the better part of three days trying to find this on my own. I have added the standard rates shipping module for MVS. The zones module that came with MVS was not working at all until I added the standard rates module (which replaces the zones module). This seems to be where the problem is. Does anyone have any ideas?

 

In addition to this, the handling fee is not being added to the zones shipping price. I am sure (well, maybe not so sure) this is a separate issue but since I was posting this I thought I would throw this one in as well. :-"

 

Thanks!

 

Gary

Share this post


Link to post
Share on other sites

anyone got any ideas why tep_show_category() would be defined in 2 files and why it is giving me a problem after I installed MVS1.1? I copied all the files to my catalog and I don't think I ever modified either file listed below:

 

Fatal error: Cannot redeclare tep_show_category() (previously declared in /home/rice/public_html/includes/header.php:176) in /home/rice/public_html/includes/boxes/categories.php on line 13

 

anyone ever come across the above error? any feedback is appreciated. Thanks.

Share this post


Link to post
Share on other sites
The OSC PayPal IPN contrib http://www.oscommerce.com/community/contributions,2679 was really easy to install (well documented, and very few if any (can't remember specifics) modifications to the store files) and took care of all of the problems I was having with PayPal including the customer not returning to your store issue. Just an FYI.

So you do have to make the checkout_process.php changes from MVS in Paypal IPN? I've just checked it at a glance, but a lot of the changes suggested don't even seem to be in the 2 files from Paypal IPN? Is it ok to bypass some of the changes, or are they important?

 

I don't know about the shipping totals. I would like to know about that as well. I think there may be a contrib/mod for that. Not sure though.

Gary

I got that fixed easily. You just have to make sure Shipping is enabled under Order Totals, and it will show.

Share this post


Link to post
Share on other sites

Hello!

 

Having difficulty with the invoice feature in admin - have MVS installed. When I go to a couple of different customer orders and one that I know had all items ship from the same vendor - the invoice shows 4 packages to be shipped (there will only be one). Also shows 4 shipment numbers #1 shows the products, #2 does not, #3 does again and so does #4. The Weird thing is it shows the correct totals. However this is what the customer is able to see. Can anyone suggest a fix?

 

Thanks

Pete

Share this post


Link to post
Share on other sites

Guys, I'm in trouble.

 

I've installed the MVS 1.1 into the latest version of OSC and I'm getting the following erroe:

 

Warning: main(includes/functions/general.php) [function.main]: failed to open stream: No such file or directory in /home/brummie/public_html/shop/includes/application_top.php on line 123

 

Warning: main(includes/functions/general.php) [function.main]: failed to open stream: No such file or directory in /home/brummie/public_html/shop/includes/application_top.php on line 123

 

Warning: main(includes/functions/general.php) [function.main]: failed to open stream: No such file or directory in /home/brummie/public_html/shop/includes/application_top.php on line 123

 

Fatal error: main() [function.require]: Failed opening required 'includes/functions/general.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/brummie/public_html/shop/includes/application_top.php on line 123

 

The problem is that the latest version of OSC does not have a "general.php" as part of the package, so "application_top.php" is banging its head against a brick wall.

 

How can I get around this please?

 

Thanks in advance of your help.

 

Martin

Share this post


Link to post
Share on other sites
I really hate to repost but I think that sometimes a post can get lost in the shuffle. I want repost this again, promise.

Gary

Check the language files for the kg/lb thing. I am not sure about where else that may be changed right now, there is something in the back of my mind about it, but I can't quite put a finger on it.

The handling fee: do a search for it, you should find some code posted some pages back, several of the modules did not end up with the right code to add the vendor handling fee.

 

Good luck, Craig :)

 

Hello!

 

Having difficulty with the invoice feature in admin - have MVS installed. When I go to a couple of different customer orders and one that I know had all items ship from the same vendor - the invoice shows 4 packages to be shipped (there will only be one). Also shows 4 shipment numbers #1 shows the products, #2 does not, #3 does again and so does #4. The Weird thing is it shows the correct totals. However this is what the customer is able to see. Can anyone suggest a fix?

 

Thanks

Pete

This sounds a lot like the edits in classes/order.php in the Admin. If all is well there, then double check your edits in checkout_process.php on the catalog side. That file does all the database work for each order, and obviously, is very important.

 

Good luck, 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: webmaster@blucollarsales.com

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!

Share this post


Link to post
Share on other sites
Good luck, Craig :)

This sounds a lot like the edits in classes/order.php in the Admin. If all is well there, then double check your edits in checkout_process.php on the catalog side. That file does all the database work for each order, and obviously, is very important.

 

Good luck, Craig :)

 

This is my classes/order.php

 

<?php

/*

$Id: order.php,v 1.7 2003/06/20 16:23:08 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

class order {

var $info, $totals, $products, $customer, $delivery;

 

function order($order_id) {

$this->info = array();

$this->totals = array();

$this->products = array();

$this->customer = array();

$this->delivery = array();

 

$this->query($order_id);

}

 

function query($order_id) {

$order_query = tep_db_query("select customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");

$order = tep_db_fetch_array($order_query);

 

$totals_query = tep_db_query("select title, text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' order by sort_order");

while ($totals = tep_db_fetch_array($totals_query)) {

$this->totals[] = array('title' => $totals['title'],

'text' => $totals['text']);

}

 

$this->info = array('currency' => $order['currency'],

'currency_value' => $order['currency_value'],

'payment_method' => $order['payment_method'],

'cc_type' => $order['cc_type'],

'cc_owner' => $order['cc_owner'],

'cc_number' => $order['cc_number'],

'cc_expires' => $order['cc_expires'],

'date_purchased' => $order['date_purchased'],

'orders_status' => $order['orders_status'],

'last_modified' => $order['last_modified']);

 

$this->customer = array('name' => $order['customers_name'],

'company' => $order['customers_company'],

'street_address' => $order['customers_street_address'],

'suburb' => $order['customers_suburb'],

'city' => $order['customers_city'],

'postcode' => $order['customers_postcode'],

'state' => $order['customers_state'],

'country' => $order['customers_country'],

'format_id' => $order['customers_address_format_id'],

'telephone' => $order['customers_telephone'],

'email_address' => $order['customers_email_address']);

 

$this->delivery = array('name' => $order['delivery_name'],

'company' => $order['delivery_company'],

'street_address' => $order['delivery_street_address'],

'suburb' => $order['delivery_suburb'],

'city' => $order['delivery_city'],

'postcode' => $order['delivery_postcode'],

'state' => $order['delivery_state'],

'country' => $order['delivery_country'],

'format_id' => $order['delivery_address_format_id']);

 

$this->billing = array('name' => $order['billing_name'],

'company' => $order['billing_company'],

'street_address' => $order['billing_street_address'],

'suburb' => $order['billing_suburb'],

'city' => $order['billing_city'],

'postcode' => $order['billing_postcode'],

'state' => $order['billing_state'],

'country' => $order['billing_country'],

'format_id' => $order['billing_address_format_id']);

//MVS Start

$orders_shipping_id = '';

$check_new_vendor_data_query = tep_db_query("select orders_shipping_id, orders_id, vendors_id, vendors_name, shipping_module, shipping_method, shipping_cost, vendor_order_sent from " . TABLE_ORDERS_SHIPPING . " where orders_id = '" . (int)$order_id . "'");

while ($checked_data = tep_db_fetch_array($check_new_vendor_data_query)) {

$this->orders_shipping_id = $checked_data['orders_shipping_id'];

//$orders_vendor_name = $checked_data['vendors_name'];

}

if (tep_not_null($this->orders_shipping_id)) {

/* MVS

$Id: vendor_order_data.php

By Craig Garrison Sr. (craig@blucollarsales.com) for Multi-Vendor Shipping

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2005 osCommerce

 

Released under the GNU General Public License

*/

$index2 = 0;

//let's get the Vendors

$vendor_data_query = tep_db_query("select orders_shipping_id, orders_id, vendors_id, vendors_name, shipping_module, shipping_method, shipping_cost, shipping_tax, vendor_order_sent from " . TABLE_ORDERS_SHIPPING . " where orders_id = '" . (int)$order_id . "'");

while ($vendor_order = tep_db_fetch_array($vendor_data_query)) {

 

$this->products[$index2] = array('Vid' => $vendor_order['vendors_id'],

'Vname' => $vendor_order['vendors_name'],

'Vmodule' => $vendor_order['shipping_module'],

'Vmethod' => $vendor_order['shipping_method'],

'Vcost' => $vendor_order['shipping_cost'],

'Vship_tax' => $vendor_order['shipping_tax'],

'Vorder_sent' => $vendor_order['vendor_order_sent'], //a yes=sent a no=not sent

'Vnoname' => 'Shipper',

'spacer' => '-');

 

$index = 0;

$orders_products_query = tep_db_query("select orders_products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price, vendors_id from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "' and vendors_id = '" . (int)$vendor_order['vendors_id'] . "'");

 

while ($orders_products = tep_db_fetch_array($orders_products_query)) {

$this->products[$index2]['orders_products'][$index] = array('qty' => $orders_products['products_quantity'],

'name' => $orders_products['products_name'],

'tax' => $orders_products['products_tax'],

'model' => $orders_products['products_model'],

'price' => $orders_products['products_price'],

'vendor_name' => $orders_products['vendors_name'],

'vendor_ship' => $orders_products['shipping_module'],

'shipping_method' => $orders_products['shipping_method'],

'shipping_cost' => $orders_products['shipping_cost'],

'final_price' => $orders_products['final_price'],

'spacer' => '-');

//MVS end

$subindex = 0;

$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)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");

if (tep_db_num_rows($attributes_query)) {

while ($attributes = tep_db_fetch_array($attributes_query)) {

$this->products[$index2]['orders_products'][$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],

'value' => $attributes['products_options_values'],

'prefix' => $attributes['price_prefix'],

'price' => $attributes['options_values_price']);

 

$subindex++;

}

}

$index++;

}

$index2++;

}

 

} else { // old order, use the regular osC data

//MVS End

$index = 0;

$orders_products_query = tep_db_query("select orders_products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");

while ($orders_products = tep_db_fetch_array($orders_products_query)) {

$this->products[$index] = array('qty' => $orders_products['products_quantity'],

'name' => $orders_products['products_name'],

'model' => $orders_products['products_model'],

'tax' => $orders_products['products_tax'],

'price' => $orders_products['products_price'],

'final_price' => $orders_products['final_price']);

 

$subindex = 0;

$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)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");

if (tep_db_num_rows($attributes_query)) {

while ($attributes = tep_db_fetch_array($attributes_query)) {

$this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],

'value' => $attributes['products_options_values'],

'prefix' => $attributes['price_prefix'],

'price' => $attributes['options_values_price']);

 

$subindex++;

}

}

$index++;

}

}//MVS end

}

}

?>

 

 

 

 

THIS IS MY CHECKOUT_PROCESS.PHP

<?php

/*

$Id: checkout_process.php,v 1.128 2003/05/28 18:00:29 hpdl Exp $

 

Modified for MVS V1.0 2006/03/25 JCK/CWG

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2006 osCommerce

 

Released under the GNU General Public License

*/

 

include('includes/application_top.php');

 

// if the customer is not logged on, redirect them to the login page

if (!tep_session_is_registered('customer_id')) {

$navigation->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT));

tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

}

 

if (!tep_session_is_registered('sendto')) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

}

 

if ( (tep_not_null(MODULE_PAYMENT_INSTALLED)) && (!tep_session_is_registered('payment')) ) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

}

 

// avoid hack attempts during the checkout procedure by checking the internal cartID

if (isset($cart->cartID) && tep_session_is_registered('cartID')) {

if ($cart->cartID != $cartID) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));

}

}

 

include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PROCESS);

 

// load selected payment module

require(DIR_WS_CLASSES . 'payment.php');

$payment_modules = new payment($payment);

 

//MVS start

// load the selected shipping module

if (($total_weight > 0 ) || (SELECT_VENDOR_SHIPPING == 'true')){

include(DIR_WS_CLASSES . 'vendor_shipping.php');

} elseif (($total_weight > 0 ) || (SELECT_VENDOR_SHIPPING == 'false')){

include(DIR_WS_CLASSES . 'shipping.php');

}

$shipping_modules = new shipping($shipping);

//MVS End

 

require(DIR_WS_CLASSES . 'order.php');

$order = new order;

 

 

require(DIR_WS_CLASSES . 'order_total.php');

$order_total_modules = new order_total;

 

$order_totals = $order_total_modules->process();

 

// load the before_process function from the payment modules

$payment_modules->before_process();

 

 

$sql_data_array = array('customers_id' => $customer_id,

'customers_name' => $order->customer['firstname'] . ' ' . $order->customer['lastname'],

'customers_company' => $order->customer['company'],

'customers_street_address' => $order->customer['street_address'],

'customers_suburb' => $order->customer['suburb'],

'customers_city' => $order->customer['city'],

'customers_postcode' => $order->customer['postcode'],

'customers_state' => $order->customer['state'],

'customers_country' => $order->customer['country']['title'],

'customers_telephone' => $order->customer['telephone'],

'customers_email_address' => $order->customer['email_address'],

'customers_address_format_id' => $order->customer['format_id'],

'delivery_name' => $order->delivery['firstname'] . ' ' . $order->delivery['lastname'],

'delivery_company' => $order->delivery['company'],

'delivery_street_address' => $order->delivery['street_address'],

'delivery_suburb' => $order->delivery['suburb'],

'delivery_city' => $order->delivery['city'],

'delivery_postcode' => $order->delivery['postcode'],

'delivery_state' => $order->delivery['state'],

'delivery_country' => $order->delivery['country']['title'],

'delivery_address_format_id' => $order->delivery['format_id'],

'billing_name' => $order->billing['firstname'] . ' ' . $order->billing['lastname'],

'billing_company' => $order->billing['company'],

'billing_street_address' => $order->billing['street_address'],

'billing_suburb' => $order->billing['suburb'],

'billing_city' => $order->billing['city'],

'billing_postcode' => $order->billing['postcode'],

'billing_state' => $order->billing['state'],

'billing_country' => $order->billing['country']['title'],

'billing_address_format_id' => $order->billing['format_id'],

'payment_method' => $order->info['payment_method'],

'cc_type' => $order->info['cc_type'],

'cc_owner' => $order->info['cc_owner'],

'cc_number' => (substr_replace($order->info['cc_number'], ' xxxx xxxx ', 4, -4)),

'cc_expires' => $order->info['cc_expires'],

'date_purchased' => 'now()',

'orders_status' => $order->info['order_status'],

'currency' => $order->info['currency'],

'currency_value' => $order->info['currency_value']);

tep_db_perform(TABLE_ORDERS, $sql_data_array);

$insert_id = tep_db_insert_id();

for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {

$sql_data_array = array('orders_id' => $insert_id,

'title' => $order_totals[$i]['title'],

'text' => $order_totals[$i]['text'],

'value' => $order_totals[$i]['value'],

'class' => $order_totals[$i]['code'],

'sort_order' => $order_totals[$i]['sort_order']);

tep_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);

}

 

$customer_notification = (SEND_EMAILS == 'true') ? '1' : '0';

$sql_data_array = array('orders_id' => $insert_id,

'orders_status_id' => $order->info['order_status'],

'date_added' => 'now()',

'customer_notified' => $customer_notification,

'comments' => $order->info['comments']);

tep_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);

//kgt - discount coupons

if( tep_session_is_registered( 'coupon' ) && $order->info['coupon'] != '' ) {

$sql_data_array = array( 'coupons_id' => $order->info['coupon'],

'orders_id' => $insert_id );

tep_db_perform( TABLE_DISCOUNT_COUPONS_TO_ORDERS, $sql_data_array );

}

//end kgt - discount coupons

//MVS - added insert for new orders_shipping table

$shipping_array = $shipping['vendor'];

foreach ($shipping_array as $vendors_id => $shipping_data) {

$vendors_query = tep_db_query("select vendors_name

from " . TABLE_VENDORS . "

where vendors_id = '" . (int)$vendors_id . "'"

);

$vendors_name = 'Unknown';

if ($vendors = tep_db_fetch_array($vendors_query)) {

$vendors_name = $vendors['vendors_name'];

}

$shipping_method_array = explode ('_', $shipping_data['id']);

if ($shipping_method_array[0] == 'fedex1') {

$shipping_method = 'Federal Express';

} elseif ($shipping_method_array[0] == 'upsxml') {

$shipping_method = 'UPS';

} elseif ($shipping_method_array[0] == 'usps') {

$shipping_method = 'USPS';

} else {

$shipping_method = $shipping_method_array[0];

}

$sql_data_array = array('orders_id' => $insert_id,

'vendors_id' => $vendors_id,

'shipping_module' => $shipping_method,

'shipping_method' => $shipping_data['title'],

'shipping_cost' => $shipping_data['cost'],

'shipping_tax' => $shipping_data['ship_tax'],

'vendors_name' => $vendors_name,

'vendor_order_sent' => 'no'

);

tep_db_perform(TABLE_ORDERS_SHIPPING, $sql_data_array);

}

//MVS End

 

// initialized for the email confirmation

$products_ordered = '';

$subtotal = 0;

$total_tax = 0;

 

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']) . "'");

}

}

}

 

// Update products_ordered (for bestsellers list)

tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

 

//MVS start - added 'vendors_id' => ...

$sql_data_array = array('orders_id' => $insert_id,

'products_id' => tep_get_prid($order->products[$i]['id']),

'products_model' => $order->products[$i]['model'],

'products_name' => $order->products[$i]['name'],

'products_price' => $order->products[$i]['price'],

'final_price' => $order->products[$i]['final_price'],

'products_tax' => $order->products[$i]['tax'],

'products_quantity' => $order->products[$i]['qty'],

'vendors_id' => $order->products[$i]['vendors_id']

); //MVS end

tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);

$order_products_id = tep_db_insert_id();

 

//------insert customer choosen option to order--------

$attributes_exist = '0';

$products_ordered_attributes = '';

if (isset($order->products[$i]['attributes'])) {

$attributes_exist = '1';

for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {

if (DOWNLOAD_ENABLED == 'true') {

$attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename

from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa

left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad

on pa.products_attributes_id=pad.products_attributes_id

where pa.products_id = '" . $order->products[$i]['id'] . "'

and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'

and pa.options_id = popt.products_options_id

and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'

and pa.options_values_id = poval.products_options_values_id

and popt.language_id = '" . $languages_id . "'

and poval.language_id = '" . $languages_id . "'";

$attributes = tep_db_query($attributes_query);

} else {

$attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");

}

$attributes_values = tep_db_fetch_array($attributes);

 

$sql_data_array = array('orders_id' => $insert_id,

'orders_products_id' => $order_products_id,

'products_options' => $attributes_values['products_options_name'],

'products_options_values' => $attributes_values['products_options_values_name'],

'options_values_price' => $attributes_values['options_values_price'],

'price_prefix' => $attributes_values['price_prefix']);

tep_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);

 

if ((DOWNLOAD_ENABLED == 'true') && isset($attributes_values['products_attributes_filename']) && tep_not_null($attributes_values['products_attributes_filename'])) {

$sql_data_array = array('orders_id' => $insert_id,

'orders_products_id' => $order_products_id,

'orders_products_filename' => $attributes_values['products_attributes_filename'],

'download_maxdays' => $attributes_values['products_attributes_maxdays'],

'download_count' => $attributes_values['products_attributes_maxcount']);

tep_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);

}

$products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];

}

}

//------insert customer choosen option eof ----

$total_weight += ($order->products[$i]['qty'] * $order->products[$i]['weight']);

$total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];

$total_cost += $total_products_price;

 

//MVS begin

if (SELECT_VENDOR_EMAIL_OPTION == 'false') {

$products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";

}

}

if (SELECT_VENDOR_EMAIL_OPTION == 'true') {

$order_id = $insert_id;

require(DIR_WS_INCLUDES . 'vendor_order_data.php');

}

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_SHIPPING . " set vendor_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;

} //MVS end

 

// lets start with the email confirmation

$email_order = STORE_NAME . "\n" .

EMAIL_SEPARATOR . "\n" .

EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .

EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .

EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";

if ($order->info['comments']) {

$email_order .= tep_db_output($order->info['comments']) . "\n\n";

}

$email_order .= EMAIL_TEXT_PRODUCTS . "\n" .

EMAIL_SEPARATOR . "\n" .

$products_ordered .

EMAIL_SEPARATOR . "\n";

 

for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {

$email_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";

}

 

if ($order->content_type != 'virtual') {

$email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" .

EMAIL_SEPARATOR . "\n" .

tep_address_label($customer_id, $sendto, 0, '', "\n") . "\n";

}

 

$email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .

EMAIL_SEPARATOR . "\n" .

tep_address_label($customer_id, $billto, 0, '', "\n") . "\n\n";

if (is_object($$payment)) {

$email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .

EMAIL_SEPARATOR . "\n";

$payment_class = $$payment;

$email_order .= $payment_class->title . "\n\n";

if ($payment_class->email_footer) {

$email_order .= $payment_class->email_footer . "\n\n";

}

}

tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

// 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);

}

// Prepare Order SMS Message Notification

if (SMS_ORDER_NOTIFY == 'true') {

if (SEND_EXTRA_ORDER_SMS_TO != '') {

 

$SMS_subject = STORE_NAME . ' ' . $insert_id;

$SMS_order = '';

for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) {

$SMS_order .= strip_tags($order_totals[$i]['title']) . ' ' . strip_tags($order_totals[$i]['text']) . "\n";

}

 

tep_mail('', SEND_EXTRA_ORDER_SMS_TO, $SMS_subject, $SMS_order, STORE_OWNER, STORE_NAME);

}

}

//MVS start

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

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

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

//MVS end this file is complete

 

// load the after_process function from the payment modules

$payment_modules->after_process();

 

$cart->reset(true);

 

// unregister session variables used during checkout

tep_session_unregister('sendto');

tep_session_unregister('billto');

tep_session_unregister('shipping');

tep_session_unregister('payment');

tep_session_unregister('comments');

//kgt - discount coupons

tep_session_unregister('coupon');

//end kgt - discount coupons

tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));

 

require(DIR_WS_INCLUDES . 'application_bottom.php');

?>

 

 

THIS IS WHAT THE INVOICE LOOKS LIKE

 

INVOICE.JPG

 

I have look through my edits and it seems as if I have done them correctly - any help or pointers would be greatly apprectiated!!

 

Thanks

Pete

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×