Jump to content
blucollarguy

Multi_Vendor_Shipping new thread

Recommended Posts

Dave: That would take some work. The code currently just totals everything by vendor and uses the totals. You could end up charging for a large number of small, lightweight packages that would be much more economical to box together. Still, if you want to try this, I can tell you where to look in the code to get started. You will learn PHP if nothing else. Hey, that's how I learned it -- PHP, mySQL, and osCommerce all at once. My head hurt for weeks....

 

Regards

Jim

 

Well, as much as I (or anyone else :D ) would like it on a silver platter, I have to start somewhere! Let me know your thoughts on this and I'll see what I can figure out!

Share this post


Link to post
Share on other sites
Well, as much as I (or anyone else :D ) would like it on a silver platter, I have to start somewhere! Let me know your thoughts on this and I'll see what I can figure out!

Sorry, all my silver platters are in storage. All 0 of them. If I can do it, you can learn this too. Persistence is the key. That, and a copy of the PHP reference manual, which I consider essential.

 

I would start with the vendor_shipping method in includes/classes/shopping_cart.php. That's where MVS gets a lot of the variables to work with. It starts with this (line 247):

//////
//MVS Start
//  New method to provide cost, weight, quantity, and product IDs by vendor
//////

Just after that is an example of the output. Notice that weight is given as a total by vendor, but product IDs are presented individually in an array. We want to leave everything there as it is, since most of the data is used in multiple places, but we can add to it. We want a weight element that looks like the products_id element.

 

Down at line 288, the method starts a foreach loop that steps through every product in the cart. The data is pulled from the database and manipulated. The weight of each product is set to $products_weight in line 301. In line 317 the weights are added up by vendor, and in line 320 the products_id values are added to the array. So we can make a new line, just after 320, and make it similar to the line above (read: copy and paste) and just change the parameters a bit. So:

		  $this->vendor_shipping[$vendors_id]['products_weights'][] = array('qty' => $quantity, 'weight' => $products_weight);

Take a look at that and you'll probably see what I've done. Note that we are storing the quantity of each product as well. It may help to look up array syntax in the manual.

 

Now we need to do the module part. I would use the UPSXML module, since the old UPS interface seems to calculate the old way internally (to the UPS server, that is.) So, in upsxml.php, starting at line 318, we find:

			for ($i = 0; $i < $shipping_num_boxes; $i++) {
			$this->_addItem (0, 0, 0, $shipping_weight);
		}

Now we need to replace both $shipping_num_boxes and $shipping_weight, since those will not be the correct values. This code will get replaced by the following lines. First, get the data from the $cart method that we just modified:

		$vendor_shipping = $cart->vendor_shipping();

Now we can get the number of boxes by counting the weights, and the weights array as well:

		$shipping_weights = $vendor_shipping[$vendors_id]['products_weights'];
	$shipping_num_products = count($shipping_weights);

and use the count to check that there really are products, then add each item so:

		if ($shipping_num_products > 0) {
	  foreach ($shipping_weights as $id => $weight) {
		$count = $weight['qty'];
		for ($item=0; $item<$count; $item++) {
		  $this->_addItem (0, 0, 0, $weight['weight']);
		}
	  }
	}

See, that wasn't too bad. Err -- I seem to have done the whole thing. Well, given my normal practice, I'm certain that there are some entertaining typos and syntax errors waiting to trip you up. At the very least. Let me know what the error messages look like and I'll help you find them.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites
Sorry, all my silver platters are in storage. All 0 of them. If I can do it, you can learn this too. Persistence is the key. That, and a copy of the PHP reference manual, which I consider essential.

 

I would start with the vendor_shipping method in includes/classes/shopping_cart.php. That's where MVS gets a lot of the variables to work with. It starts with this (line 247):

//////
//MVS Start
//  New method to provide cost, weight, quantity, and product IDs by vendor
//////

Just after that is an example of the output. Notice that weight is given as a total by vendor, but product IDs are presented individually in an array. We want to leave everything there as it is, since most of the data is used in multiple places, but we can add to it. We want a weight element that looks like the products_id element.

 

Down at line 288, the method starts a foreach loop that steps through every product in the cart. The data is pulled from the database and manipulated. The weight of each product is set to $products_weight in line 301. In line 317 the weights are added up by vendor, and in line 320 the products_id values are added to the array. So we can make a new line, just after 320, and make it similar to the line above (read: copy and paste) and just change the parameters a bit. So:

		  $this->vendor_shipping[$vendors_id]['products_weights'][] = array('qty' => $quantity, 'weight' => $products_weight);

Take a look at that and you'll probably see what I've done. Note that we are storing the quantity of each product as well. It may help to look up array syntax in the manual.

 

Now we need to do the module part. I would use the UPSXML module, since the old UPS interface seems to calculate the old way internally (to the UPS server, that is.) So, in upsxml.php, starting at line 318, we find:

			for ($i = 0; $i < $shipping_num_boxes; $i++) {
			$this->_addItem (0, 0, 0, $shipping_weight);
		}

Now we need to replace both $shipping_num_boxes and $shipping_weight, since those will not be the correct values. This code will get replaced by the following lines. First, get the data from the $cart method that we just modified:

		$vendor_shipping = $cart->vendor_shipping();

Now we can get the number of boxes by counting the weights, and the weights array as well:

		$shipping_weights = $vendor_shipping[$vendors_id]['products_weights'];
	$shipping_num_products = count($shipping_weights);

and use the count to check that there really are products, then add each item so:

		if ($shipping_num_products > 0) {
	  foreach ($shipping_weights as $id => $weight) {
		$count = $weight['qty'];
		for ($item=0; $item<$count; $item++) {
		  $this->_addItem (0, 0, 0, $weight['weight']);
		}
	  }
	}

See, that wasn't too bad. Err -- I seem to have done the whole thing. Well, given my normal practice, I'm certain that there are some entertaining typos and syntax errors waiting to trip you up. At the very least. Let me know what the error messages look like and I'll help you find them.

 

Regards

Jim

It's such a shame you hate coding sooo much Jim...

 

 

LOL

 

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
It's such a shame you hate coding sooo much Jim...

LOL

 

Craig :)

It's true. I prefer building hardware to coding. However, give me a challenge that interests me in either one and I'm going to attack it until I'm satisfied with it. I just have that problem-solving mentality.

 

It's a curse. Really.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites
It's true. I prefer building hardware to coding. However, give me a challenge that interests me in either one and I'm going to attack it until I'm satisfied with it. I just have that problem-solving mentality.

 

It's a curse. Really.

 

Regards

Jim

Welcome to the hacker family. :thumbsup:

Share this post


Link to post
Share on other sites

ummmmmm what is the latest "rollup" - the last one listed says to not to install. Sorry, you'll have to dummy down the verbage just a tad for me *grins*

 

As for what I have installed - just the header tag and shadowbox contribs - nothing too serious.


26 contributions installed - - And counting ....

 

Just want to take this time to extend my appreciation to everyone who have patiently answered my questions over the months of working on my site. I hope to be able to "pass it forward" and help new folks.

Share this post


Link to post
Share on other sites
ummmmmm what is the latest "rollup" - the last one listed says to not to install. Sorry, you'll have to dummy down the verbage just a tad for me *grins*

 

As for what I have installed - just the header tag and shadowbox contribs - nothing too serious.

Use this one:

Roll up with loose mzmt references removed HallMarc 17 Feb 2006

There are no instructions with this package, so download the RC4 package for some instructions.

 

These files are best for overwrite and run, but you can also use a differencing tool, I use WinMerge, there is a link for it in the RC4 package, it is an Open Source tool, so it is free to use.

 

I hope to have a fully updated version finished this week, but no guaruntees.

 

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

If you're going to be supplying an updated version, I'll hold off - I have plenty to do elsewhere in the site LOL.


26 contributions installed - - And counting ....

 

Just want to take this time to extend my appreciation to everyone who have patiently answered my questions over the months of working on my site. I hope to be able to "pass it forward" and help new folks.

Share this post


Link to post
Share on other sites
Sorry, I didn't make myself clear. I was fairly certain that those lines are there, I'm just not sure that they are working correctly with MVS. Try printing out the variables to see if they are being set to a proper value. The code that I quoted should evaluate to a non-blank string. Try inserting something like this just before that line:

print 'Shipping Method: ' . $order->info['shipping_method'];

If that looks OK, try the same thing with $module, which should also produce a string (the module name, or one of them anyway.) If either or both of those are blank the tax will not get added into the final total.

 

Regards

Jim

 

Hi Jim,

 

Ok i have tried a few things and found:

 

Chemos tep get tax rate was in fact upsetting my tax system & zones. I have found a fix relating to it which means i have now set my tax zones up the way they are meant to be - all good - but im wondering if it is an issue with shipping somehow as far as tax goes? Who knows. All i know is that selecting a tax zone or tax rate in any of the shipping module drop downs in MVS has 0 effect. I have one tax class - Taxable goods - set at a rate of 10% at priority 1 and it gets applied to goods and shipping alike.

 

At the moment i have brutally hacked my way through all the shipping and ordering pages and hardcoded a 10% tax in on all the prices. *1.1 & /11 & all sorts of ugly dividers and multipliers all over the place but it works.

 

I am also wondering if i am supposed to be setting a special "shipping tax" tax zone with a seperate shipping tax class? I have seen a number of different variations on the theme but none seem to have any effect.

 

All is working anyway - the only thing i cant get it to do is add the credit card surcharge tax to the tax total, but i can live with that for the moment.

 

All my order total/OT_XXX.php files are still bog standard oscommerce i have compared them all.

 

I would post the hacks i have done but fear it may be darkly disturbing for some.

 

For now i will get my shop up and running again, and will come back to tweak the code when it calms down a bit. Great add on guys thanks.

 

:thumbsup:


And with a 9 in 10 search rate success the no.1 returned Oscommerce forum hit:

"The administrator has enabled flood control - please try again in 30 seconds."

 

Never fails.

 

Every time.

Share this post


Link to post
Share on other sites

hi, i was wondering if there is a wat to integrate the module Supplier Admin Area V0.2, 3957. This will probably allow vendors to add products themselves rather having the store Admin add them. For e.g. the vendor uses a login & password to log in to the supplier side and adds products to the catalog. The new products are not live until they are approved by the store admin. Also a functionality to disable a particular vendor may be added, such that when a particular vendor/supplier is diabled all products served by that supplier or vendor is disabled.

 

In essence this will be like creating a marketplace module for Oscommerce.

 

i am very keen on this kind of mudule and to speed up the development on this side i am willing to sponsor this development.

 

bookseller.

Share this post


Link to post
Share on other sites
hi, i was wondering if there is a wat to integrate the module Supplier Admin Area V0.2, 3957. This will probably allow vendors to add products themselves rather having the store Admin add them. For e.g. the vendor uses a login & password to log in to the supplier side and adds products to the catalog. The new products are not live until they are approved by the store admin. Also a functionality to disable a particular vendor may be added, such that when a particular vendor/supplier is diabled all products served by that supplier or vendor is disabled.

 

In essence this will be like creating a marketplace module for Oscommerce.

 

i am very keen on this kind of mudule and to speed up the development on this side i am willing to sponsor this development.

 

bookseller.

I think someone already worked on this, they posted here for a bit and then disappeared. I have been considering working on this myself, but have not had time. One could start with "Admin Access with levels" and add the approve/disapprove code from there. I don't think it would be that difficult, but perhaps time consuming.

 

 

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 think someone already worked on this, they posted here for a bit and then disappeared. I have been considering working on this myself, but have not had time. One could start with "Admin Access with levels" and add the approve/disapprove code from there. I don't think it would be that difficult, but perhaps time consuming.

Craig :)

Exactly what I was thinking when I read the question. Excellent idea. I already have Admins with levels added to my development site (Along with about 55 other contributions!) and if I can find some time i will look into it myself.

Share this post


Link to post
Share on other sites

Hi - I've got a question about the capabilities of this module. Our store ships most items via FedEx, and we are currently using FedEx Real Time Quotes. However, we offer a few very large, heavy items, and we would like customers to call us for freight quotes for those items. Can this be set up with MVS, working with the "Request for Quote" contribution?

 

We don't drop ship or have separate vendors, but I am thinking we could set the heavy items up as a separate vendor, and then just offer the 'request for quote' option for items set up under the 'freight' vendor.

 

Would that work through MVS? Thanks for the assistance.

 

Donna

Share this post


Link to post
Share on other sites
Hi - I've got a question about the capabilities of this module. Our store ships most items via FedEx, and we are currently using FedEx Real Time Quotes. However, we offer a few very large, heavy items, and we would like customers to call us for freight quotes for those items. Can this be set up with MVS, working with the "Request for Quote" contribution?

 

We don't drop ship or have separate vendors, but I am thinking we could set the heavy items up as a separate vendor, and then just offer the 'request for quote' option for items set up under the 'freight' vendor.

 

Would that work through MVS? Thanks for the assistance.

 

Donna

Why not use the FedEx Freight shipping contribution found here:?

http://www.oscommerce.com/community/contri.../search,FREIGHT

 

MVS is a great contribution, please do not get me wrong, however if you don't need it for your store then I don't see having to go through all the work to install this one when a shipping contribution exists for freight.

Share this post


Link to post
Share on other sites
Why not use the FedEx Freight shipping contribution found here:?

http://www.oscommerce.com/community/contri.../search,FREIGHT

 

MVS is a great contribution, please do not get me wrong, however if you don't need it for your store then I don't see having to go through all the work to install this one when a shipping contribution exists for freight.

 

Thanks for the super-fast reply :D

 

The problem is that we don't use fedex for freight - only for regular shipments. Do you think it would just be better to switch to Fedex Freight? I may be able to persuade the owner...

 

thanks

 

Donna

Share this post


Link to post
Share on other sites
Thanks for the super-fast reply :D

 

The problem is that we don't use fedex for freight - only for regular shipments. Do you think it would just be better to switch to Fedex Freight? I may be able to persuade the owner...

 

thanks

 

Donna

I can't say really, as I don't know who you use for your LTL shipments. However, and then this really should be moved elsewhere (maybe email or pm) because this isn't relative to this thread, you could use this RFQ contribution

http://www.oscommerce.com/community/contri.../search,FREIGHT

Share this post


Link to post
Share on other sites
I can't say really, as I don't know who you use for your LTL shipments. However, and then this really should be moved elsewhere (maybe email or pm) because this isn't relative to this thread, you could use this RFQ contribution

http://www.oscommerce.com/community/contri.../search,FREIGHT

 

I have the RFQ contrib installed - the problem is that it offers customers the choice of FedEx or the call for quote option, not just one.

 

Now, moving back to the topic ;) - my original idea was to set up MVS putting the heavy items under their own vendor, then only offering the RFQ option for the 'heavy' vendor. Then all other items would offer only the FedEx option. I just don't know enough about MVS to know if that would work, and I don't want to install it and find that it doesn't work the way I think it will.

 

Thanks again :D

 

Donna

Share this post


Link to post
Share on other sites
I have the RFQ contrib installed - the problem is that it offers customers the choice of FedEx or the call for quote option, not just one.

 

Now, moving back to the topic ;) - my original idea was to set up MVS putting the heavy items under their own vendor, then only offering the RFQ option for the 'heavy' vendor. Then all other items would offer only the FedEx option. I just don't know enough about MVS to know if that would work, and I don't want to install it and find that it doesn't work the way I think it will.

 

Thanks again :D

 

Donna

MVS should do exactly what you have described.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites

any ideas why i would get the following error when i go to edit the default vendor?

 

1054 - Unknown column 'num_tables' in 'field list'

 

select vendors_id, vendors_name, vendors_email, vendors_contact, vendors_phone1, vendors_email, vendors_send_email, vendors_status_send, vendor_street, vendor_city, vendor_state, vendors_zipcode, vendor_country, vendor_country, account_number, vendors_url, vendor_add_info, handling_charge, handling_per_box, tare_weight, percent_tare_weight, max_box_weight, num_tables, zones from vendors where vendors_id = '1'

 

[TEP STOP]

 

this is probably obvious to a veteran but i'm new to php/mysql stuff any healp greatly apprieciatted

 

also and i am hopeing its the same problem when i try to check out it wont go past the area where it confirms your address but it doesnt give any shipping options

Share this post


Link to post
Share on other sites
any ideas why i would get the following error when i go to edit the default vendor?

 

1054 - Unknown column 'num_tables' in 'field list'

I don't see that column in any version of MVS, including the latest rollup and the addons. Do you have any other mods in your osCommerce code? Perhaps some other Contribution that works with MVS. I'm sorry to say that there are now several additional contributions that work with MVS that I haven't even looked at.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites
I don't see that column in any version of MVS, including the latest rollup and the addons. Do you have any other mods in your osCommerce code? Perhaps some other Contribution that works with MVS. I'm sorry to say that there are now several additional contributions that work with MVS that I haven't even looked at.

 

Regards

Jim

 

It looks like i missed a merge on the app_top file in the admin section unfortunalt netfirms version of this file is totally screwed up in regards to merging this into it seems the have changed about 95% of the file. so in order to hopfully save myself some greif <my store isnt live yet> I am going to attempt a clean install and just do it all by hand instead of useing there setup. god i hope this works LOL

Share this post


Link to post
Share on other sites
any ideas why i would get the following error when i go to edit the default vendor?

 

1054 - Unknown column 'num_tables' in 'field list'

 

select vendors_id, vendors_name, vendors_email, vendors_contact, vendors_phone1, vendors_email, vendors_send_email, vendors_status_send, vendor_street, vendor_city, vendor_state, vendors_zipcode, vendor_country, vendor_country, account_number, vendors_url, vendor_add_info, handling_charge, handling_per_box, tare_weight, percent_tare_weight, max_box_weight, num_tables, zones from vendors where vendors_id = '1'

 

[TEP STOP]

 

this is probably obvious to a veteran but i'm new to php/mysql stuff any healp greatly apprieciatted

 

also and i am hopeing its the same problem when i try to check out it wont go past the area where it confirms your address but it doesnt give any shipping options

That reference 'num_tables' is related to the MZMT contribution.

Edited by HallMarc

Share this post


Link to post
Share on other sites

How to fix this Part Deux for dkalasz

In catalog/admin/vendors.php remove or comment out these lines:

line 51 $num_tables = tep_db_prepare_input($HTTP_POST_VARS['num_tables']); // for mzmt shipping

line 77 'num_tables' => $num_tables, // for mzmt shipping

line 144 $num_tables = tep_db_prepare_input($HTTP_POST_VARS['num_tables']); // for mzmt shipping

 

In line 156 replace

$vendors_query = tep_db_query("select vendors_id, vendors_name, vendors_email, vendors_contact, vendors_phone1, vendors_email, vendors_send_email, vendors_status_send, vendor_street, vendor_city, vendor_state, vendors_zipcode, vendor_country, vendor_country, account_number, vendors_url, vendor_add_info, handling_charge, handling_per_box, tare_weight, percent_tare_weight, max_box_weight, num_tables, zones from " . TABLE_VENDORS . " where vendors_id = '" . (int)$HTTP_GET_VARS['vendors_id'] . "'");

with

$vendors_query = tep_db_query("select vendors_id, vendors_name, vendors_email, vendors_contact, vendors_phone1, vendors_email, vendors_send_email, vendors_status_send, vendor_street, vendor_city, vendor_state, vendors_zipcode, vendor_country, vendor_country, account_number, vendors_url, vendor_add_info, handling_charge, handling_per_box, tare_weight, percent_tare_weight, max_box_weight, zones from " . TABLE_VENDORS . " where vendors_id = '" . (int)$HTTP_GET_VARS['vendors_id'] . "'");

 

 

and lastly, starting at or around 430 (probably line 426 if you are doing this step by step)

remove or comment out this whole section

 

<?php // for mzmt shipping ?>

<tr>

<td class="main"><?php echo TEXT_TABLES; ?></td>

<td class="main">

<?php

 

echo tep_draw_input_field('num_tables', $vInfo->num_tables, 'maxlength="32"');

 

?>

</td>

</tr>

<?php // end for mzmt shipping ?>

 

and that's it!

Edited by HallMarc

Share this post


Link to post
Share on other sites

I ended up doing a fresh install..i wanted to get this package working first and be sure it was solid befor i moved on. i'm now getting this error on confirming an order

 

1054 - Unknown column 'vendor_order_sent' in 'field list'

 

insert into orders_shipping (orders_id, vendors_id, shipping_module, shipping_method, shipping_cost, shipping_tax, vendors_name, vendor_order_sent) values ('1', '1', 'firstitemplus', '($6.00 for first item, $1.00 for each additional)', '6.00', '0', 'My Store', 'no')

 

looks like a missing field in the database but where? I've bought a stack of books unfortunatly i can only absorb the info so fast hehe and I just cant figure this one out.

 

is there a fresh package anywhere to download?

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

×