Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Shipping by category


zpupster

Recommended Posts

Hello shipping support,

 

currently using UPS shipping and freeamount shipping module on 2.3.4 BS.

 

we have my free amount shipping set for free shipping over 500 dollars.

 

we have a new category that  we can not offer free shipping for that category only.

 

Can someone suggest an addon for this, 

 

 

TY,

Craig

Link to comment
Share on other sites

think you have to add a routine to the freeamount routine to disable it when a product from that category is in the order.

maybe you can post yhe shipping module you use and someone can tell you what needs to be inserted where exactly ...

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

below is the free amount -free shipping module I use

 

1) i am not sure if i have to query the db for the category ids

2)if i do i will and write some statement similar to this

 

  if ($category_id== NUMBER_ OF_CATEGORY_I_DO_NOT_ WANT_FREE_SHIPPING _ON)
     {
then (NUMBER_ OF_CATEGORY_I_DO_NOT_ WANT_FREE_SHIPPING _ON== 'False')

3) no idea where to place it in this code.

/*
  $Id$ freeamount.php 2


  The Exchange Project - Community Made Shopping!
  http://www.theexchangeproject.org


  Copyright (c) 2003


  Released under the GNU General Public License


  ----------------------------------------------
  ane - 06/02/02 - modified freecount.php to
  allow for freeshipping on minimum order amount
  originally written by dwatkins 1/24/02
  Modified BearHappy 09/04/04
  ----------------------------------------------
*/


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


// class constructor
    function freeamount() {
      global $order, $customer;


      $this->code = 'freeamount';
      $this->title = MODULE_SHIPPING_FREEAMOUNT_TEXT_TITLE;
      $this->description = MODULE_SHIPPING_FREEAMOUNT_TEXT_DESCRIPTION;
      $this->sort_order = MODULE_SHIPPING_FREEAMOUNT_SORT_ORDER;
      $this->icon ='';
      $this->enabled = ((MODULE_SHIPPING_FREEAMOUNT_STATUS == 'True') ? true : false);


      if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FREEAMOUNT_ZONE > 0) ) {


        $check_flag = false;
        $check_query = tep_db_query("select zone_id, zone_country_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FREEAMOUNT_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
        $order_shipping_country = $order->delivery['country']['id'];


        while ($check = tep_db_fetch_array($check_query)) {


          if ($check['zone_id'] < 1) {
            $check_flag = true;
            break;
          } elseif ($check['zone_id'] == $order->delivery['zone_id']) {
//          } elseif ($check['zone_country_id'] == $order->delivery['country']['id']) {
            $check_flag = true;
            break;
          }
        }
        if ($check_flag == false) {
          $this->enabled = false;
        }
     }
}


// class methods
    function quote($method = '') {
      global $order, $cart, $shipping_weight, $shipping_num_boxes;


      $dest_country = $order->delivery['country']['id'];
      $currency = $order->info['currency'];
      $get_total = false;
      $get_weight = false;
      $cart_total = $cart->show_total();


    // 2008-02-06 Joshwa
    // I rewrote this section that removes the value of any items in the card that are on
    // special because it did not take into account that items can have multiple quantities
    if (MODULE_SHIPPING_FREEAMOUNT_HIDE_SPECIALS == 'True') {
      if ($cart->count_contents() > 0) {
        $products = $cart->get_products();
        for ($i=0, $n=sizeof($products); $i<$n; $i++) {
          if ($special_price = tep_get_products_special_price($products[$i]['id'])) {
            $cart_total -= ($special_price * $products[$i]['quantity']);
          }
        }
      }
    }
    // End of modification by Joshwa


 if ($cart_total < MODULE_SHIPPING_FREEAMOUNT_AMOUNT)
 {
if (MODULE_SHIPPING_FREEAMOUNT_DISPLAY == 'True')
  {
$this->quotes['error'] = MODULE_SHIPPING_FREEAMOUNT_TEXT_ERROR;
  }
$get_total = false;
  } else {
   $get_total = true;
  }
 $total_weight = $shipping_num_boxes * $shipping_weight;
      if ($total_weight > MODULE_SHIPPING_FREEAMOUNT_WEIGHT_MAX)
     {
if (MODULE_SHIPPING_FREEAMOUNT_DISPLAY == 'True')
  {
       $this->quotes['error'] = MODULE_SHIPPING_FREEAMOUNT_TEXT_TO_HEIGHT;
  }
$get_weight = false;
 } else {
  $get_weight = true;
 }


if (($get_total == true && $get_weight == true))
{
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_FREEAMOUNT_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_FREEAMOUNT_TEXT_WAY,
'cost' => MODULE_SHIPPING_FREEAMOUNT_COST)));
}




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


 return $this->quotes;


}


    function check() {
      if (!isset($this->_check)) {
        $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_FREEAMOUNT_STATUS'");
        $this->_check = tep_db_num_rows($check_query);
      }
      return $this->_check;
    }


    function install() {
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Free Shipping with Minimum Purchase', 'MODULE_SHIPPING_FREEAMOUNT_STATUS', 'True', 'Do you want to offer minimum order free shipping?', '6', '7', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id,  sort_order, date_added) values ('Maximum Weight', 'MODULE_SHIPPING_FREEAMOUNT_WEIGHT_MAX', '10', 'What is the maximum weight you will ship?', '6', '8', now())");
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Display', 'MODULE_SHIPPING_FREEAMOUNT_DISPLAY', 'True', 'Do you want to display text way if the minimum amount is not reached?', '6', '7', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id,  sort_order, date_added) values ('Minimum Cost', 'MODULE_SHIPPING_FREEAMOUNT_AMOUNT', '50.00', 'Minimum order amount purchased before shipping is free?', '6', '8', now())");
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id,  sort_order, set_function, date_added) values ('Disable for Specials', 'MODULE_SHIPPING_FREEAMOUNT_HIDE_SPECIALS', 'True', 'Do you want to disable free shipping for products on special?', '6', '7', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_FREEAMOUNT_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
      tep_db_query("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_FREEAMOUNT_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
   }


    function remove() {
      tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
    }


   function keys() {
     $keys = array(
           'MODULE_SHIPPING_FREEAMOUNT_STATUS',
           'MODULE_SHIPPING_FREEAMOUNT_WEIGHT_MAX',
           'MODULE_SHIPPING_FREEAMOUNT_SORT_ORDER',
           'MODULE_SHIPPING_FREEAMOUNT_DISPLAY',
           'MODULE_SHIPPING_FREEAMOUNT_HIDE_SPECIALS',
           'MODULE_SHIPPING_FREEAMOUNT_AMOUNT',
           'MODULE_SHIPPING_FREEAMOUNT_ZONE'
           );
     return $keys;
   }
 }
?>
Link to comment
Share on other sites

  • 2 weeks later...

ok picking this back up.

 

i added this key:

'MODULE_XTR_SHIPPING_FREEAMOUNT_ZONE'

i added a tb_db_query adding this to db in install

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Xtreme no free shipping', 'MODULE_XTR_SHIPPING_FREEAMOUNT_ZONE', 'True', 'Do you want to offer Xtreme free shipping?', '6', '7', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");

and this is my written function:

 

function check() {
      if (!isset($this->_check)) {
        $check_query = tep_db_query("select category_id from " . TABLE_CONFIGURATION . " where category_id >188 
then 'MODULE_XTR_SHIPPING_FREEAMOUNT_ZONE'");
        $this->_check = tep_db_num_rows($check_query);
      }
      return $this->_check;
    }

i think this function statement is not right --what i am trying to ask the statement to do is--

if the category id is greater than 188 ( and less than TBD) offer no free shipping 

 

from includes>languages>modules>shipping> freeamount.php

define('MODULE_XTR_SHIPPING_FREEAMOUNT_ZONE', 'We Offer No Free Shipping For Xtr Products.');
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...