Zen Cart Logo

Minimum shipping fee

Views: 9,365

Results 41 to 60 of 60
4 Mar 2010, 11:08 PM
#41
cdnbride avatar

cdnbride

Zen Follower

Join Date:
Sep 2009
Location:
Toronto, Canada
Posts:
149
Plugin Contributions:
0

Minimum shipping fee

Ajeh:

Customize the code from:

    $methods[] = array('id' => $type,
                       'title' => $this->types[$type],
                       'cost' => ($cost + MODULE_SHIPPING_UPS_HANDLING) * $shipping_num_boxes);
> 
> to now force the amount ...
> ```
if ($cost < 7.95) {
        $methods[] = array('id' => $type,
                           'title' => $this->types[$type],
                           'cost' => (7.95 + MODULE_SHIPPING_UPS_HANDLING) * $shipping_num_boxes);
} else {
        $methods[] = array('id' => $type,
                           'title' => $this->types[$type],
                           'cost' => ($cost + MODULE_SHIPPING_UPS_HANDLING) * $shipping_num_boxes);
}

Will this also work in the "Per Unit"(by weight) shipping module?
Lisa

5 Mar 2010, 6:10 AM
#42
ajeh avatar

ajeh

Oba-san

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

Re: Minimum shipping fee

Same concept but you have to adapt the code for that shipping module ...

5 Mar 2010, 1:00 PM
#43
cdnbride avatar

cdnbride

Zen Follower

Join Date:
Sep 2009
Location:
Toronto, Canada
Posts:
149
Plugin Contributions:
0

Re: Minimum shipping fee

Okay sounds easy,(probably isn't) lol, I'm going to give it a try.

5 Mar 2010, 7:01 PM
#44
cdnbride avatar

cdnbride

Zen Follower

Join Date:
Sep 2009
Location:
Toronto, Canada
Posts:
149
Plugin Contributions:
0

Re: Minimum shipping fee

Okay so putting that bit of code into the perweightunit.php didn't work..... can somebody tell me where to put the code in and if it would be the same code that was used for the USPS module?
Thanks again!
Lisa

5 Mar 2010, 8:37 PM
#45
ajeh avatar

ajeh

Oba-san

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

Re: Minimum shipping fee

This is a constant:
MODULE_SHIPPING_UPS_HANDLING

all of the shipping modules have unique constants ...

For UPS it uses:
MODULE_SHIPPING_UPS_HANDLING

For Per Unit it uses:
MODULE_SHIPPING_PERWEIGHTUNIT_HANDLING

See if you forgot to change ALL of the constants to match the shipping module you are working with ...

5 Mar 2010, 9:00 PM
#46
cdnbride avatar

cdnbride

Zen Follower

Join Date:
Sep 2009
Location:
Toronto, Canada
Posts:
149
Plugin Contributions:
0

Re: Minimum shipping fee

Hi Ajeh

All I changed is the two lines below (in red), because I really haven't learned as much as I need to to understand why I'm changing it, but I thought that I would at least give it a try. I kind of knew that it probably wouldn't work out to be that easy. :smile:

<?php /** * @package shippingMethod * @copyright Copyright 2003-2006 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license <http://www.zen-cart.com/license/2_0.txt> GNU Public License V2.0 * @version $Id: perweightunit.php 3308 2006-03-29 08:21:33Z ajeh $ */ /** * "Per Weight Unit" shipping module, allowing you to offer per-unit-rate shipping options * */ class perweightunit extends base { /** * $code determines the internal 'code' name used to designate "this" payment module * * @var string */ var $code; /** * $title is the displayed name for this payment method * * @var string */ var $title; /** * $description is a soft name for this payment method * * @var string */ var $description; /** * module's icon * * @var string */ var $icon; /** * $enabled determines whether this module shows or not... during checkout. * * @var boolean */ var $enabled; /** * Constructor * * @return perweightunit */ function perweightunit() { global $order, $db; $this->code = 'perweightunit'; $this->title = MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_TITLE; $this->description = MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_PERWEIGHTUNIT_SORT_ORDER; $this->icon = ''; $this->tax_class = MODULE_SHIPPING_PERWEIGHTUNIT_TAX_CLASS; $this->tax_basis = MODULE_SHIPPING_PERWEIGHTUNIT_TAX_BASIS; // disable only when entire cart is free shipping if (zen_get_shipping_enabled($this->code)) { $this->enabled = ((MODULE_SHIPPING_PERWEIGHTUNIT_STATUS == 'True') ? true : false); } if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_PERWEIGHTUNIT_ZONE > 0) ) { $check_flag = false; $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_PERWEIGHTUNIT_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; } } } /** * Obtain quote from shipping system/calculations * * @param string $method * @return array */ function quote($method = '') { global $order, $shipping_weight; $total_weight_units = $shipping_weight; if ($cost < 15.00) { $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_WAY, 'cost' => (15.00 + MODULE_SHIPPING_PERWEIGHTUNIT_COST * $total_weight_units) + MODULE_SHIPPING_PERWEIGHTUNIT_HANDLING))); 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; } /** * Check to see whether module is installed * * @return boolean */ function check() { global $db; if (!isset($this->_check)) { $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_PERWEIGHTUNIT_STATUS'"); $this->_check = $check_query->RecordCount(); } return $this->_check; } /** * Install the shipping module and its configuration settings * */ 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 Per Weight Unit Shipping', 'MODULE_SHIPPING_PERWEIGHTUNIT_STATUS', 'True', 'Do you want to offer per unit rate shipping?<br /><br />Product Quantity * Units (products_weight) * Cost per Unit', '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 per Unit', 'MODULE_SHIPPING_PERWEIGHTUNIT_COST', '1', 'NOTE: When using this Shipping Module be sure to check the Tare settings in the Shipping/Packaging and set the Largest Weight high enough to handle the price, such as 5000.00 and the adjust the settings on Small and Large packages which will add to the price as well.<br /><br />The shipping cost will be used to determin shipping charges based on: Product Quantity * Units (products_weight) * Cost per Unit - in an order that uses 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, date_added) values ('Handling Fee', 'MODULE_SHIPPING_PERWEIGHTUNIT_HANDLING', '0', 'Handling fee for 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_PERWEIGHTUNIT_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_PERWEIGHTUNIT_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_PERWEIGHTUNIT_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_PERWEIGHTUNIT_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())"); } /** * Remove the module and all its settings * */ function remove() { global $db; $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key LIKE 'MODULE_SHIPPING_PERWEIGHTUNIT_%'"); } /** * Internal list of configuration keys used for configuration of the module * * @return array */ function keys() { return array('MODULE_SHIPPING_PERWEIGHTUNIT_STATUS', 'MODULE_SHIPPING_PERWEIGHTUNIT_COST', 'MODULE_SHIPPING_PERWEIGHTUNIT_HANDLING', 'MODULE_SHIPPING_PERWEIGHTUNIT_TAX_CLASS', 'MODULE_SHIPPING_PERWEIGHTUNIT_TAX_BASIS', 'MODULE_SHIPPING_PERWEIGHTUNIT_ZONE', 'MODULE_SHIPPING_PERWEIGHTUNIT_SORT_ORDER'); } } ?>
6 Mar 2010, 4:13 AM
#47
ajeh avatar

ajeh

Oba-san

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

Re: Minimum shipping fee

Try using this ...

    $total_weight_units = $shipping_weight;
    if (MODULE_SHIPPING_PERWEIGHTUNIT_COST * $total_weight_units < 15.00) {
    $this->quotes = array('id' => $this->code,
                          'module' => MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_TITLE,
                          'methods' => array(array('id' => $this->code,
                                                   'title' => MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_WAY,
                                                   'cost' => (15.00)
                                                              + MODULE_SHIPPING_PERWEIGHTUNIT_HANDLING)));
    } else {
    $this->quotes = array('id' => $this->code,
                          'module' => MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_TITLE,
                          'methods' => array(array('id' => $this->code,
                                                   'title' => MODULE_SHIPPING_PERWEIGHTUNIT_TEXT_WAY,
                                                   'cost' => (MODULE_SHIPPING_PERWEIGHTUNIT_COST * $total_weight_units)
                                                              + MODULE_SHIPPING_PERWEIGHTUNIT_HANDLING)));
    }
6 Mar 2010, 8:32 PM
#48
cdnbride avatar

cdnbride

Zen Follower

Join Date:
Sep 2009
Location:
Toronto, Canada
Posts:
149
Plugin Contributions:
0

Re: Minimum shipping fee

Thanks so much Linda, it worked fantastically! I just couldn't do this without the amazing help from several people on this forum. I really hope that I am able to give back the same way eventually. Thank you so very much. :D
Lisa

15 Jan 2011, 8:30 AM
#49
botanophilia avatar

botanophilia

New Zenner

Join Date:
Jan 2011
Posts:
4
Plugin Contributions:
0

Re: Minimum shipping fee

I'm using the per item shipping fee and need a minimum shipping cost of $20. Can't seem to make it work by altering the code. Could be 'cause it's past 2 am and I'm tired, but any help would be appreciated.

15 Jan 2011, 2:29 PM
#50
ajeh avatar

ajeh

Oba-san

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

Re: Minimum shipping fee

Per Unit perweightunit is based on the total weight of the order and that weight is used to calculate the shipping charges ...

If your units are set to 1.00 then you can just alter the code:

    $total_weight_units = $shipping_weight;
    // bof: minimum 20.00
    if ($total_weight < 20.00) {
      $total_weight = 20.00;
    }
    // eof: minimum 20.00

by adding the code in RED below the code in BLACK ...

15 Jan 2011, 5:07 PM
#51
botanophilia avatar

botanophilia

New Zenner

Join Date:
Jan 2011
Posts:
4
Plugin Contributions:
0

Re: Minimum shipping fee

I enabled the perweightunit shipping and I changed the code and got a shipping cost of $12. My units are all set to 1, shipping cost per unit set to 4.

My shipping cost per item needs to be $4, but min shipping charge is $20.

15 Jan 2011, 7:11 PM
#52
ajeh avatar

ajeh

Oba-san

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

Re: Minimum shipping fee

Sorry I boo booed ... :blink:

Try this code:

    $total_weight_units = $shipping_weight;
    // bof: minimum 20.00
    if ($total_weight_units < 20) {
      $total_weight_units = 20;
    }
    // eof: minimum 20.00
15 Jan 2011, 10:58 PM
#53
botanophilia avatar

botanophilia

New Zenner

Join Date:
Jan 2011
Posts:
4
Plugin Contributions:
0

Re: Minimum shipping fee

Still isn't working right, now shipping is $20 regardless how many items are in the cart.
Is there a way to make this work using the item module rather than perweightunit module since I don't ship by weight?

15 Jan 2011, 11:23 PM
#54
ajeh avatar

ajeh

Oba-san

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

Re: Minimum shipping fee

See if this works on the Item Rate item shipping module:

      $this->quotes = array('id' => $this->code,
                            'module' => MODULE_SHIPPING_ITEM_TEXT_TITLE,
                            'methods' => array(array('id' => $this->code,
                                                     'title' => MODULE_SHIPPING_ITEM_TEXT_WAY,
                                                     'cost' => ((MODULE_SHIPPING_ITEM_COST * $item_total_count) < 20.00 ? 20.00 : (MODULE_SHIPPING_ITEM_COST * $item_total_count)) + MODULE_SHIPPING_ITEM_HANDLING)));
16 Jan 2011, 4:53 AM
#55
botanophilia avatar

botanophilia

New Zenner

Join Date:
Jan 2011
Posts:
4
Plugin Contributions:
0

Re: Minimum shipping fee

That's what I was looking for! :clap: Thanks!

26 May 2011, 8:58 PM
#56
webskipper avatar

webskipper

Totally Zenned

Join Date:
Nov 2007
Location:
USA
Posts:
876
Plugin Contributions:
2

Re: Minimum shipping fee

Linda:

Did you already post the mod for 139h?

I had it working for 138 and ow need to do the same for 139. Thanks!

26 May 2011, 10:50 PM
#57
ajeh avatar

ajeh

Oba-san

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

Re: Minimum shipping fee

You lost me ...

This is a customization to the shipping ...

Customization of v1.3.8 vs v1.3.9 would be similar ...

What is it you are asking? :unsure:

26 May 2011, 11:45 PM
#58
webskipper avatar

webskipper

Totally Zenned

Join Date:
Nov 2007
Location:
USA
Posts:
876
Plugin Contributions:
2

Re: Minimum shipping fee

I was under the impression from some of the 139 mods that not all the duplicate files of 138 need to be messed with in 139.

So It is still just the same usps.php that is tweaked?

26 May 2011, 11:55 PM
#59
webskipper avatar

webskipper

Totally Zenned

Join Date:
Nov 2007
Location:
USA
Posts:
876
Plugin Contributions:
2

Re: Minimum shipping fee

Found it and fixed it. Thanks for brightening the light bulb, Linda.

includes/modules/shipping/usps.php

/*
$methods[] = array('id' => $type,
'title' => ((isset($this->types[$type])) ? $this->types[$type] : $type),
'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
/
/

$cost = preg_replace('/[^0-9.]/', '', $cost);
$methods[] = array('id' => $type,
'title' => $title,
'cost' => ($cost * $shipping_num_boxes) + (MODULE_SHIPPING_USPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_USPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_USPS_HANDLING) );

    }

    $this->quotes['methods'] = $methods;
    */

    /* Minimum USPS Shipping */
    if ($cost < 6.00) {
      $methods[] = array('id' => $type,
                         'title' => $title,
                         'cost' => (6.00 + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
      } else {
      $methods[] = array('id' => $type,
                         'title' => $title,
                         'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
      }
    }

    $this->quotes['methods'] = $methods;
    /* EOF Minimum USPS Shipping */
27 May 2011, 12:02 AM
#60
ajeh avatar

ajeh

Oba-san

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

Re: Minimum shipping fee

As long as you are using the January 2, 2011 C from post #26 from:
http://www.zen-cart.com/forum/showthread.php?t=171314

Then you have the latest USPS version that we have released ...

NOTE: this came out after v1.3.9 ...