Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Multi_Vendor_Shipping new thread


blucollarguy

Recommended Posts

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.

Link to comment
Share on other sites

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: [email protected]

pass: mvs_demo

MVS Thread:

Multi-Vendor Shipping

My contribs:

Download Multi Vendor Shipping V1.1

Vendor Email

Vendor Info in easypopulate

EZ Price Updater

And more to come!

Link to comment
Share on other sites

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: [email protected]

pass: mvs_demo

MVS Thread:

Multi-Vendor Shipping

My contribs:

Download Multi Vendor Shipping V1.1

Vendor Email

Vendor Info in easypopulate

EZ Price Updater

And more to come!

Link to comment
Share on other sites

I 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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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: [email protected]

pass: mvs_demo

MVS Thread:

Multi-Vendor Shipping

My contribs:

Download Multi Vendor Shipping V1.1

Vendor Email

Vendor Info in easypopulate

EZ Price Updater

And more to come!

Link to comment
Share on other sites

I 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

Link to comment
Share on other sites

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

Happy Coding!

Craig Garrison Sr

Anything worth having, is worth working for.

Multi Vendor Shipping V1.1 Demo Catalog

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

Multi Vendor Shipping V1.1 Demo Admin

login: [email protected]

pass: mvs_demo

MVS Thread:

Multi-Vendor Shipping

My contribs:

Download Multi Vendor Shipping V1.1

Vendor Email

Vendor Info in easypopulate

EZ Price Updater

And more to come!

Link to comment
Share on other sites

LOL :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 !

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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/doc/mysql/en/index.html

 

Count Reference:

Counting Rows: http://dev.mysql.com/doc/mysql/en/Counting_rows.html

 

Distinct Reference:

http://dev.mysql.com/doc/mysql/en/DISTINCT_optimisation.html

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 :)

Happy Coding!

Craig Garrison Sr

Anything worth having, is worth working for.

Multi Vendor Shipping V1.1 Demo Catalog

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

Multi Vendor Shipping V1.1 Demo Admin

login: [email protected]

pass: mvs_demo

MVS Thread:

Multi-Vendor Shipping

My contribs:

Download Multi Vendor Shipping V1.1

Vendor Email

Vendor Info in easypopulate

EZ Price Updater

And more to come!

Link to comment
Share on other sites

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/manual/language.oop.php

http://www.phpbuilder.com/columns/rod19990601.php3

Link to comment
Share on other sites

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: [email protected]

pass: mvs_demo

MVS Thread:

Multi-Vendor Shipping

My contribs:

Download Multi Vendor Shipping V1.1

Vendor Email

Vendor Info in easypopulate

EZ Price Updater

And more to come!

Link to comment
Share on other sites

I am already using a higly modified vendors mod. The becuase of my situation each product can only have 1 vendor. We actualy have 2 different locations and sell the same stuff on one website. Because we have a lot of local customers to both locations ve need to alow customer to search localy so they can pick up there items. The cart load the vendor id with each product , so that is why I created the code above, becuase I did know the vendor id.

 

I am going to code for my situation and you guys can have a look at it and change things as needed.

Link to comment
Share on other sites

Okay folks, I am a bit stumped. I am pretty confident that I have collected the Vendor Zip, defined it so it can be passed easily from file to the next, and changed

$this->_upsOrigin(SHIPPING_ORIGIN_ZIP, $country_name['countries_iso_code_2']);
to
$this->_upsOrigin($vendors_zipcode_list, $country_name['countries_iso_code_2']);

BUT! No quote. I am calling for a quote for only one product for testing purposes, so I will not yet need to loop for more quotes. So I have tried to track down exactly where this

$this->_upsWeight($shipping_weight);

particularly "$shipping_weight" , gets defined. This is the only variable that comes directly from the products that are in the cart that gets used for the quote. My logic being, find where this is defined and I will know exaclty where to define all the Vendor info. Problem is, I can't find it. Exactly.

 

In cat/inc/classes/shipping.php you will see

function quote($method = '', $module = '') {

      global $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes;

 

      $quotes_array = array();

 

      if (is_array($this->modules)) {

        $shipping_quoted = '';

        $shipping_num_boxes = 1;

        $shipping_weight = $total_weight;

Note "$shipping_weight = $total_weight;" , yet both are defined as GLOBAL variables. I cannot find specifically where these begin.

Possibly in /*/*/calsses/shopping_cart.php where this code

function show_total() {

      $this->calculate();

 

      return $this->total;

    }

 

    function show_weight() {

      $this->calculate();

 

      return $this->weight;

    }

But I am not sure and my first several attempts to define the Vendors Zip have not worked. Any ideas or suggestions?

Happy Coding!

Craig Garrison Sr

Anything worth having, is worth working for.

Multi Vendor Shipping V1.1 Demo Catalog

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

Multi Vendor Shipping V1.1 Demo Admin

login: [email protected]

pass: mvs_demo

MVS Thread:

Multi-Vendor Shipping

My contribs:

Download Multi Vendor Shipping V1.1

Vendor Email

Vendor Info in easypopulate

EZ Price Updater

And more to come!

Link to comment
Share on other sites

Did you print out $vendors_zipcode_list before you obtained your quote? make sure it prints out a value that makes sense and that you are not sending mulitple numbers (the "list" part of the name makes me think that).

 

Here is what my search yielded.

 

Searching for: $shipping_weight

\catalog\includes\classes\shipping.php(45): global $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes;

\catalog\includes\classes\shipping.php(52): $shipping_weight = $total_weight;

\catalog\includes\classes\shipping.php(54): if (SHIPPING_BOX_WEIGHT >= $shipping_weight*SHIPPING_BOX_PADDING/100) {

\catalog\includes\classes\shipping.php(55): $shipping_weight = $shipping_weight+SHIPPING_BOX_WEIGHT;

\catalog\includes\classes\shipping.php(57): $shipping_weight = $shipping_weight + ($shipping_weight*SHIPPING_BOX_PADDING/100);

\catalog\includes\classes\shipping.php(60): if ($shipping_weight > SHIPPING_MAX_WEIGHT) { // Split into many boxes

\catalog\includes\classes\shipping.php(61): $shipping_num_boxes = ceil($shipping_weight/SHIPPING_MAX_WEIGHT);

\catalog\includes\classes\shipping.php(62): $shipping_weight = $shipping_weight/$shipping_num_boxes;

\catalog\includes\modules\shipping\table.php(49): global $order, $cart, $shipping_weight, $shipping_num_boxes;

\catalog\includes\modules\shipping\table.php(54): $order_total = $shipping_weight;

\catalog\includes\modules\shipping\ups.php(71): global $HTTP_POST_VARS, $order, $shipping_weight, $shipping_num_boxes;

\catalog\includes\modules\shipping\ups.php(88): $this->_upsWeight($shipping_weight);

\catalog\includes\modules\shipping\ups.php(94): 'module' => $this->title . ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . 'lbs)');

\catalog\includes\modules\shipping\usps.php(65): global $order, $shipping_weight, $shipping_num_boxes, $transittime;

\catalog\includes\modules\shipping\usps.php(76): $shipping_weight = ($shipping_weight < 0.1 ? 0.1 : $shipping_weight);

\catalog\includes\modules\shipping\usps.php(77): $shipping_pounds = floor ($shipping_weight);

\catalog\includes\modules\shipping\usps.php(78): $shipping_ounces = round(16 * ($shipping_weight - floor($shipping_weight)));

\catalog\includes\modules\shipping\usps.php(82): $shiptitle = ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . 'lbs)';

\catalog\includes\modules\shipping\zones.php(116): global $order, $shipping_weight, $shipping_num_boxes;

\catalog\includes\modules\shipping\zones.php(140): if ($shipping_weight <= $zones_table[$i]) {

\catalog\includes\modules\shipping\zones.php(142): $shipping_method = MODULE_SHIPPING_ZONES_TEXT_WAY . ' ' . $dest_country . ' : ' . $shipping_weight . ' ' . MODULE_SHIPPING_ZONES_TEXT_UNITS;

Found 21 occurrence(s) in 5 file(s)

 

 

I use TextPad for programming in osC, I've tried all the others out there and they seem too slow or they don't offer features that are really needed for hacking osC, such as a fast Global Search or line wrapping. If you want a copy, I'll send you my copy.

 

I hope this helps you.

 

BTW, I hope you are making backups.

 

Craig, you are doing a great job!!!

 

Joey

Link to comment
Share on other sites

I have so many different copies of my shop in different stages of developement that I often get confused as to which is my "Live" shop. LOL

 

I will look at TextPad and see if it makes anything easier for me.

 

As you can see from your search, there does not seem to be a definitive spot where $shipping_weight gets defined. My best guess is in /*/*/calsses/shopping_cart.php

function show_total() {

      $this->calculate();

 

      return $this->total;

    }

 

    function show_weight() {

      $this->calculate();

 

      return $this->weight;

    }

At the "return" point, I think it is creating the "$shipping_weight".

So, what I have been working on is writing a "function" to properly create the zip data. I do need to print the "list" and make sure it is what I think it is. To simplify things to start with, I am only using 1 product for the quote, so there can be only 1 zipcode being used, if it is collected properly to begin with. I am going to use your search as ref and check some more files before I strain my brain too much more in the same spot. Sometimes, I have found that if I look away for a while the answer becomes so clear when I get back to it. Thanks Joey, for the encouragement and suggestion. :)

Happy Coding!

Craig Garrison Sr

Anything worth having, is worth working for.

Multi Vendor Shipping V1.1 Demo Catalog

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

Multi Vendor Shipping V1.1 Demo Admin

login: [email protected]

pass: mvs_demo

MVS Thread:

Multi-Vendor Shipping

My contribs:

Download Multi Vendor Shipping V1.1

Vendor Email

Vendor Info in easypopulate

EZ Price Updater

And more to come!

Link to comment
Share on other sites

I was doing something else and ran across some code that I think you will need.

 

Here is an example of some osC code that stuffs values into an array the easy way. If you want to make a vendors array you might want to do it this way.

 

 

 

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

$vendors_array[] = array('id' => $vendors['vendors_id'],

'zip' => $vendors['vendors_zip'],

'fees' => $vendors['vendors_fees'],

);

}

 

You get it out like this: $vendors_array[$i]['fees']

 

the $i variable will the index used in the For Loop, when you do your looping.

 

Joey

Link to comment
Share on other sites

Since $shipping_weight is a simple variable you won't fine it "defined" per se, instead you'll find that that variable was created and set to a value, possibly from calling a function and the return value sets the value of $shipping_weight.

 

Always test your data before you use it, typically this is the biggest mistake programmers have, they assume the data they are using it correct only to find out downstream that their variable is empty or something else. I print out my values for every step, especially if there are other functions, loops, etc. that are dependent on that variable's value. I use an if statement that has a "debug" variable that I can change the value from true to false to see values printed out, I put an example of that in a previous post.

 

I would also support your idea to take breaks, a lot of times a drive is a good time to see your answer because you think while you drive, just don't get into an accident we need you!! :)

 

Joey

Link to comment
Share on other sites

Thanks Joey, I have worked with that basic code structure(the array) before and will need your example when it is time to create the loop for multiple quotes. I have started a bit of a re-write to include the "debug" info and your right, $shipping_weight isn't actually defined, it is created through a function. I am moving forward from here so wish me 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: [email protected]

pass: mvs_demo

MVS Thread:

Multi-Vendor Shipping

My contribs:

Download Multi Vendor Shipping V1.1

Vendor Email

Vendor Info in easypopulate

EZ Price Updater

And more to come!

Link to comment
Share on other sites

FRUSTRATION!!!!!!!!!!!!!!!!!!!!!!!!!

 

I know I am retrieving the info, I can echo it no problem. Just can't figure out how to pass it to the ship module! Breaktime. Anyone with ANY suggestions?

 

Craig :)

Happy Coding!

Craig Garrison Sr

Anything worth having, is worth working for.

Multi Vendor Shipping V1.1 Demo Catalog

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

Multi Vendor Shipping V1.1 Demo Admin

login: [email protected]

pass: mvs_demo

MVS Thread:

Multi-Vendor Shipping

My contribs:

Download Multi Vendor Shipping V1.1

Vendor Email

Vendor Info in easypopulate

EZ Price Updater

And more to come!

Link to comment
Share on other sites

Alright now, this is dirving crazy. Look at the following code

function show_total() {

      $this->calculate();

 

      return $this->total;

    }

 

    function show_weight() {

      $this->calculate();

 

      return $this->weight;

    }

    //mlti vendor

    function show_vendors_postcode() {

    $this->contents();

    return $this->vendors_postcode;

    }

    function show_mlti_weight() {

      $this->calculate();

 

      return $this->mlti_weight;

    }

 

    function generate_cart_id($length = 5) {

      return tep_create_random_value($length, 'digits');

    }

 

    function get_content_type() {

      $this->content_type = false;

 

echo " Vendor's id: ". $vendors['vendors_id'] ."<br>";

echo " Vendor's zipcode: ". $vendors['vendors_zipcode'] ."<br>";

Why you ask? Because something about this is "breaking" the data from the Vendor array.

 

Here is what I did. I have been on a rabbit hunt with this, and I see little "ears" everywhere, so bare with me. As I posted B4 I have collected the data in the shopping_cart class. Passing it to the ship module is the hard part. So I started adding some "echo" satatements at different points in the file. The code above is when I lose the data. Add the "echo" statements above this code, anywhere above this code and we can see the data printed on the screen.

 

Thus, the question is why? Suggestions? Craig :)

Happy Coding!

Craig Garrison Sr

Anything worth having, is worth working for.

Multi Vendor Shipping V1.1 Demo Catalog

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

Multi Vendor Shipping V1.1 Demo Admin

login: [email protected]

pass: mvs_demo

MVS Thread:

Multi-Vendor Shipping

My contribs:

Download Multi Vendor Shipping V1.1

Vendor Email

Vendor Info in easypopulate

EZ Price Updater

And more to come!

Link to comment
Share on other sites

There is a cart class because I can see a cart object, I think what needs to happen is create a method in this class. Methods are the class equivalent of functions. Once the cart class is found a method called getVendorCount() needs to be added.

 

When making methods for classes you always want the method names to be verbs, and it is a typical practice to use getters and setters, which look like this:

 

Examples:

$cart->getOrderTotal();

$cart->getShippingQuote();

$cart->getVendorCount();

 

 

$cart->setDiscount( $discount );

$cart->setShippingMethod( $selectedShippingMethod );

 

It would cleanest to do the dirty work there.

 

Remember, 1 cart and multiple: vendors, weight, contents, zip codes

 

 

I am starting to look under the hood of this shipping stuff because I'd like to do this right the first time since it is so critical.

 

Joey

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