Jump to content
blucollarguy

Multi_Vendor_Shipping new thread

Recommended Posts

Any modules installed and enabled for a vendor will show as options for products assigned to that vendor. If you only want your customer to see one option, then only assign one module to that vendor.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites

It's not working with MVS on.

 

I have no clue why it's not working it must be in the includes/modules/classes/vendors_shipping im guessing:

 

here is the code of /includes/classes/shopping_cart.php that I added:

 

> Find (near the beginning)

 

class shoppingCart {

var $contents, $total, $weight, $cartID, $content_type;

 

-> Add after

 

// mod multi indvship

var $shiptotal1;

var $shiptotal2;

var $shiptotal3;

var $shiptotal4;

// end multi indvship

 

-> Find (in function reset)

 

$this->contents = array();

$this->total = 0;

$this->weight = 0;

 

-> Add after

 

// mod multi indvship

$this->shiptotal1 = 0;

$this->shiptotal2 = 0;

$this->shiptotal3 = 0;

$this->shiptotal4 = 0;

// end multi indvship

 

-> Find

 

function calculate() {

$this->total = 0;

$this->weight = 0;

 

-> Add after

 

// mod multi indvship

$this->shiptotal1 = 0;

$this->shiptotal2 = 0;

$this->shiptotal3 = 0;

$this->shiptotal4 = 0;

// end multi indvship

 

-> Find

 

// products price

$product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id='" . tep_get_prid($products_id) . "'");

 

-> Add products_ship_price_one, products_ship_price_two, products_ship_price_three, products_ship_price_four, to query as illustrated below OR if you don't have any other mods installed here you can simply replace with

 

// products price - multi indvship added

$product_query = tep_db_query("select products_id, products_price, products_ship_price_one, products_ship_price_two, products_ship_price_three, products_ship_price_four, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id='" . tep_get_prid($products_id) . "'");

 

-> Find (a few lines down)

 

$products_weight = $product['products_weight'];

 

-> Add after

 

// mod multi indvship

$products_ship_price_one = $product['products_ship_price_one'];

$products_ship_price_two = $product['products_ship_price_two'];

$products_ship_price_three = $product['products_ship_price_three'];

$products_ship_price_four = $product['products_ship_price_four'];

// end multi indvship

 

-> Find

 

$this->total += tep_add_tax($products_price, $products_tax) * $qty;

 

-> Add after

 

// mod multi indvship

$this->shiptotal1 += ($products_ship_price_one * $qty);

$this->shiptotal2 += ($products_ship_price_two * $qty);

$this->shiptotal3 += ($products_ship_price_three * $qty);

$this->shiptotal4 += ($products_ship_price_four * $qty);

// end multi indvship

 

-> Find

 

function show_total() {

$this->calculate();

 

return $this->total;

}

 

-> Add after

 

function get_shiptotal1() {

$this->calculate();

 

return $this->shiptotal1;

}

 

function get_shiptotal2() {

$this->calculate();

 

return $this->shiptotal2;

}

 

function get_shiptotal3() {

$this->calculate();

 

return $this->shiptotal3;

}

 

function get_shiptotal4() {

$this->calculate();

 

return $this->shiptotal4;

}

 

now I made indivship1,2,3 and 4

 

and change the settings to reflect that.

Share this post


Link to post
Share on other sites

I'm very confused, Shiptotal1 shows price but shiptotal2 don't

 

how can I add ship_cost_1 to vendors_shipping?

 

I;m thinking this is the problem

 

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

$shiptotal2 = $cart->vendor_shipping[vendors_id]['ship_cost_1'];

Share this post


Link to post
Share on other sites

I have no idea what you are trying to do. I'm always suspicious of any mod that starts adding hard-coded numbers to the end of existing variables. That's almost always wrong.

 

regards

Jim


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

Share this post


Link to post
Share on other sites

what im trying to do is add 4 shipping prices for products

 

products_ship_price_one, products_ship_price_two , etc

 

Multi-Individual, shipping based on product shipping price, only works with just one products_ship_price_one, do I make sense? Hopefully you can help me Im going nuts.

 

Individual1:

 

Express saver

 

Individual2:

Next Day

 

Individual3:

Air

 

Individual4:

3 day select

Share this post


Link to post
Share on other sites

I converted MVS to Oscommerce 2.3.1, I uploaded, the version is MVS 1.2.4

 

I hope you can help me with the above.

 

Thanks

Share this post


Link to post
Share on other sites

Those are usually provided in the form of an array inside the module itself. You could also use four different modules with different values in each one, then install all four in your chosen vendor.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites

You can do that in any shipping module. Either way that I mentioned, that is.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites

This is the code I used in Individula shipping but getting $0.00 in output am I missing something?

 

//MVS - Changed 'cost' => $shiptotal + $handling

$this->quotes = array (

'id' => $this->code,

'module' => MODULE_SHIPPING_INDVSHIP_TEXT_TITLE,

'methods' => array (

array (

'id' => $this->code,

'title' => MODULE_SHIPPING_INDVSHIP_TEXT_WAY,

'cost' => $quantity * $products_ship_price_one + $handling

),

array (

'id' => $this->code,

'title' => MODULE_SHIPPING_INDVSHIP1_TEXT_WAY,

'cost' => $quantity * $products_ship_price_two + $handling

)

Edited by drillsar

Share this post


Link to post
Share on other sites

I think I may have figured it out,

 

I have another ? is it possible to have one shipping price added from all the vendors?

 

Example

 

Ground All Vendors Ground Prices, Next Day all vendors Next day prices

 

Instead of all different shipping, so it looks like it's coming from one store

Share this post


Link to post
Share on other sites

I'm close here but I'm getting this error:

 

I added the function subtotal1 and 2 in shopping_cart, so I have no idea why im getting this error.

 

 

Fatal error: Call to a member function get_shiptotal1() on a non-object in /home/giftboundgifts/public_html/includes/modules/vendors_shipping/indvship.php on line 104

 

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

     global $order, $total_count, $shipping_weight, $shipping_num_boxes;
   $shiptotal1 = $cart->get_shiptotal1();
   $shiptotal2 = $cart->get_shiptotal2();
     //MVS Start
     $vendors_data_query = tep_db_query("select handling_charge,
                                                handling_per_box,
                                                vendor_country,
                                                vendors_zipcode
                                         from " . TABLE_VENDORS . "
                                         where vendors_id = '" . (int) $vendors_id . "'");
     $vendors_data = tep_db_fetch_array($vendors_data_query);
     $country_name = tep_get_countries($vendors_data['vendor_country'], true);

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

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

     $handling += $vendors_handling_data['configuration_value'];

     //MVS End

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

Share this post


Link to post
Share on other sites

Jim,

 

I got it working. I converted MVS to work with Oscommerce 2.3.1, I uploaded it but not on contribution site.

 

I have one more ? is it possible to add all the vendors in one shipping method?

 

For instance UPS you add Individual products to the Ups quote

Share this post


Link to post
Share on other sites

If you have to add something to the cart class to get your module to work, you're on the wrong track. Fix the code in the module instead.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites

I beleive I fixed it in the module.

 

I added $cart to global, this is the only way it works.

 

I tried 'cost' => $qty * $products_ship_price_one

 

Have any ideas?

 

Have you got a idea on how to add all vendor shipping into one shipping cost?

 

Thanks for all your help

 

 

here is what I added:

 

function quote($method = '', $module = '', $vendors_id = '1') {
     global $order, $cart, $total_count, $shipping_weight, $shipping_num_boxes;
$shiptotal1 = $cart->get_shiptotal1();
   $shiptotal2 = $cart->get_shiptotal2(); 

 

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

Share this post


Link to post
Share on other sites

MVS and usps.php?

 

does anybody have a working version of usps.php modified for MVS?

Seems that the folks over at the Post Office royally messed up the API with the latest revisions on Jan 2, 2011

International shipping does not work anymore.

 

looks like they have a "working" version of USPS Methods at USPS Methods Contrib. but i need it to work with MVS

 

losing money hand over foot thanks to the folks at USPS

anyone?


Jim Bullen - President

The Cigar Hut Group of Companies

 

 

Installed add-ons: (that now need to be upgraded to OSC CE Phoenix)

PWA, MVS, Easy Populate, Dynamic Sitemap, Featured Products, MVS Order Editor, MVS Shipping Estimator, Google XML Sitemap, About Us, Ad Tracker, Address Enhancer, Also Purchased, Backorders, Category Descriptions, Dynamic Meta Tags, Contact Us Email Subjects, Country state Selector, Extra Address Line, Order Number in Email Subject, OSC Affiliate, Product Extra Fields, Review Approval System, Reviews in Product Display, Sold Out, Sold Out (but Displayed), Ultimate SEO URL's, Updated Spiders, Welcome Email Password, Pending Order Email, Who's Online Enhancement, CCGV, Easy Discounts, Customer Comments, Request a Review, Sales Report, plus many many more!

Share this post


Link to post
Share on other sites

MVS and usps.php?

 

does anybody have a working version of usps.php modified for MVS?

Seems that the folks over at the Post Office royally messed up the API with the latest revisions on Jan 2, 2011

International shipping does not work anymore.

 

looks like they have a "working" version of USPS Methods at USPS Methods Contrib. but i need it to work with MVS

 

losing money hand over foot thanks to the folks at USPS

anyone?

Share this post


Link to post
Share on other sites

I took a look at it, it dont seem that bad, what you can do is basicaly look at the old usps.php code to the new code

 

Here is some of what I know, I stopped at where im not sure of, hope this helps:

 

<?php
/*
$Id: usps.php 5.0 2008-03-01 04:59:07Z user $

+++++ Original contribution by Brad Waite and Fritz Clapp ++++
++++ Revisions and Modifications made by Greg Deeth, 2008 ++++
++++++++++++ Insurance module by Kevin Shelton +++++++++++++++

Copyright 2008 osCommerce
Released under the GNU General Public License
*/
//VERSION: 5.1.0 ALPHA
//LAST UPDATED: January 6th, 2011 by Fulluv Scents
//Please refer to http://www.usps.com/webtools/ for more information on API syntax.


class usps {
var $code, $title, $description, $icon, $enabled, $countries;
function usps() {
global $order;
$this->code = 'usps';
$this->title = MODULE_SHIPPING_USPS_TEXT_TITLE;
$this->icon = DIR_WS_ICONS . 'shipping_usps.gif';

$this->types = array(
'First-Class Mail' => 'First-Class Mail',
'Media Mail' => 'Media Mail',
'Parcel Post' => 'Parcel Post',
'Priority Mail' => 'Priority Mail',
'Priority Mail Flat Rate Envelope' => 'Priority Mail Flat Rate Envelope',
'Priority Mail Small Flat Rate Box' => 'Priority Mail Small Flat Rate Box',
'Priority Mail Medium Flat Rate Box' => 'Priority Mail Medium Flat Rate Box',
'Priority Mail Large Flat Rate Box' => 'Priority Mail Large Flat Rate Box',
'Express Mail' => 'Express Mail',
'Express Mail Flat Rate Envelope' => 'Express Mail Flat Rate Envelope'
);

$this->intl_types = array(
'Global Express' => 'Global Express Guaranteed (GXG)',
'Global Express Non-Doc Rect' => 'Global Express Guaranteed Non-Document Rectangular',
'Global Express Non-Doc Non-Rect' => 'Global Express Guaranteed Non-Document Non-Rectangular',
'USPS GXG Envelopes' => 'USPS GXG Envelopes',
'Express Mail Int' => 'Express Mail International',
'Express Mail Int Flat Rate Env' => 'Express Mail International Flat Rate Envelope',
'Priority Mail International' => 'Priority Mail International',
'Priority Mail Int Flat Rate Lrg Box' => 'Priority Mail International Large Flat Rate Box',
'Priority Mail Int Flat Rate Med Box' => 'Priority Mail International Medium Flat Rate Box',
'Priority Mail Int Flat Rate Small Box' => 'Priority Mail International Small Flat Rate Box',
'Priority Mail Int Flat Rate Env' => 'Priority Mail International Flat Rate Envelope',
'First-Class Mail Int Lrg Env' => 'First-Class Mail International Large Envelope',
'First-Class Mail Int Package' => 'First-Class Mail International Package',
'First-Class Mail Int Letter' => 'First-Class Mail International Letter'
);

$this->countries = $this->country_list();

$this->countryinsure = $this->country_maxinsure();
}
// MVS ADD
   function sort_order($vendors_id = '1') {
     $sort_order = @ constant('MODULE_SHIPPING_USPS_SORT_ORDER_' . $vendors_id);
     if (isset ($sort_order)) {
       $this->sort_order = $sort_order;
     } else {
       $this->sort_order = '0';
     }
     return $this->sort_order;
   }

   function tax_class($vendors_id = '1') {
     $this->tax_class = constant('MODULE_SHIPPING_USPS_TAX_CLASS_' . $vendors_id);
     return $this->tax_class;
   }

   function enabled($vendors_id = '1') {

     $this->enabled = false;

     $status = @ constant('MODULE_SHIPPING_USPS_STATUS_' . $vendors_id);

     if (isset ($status) && $status != '') {

       $this->enabled = (($status == 'True') ? true : false);

     }
     if (($this->enabled == true) && ((int) constant('MODULE_SHIPPING_USPS_ZONE_' . $vendors_id) > 0)) {
       $check_flag = false;
       $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . (int) constant('MODULE_SHIPPING_USPS_ZONE_' . $vendors_id) . "' and zone_country_id = '" . $this->delivery_country_id . "' order by zone_id");
       while ($check = tep_db_fetch_array($check_query)) {
         if ($check['zone_id'] < 1) {
           $check_flag = true;
           break;
         }
         elseif ($check['zone_id'] == $this->delivery_zone_id) {
           $check_flag = true;
           break;
         }
       }

       if ($check_flag == false) {
         $this->enabled = false;
       } //if
     } //if
     return $this->enabled;
   }

   function zones($vendors_id = '1') {
     /*
       if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_USPS_ZONE_' . $vendors_id) > 0) ) {
         $check_flag = false;
         $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . (int)constant('MODULE_SHIPPING_USPS_ZONE_' . $vendors_id) . "' and zone_country_id = '" . $this->delivery_zone_id . "' order by zone_id");
         */
     if (($this->enabled == true) && ((int) constant('MODULE_SHIPPING_USPS_ZONE_' . $vendors_id) > 0)) {

       $check_flag = false;

       $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . (int) constant('MODULE_SHIPPING_USPS_ZONE_' . $vendors_id) . "' and zone_country_id = '" . $this->delivery_country_id . "' order by zone_id");
       while ($check = tep_db_fetch_array($check_query)) {
         if ($check['zone_id'] < 1) {
           $check_flag = true;
           break;
         }
         elseif ($check['zone_id'] == $this->delivery_zone_id) {
           $check_flag = true;
           break;
         } //if
       } //while

       if ($check_flag == false) {
         $this->enabled = false;
       } //if
     } //if
     return $this->enabled;
   } //function
   // EOADD MVS

   // class methods
   // Changed MVS
   //    function quote($method = '') {
   function quote($method = '', $module = '', $vendors_id = '1') {
     // EOCHANGE
global $order, $shipping_weight, $shipping_num_boxes, $transittime;

if ( tep_not_null($method) && (isset($this->types[$method]) || in_array($method, $this->intl_types)) ) {

$this->_setService($method);
}

if constant ('MODULE_SHIPPING_USPS_INSURE_TAX' . '$vendors_id' == 'True') { //NOT SURE OF THIS
$costperpkg = $order->info['total'] / $shipping_num_boxes;
}
else {
$costperpkg = $order->info['subtotal'] / $shipping_num_boxes;
}

Share this post


Link to post
Share on other sites

if constant ('MODULE_SHIPPING_USPS_INSURE_TAX_' . $vendors_id == 'True') {

There are module modification instructions in the MVS distribution -- see the modules.txt file.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites

USPS Methods for MVS now uploaded!

 

after much hair pulling and a celebratory shot of rum, I finally got USPS international rates to work.

this forum and its contibutors have helped me so much over the years I had to share. :)

 

you can find the usps.php file in the UPS Methods contrib page here

UPS Methods for MVS

 

or in the MVS contrib page here

USPS for MVS

 

sorry, no taxes, insurance, dimensions and many letter mail services are included as I do not use them, but it does return valid rates for both US domestic and international shiping


Jim Bullen - President

The Cigar Hut Group of Companies

 

 

Installed add-ons: (that now need to be upgraded to OSC CE Phoenix)

PWA, MVS, Easy Populate, Dynamic Sitemap, Featured Products, MVS Order Editor, MVS Shipping Estimator, Google XML Sitemap, About Us, Ad Tracker, Address Enhancer, Also Purchased, Backorders, Category Descriptions, Dynamic Meta Tags, Contact Us Email Subjects, Country state Selector, Extra Address Line, Order Number in Email Subject, OSC Affiliate, Product Extra Fields, Review Approval System, Reviews in Product Display, Sold Out, Sold Out (but Displayed), Ultimate SEO URL's, Updated Spiders, Welcome Email Password, Pending Order Email, Who's Online Enhancement, CCGV, Easy Discounts, Customer Comments, Request a Review, Sales Report, plus many many more!

Share this post


Link to post
Share on other sites

Thanks for sharing the code, but please remember that only full uploads are allowed, as partials break the download system.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites

I've just installed v2.2.3 and I seem to be receiving some warning messages that I cannot figure out. Any suggestions on how to fix would be appreciated.

 

The following are the warning messages:

Warning: Attempt to assign property of non-object in /catalog/products_ship_estimator.php on line 158

 

Warning: Attempt to assign property of non-object in /catalog/products_ship_estimator.php on line 162

 

Warning: Attempt to assign property of non-object in /catalog/products_ship_estimator.php on line 166

 

Warning: Attempt to assign property of non-object in /catalog/products_ship_estimator.php on line 170

Share this post


Link to post
Share on other sites

I have no idea what 2.2.3 is. The latest supported version of MVS is 1.2.4. In that version, /catalog/products_ship_estimator.php has no object properties on those lines. I suggest that you install the supported version of MVS and try again.

 

Regards

Jim


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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×