Jump to content



Photo
* * * * * 8 votes

Multi_Vendor_Shipping new thread


  • Please log in to reply
4713 replies to this topic

#61   blucollarguy

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

Posted 01 August 2004 - 18:36

Appreciate the support Joey, I know about other responsibilities, I am fortunate at the moment, my 11 year old son just got back from 10 days at camp and just wants to chill and watch NASCAR and play games on the laptop, my wife generally takes Sundays off to catch up on rest. So this is my day to focus on whatever I want (my shop, at this point is not really work, it is Sunday) so I understand your other needs.
I have never been one to quit too easily, we will get this done, I firmly believe that this could be incredibly valuable to a lot of people. So, when you get something, let me know. 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!

#62   blucollarguy

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

Posted 02 August 2004 - 10:41

A quick note:
Searched like crazy to find some answers. Tried code to save v-zip directly to session, no luck. Tried querying form the ship module directly, customer_id, basket_id and therefore products_id not accessible. Posted a request for explanaination of how the info gets to ship modules in the "general discussion" section, no response so far. Not sure where to go to find this info, but it must be out there some where. We are stuck until we figure this part out. 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!

#63   joeyjgarcia

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

Posted 02 August 2004 - 23:28

Ok, give me a task and I'll work on just that.

Export your table structure of your new table(s) and I'll put in my own rows so we have that in common.

Joey

#64   moonlitsun

moonlitsun
  • Members
  • 339 posts
  • Real Name:Moonlitsun
  • Location:Portland, Oregon

Posted 03 August 2004 - 00:14

Joey, blucollarguy, et al.......

I wanted to add my 2 cents to the conversation and provide everyone with a synopsis of how our company was looking to enhance the original MVS:

- Vendor Based zipcode origins seem to be the most effective method of calling data from the mySQL tables;

- We currently have the original MVS running, along with a couple added shipping methods in place (Individual Shipping, Free Shipping, etc);

- Mike, the original author of EMVS (tahuti@netzero.net), has tried to work closely with our IT team to integrate global zipcode variables into his updated code. However, we were having problems since it appeared Mike wrote only a portion of the code needed to simply reference the zips from the Vendor table, but not an actual call to the shopping cart when checking out. The shopping cart class was running into problems and wasnt producing the correct shipping quote based in ziporigins.

- MVS and EMVS were also having problems with combining 2 or more items in the cart with 2 or more vendors/shipping origins. Perhaps this is a wrongly designed calculation function in the shopping cart?

********

On a personal note, I believe this new version of Enhanced Vendors will easily supercede older releases. The zipcode origin functionality alone is worth its weight in gold. This kind of contribution will make the concept of dropshipping very doable, and we hope to introduce the code into our family of websites.

Please let me know what I can do to help!

Thanks,

-Codi
Carpe Carp: Seize the Fish.

#65   blucollarguy

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

Posted 03 August 2004 - 02:16

Glad to have you on board with us Codi, and enjoyed our conversation. I will look at things a bit differently while we work on this from our current direction, I would like to exhaust our efforts on this track before changing the "how" portion of what we are trying to accomplish.

Joey, which table do you want, the Vendors table? Here is the sql to create the Vendors table and add rows to "products" table

###SQL-query : Vendors Email
ALTER TABLE `products` ADD `vendors_id` VARCHAR( 11 ) DEFAULT NULL ;
ALTER TABLE `products` ADD `vendors_product_price` DECIMAL( 15, 4 ) DEFAULT '0.0000' NOT NULL ;
ALTER TABLE `products` ADD `vendors_prod_id` VARCHAR( 24 ) NOT NULL AFTER `vendors_product_price` ;
ALTER TABLE `products` ADD `vendors_prod_comments` TEXT DEFAULT NULL AFTER `vendors_prod_id` ;

# --------------------------------------------------------
# Table structure for table `vendors`
#

CREATE TABLE `vendors` (
  `vendors_id` int(11) NOT NULL auto_increment,
  `vendors_price_id` int(32) NOT NULL default '0',
  `vendors_contact` varchar(32) NOT NULL default '',
  `account_number` varchar(32) NOT NULL default '',
  `vendors_name` varchar(32) NOT NULL default '',
  `vendors_phone1` varchar(20) NOT NULL default '',
  `vendors_fax` varchar(20) NOT NULL default '',
  `vendors_email` varchar(64) NOT NULL default '',
  `vendors_url` varchar(64) NOT NULL default '',
  `date_added` datetime default NULL,
  `last_modified` datetime default NULL,
  `vendors_image` varchar(24) default NULL,
  `vendors_send_email` tinyint(1) default '0',
  `vendor_street` varchar(64) NOT NULL default '',
  `vendor_city` varchar(32) NOT NULL default '',
  `vendor_state` varchar(32) default NULL,
  `vendor_country` varchar(64) NOT NULL default '',
  `vendors_zipcode` varchar(11) NOT NULL default '',
  `vendor_add_info` text,
  `method_name` varchar(32) NOT NULL default '',
  `module_names` varchar(64) NOT NULL default '',
  `handling_charge` decimal(5,2) NOT NULL default '0.00',
  `handling_per_box` tinyint(1) NOT NULL default '0',
  `tare_weight` decimal(4,2) NOT NULL default '0.00',
  `max_box_weight` tinyint(3) unsigned NOT NULL default '0',
  PRIMARY KEY  (`vendors_id`)
) TYPE=MyISAM COMMENT='Vendors table add-in' AUTO_INCREMENT=34 ;

Everything is stored within these 2 tables, If you have not installed VA_Email, you can run this script as is, if you have it installed, you will need to add the following rows to the VENDORS table:

`method_name` varchar(32) NOT NULL default '',
  `module_names` varchar(64) NOT NULL default '',
  `handling_charge` decimal(5,2) NOT NULL default '0.00',
  `handling_per_box` tinyint(1) NOT NULL default '0',
  `tare_weight` decimal(4,2) NOT NULL default '0.00',
  `max_box_weight` tinyint(3) unsigned NOT NULL default '0',


Note that at this point in our progress I have not botheres to call for the addinitional info you see in the Vendors table here, just the zipcode. But you can see that it is a copy of what was being used in the original MVS contrib. I can explain this portion further if you want, but I think you can see what would be available from each Vendor.

If there is any other info you need, just let me know. If you want a copy of the */*/classes/shopping_cart.php file or any of the other files I have worked with, email me and I will email all related files for you to see what I have done.

It still comes down to "how" we will pass the "vendors_zipcode" to the ship module itself. After talking to Codi, we have a couple of other possibilities. I will explore them a little further before posting anything on those. For now, I think we should continue on our current track. Lets see what we can do! 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!

#66   joeyjgarcia

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

Posted 03 August 2004 - 16:51

Great, something I can focus on. I'll install your vendors table and use a query to get the zip code and I will work on passing this to the shipping module.

Joey

#67   zebrax

zebrax
  • Members
  • 19 posts
  • Real Name:Dax

Posted 03 August 2004 - 18:33

I have already said how to pass the zip code to each module. You NEED to modify each module. Most modules use a contant SHIPPING_ORIGIN_ZIP for the zip code. This can't be changed. You need to use a global variable that can be changed.


The whole concept of this thread isn't hard. When I get an extra hour I will show you that it can be done.

#68   blucollarguy

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

Posted 03 August 2004 - 21:53

Ok Dax, we already know we need to change call in each module, DUH!!!!!
How? I have gotten the queries to collect the data in the classes/shopping_cart.php no problem, but I have not been able to successfully pass that info to the module by any means. If you know how to store the info once we have collected it please post that instead of a snotty post implying I had not read your previous post. Apparently, you did not bother to read the last page or 2 of this thread or you would have know that.

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!

#69   zebrax

zebrax
  • Members
  • 19 posts
  • Real Name:Dax

Posted 03 August 2004 - 23:36

Apparently you didn't read my posts on the second or third page, becuase when I follow what I have said, its amazing! I get quotes back using different postal codes. Now all I have to do is sort and display them.
but apparently you don't want my help here, so BYE.

#70   blucollarguy

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

Posted 04 August 2004 - 02:15

Ok Dax, I have gone back and checked, this is what I found.

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.

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


changed to
CODE

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


and

I started to code this now,
so far I have this
CODE

$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

And I woked a bit with the code you posted here but I could not follow you well enough to not get constant errors. I apologize for jumping on you, but you seem to think that you had already resolved our issues and I had chosen to ignore you. Not the case at all. We all need to work together and get this done so we can all get what we need. If there is something in your posts that shows how the zipcodes make their way to the shipping modules, POINT IT OUT TO ME because I am apparrently too stupid to see it. It's up to you, we can work together, or you can take your ball and go home, and we will just keep struggling along until we work it out.
We need all the help we can get.

blucollarguy 
Posted: Jul 12 2004, 06:11 AM
Craig Garrison Sr



Group: Community Member
Posts: 164
Joined: 25-April 04




I'm gonna give it a shot. I am no coding genius but I may be able to figure it out with a little help here and there. the features you write about are exactly the functionality I am hoping to accomplish.


As I said from the beginning, I am no genius. 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!

#71   zebrax

zebrax
  • Members
  • 19 posts
  • Real Name:Dax

Posted 04 August 2004 - 03:09

My shipping.php class contains this code in th quote function
global $origininfo;
$origininfo['zipcode']=$vendor['vendors_ship_zip'];
$origininfo['country']=$vendor['vendors_ship_country'];
$origininfo['state']=$vendor['vendors_ship_state'];

then each module need to has code likethis also in the quote function.
global $origininfo;

$countries_array = tep_get_countries($origininfo['country'], true);
        $this->country = $countries_array['countries_iso_code_2'];

$this->originZip=$origininfo['zipcode'];


of coarse each module sets the zipcode and country in a different place.


I set the top code in a loop for all of the vendors, which gives me a shipping quote for each vendor. I now have to combin the array and display the contents and have that quote get carried over to the next step of the checkout process, ( 1 quote can contain multiple quotes from different shipping companies) th current way will not work.

#72   blucollarguy

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

Posted 04 August 2004 - 03:17

Thanks for comoing back Dax. I will see if I can work with what you have started. A few questions so I can understand what you are doing. Obviously, you are creating the global variable $origininfo, I assume the query to get this info will happen in catalog/includes/classes/shopping_cart.php, yes?
This is where it has been breaking for me, what is the code to carry or define what we get from the query? I have been able to get all the data, but I have not been able to retain it all the way through to the ship module. Can you explain how this works? 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!

#73   blucollarguy

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

Posted 04 August 2004 - 03:26

It just hit me. You are storing the $originingo in the session. I tried that but, looking at your code now I think I see what I was doing wrong! We still need to define $origininfo from shopping_cart class though, right?
Like this?

//mlti vendor
    function show_origininfo() {
    $this->contents();

    return $this->origininfo;
    }


At the end of the classes/shopping_cart file?
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!

#74   joeyjgarcia

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

Posted 04 August 2004 - 17:26

Stress in settling in, sorry I haven't had any time to help out so far.

Zebrax, your suggestion is helpful!

Craig, I think I finally understand your problem because you said it yourself, sessions. If I understand you corectly, you want to know how to carry the data to the next page? I figure this is only a small part of the bigger problem but a very basic necessity. Global variables are not the same as Session variables, global variables are usable in every function where local variables are usable only in that function, session variables would be usable in every page, and function. Session variables are officially registered (see http://us2.php.net/session).

I hope this help a little. I apologize if I still misunderstand.

I'll take a closer look at Zebrax's code example.

Joey

#75   zebrax

zebrax
  • Members
  • 19 posts
  • Real Name:Dax

Posted 04 August 2004 - 18:15

Sessions are not used for the shipping cost until, a specific shipping method is picked. The method is picked on checkout_shipping.php page using an input variable with name=shipping and value in the form of "module_method" eg "fedex_express" When this info is posted back to chekout_shipping.php it calls the shipping module again and gets the value of "method" at that time it creates a session called shipping with the choosen method price and title,etc, it then redirects to checkout_payment.php.

So at no time do we need to directly set the session with the shipping info, it should be done automaticly when the method is chosen. But this is where the problems start. We are using multiple modules and methods so the standard input of "module_method" will not work in our situation. we may have to change it to somethng like "vendor_number" where the number would be the quote that could consist of many modules and method prices added together.

example
2 items from vendor A
1 item from vendor B

Vendor A ships with UPS
Vendor B ships with Fedex

For 1 box from Vendor A would would have a few methods: Ground and express
the same for box 2 from vendor B: ground and Express

so now you have a quote 1 which is ups ground and fedex ground added together.
and quote 2 for UPS express and Fedex express.

now the customer would choose the shipping they want..normaly that would be posted as fedex_express or ups_ground but we could change that to vendor_1

so now the price for quote 1 get entered into the session with title "2 boxes fedex and UPS" and price "$" and the checkout process continues as normal.

I understand that we could end up with multiple methods and multiple modules, and it could be very confusing. But we should be able to manage it.

#76   joeyjgarcia

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

Posted 04 August 2004 - 21:20

This is getting too confusing for a first attempt. I suggest we make this contribution and provide some limitations. Maybe after the first pass, we can look at enhancing this for specific instances, but I think that should come for a $price$ unless it is something that you need to do your business and you will provide your own labor. This way we can make a disclaimer that this contribution may not fit everyone's needs.

Something else that I am thinking is, are we too far into the shipping quote process? I mean should we be looking for some function called "getQuote($vendor['zipcode'])" that we could change to "getQuote($vendor[$i]['zipcode'])" or something like this and just call this method for each vendor's zip code we have and let the quote write out the display as normal with a line separator for each vendor? The problem is finding that specific location in the code.

#77   blucollarguy

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

Posted 04 August 2004 - 21:23

Alright, I think I am finally getting it, thanks Joey. But Dax, I still don't know how do we show the zipcodes to the ship module? I am still lost on this one piont. Maybe it is a simple code part but, man, it has been driving me crazy. The query in the classes/shopping_cart file is no problem, but then, don't we have to some how "define" the "origininfo" from here as well, so it can then be passed to the classes/shipping file and then to the ship module? I am not trying to be dense here, it seems to just come naturally. 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!

#78   zebrax

zebrax
  • Members
  • 19 posts
  • Real Name:Dax

Posted 04 August 2004 - 21:44

I am working on a vendor shipping class that extends the original shipping class, I should have a semi working version in a day or 2. You can then see what my ideas are and it will include something like

getQuote($vendor[$i]['zipcode'])


By making a variable "global" you can access from any function anywhere in the script , so this is what it is doing, changing a variable and then the including modules use the changed variable you could also use $GLOBALS['origininfo'] to get the info in the modules.

#79   moonlitsun

moonlitsun
  • Members
  • 339 posts
  • Real Name:Moonlitsun
  • Location:Portland, Oregon

Posted 04 August 2004 - 23:48

By making a variable "global" you can access from any function anywhere in the script , so this is what it is doing, changing a variable and then the including modules use the changed variable you could also use $GLOBALS['origininfo'] to get the info in the modules.


Dax,

This may be an obsolete observation, but I remember something about osCommerce having some kind of problem with registering/enabling global variables???

Take a look at this thread:
http://forums.oscomm...showtopic=93343

This might be a mute point, but I wanted to bring it to everyone's attention anyway. /rolleyes.gif' class='bbc_emoticon' alt=':rolleyes:' />

Thx,

-Codi
Carpe Carp: Seize the Fish.

#80   blucollarguy

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

Posted 05 August 2004 - 01:03

Codi, I have read about the "register globals" problem. I believe it is, in fact no longer a real issue. It was a security issue at one point and code to not allow osC to run was used for a time. But I am pretty sure that is no longer the case since I have globals enabled on my test server at home and everything runs fine.
Dax, I will play with global variable some more, but I had tried to get it working before with no success. It could have been an issue with the older version of php that was on my live site (the globals issue) or my code was probably not right. I am in the process of changing hosts and I will now have 4.3.3 to work with out in the real world. Good luck with the code Dax, if you need anything, let us know. 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!