Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / flat rate shipping for three or more shippers

flat rate shipping for three or more shippers

Locked

Views: 1,761

Results 1 to 19 of 19
This thread is locked. New replies are disabled.
29 Oct 2010, 12:49 AM
#1
bigbear avatar

bigbear

New Zenner

Join Date:
Sep 2010
Posts:
14
Plugin Contributions:
0

flat rate shipping for three or more shippers

ok I have three suppliers that i ship from each charges a flat rate of 3.50 regardless of size or quantity what I would like to do is if someone buys something from that shipper I want to add 3.50 to the shipping price only once per shipper dose anyone know a mod that will work, I'm not live yet and I am held up till I can figure this out. I know other carts that offer this but zen cart is the only one I have found with ease of use and prestashop would lock me out requiring a reinstall constantly I really need to find this solution or i will be unable to open my shop with out charging outrageous shipping prices or ocuring these costs my self. This is the first time i have done an online business or for that mater built a website, and I have been working on this now for a few months and would like to start seeing some kind of profit from it as money keeps going out and I need money to start comming in soon or I have to make this a wash please help. ASAP

29 Oct 2010, 3:43 AM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: flat rate shipping for three or more shippers

Are you saying that you are using some shipping module and that if you could check if there was 1 or more Products from 1 or more of these 3 manufacturers you want to add $3.50 to the price?

Or, are you saying that you are using some shipping module and that if you could check how many Products * quantity * 3.50 from these 3 manufacturers you would then be adding $3.50 per quantity?

Or, are you saying something else?

Pretend I have no clue what your shop looks like nor what you think you want to do with your shipping ... so type very very slowly ... :smile:

29 Oct 2010, 4:33 AM
#3
bigbear avatar

bigbear

New Zenner

Join Date:
Sep 2010
Posts:
14
Plugin Contributions:
0

Re: flat rate shipping for three or more shippers

Ok I have three places that ship for me I want to check the buyers cart and add 3.50 for each place shipping the product so if all three places have item in the cart the cost will be 10.50 if only one of these places has an item in the cart it would only be 3.50 it has nothing to do with quantity.

Another way to look at it is I have three manufaturs (sorry I'm a bad speller) if someone buys something from any of the manufactures I want a one time adding of 3.50 for each manufacturer used regardless of price or quantity

Hope that helps

29 Oct 2010, 5:10 AM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: flat rate shipping for three or more shippers

Let's say the three manufacturers are using manufacturers_id 1, 17 and 19 ...

global $cart;
$chk_manufacturer_1 = $_SESSION['cart']->in_cart_check('manufacturers_id','1');
$chk_manufacturer_17 = $_SESSION['cart']->in_cart_check('manufacturers_id','17');
$chk_manufacturer_19 = $_SESSION['cart']->in_cart_check('manufacturers_id','19');

$extra_charges = 0.00;
if ($chk_manufacturer_1 > 0) {
  $extra_charges += 3.50;
}
if ($chk_manufacturer_17 > 0) {
  $extra_charges += 3.50;
}
if ($chk_manufacturer_19 > 0) {
  $extra_charges += 3.50;
}

then just add the:
$extra_charges

to the cost in the function quote ...

29 Oct 2010, 2:47 PM
#5
bigbear avatar

bigbear

New Zenner

Join Date:
Sep 2010
Posts:
14
Plugin Contributions:
0

Re: flat rate shipping for three or more shippers

That's great thank but were do I add the code?

29 Oct 2010, 4:08 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: flat rate shipping for three or more shippers

I do not know what shipping module you are using ...

But the code goes in the function quote portion and you add the extra charge to where you see the handling ...

29 Oct 2010, 5:53 PM
#7
bigbear avatar

bigbear

New Zenner

Join Date:
Sep 2010
Posts:
14
Plugin Contributions:
0

Re: flat rate shipping for three or more shippers

ok so i am using the already included flat rate mod

I figure i should install thing in the main php file located in the includes/modual/flatrate.php

next I am wondering how to figure out what the manufactures ID is as described above

Also would this be put in the main class there or do i need to add a new class to put the function in

lastly adding to the cost is that done it the file or is that another file and what would that code look like since I can identify what variable you are using, sorry if this is confusing but i am confused my programing knowledge is limited to VB.net and vary basic C++ (I only just started that class)

29 Oct 2010, 6:26 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: flat rate shipping for three or more shippers

Go to the Catalog ... Manufacturers ... and click on each of the 3 manufacturers and see what the URL reads for the mID= to get the value for that manufacturers_id ...

29 Oct 2010, 6:54 PM
#9
bigbear avatar

bigbear

New Zenner

Join Date:
Sep 2010
Posts:
14
Plugin Contributions:
0

Re: flat rate shipping for three or more shippers

bigbear:

lastly adding to the cost is that done it the file or is that another file and what would that code look like since I can identify what variable you are using, (I only just started that class)

let me rephrase this so that its easier to understand but first let me thank you for all this help. I have been getting vary frustrated because of this problem and thanks to you it seems as if I may be getting some where.

ok to I want to add this to the cost immediately it think simple equations

man_cost1 + man_cost2 + man_cost3 = shipping_cost

however I don't know what variable you are using above to add I keep looking at the function you wrote but I just cant figure it out. I will keep trying to figure it out but if you could kind of identify the formula or even what variable holds the information gained. I hope that makes more since then before.

29 Oct 2010, 6:57 PM
#10
bigbear avatar

bigbear

New Zenner

Join Date:
Sep 2010
Posts:
14
Plugin Contributions:
0

Re: flat rate shipping for three or more shippers

ok wait is it

$extra_charges

and would i just write the equation

shipping_cost += $extra_charges

in the proper place?

(shipping_cost is my example var for what the actual var name would be)

29 Oct 2010, 7:08 PM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: flat rate shipping for three or more shippers

On your Products, for these 3 manufacturers where you want to charge the 3.50 for shipping for each of the 3 manufacturers if 1 or more Products are in the cart from them ...

Have you set the Manufacturer as the Manufacturer for the Product?

29 Oct 2010, 7:15 PM
#12
bigbear avatar

bigbear

New Zenner

Join Date:
Sep 2010
Posts:
14
Plugin Contributions:
0

Re: flat rate shipping for three or more shippers

Yes each product has the manufacturer set to the proper manufacturer

29 Oct 2010, 7:44 PM
#13
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: flat rate shipping for three or more shippers

Then the next step is to go and find what each manufacturers_id is for these ...

Look in the Catalog ... Manufacturers ...

Click on one of the Manufacturers ... then look in the URL of your browser and jot down the mID that you see in the URL ... and do this on all 3 of them ...

29 Oct 2010, 7:46 PM
#14
bigbear avatar

bigbear

New Zenner

Join Date:
Sep 2010
Posts:
14
Plugin Contributions:
0

Re: flat rate shipping for three or more shippers

Ok I have the Ida it says mID= '1' so on and so forth

29 Oct 2010, 8:27 PM
#15
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: flat rate shipping for three or more shippers

Then you need to edit the Flat rate flat shipping module:
/includes/modules/shipping/flat.php

and change the code:

global $cart;
$chk_manufacturer_1 = $_SESSION['cart']->in_cart_check('manufacturers_id','1');
$chk_manufacturer_17 = $_SESSION['cart']->in_cart_check('manufacturers_id','17');
$chk_manufacturer_19 = $_SESSION['cart']->in_cart_check('manufacturers_id','19');

$extra_charges = 0.00;
if ($chk_manufacturer_1 > 0) {
  $extra_charges += 3.50;
}
if ($chk_manufacturer_17 > 0) {
  $extra_charges += 3.50;
}
if ($chk_manufacturer_19 > 0) {
  $extra_charges += 3.50;
}
      $this->quotes = array('id' => $this->code,
                            'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
                            'methods' => array(array('id' => $this->code,
                                                     'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
                                                     'cost' => MODULE_SHIPPING_FLAT_COST + $extra_charges)));

and replace the values for the manufacturers_id to match the 3 that you found ...

This should give you an extra one time charge for $3.50 for each of the manufacturers that appears in the shopping cart, added to the Flat Rate charge you have setup ...

29 Oct 2010, 10:11 PM
#16
bigbear avatar

bigbear

New Zenner

Join Date:
Sep 2010
Posts:
14
Plugin Contributions:
0

Re: flat rate shipping for three or more shippers

ok so I have put the code in tryed it exactly the way you said the result is that half of my shipping modules disappear including my flat rate modual and on my front end when i try to buy something the shipping options page is blank

i am puting in the code the entire source cod for the includes/moduals/shipping/flat.php
you will see that the code you told me to put in is commented out that was to prove it was the new code that was the problem and it was everything worked fine after that minus i only had the shipping rate please look and tell me if I did something worng

FYI I added a forth supplier in the code because I guess I have four of them even though I only use three at the moment

If it helps my site is https://www.socialvapor.com

<?php
/**
 * @package shippingMethod
 * @copyright Copyright 2003-2009 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 */
// $Id: flat.php 14498 2009-10-01 20:16:16Z ajeh $
//

  class flat {
    var $code, $title, $description, $icon, $enabled;

// class constructor
    function flat() {
      global $order, $db;

      $this->code = 'flat';
      $this->title = MODULE_SHIPPING_FLAT_TEXT_TITLE;
      $this->description = MODULE_SHIPPING_FLAT_TEXT_DESCRIPTION;
      $this->sort_order = MODULE_SHIPPING_FLAT_SORT_ORDER;
      $this->icon = '';
      $this->tax_class = MODULE_SHIPPING_FLAT_TAX_CLASS;
      $this->tax_basis = MODULE_SHIPPING_FLAT_TAX_BASIS;

      // disable only when entire cart is free shipping
      if (zen_get_shipping_enabled($this->code)) {
        $this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
      }

      if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FLAT_ZONE > 0) ) {
        $check_flag = false;
        $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FLAT_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
        while (!$check->EOF) {
          if ($check->fields['zone_id'] < 1) {
            $check_flag = true;
            break;
          } elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
            $check_flag = true;
            break;
          }
          $check->MoveNext();
        }

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

//Flat rate change start
//global $cart;
//$chk_manufacturer_1 = $_SESSION['cart']->in_cart_check('manufacturers_id','1');
//$chk_manufacturer_2 = $_SESSION['cart']->in_cart_check('manufacturers_id','2');
//$chk_manufacturer_3 = $_SESSION['cart']->in_cart_check('manufacturers_id','3');
//$chk_manufacturer_4 = $_SESSION['cart']->in_cart_check('manufacturers_id','4');

//$extra_charges = 0.00;
//if ($chk_manufacturer_1 > 0) {
 // $extra_charges += 3.50;
//}
//if ($chk_manufacturer_2 > 0) {
  //$extra_charges += 3.50;
//}
//if ($chk_manufacturer_3 > 0) {
  //$extra_charges += 3.50;
//}
//if ($chk_manufacturer_4 > 0) {
  //$extra_charges += 3.50;
//}
  //    $this->quotes = array('id' => $this->code,
  //                          'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
    //                        'methods' => array(array('id' => $this->code,
      //                                               'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
        //                                             'cost' => MODULE_SHIPPING_FLAT_COST + $extra_charges)));
//flat rate change end


// class methods
    function quote($method = '') {
      global $order;

      $this->quotes = array('id' => $this->code,
                            'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
                            'methods' => array(array('id' => $this->code,
                                                     'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
                                                     'cost' => MODULE_SHIPPING_FLAT_COST)));
      if ($this->tax_class > 0) {
        $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
      }

      if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);

      return $this->quotes;
    }

    function check() {
      global $db;
      if (!isset($this->_check)) {
        $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_FLAT_STATUS'");
        $this->_check = $check_query->RecordCount();
      }
      return $this->_check;
    }

    function install() {
      global $db;
      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Flat Shipping', 'MODULE_SHIPPING_FLAT_STATUS', 'True', 'Do you want to offer flat rate shipping?', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Shipping Cost', 'MODULE_SHIPPING_FLAT_COST', '5.00', 'The shipping cost for all orders using this shipping method.', '6', '0', now())");
      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_FLAT_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'zen_get_tax_class_title', 'zen_cfg_pull_down_tax_classes(', now())");
      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Tax Basis', 'MODULE_SHIPPING_FLAT_TAX_BASIS', 'Shipping', 'On what basis is Shipping Tax calculated. Options are<br />Shipping - Based on customers Shipping Address<br />Billing Based on customers Billing address<br />Store - Based on Store address if Billing/Shipping Zone equals Store zone', '6', '0', 'zen_cfg_select_option(array(\'Shipping\', \'Billing\', \'Store\'), ', now())");
      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_FLAT_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())");
      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_FLAT_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
    }

    function remove() {
      global $db;
      $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key like 'MODULE\_SHIPPING\_FLAT\_%'");
    }

    function keys() {
      return array('MODULE_SHIPPING_FLAT_STATUS', 'MODULE_SHIPPING_FLAT_COST', 'MODULE_SHIPPING_FLAT_TAX_CLASS', 'MODULE_SHIPPING_FLAT_TAX_BASIS', 'MODULE_SHIPPING_FLAT_ZONE', 'MODULE_SHIPPING_FLAT_SORT_ORDER');
    }
  }
?>
30 Oct 2010, 1:07 AM
#17
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: flat rate shipping for three or more shippers

You have the code in the wrong place ...

You should have:

// class methods
    function quote($method = '') {
      global $order;

// Flat rate change start
global $cart;
$chk_manufacturer_1 = $_SESSION['cart']->in_cart_check('manufacturers_id','1');
$chk_manufacturer_2 = $_SESSION['cart']->in_cart_check('manufacturers_id','2');
$chk_manufacturer_3 = $_SESSION['cart']->in_cart_check('manufacturers_id','3');
$chk_manufacturer_4 = $_SESSION['cart']->in_cart_check('manufacturers_id','4');

$extra_charges = 0.00;
if ($chk_manufacturer_1 > 0) {
  $extra_charges += 3.50;
}
if ($chk_manufacturer_2 > 0) {
  $extra_charges += 3.50;
}
if ($chk_manufacturer_3 > 0) {
  $extra_charges += 3.50;
}
if ($chk_manufacturer_4 > 0) {
  $extra_charges += 3.50;
}
//flat rate change end

      $this->quotes = array('id' => $this->code,
                            'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
                            'methods' => array(array('id' => $this->code,
                                                     'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
                                                     'cost' => MODULE_SHIPPING_FLAT_COST + $extra_charges)));

Start with the original code and just add the code in red ...

30 Oct 2010, 2:05 AM
#18
bigbear avatar

bigbear

New Zenner

Join Date:
Sep 2010
Posts:
14
Plugin Contributions:
0

Re: flat rate shipping for three or more shippers

it works exactly the way its supposed to thank you so much you have made my day if i wasn't marred and online i would kiss you thank you thank you thank you :clap::clap::clap:

30 Oct 2010, 2:21 AM
#19
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: flat rate shipping for three or more shippers

You are most welcome ... remember us when you are rich and famous ... :cool: