Jump to content



Photo
* * * * * 8 votes

Multi_Vendor_Shipping new thread


  • Please log in to reply
4707 replies to this topic

#21   mugitty

mugitty
  • Members
  • 1,201 posts
  • Real Name:Stuart Owens
  • Location:Great Southeastern Washington Desert, USA

Posted 28 July 2004 - 05:53

Joey;

First, let me say that I am excited to have someone else express an interest in getting this developed. As I am not a great amount of use when it comes to writing code, I was starting to worry that Craig might get that entire chore dumped solely in his lap!

I wouldn't necessarily say that you are oversimplifying the desired scenario - the simpler, the better - as long as the desired results and/or capabilities are achieved.

I would offer an observation that might have a bearing on some people's use of what is being proposed:

If one has a given manufacturer that can be sourced from more than one vendor and that choice is made based on who has a given product available on any given day, then to utilize a manufacturer assignment to vendor format would create some problems. I don't think it's a bad idea, just that there are some situations in which it would not work. I personally don't see any problem with adding one more field to the Product Page (which won't be there at all for people who have no need for the type of modification we are discussing here, because they will not have installed it). Could not a manufacturer be synonymous with a vendor if one always ships all of that manufacturer's products from the same vendor?

I guess from a selfish standpoint I should point out that my primary desire in the development of this idea is to be able to dictate, on a per item basis, which shipping options will be allowed to be shown to the customer. This stems from having products from the same manufacturer, some of which can ship "any ol' way" and others which can only be shipped by truck freight, due to their weight and/or size. The idea of having one additional field on the product page where I could make that determination seemed like just the ticket to solve that problem.

Again, I'm thrilled to have another brain working on this, let's keep the discussion lively and moving forward! /wink.gif' class='bbc_emoticon' alt=';)' />
... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,
try being a Foster Parent!

#22   blucollarguy

blucollarguy
  • Members
  • 746 posts
  • Real Name:Craig Garrison Sr
  • Location:Edinburg, VA

Posted 28 July 2004 - 10:33

Awesome Joey, I will need the help working out the code for this as I have already started and stopped many different attempts from different directions. I think the problem with adding Vendors to each product from a separate page in the admin would be time involved during new product additions. The way I am currently tieing prods to Vendors (and therefore each location, would happen in prod add screen the same way you tie a manufacturer, from a dropdown) and this seems a logical spot since you will have the option with every new prod every time you add or edit a prod. The rest of what you have written is exactly what we want to accomplish. I have already created a Vendors table and the ability to tie each prod to a vendor in my contrib Vendors_Auto_Email. My plan has been to simply add the shipping info to that table and everything will happen at once. One does not have to send the Vendor any Email to use the V_A_Email contrib so it seems an easy step to use this as the starting point where to store the ship info. If you can would like to see how I am doing this you can download V_A_Email from the link in my signature. I would appreciate your coding help a great deal so let me know what you think. A lot of people can get a lot of value from this functionality I think, I know I will and many others who have already contacted me. If you have the time I can certainly use some guidance with this code. Replacing the zipcode from the STORE with the zipcodez from the Vendors has been difficult since each shop module is a little different and I fear a rewrite of each module would be needed. What do you think? Thanks again for the input, Joey. Craig /smile.gif' class='bbc_emoticon' alt=':)' />
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!

#23   blucollarguy

blucollarguy
  • Members
  • 746 posts
  • Real Name:Craig Garrison Sr
  • Location:Edinburg, VA

Posted 29 July 2004 - 11:23

Another thought. We would probably need an additional "fee" field in the prod screen for misc fees. For instance: Vendor's Prod A requires custom packaging, Vendor charges $10.00 for this packaging, and all shipping options are the same as all other prods from this Vendor. This would need to be implemented per prod not per Vendor. I have not looked at the "Per Prod Ship" cnotrib but I would assume that this is done in some way in that contrib. This does not seem overly difficult, but would need to be included in the shipping calls in each quote. Thoughts?
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!

#24   blucollarguy

blucollarguy
  • Members
  • 746 posts
  • Real Name:Craig Garrison Sr
  • Location:Edinburg, VA

Posted 29 July 2004 - 11:39

Manufacturer thoughts. We might be able to tie manufacturers to vendors as an "option". This had not occured to me before, but it could be very useful to be able to not only get the quote from whichever Vendor has the given manufacturers prod available but also to sort the order in kind. Availability checks would be needed, I think. I think this would need to be much deeper than the shipping mod itself, though. If all of manufacturer B's prods only come from Vendor C, this would be, in theory, not that difficult to a achieve, I think. While working on VAEmail I was a bit surprised as to how simple it was to tie each prod to a Vendor. Then calling that information for use in the email was what gave me the most difficulty. And, here again, this is what is causing my frustration with my early attempts with this MVS mod. Adding the info to be available is relatively easy, getting and using properly is the tricky part. Just thoughts bouncing around thoughts in an otherwise empty mind.
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!

#25   zebrax

zebrax
  • Members
  • 19 posts
  • Real Name:Dax

Posted 29 July 2004 - 17:37

Each shipping module is going to need some code change since most use a constant to get the origin zip. in the modules I have looked at, it should only be 2 line change.

$country_name = tep_get_countries(SHIPPING_ORIGIN_COUNTRY, true);
      $this->_Origin(SHIPPING_ORIGIN_ZIP, $country_name['countries_iso_code_2']);

changed to
global $origininfo;
$country_name = tep_get_countries($origininfo['country'], true);
      $this->_Origin($origininfo['zipcode'], $country_name['countries_iso_code_2']);

the key here is rewriting the shipping class to change the value of $origininfo before calling each need module.

the shipping class uses the cart class to get the products and coresponding vendors, it sorts the items by vendor, adds up the weights and calls the valid shipping modules for each vendor. it then returns the totals of all the different items and methods.

Now if I just had some time I would code it....

#26   joeyjgarcia

joeyjgarcia
  • Members
  • 415 posts
  • Real Name:Joey Garcia

Posted 29 July 2004 - 18:16

I understand your agenda, I also have my own and I think that is reasonable. We want to have a tool that will work for our needs, especially if we are going to invest our time and labor.

I see this as a multi-part approach.

Part I

For the categories.php page:
If you have some products that ship on a truck while other products through the mail, but both are from the same vendor then a vendor list will not suffice. We would need something more specific. I don't think this is inline with my original idea, but since we are creating this from scratch it probably wouldn't be too hard to add in. I think that we can't focus on vendors then and have to focus on "Shipping Type" or "Shipper" or whatever. This table would need a Vendor Name, Zipcode, and handling fees (that could be used to pad the shipping cost when necessary), possibly a couple more shipping metadata for boxes, etc but I think the handling fees can take care of this more easily. So the Add/Edit Product page would have a "Shipping Type" drop-down list. Keep in mind that you could have different Shipping Types from the same vendor. Would this work for you?

For the Checkout_shipping.php(assuming this is the right name) page:
You would need a query that can start with a set of product_ids and determine how many shipping types are needed and that number will be the number of time you loop (using a for loop). This should look something like this select distinct count(shippers_id) from products p where products_id in (23, 45, 89, 13, 25, 68). This is just psuedo code; I can help with this query.

You will need another query to get the shipping type information (zipcode, handling fees, or a specific shipper for special shipping methods like trucking (I am clueless here)) to get the quote from the shipping web sites. Again, much like it does now.

It would be nice to have the product model number displayed in the same area for each shipping type. For example, if a customer is wondering why his/her shipping cost is so much they will be able to see that product 123, 456, and 789 are going to be shippied via Shipper 1 and products abc, xyz are going to be shipping from Shipper 2 and the capability to remove these items from the cart with a single click. This give the customer an oppotunity to remove items that are driving up their shipping cost or at least make them aware of what it going on.

You'll need to add the shipping sub-totals of all the shippers then add that to the main Shipping variable and call that "Shipping Total" instead of just Shipping.



Part II

A new page will need to be added for managing the Shippers, i.e., inputing the name, zipcode and handling fees and whatever else that is needed (free shipping options?).




Part III

This part has to modify the following:

1) Order Receipt that is emailed to the customer
2) Orders Admin page


These pages need to reflect excactly what was shown on the checkout_shipping.php page.





Steps:

I would start with the hardest part first, this would be the query that can start with a set of product_ids and determine how many shipping types are needed.

Then get n quotes from the shipping sites.

Display these quotes one on top of each other in the checkout page.

Add the "Remove Item" link to the displayed model numbers.

Sum the sub-totals for shipping to the Shipping Total.

Make the GUI interface for the Shipper table

Update the Orders Admin pages

update the order receipt that is email



I think that the orders table will need to be modified, and I hate to modify existing tables but in this case it will need a "shippers" column and look like this shipper_id/<shipper_cost>,shipper_id/<shipper_cost>,shipper_id/<shipper_cost>,...

We could use shipper_id or shipper_name, shipper_name may be better because if you remove a shipper or change its name that the shipper_id woun't find the original shipper name, so it may be better to just store it now and never have to go back and query for it ever again.

If you don't know how to parse this value, it is simple and a basic programming tool. The


The Shipping column must stay the same and must still be the shipping total for the order, the shipper column is just a break out of the shipping total for display purposes. Doing it this way will not break any other modules that still use the shipping column values and can buy us time for the Orders Admin and the Order Receipt that is emailed because I'm sure it is pulled from this column in this table.

I really think this approach won't impact many other modules except where most of the changes are made which is in the checkout_shipping.php page.


How does this sound? I can go either way on the name, shippers, vendors, etc.

#27   blucollarguy

blucollarguy
  • Members
  • 746 posts
  • Real Name:Craig Garrison Sr
  • Location:Edinburg, VA

Posted 29 July 2004 - 21:53

First, let me say, or write, that we have certainly created a little monster here haven't we? I think it needs to be done though, and I am somewhat surprised that it has not had more attention before. And I am overjoyed not to be in this alone!

This is exactly right, and what I have been trying to accomplish thus far, I have recently been pulled away for some other concerns.

the shipping class uses the cart class to get the products and coresponding vendors, it sorts the items by vendor, adds up the weights and calls the valid shipping modules for each vendor. it then returns the totals of all the different items and methods.


Joey:

If you have some products that ship on a truck while other products through the mail, but both are from the same vendor then a vendor list will not suffice.


Would this not be a shipping module, much like UPS or FedEx? If we created the table you are suggesting, which I agree would be needed for this mod to be as COMPLETE as possible, it seems to me that we are in effect creating another shipping module, which, like all the others in osC already(this was on my original list of desired features), could be enabled or not per Vendor. By creating this module we would have in the process the page to manage each shipper, ie, optional fees or charges. We will still need, I agree, an additional field for per product shipping charges and dimensions. As Stuart already mentioned, UPSXML supports dimensions, but the others don't. So in order for this to work properly, we need to update the other shipping modules to support dimensions, this does not seem to me to be a very difficult bit of code as it would simply be added to the prod table and be included in the call for the quote. No additional tables need to be accessed for this to work. Perhaps some deeper knowledge of the shippers themselves may be needed. In fact I think there has been activity to this end in the contrib area.
So, if we did this then every Vendor and every product would have the additional shipping option available, say Freight, for example, if the "dimensions" field were filled in for the particulart product and the Vendor had that ship option enabled. This way, one would not have to create several different "Shippers" per se, but would have all possibilities available from the new ship module. Creating this module may be a bit over my head. But if we intend to be able to call for quotes from other shippers, then this will need to be done.

We will need to have all of this info show correctly to the customer as well as to the store. So, Joey, you are on there as well. I do think we will need some text to explain to the customer that some prods come from different locations and that is why the shipping charges are broken down this way. Some of the products you have chosen will ship from different locations. We apologize for any inconvenience. Or something to that effect.
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!

#28   blucollarguy

blucollarguy
  • Members
  • 746 posts
  • Real Name:Craig Garrison Sr
  • Location:Edinburg, VA

Posted 29 July 2004 - 22:07

BTW, during my first attempt to alter the chopping_cart class, I encountered the fact the onfo is stored in a "session" at this point. I am so unfamiliar with sessions that it initially intimidated me, and I stopped. But, after going back and looking at what I had gotten done, I think I already have the data collected and stored. But I'm not sure. If any one can offer any tips or quick explaination on working with sessions, I would appreciate it greatly.
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!

#29   joeyjgarcia

joeyjgarcia
  • Members
  • 415 posts
  • Real Name:Joey Garcia

Posted 29 July 2004 - 22:32

I think we are all stepping into areas that we are a little unfamilar and intimidated with, I know I am when it comes to tinkering with the checkout process a shipping modules. You don't really want to mess things up, or make it too complicated.

Sessions are not that bad. What I've learned from looking under the hood of osC is if you use their main functions for creating all your links, then their functions will put the session code in the right place, so you don't have to even concern yourself with it.

When you get a quote with the default shipping modules what is needed? Zip Code and Weight and maybe dimensions? Then why not try to keep things a close to the existing code but just get multiple quotes passing the weight and the zip code for each quote? For packages that require dimensions, would we be ok just adding a flat rate handling/shipping fee on top of the quote?

The shipping module is something that I haven't really looked at, so my questions are from pure ignorance.

Joey

#30   zebrax

zebrax
  • Members
  • 19 posts
  • Real Name:Dax

Posted 30 July 2004 - 00:17

I am using 3 different shipping modules that use dimensions ,Fedex,DHL and Canada post. I have had to modify all of my shipping modules to reflect my stiuation. The dimensions can either be retreived via the cart or passed via a global array.

I have changed all my modules to give quotes for items that don't exist in the cart. We use shipping quote links on all our ebay auctions, that uses osc shipping modules to give a quote by passing the dimension and weight.

I don't see any way of getting around modify ALL shipping modules to work with multiple vendors. But the change should only be a few line here or there.

Adding a handling fee for large packages in not an option, we have tried it. Then we found out that sending large boxes uses the dimensonal weight , so for certian size boxes if you were to fill it with feathers and it would be billed at 72 pounds!!



If we had venders associated with the shipping compays they support then most default items would use those modules.

But for special items they can be set to use specific modules and over ride the vendors defaults, say for large items going on a pallet.

I don't think there is any variables in sessions that are needed, most are found in cart and order classes.

#31   blucollarguy

blucollarguy
  • Members
  • 746 posts
  • Real Name:Craig Garrison Sr
  • Location:Edinburg, VA

Posted 30 July 2004 - 00:20

I'll work with that about the sessions and see if I can get a quote.
I am also going to look at a few other shipping contributions to see if any are doing anything close to what we are looking for as far as functionality. For instance, I know there is a module that claims to offer per product shipping. I have no idea how they have done this, but it may be helpful to see how others have done things.

The ship info used in the standard shipping modules is STORE zipcode directly from the configuration table, and the weight from the products table. Adding simple charges to any given quote would be fairly easy. Even to sort it by Vendor and product would not be that difficult once we have achieved the proper code to get the quote we need using the info from the Vendors table linked properly to the appropriate product. The shopping_cart file in the classes directory is where all this takes place and is where we must convert the info from the product and STORE tables to Vendor and product table and sort and show the customer the quote. This file has a lot going on and it was a little scary for me at first. But I will try again.
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!

#32   joeyjgarcia

joeyjgarcia
  • Members
  • 415 posts
  • Real Name:Joey Garcia

Posted 30 July 2004 - 01:44

I would be very leary of use any other contribution other than for pure reference, but once you see it it is hard to not do the exact thing you saw.


Here is what I would recommend you starting. Do a test order (but don't confirm it) and put at least 4 products in the order from at least 2 different manufacturers then do that query that I mentioned that, in this case, counts how many manufacturers are involved in this order and set that as the For Loop limit, then sum the weight of the products for manufacturer A and get a quote with that manufacturer's zipcode then do the same thing in for manufacturer B and display them in the checkout_shipping page.

This really shouldn't be too hard, I would thing that summing the product's weight for each manufacturer is the trickest part, and that isn't too bad.

I would highly recommend a pure solution versus a piece from this contribution and a piece from that contribution. If something goes wrong we want to be able to know exactly why we did what we did.

I think this is the hardest part, so if this can be done then you can easily change the query to search the vendors table versus the manufacturer table.

I have a shipping contribution installed that limits what options the user has for shipping and I need to keep this so this is why I really don't want to go too far outside the boundaries incase we really have to. Looping (doing the same thing n times) doesn't really change things too much. Simplier is safer.

If you can try this I think we can all do the rest very easily. What do you think?

Joey

#33   blucollarguy

blucollarguy
  • Members
  • 746 posts
  • Real Name:Craig Garrison Sr
  • Location:Edinburg, VA

Posted 30 July 2004 - 03:36

Sounds like a good start, Joey. My intent in looking at other mods is a matter of reference, not necessarily to get code. I have accomplished a great deal by learning from methods used for other purposes and implementing them for my needs.

Looping (doing the same thing n times)


How would this code look? Assume I have all the necessary data, and am prepared to request the quote, the only code I am used to using is a "for each", or using a "sort" to create a list ordered by whatever, in this case Vendor id or Vendor zip would be best. I have already added multiple fields to my Vendors table for testing this mod, so I can work directly with that table. My thought is to create the product list from info from the Vendors table and the Products table, sorting by Vendor Id or Vendor zip.

I have, I think, gotten this part done. So now, how do I create this "loop" and format it so it is presentable to the customer? I am not a programmer, I just get done what I need to get done. Learning as I go. I created VA_Email this way, along with much input from a few other interested people who offered several suggestions and comments about what I had and what would be more useful. I think I came up with a decent mod that is quite functional. And we can do the same here. Together, we can create something very good here I think. /smile.gif' class='bbc_emoticon' alt=':)' />
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!

#34   cyanide

cyanide
  • Members
  • 321 posts
  • Real Name:Colin
  • Location:Toronto, Canada

Posted 30 July 2004 - 10:44

LOL /rolleyes.gif' class='bbc_emoticon' alt=':rolleyes:' /> This looks like a 3-person discussion.
I'm really quite surprised there hasn't been more interest !

Anyhow, I'm very interested in this module. My php coding (from scratch) is limited, but I would be happy to help anyway I can.... suggestions, beta testing, etc.
So, far looks like you are on the right track

Cheers, guys !
|
Symptoms of Cyanide ... vomiting, convulsions, deep breathing, shortness of breath, anxiety & loss of consciousness
|

#35   joeyjgarcia

joeyjgarcia
  • Members
  • 415 posts
  • Real Name:Joey Garcia

Posted 30 July 2004 - 13:49

blucollarguy:

I'll post something later today to help you out, it will be some psuedo-code that will show how to do what I am talking about.

A For Loop looks like this:

for($i=0; i<$limit; i++){



}

The $limit can be set using that query to determine the number of vendors involved. That query will need to use the "distinct" keyword to removed the common occurances in the resultset and you will need to use the count() aggragate function to count the number of unique vendors.

Something like this:

select count( distinct vendor_id) from vendors where product_id in (12, 13, 14, 35)

I'm not sure of the exact location of the distinct keyword, but try it without the distinct keyword first to get it working. The "in" function is a cool one, you might want to look that up, but it looks in a set of values, in this case a set of product _ids.

$i++ increments the variable of $i on each iteration.

generally the for loop looks like this:

for( <initialize>; <test>; <increment>){

}

Increment can count up or down.

The best way to learn about php is use thier on-line manual, I use it all the time. To use it for a for loop, just type http://www.php.net/for and it will take you straight to that page in the manual.

Gotto go to work now.

Joey

#36   joeyjgarcia

joeyjgarcia
  • Members
  • 415 posts
  • Real Name:Joey Garcia

Posted 30 July 2004 - 17:40

Here is how it would look to obtian the vendor info and do a loop for each quote.


I would use a query like this to get the variable you need loaded.

$arrVendorInfo = new array();
$arrAllVendors = new array();



//To load the $arrAllVendors array, try something like this

$result = mysql_query("SELECT vendor_id, vendor_zipcode, vendor_fees from vendor where ....");

$index = 0;
while ( $row = mysql_fetch_array($result) ) {

$arrVendorInfo("vendor_id" => $row["vendor_id"],
"vendor_zip" => $row["vendor_zipcode"],
"vendor_fees" => $row["vendor_fees"]);
$arrAllVendors[$index] => $arrVendorInfo;
$index++;

}


$debug = false;

for( $i=0; $i < count($arrAllVendors); $i++){

if( debug) {
echo " Vendor ". $i . "'s id: ". $arrAllVendors[$i]["vendor_id"] ."<br>";
echo " Vendor ". $i . "'s zipcode: ". $arrAllVendors[$i]["vendor_zipcode"] ."<br>";
echo " Vendor ". $i . "'s fees: ". $arrAllVendors[$i]["vendor_fees"] ."<br>";
}

$vid = $arrAllVendors[$i]["vendor_id"];
$zipcode = $arrAllVendors[$i]["vendor_zipcode"];
$fees = $arrAllVendors[$i]["vendor_fees"];

//Get quote now (same as existng process)

//display results of shipping quote (same as existng process)

//Loop through again and get another quote in a new table row

}



MySQL Reference Manual:
http://dev.mysql.com...l/en/index.html

Count Reference:
Counting Rows: http://dev.mysql.com...nting_rows.html

Distinct Reference:
http://dev.mysql.com...timisation.html

#37   zebrax

zebrax
  • Members
  • 19 posts
  • Real Name:Dax

Posted 30 July 2004 - 18:34

I started to code this now,
so far I have this
$prodvendors=$cart->get_products();
     foreach ($prodvendors as $product){
     $sortvendor[$product['vendors_id']]['vendors_id']=$product['vendors_id'];
    $sortvendor[$product['vendors_id']][]=$product;
    $sortvendor[$product['vendors_id']]['weight']+=$product['weight'];
    
    }
  
	
foreach ($sortvendor as $vendor){
$vendor_info_query=tep_db_query("Select * from vendors where vendors_id='".$vendor['vendors_id']."'");
$vendor_info=tep_db_fetch_array($vendor_info_query);
$sortvendor[$vendor['vendors_id']]=array_merge($sortvendor[$vendor['vendors_id']],$vendor_info);
}

You end up with an array of all the products order grouped by vendor with the vendor infomation in an array

#38   blucollarguy

blucollarguy
  • Members
  • 746 posts
  • Real Name:Craig Garrison Sr
  • Location:Edinburg, VA

Posted 30 July 2004 - 20:28

Actually Colin, I think you make number 4! We'll take all we can get if we can get this thing done right.

This is great guys, I was a lot closer than I thought. My queries were fine but getting them into the array and sorting the lsit properly was troubling me a bit. I will work with this and let you know how it goes from my test shop. I am going to keep it simple at first. Just get the quote with the correct Vendor zipcode and I think we'll have it beat. From there, adding additional info wont't be very difficult at all. So I will push for the quote first, and we'll go from there. Thanks for the code help wish me luck. Craig /smile.gif' class='bbc_emoticon' alt=':)' />
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!

#39   joeyjgarcia

joeyjgarcia
  • Members
  • 415 posts
  • Real Name:Joey Garcia

Posted 30 July 2004 - 21:04

Yes! Craig, I think you understand it now. If you get past that part everything else will be easy.

zebrax I'm not sure about your approach because you would need to know the vendor_id to get the data out.

The reason I did mine my way was if you want to display the contents of the array using a For Loop, you just need to fill in the value for the array index which starts at 0 to the length of the array and a For loop takes care of all that for you.

Either approach is a multi-dimensional array, I didn't want to say this because that term scares people and they can get pretty hairy quick. It would be ideal to make a vendor class that will allow us to create a vendor object that may look like this.

$objVendor = new Vendor;

Load the object fields like this:
objVendor->id = 10;
objVendor->zipcode = 12345;
objVendor->fees = 2;

Get them out like this:
echo objVendor->id;
echo objVendor->zip;
echo objVendor->fees;

These object can also be put into arrays.



Here are some references on PHP Classes.

http://www.zend.com/...anguage.oop.php
http://www.phpbuilde...od19990601.php3

#40   blucollarguy

blucollarguy
  • Members
  • 746 posts
  • Real Name:Craig Garrison Sr
  • Location:Edinburg, VA

Posted 30 July 2004 - 21:41

I will work with the classes a bit as well, but for now I just want a quote!LOL
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!