Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Multi_Vendor_Shipping new thread


blucollarguy

Recommended Posts

Marc,

I am starting to see that the duplicate request bug is happening across all modules in MVS so noe I am thinking that the function is being called twice from the shipping page.
I downloaded mvs0.9-RC5 to see how the shipping modules were loaded, but can't find a single reference to the class shipping. In Separate Pricing Per Customer the loading of certain modules is manipulated only and solely in the file includes/classes/shipping.php (function shipping).

 

Seeing those double request and your mentioning of having to install the UPSXML first to be able to work with MVS makes me think that you have to move the call of the multi_vendor_modules from the checkout_shipping to the class shipping, function shipping.

Link to comment
Share on other sites

I downloaded mvs0.9-RC5 to see how the shipping modules were loaded, but can't find a single reference to the class shipping. In Separate Pricing Per Customer the loading of certain modules is manipulated only and solely in the file includes/classes/shipping.php (function shipping).

MVS uses a modified version of the shipping class -- see includes/classes/vendor_shipping.php. It is called in checkout_shipping.php around line 63. This particular instance is named $shipping_modules.

 

Regards

Jim

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

Link to comment
Share on other sites

Jim,

MVS uses a modified version of the shipping class -- see includes/classes/vendor_shipping.php. It is called in checkout_shipping.php around line 63. This particular instance is named $shipping_modules.
Yes, sorry I don't know what I'm talking about obviously :blush:

 

Although I can't figure out how the modules are loaded. Too much going on if you ask me.

 

In a test shop I use I could show what modules are present by changing the footer on checkout_shipping.php to:

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php');
echo '<pre>Shipping modules: <br />';
print_r($shipping_modules);
?>
<!-- footer_eof //-->

Perhaps that gives a clue?

Link to comment
Share on other sites

Although I can't figure out how the modules are loaded. Too much going on if you ask me.

 

In a test shop I use I could show what modules are present by changing the footer on checkout_shipping.php to:

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php');
echo '<pre>Shipping modules: <br />';
print_r($shipping_modules);
?>
<!-- footer_eof //-->

Perhaps that gives a clue?

The list of installed modules is stored in the database. For MVS, look in the vendor_configuration table for a configuration_key similar to MODULE_VENDOR_SHIPPING_INSTALLED_1 (The number at the end is the vendors_id.) The configuration_value field will hold a comma-separated list of the installed modules. There is code in application_top.php that loads the key=>value pairs from this table as constant definitions, therefore MODULE_VENDOR_SHIPPING_INSTALLED_1 becomes a constant containing a list of the installed modules. The shipping class reads this list and loads the modules in the list as instances of classes with each module's name.

 

Your footer code should show the modules loaded for the current vendor. For cases where there are multiple vendors, this would probably be the last one defined. If you want to see all of the data for an order, you will probably have to move this up to the inside of the loop that steps through the vendors by $vendors_id.

 

There is indeed too much going on here. Don't be embarrassed by not being able to see it quickly; it took a lot of work just to figure this system out, and a lot more to make a set of changes that actually worked. We'll be glad to help as much as we can with explaining it all. Just ask if you have questions.

 

Regards

Jim

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

Link to comment
Share on other sites

Marc,

I downloaded mvs0.9-RC5 to see how the shipping modules were loaded, but can't find a single reference to the class shipping. In Separate Pricing Per Customer the loading of certain modules is manipulated only and solely in the file includes/classes/shipping.php (function shipping).

 

Seeing those double request and your mentioning of having to install the UPSXML first to be able to work with MVS makes me think that you have to move the call of the multi_vendor_modules from the checkout_shipping to the class shipping, function shipping.

Working with MVS has been a huge learning curve for me. Wading through through the code and trying to understand when and where variables and arrays are set has been challenging to say the least. Also, I saw a posting in that contribution that warned of using RC5 and to start with RC4 which is what I did and then I added all fixes and posted it as the Roll Up

 

My mention of having to install UPSXML first was because there are some changes that were made to variable names and a wholle new way to set dimensional support. If you don't install the code for this new way of doing things and update your database then this won't work.

 

i.e SHIPPING_DAYS_DELAY (SHIPPING_DAYS_DELAY_ . $vendors_id in MVS) is now MODULE_SHIPPING_UPSXML_DAYS_DELAY (MODULE_SHIPPING_UPSXML_DAYS_DELAY_ . $vendors_id in MVS

 

EVERYONE don't forget to add

				'02' => MODULE_SHIPPING_UPSXML_SERVICE_CODE_CANADA_ORIGIN_02,

to the

			// Canada Origin
		'Canada Origin' => array(

right under

				'01' => MODULE_SHIPPING_UPSXML_SERVICE_CODE_CANADA_ORIGIN_01,

Edited by HallMarc
Link to comment
Share on other sites

Hey Guys,

 

I cannot get MVS to add any shipping charges at checkout. Do I need to do something to enable it, other than install it? I've tried different shipping types. I have vendors set up with shipping type assigned to each. I have the vendor ID's in in the database. This is a new store, do I need to do something to enable live testing? It does the same thing on my testing server. Oddly enough I have noticed that if regular shipping of any kind is enabled it just consistantly charges a 5.00 flat rate, even if that is not what it is set at or if that is not the regular shipping mod installed.

 

I really want to get this thing going, I want to be able to test the Individual Shipping for MVS. And eventually of course I would like to get a new site up. :(

 

Please help. Maybe I missed a file change or something.

Link to comment
Share on other sites

Please help. Maybe I missed a file change or something.

Do you have Admin > Configuration > My Store > Use vendor shipping? set to true? If so, try setting a single module (ie flat) to a specific value on your Vendor #1. What does shipping give you in this case?

 

Regards

Jim

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

Link to comment
Share on other sites

Do you have Admin > Configuration > My Store > Use vendor shipping? set to true? If so, try setting a single module (ie flat) to a specific value on your Vendor #1. What does shipping give you in this case?

 

Regards

Jim

 

Thanks Jim,

I probably missed that in the documentation. It was under Admin > Configuration > Shipping/Packaging > Use vendor shipping? set to true? I figured I had to turn it on I just couldn't see where. :D

Link to comment
Share on other sites

OK next issue. B) Remember all that time we spent fixing the check out without shipping being selected problem? Well, the problem I have now is if I activate the Free shipping over $xxx that comes with osCommerce it won't let you advance to the select payment page because it thinks you haven't chosen a shipping method. How can we fix this?

 

My shipping method for gift vouchers/certificates and downloadables works fine.

Link to comment
Share on other sites

OK next issue. B) Remember all that time we spent fixing the check out without shipping being selected problem? Well, the problem I have now is if I activate the Free shipping over $xxx that comes with osCommerce it won't let you advance to the select payment page because it thinks you haven't chosen a shipping method. How can we fix this?

 

My shipping method for gift vouchers/certificates and downloadables works fine.

The Free Shipping setup should create a fake shipping module and method named "free_free". That would be enough to satisfy the checkout without shipping test. I'll have to take a look at this one.

 

Regards

Jim

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

Link to comment
Share on other sites

The Free Shipping setup should create a fake shipping module and method named "free_free". That would be enough to satisfy the checkout without shipping test. I'll have to take a look at this one.

 

Regards

Jim

Just remember I am using the RC4 Roll Up which has all the checks in checkout_shipping.php and checkout_payment.php added in to keep people from being able to skip the shipping selection. The 'Enable Free Shipping' admin choice that comes with osCommerce is the one that isn't setting the necessary variable.

Link to comment
Share on other sites

BTW This isn't easy to find in the Admin panel unless you know where to look. At least it was hard for me to find.

 

Admin->Modules->Order Total->Shipping

Once you Install it you will see a choice 'Allow Free Shipping'

Link to comment
Share on other sites

Ok, I have more questions before I know if this contribution fits my needs.

 

I have multi-vendors - drop ship companies. CHECK

I will have to open accounts with UPS, FedEx, USPS CHECK

 

I have already uploaded about 350 products from these various companies..... if I install this contribution, how are these products (and future ones) connected to the correct shipping situation and company?

 

I have not used the Manufacturer part of OsC....none are listed. Would I have to back-track and assigned manufacturers to my products in order for this contribution to be able to 'connect' the right shipping situation/company to the right product?

 

In a way, I wish I could see screen shots of this for those who are using solely drop shipping so I can see if it's what I need or not. I'm afraid that if I go through all this install, I'll find it's not what I need. This shipping thing is my last big hurdle in getting my store up and running.

 

Thanks in advance.

Barb

Link to comment
Share on other sites

I have already uploaded about 350 products from these various companies..... if I install this contribution, how are these products (and future ones) connected to the correct shipping situation and company?

You would set up your vendors in the Admin and assign one or more shipping methods to each vendor. Then you would go back through your products and assign each one to a vendor. No need to assign manufacturers unless you want to.

 

I don't have any screenshots available right now, but I do have a demo store up on my test site. Try an order with a selection of products. Most of the hardware is on one vendor and software on another.

 

If that's not enough then ask again and I'll go do some screenshots of live stores.

 

Regards

Jim

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

Link to comment
Share on other sites

Then in indvship.php, change the beginning of the quote method to add the Cart class to the globals and define the value:

//Get a quote, added $shiptotal for IndvShip
function quote($method = '', $module = '', $vendors_id = '1') {
global $order, $total_count, $shipping_weight, $shipping_num_boxes, $cart;
$shiptotal =  $cart->vendor_shipping[$vendors_id]['ship_cost'];

That should work for any number of vendors. I haven't tested this, so beware of lurking typos.

 

Regards

Jim

 

Hey Jim that will be much better,

I didn't know how to fetch the values per vendor instead of for all at once, thanks for the

$shiptotal =  $cart->vendor_shipping[$vendors_id]['ship_cost'];

I wouldn't have been able to write that :)

Link to comment
Share on other sites

Hi all,

 

I am having problems with MVS in the checkout process. No matter what shipping type I assign to second vendor their shipping doesn't show up in checkout. :( And the products from the second vendor don't show up in the cart either. The cart totals all of the products prices correctly though?

Link to comment
Share on other sites

BTW This isn't easy to find in the Admin panel unless you know where to look. At least it was hard for me to find.

 

Admin->Modules->Order Total->Shipping

Once you Install it you will see a choice 'Allow Free Shipping'

 

Not to butt in, but can't you just model the free shipping modual after the RFQ one. since you just need it to add text Free and not an amount? Maybe I'm way off, I was thinking of working on FREE shipping next and that is how I was going to do it. I was just going to hack the shipping and checkout files for the RFQ MVS addon.

Link to comment
Share on other sites

Hi all,

 

I am having problems with MVS in the checkout process. No matter what shipping type I assign to second vendor their shipping doesn't show up in checkout. :( And the products from the second vendor don't show up in the cart either. The cart totals all of the products prices correctly though?

It sounds like the $vendors_id is not getting set. The code defaults to an id of vendor 1 to avoid lots of nasty error messages. You could check this with an order containing only products from vendors other than #1.

 

I would start by checking all of your changes to checkout_shipping.php and includes/classes/shopping_cart.php. If those are correct, it could be almost anywhere in the catalog side.

 

Regards

Jim

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

Link to comment
Share on other sites

Jim,

 

Line 19 of your functions/database.php is messed up - couldn't see the store.

 

See, I don't want my vendors/manufacturers to show to the public. Is there a way to hide that and still use this contribution? My stuff isn't namebrand, like Nike, Puma, etc....small companies.

 

Thanks for helping,

Barb

 

 

 

You would set up your vendors in the Admin and assign one or more shipping methods to each vendor. Then you would go back through your products and assign each one to a vendor. No need to assign manufacturers unless you want to.

 

I don't have any screenshots available right now, but I do have a demo store up on my test site. Try an order with a selection of products. Most of the hardware is on one vendor and software on another.

 

If that's not enough then ask again and I'll go do some screenshots of live stores.

 

Regards

Jim

Link to comment
Share on other sites

Jim,

 

Line 19 of your functions/database.php is messed up - couldn't see the store.

 

See, I don't want my vendors/manufacturers to show to the public. Is there a way to hide that and still use this contribution? My stuff isn't namebrand, like Nike, Puma, etc....small companies.

 

Thanks for helping,

Barb

That's strange, I just tried it and everything looks fine. What page were you seeing the error on?

 

Your vendors are not shown to the public. All that your customers will see is a notice that products are shipping from more than one location. The text of that notice can be easily changed to say anything you want. The customer then sees selection boxes for the allowed shipping methods for each vendor. I just snapped a screenshot of my test site and put it up here. That's what the default shipping page looks like (or most of it anyway.)

 

Regards

Jim

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

Link to comment
Share on other sites

It sounds like the $vendors_id is not getting set. The code defaults to an id of vendor 1 to avoid lots of nasty error messages. You could check this with an order containing only products from vendors other than #1.

 

I would start by checking all of your changes to checkout_shipping.php and includes/classes/shopping_cart.php. If those are correct, it could be almost anywhere in the catalog side.

 

Regards

Jim

 

Ok i got MVS working and am now testing Individual Shipping. All I get at checkout is the handling fee.

 //Add values to the output array
	  $this->vendor_shipping[$vendors_id]['weight'] += ($quantity * $products_weight);
	  $this->vendor_shipping[$vendors_id]['cost'] += tep_add_tax($products_price, $products_tax) * $quantity;
	  //mod IndvShip
	  $this->vendor_shipping[$vendors_id]['ship_cost'] += ($quantity * $products_ship_price);
	  //mod IndvShip
	  $this->vendor_shipping[$vendors_id]['qty'] += $quantity;
	  $this->vendor_shipping[$vendors_id]['products_id'][] = $products_id; //There can be more than one product

Is this code retreiving products_ship_cost individually dependant upon the vendor_id?

 

And does this code (in indvship.php) total products_ship_cost?

/Get a quote, added $shiptotal for IndvShip
function quote($method = '', $module = '', $vendors_id = '1') {
  global $order, $total_count, $shipping_weight, $shipping_num_boxes;
  $shiptotal = $cart->vendor_shipping[$vendors_id]['ship_price'];

Link to comment
Share on other sites

Ok i got MVS working and am now testing Individual Shipping. All I get at checkout is the handling fee.
 //Add values to the output array
	  $this->vendor_shipping[$vendors_id]['weight'] += ($quantity * $products_weight);
	  $this->vendor_shipping[$vendors_id]['cost'] += tep_add_tax($products_price, $products_tax) * $quantity;
	  //mod IndvShip
	  $this->vendor_shipping[$vendors_id]['ship_cost'] += ($quantity * $products_ship_price);
	  //mod IndvShip
	  $this->vendor_shipping[$vendors_id]['qty'] += $quantity;
	  $this->vendor_shipping[$vendors_id]['products_id'][] = $products_id; //There can be more than one product

Is this code retreiving products_ship_cost individually dependant upon the vendor_id?

 

And does this code (in indvship.php) total products_ship_cost?

/Get a quote, added $shiptotal for IndvShip
function quote($method = '', $module = '', $vendors_id = '1') {
  global $order, $total_count, $shipping_weight, $shipping_num_boxes;
  $shiptotal = $cart->vendor_shipping[$vendors_id]['ship_price'];

Oops. I did say something about lurking typos, didn't I? Well, there's definitely one in there. I used ['ship_cost'] in one place and ['ship_price'] in another. You might want to make them all the same.

 

Yes, the first chunk of code is supposed to total the individual shipping costs by vendor. The second one is supposed to retrieve the total cost for the current vendor. Which will probably happen if I can remember to use the same key name everywhere. This is what makes debugging code so much fun.

 

Regards

Jim

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

Link to comment
Share on other sites

Oops. I did say something about lurking typos, didn't I? Well, there's definitely one in there. I used ['ship_cost'] in one place and ['ship_price'] in another. You might want to make them all the same.

 

Yes, the first chunk of code is supposed to total the individual shipping costs by vendor. The second one is supposed to retrieve the total cost for the current vendor. Which will probably happen if I can remember to use the same key name everywhere. This is what makes debugging code so much fun.

 

Regards

Jim

 

In advance let me say sorry for how long this post is, but I've been bannging my head for a couple hours now and I can't get it working. I did catch that and have already fixed it. >_< So here is what I have:

 

shopping_cart.php

	function vendor_shipping() {

  if (!is_array($this->contents)) return 0;  //Cart is empty

  $this->vendor_shipping = array();  //Initialize the output array
  reset($this->contents);			//  and reset the input array
  foreach ($this->contents as $products_id => $value) {  //$value is never used
	$quantity = $this->contents[$products_id]['qty'];
//mod IndvShip, added products_ship_price
	$products_query = tep_db_query("select products_id, 
										   products_price,
										   products_ship_price,
										   products_tax_class_id, 
										   products_weight, 
										   vendors_id
									from " . TABLE_PRODUCTS . " 
									where products_id = '" . (int)$products_id . "'"
								  );
	if ($products = tep_db_fetch_array($products_query)) {
	  $products_price = $products['products_price'];
	  //mod IndvShip
	  $products_ship_price = $products['products_ship_price'];
	  //mod IndvShip
	  $products_weight = $products['products_weight'];
	  $vendors_id = ($products['vendors_id'] <= 0) ? 1 : $products['vendors_id']; 
	  $products_tax = tep_get_tax_rate($products['products_tax_class_id']);
	  //Find special prices (if any)
	  $specials_query = tep_db_query("select specials_new_products_price 
									  from " . TABLE_SPECIALS . " 
									  where products_id = '" . (int)$products_id . "' 
										and status = '1'"
									);
	  if (tep_db_num_rows ($specials_query)) {
		$specials = tep_db_fetch_array($specials_query);
		$products_price = $specials['specials_new_products_price'];
	  }

	  //Add values to the output array
	  $this->vendor_shipping[$vendors_id]['weight'] += ($quantity * $products_weight);
	  $this->vendor_shipping[$vendors_id]['cost'] += tep_add_tax($products_price, $products_tax) * $quantity;
	  //mod IndvShip
	  $this->vendor_shipping[$vendors_id]['ship_cost'] += ($quantity * $products_ship_price);					//mod IndvShip
	  $this->vendor_shipping[$vendors_id]['qty'] += $quantity;
	  $this->vendor_shipping[$vendors_id]['products_id'][] = $products_id; //There can be more than one product
	}

 

And indvship.php:

//Get a quote, added $shiptotal for IndvShip
function quote($method = '', $module = '', $vendors_id = '1') {
  global $order, $total_count, $shipping_weight, $shipping_num_boxes;
  $shiptotal = $cart->vendor_shipping[$vendors_id]['ship_cost'];

//MVS Start
  $vendors_data_query = tep_db_query("select handling_charge,
											 handling_per_box,
											 vendor_country,
											 vendors_zipcode
									  from " . TABLE_VENDORS . "
									  where vendors_id = '" . (int)$vendors_id . "'"
									);
  $vendors_data = tep_db_fetch_array($vendors_data_query);
  $country_name = tep_get_countries($vendors_data['vendor_country'], true);


// begin mod for extra handling fee
$vendors_handling_query = tep_db_query("select configuration_value from " . TABLE_VENDOR_CONFIGURATION . " where vendors_id = '". $vendors_id ."' and configuration_key = 'MODULE_SHIPPING_INDVSHIP_HANDLING_" . $vendors_id . "'");
$vendors_handling_data = tep_db_fetch_array($vendors_handling_query);

$handling_charge = $vendors_data['handling_charge'] + $vendors_handling_data['configuration_value'];
// end mod for extra handling fee
  $handling_per_box = $vendors_data['handling_per_box'];
  if ($handling_charge > $handling_per_box*$shipping_num_boxes) {
	$handling = $handling_charge;
  } else {
	$handling = $handling_per_box*$shipping_num_boxes;
  }

//MVS End

//MVS - Changed 'cost' => $shiptotal + $handling
  $this->quotes = array('id' => $this->code,
						'module' => MODULE_SHIPPING_INDVSHIP_TEXT_TITLE,
						'methods' => array(array('id' => $this->code,
												 'title' => MODULE_SHIPPING_INDVSHIP_TEXT_WAY,
												 'cost' => $shiptotal + $handling)));

 

These are the only areas I have really modified maybe I need to change something else? :huh:

I compare shipping with weight alot. Since they are both retrieved from the database and totaled on per vendor basis. So my question is can't we get shiptotal from the shopping cart like we do weight? I see $shipping_weight or $shipping_cost in alot of the strings like:

 function quote($method = '', $module = '', $vendors_id = '1') {
  global $HTTP_POST_VARS, $shipping_cost, $shipping_weight, $order, $cart, $shipping_num_boxes;

but I don't see where $shipping_cost and $shipping_weight come from in the cart? I can see $cost and $weight.

Anyway I thought maybe the

$shiptotal = $cart->vendor_shipping[$vendors_id]['ship_cost'];

isn't working since no other values ar retrieved that way.

 

Thank you for being so helpful :D I really need this for my store.

Link to comment
Share on other sites

Hey Jim,

I got it to work :D I changed:

//Get a quote, added $shiptotal for IndvShip
function quote($method = '', $module = '', $vendors_id = '1') {
  global $order, $total_count, $shipping_weight, $shipping_num_boxes;
  $shiptotal = $cart->vendor_shipping[$vendors_id]['ship_cost'];

to:

//Get a quote, added $shiptotal for IndvShip
function quote($method = '', $module = '', $vendors_id = '1') {
  global $order, $total_count, $shipping_weight, $shipping_num_boxes, $shiptotal;

in indvship.php.

 

And I added to the vendor_shipping.php like so:

// Get a quote for one or many shipping methods, for a specific vendor 
//added $shiptotal for indvship
function quote($method = '', $module = '', $vendors_id='1') {
  global $shipping_quoted, $order, $cart, $shipping_num_boxes, $shipping_weight, $shiptotal;

  $quotes_array = array();
  if (is_array($this->modules[$vendors_id])) {
	$shipping_quoted = '';
	$shipping_num_boxes = 1;

	$shipping_weight = $cart->vendor_shipping[$vendors_id]['weight'];
	//mod indvship
	$shiptotal = $cart->vendor_shipping[$vendors_id]['ship_cost'];
	//mod indvship
	$shipping_cost = $cart->vendor_shipping[$vendors_id]['cost'];
	$total_count = $cart->vendor_shipping[$vendors_id]['qty'];

 

I guess I answered my own question. I knew it should work similar to weight but needed to find where the $shipping_weight was coming from.

 

Yea I am soooo Happy :rolleyes:

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...