If this is your first visit, check our documentation. To post, register or login.
Forums / Built-in Shipping and Payment Modules / Different shipping methods for different categories

Different shipping methods for different categories

Started by tylerd213 on 13 Mar 2008, 2:16 AM · Views: 107,885

Results 381 to 400 of 554
20 Oct 2011, 11:45 PM
#381
ajeh avatar

ajeh

Oba-san

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

Different shipping methods for different categories

Check that you do not have a Zone set for this shipping module you should have a green dot ...

Also check that if using Sort Orders on your shipping modules that you use a Sort Order on all of the installed shipping modules and that they are unique ...

I cannot reproduce the problem on my site ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

20 Oct 2011, 11:49 PM
#382
brobrow avatar

brobrow

New Zenner

Join Date:
Jun 2011
Posts:
13
Plugin Contributions:
0

Re: Different shipping methods for different categories

I have no zone set.

Each module has a unique sort order.

I have item, freeshipper and storepickup enabled.

If I upload the default item.php the icon goes back green.

If I add the code and upload it the code turns yellow. Really weird.

20 Oct 2011, 11:58 PM
#383
brobrow avatar

brobrow

New Zenner

Join Date:
Jun 2011
Posts:
13
Plugin Contributions:
0

Re: Different shipping methods for different categories

Ok the icon is green now.

I copied only the red code from post #376 and added it after rather than overwriting the whole lot.

Now the item shipping shows all the time, even when an item from that category is in the cart.

e.g. product http://www.blackmarketartco.com/index.php?main_page=product_info&cPath=22_31&products_id=676

Here it my item.php now

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

 * @version $Id: item.php 14498 2009-10-01 20:16:16Z ajeh $

 */





  class item {

    var $code, $title, $description, $icon, $enabled;



// class constructor

    function item() {

      global $order, $db;



      $this->code = 'item';

      $this->title = MODULE_SHIPPING_ITEM_TEXT_TITLE;

      $this->description = MODULE_SHIPPING_ITEM_TEXT_DESCRIPTION;

      $this->sort_order = MODULE_SHIPPING_ITEM_SORT_ORDER;

      $this->icon = '';

      $this->tax_class = MODULE_SHIPPING_ITEM_TAX_CLASS;

      $this->tax_basis = MODULE_SHIPPING_ITEM_TAX_BASIS;



      // disable only when entire cart is free shipping

      if (zen_get_shipping_enabled($this->code)) {

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

      }
	  
	  // bof: turn off for master_categories_id 31, 32 or 33
      if (!IS_ADMIN_FLAG) {
        global $cart;
        $chk_products = 0;
        $chk_products += $_SESSION['cart']->in_cart_check('master_categories_id','31');
        $chk_products += $_SESSION['cart']->in_cart_check('master_categories_id','22_31');
        $chk_products += $_SESSION['cart']->in_cart_check('master_categories_id','22');
        if ($chk_products > 0) {
          $this->enabled = false;
        }
      }
// eof: turn off for master_categories_id 31, 32 or 33



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

        $check_flag = false;

        $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_ITEM_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;

        }

      }

    }



// class methods

    function quote($method = '') {

      global $order, $total_count;



      // adjusted count for free shipping

      $item_total_count = $total_count - $_SESSION['cart']->free_shipping_items();

      $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) + MODULE_SHIPPING_ITEM_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;

    }



    function check() {

      global $db;

      if (!isset($this->_check)) {

        $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_ITEM_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 Item Shipping', 'MODULE_SHIPPING_ITEM_STATUS', 'True', 'Do you want to offer per item 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_ITEM_COST', '2.50', 'The shipping cost will be multiplied by the number of items 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_ITEM_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_ITEM_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_ITEM_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_ITEM_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_ITEM_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\_ITEM\_%'");

    }



    function keys() {

      return array('MODULE_SHIPPING_ITEM_STATUS', 'MODULE_SHIPPING_ITEM_COST', 'MODULE_SHIPPING_ITEM_HANDLING', 'MODULE_SHIPPING_ITEM_TAX_CLASS', 'MODULE_SHIPPING_ITEM_TAX_BASIS', 'MODULE_SHIPPING_ITEM_ZONE', 'MODULE_SHIPPING_ITEM_SORT_ORDER');

    }

  }

?>
21 Oct 2011, 12:12 AM
#384
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

These are not set right:

        $chk_products += $_SESSION['cart']->in_cart_check('master_categories_id','31');
        $chk_products += $_SESSION['cart']->in_cart_check('master_categories_id','22_31');
        $chk_products += $_SESSION['cart']->in_cart_check('master_categories_id','22');

If you want it for master_categories_id 31, 32 and 33 then use:

        $chk_products += $_SESSION['cart']->in_cart_check('master_categories_id','31');
        $chk_products += $_SESSION['cart']->in_cart_check('master_categories_id','32');
        $chk_products += $_SESSION['cart']->in_cart_check('master_categories_id','33');

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 Oct 2011, 12:16 AM
#385
brobrow avatar

brobrow

New Zenner

Join Date:
Jun 2011
Posts:
13
Plugin Contributions:
0

Re: Different shipping methods for different categories

:oops:Sorry, that was one I was trying to see if it Made any difference.

This is what my actual live item.php looks like. Still has the same problem of being enabled when a category 31 product is in the cart.

Again, sorry I posted the wrong code and thanks for helping :)

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

 * @version $Id: item.php 14498 2009-10-01 20:16:16Z ajeh $

 */





  class item {

    var $code, $title, $description, $icon, $enabled;



// class constructor

    function item() {

      global $order, $db;



      $this->code = 'item';

      $this->title = MODULE_SHIPPING_ITEM_TEXT_TITLE;

      $this->description = MODULE_SHIPPING_ITEM_TEXT_DESCRIPTION;

      $this->sort_order = MODULE_SHIPPING_ITEM_SORT_ORDER;

      $this->icon = '';

      $this->tax_class = MODULE_SHIPPING_ITEM_TAX_CLASS;

      $this->tax_basis = MODULE_SHIPPING_ITEM_TAX_BASIS;



      // disable only when entire cart is free shipping

      if (zen_get_shipping_enabled($this->code)) {

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

      }
	  
	  // bof: turn off for master_categories_id 31, 32 or 33
      if (!IS_ADMIN_FLAG) {
        global $cart;
        $chk_products = 0;
        $chk_products += $_SESSION['cart']->in_cart_check('master_categories_id','31');
        $chk_products += $_SESSION['cart']->in_cart_check('master_categories_id','32');
        $chk_products += $_SESSION['cart']->in_cart_check('master_categories_id','33');
        if ($chk_products > 0) {
          $this->enabled = false;
        }
      }
// eof: turn off for master_categories_id 31, 32 or 33



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

        $check_flag = false;

        $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_ITEM_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;

        }

      }

    }



// class methods

    function quote($method = '') {

      global $order, $total_count;



      // adjusted count for free shipping

      $item_total_count = $total_count - $_SESSION['cart']->free_shipping_items();

      $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) + MODULE_SHIPPING_ITEM_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;

    }



    function check() {

      global $db;

      if (!isset($this->_check)) {

        $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_ITEM_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 Item Shipping', 'MODULE_SHIPPING_ITEM_STATUS', 'True', 'Do you want to offer per item 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_ITEM_COST', '2.50', 'The shipping cost will be multiplied by the number of items 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_ITEM_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_ITEM_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_ITEM_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_ITEM_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_ITEM_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\_ITEM\_%'");

    }



    function keys() {

      return array('MODULE_SHIPPING_ITEM_STATUS', 'MODULE_SHIPPING_ITEM_COST', 'MODULE_SHIPPING_ITEM_HANDLING', 'MODULE_SHIPPING_ITEM_TAX_CLASS', 'MODULE_SHIPPING_ITEM_TAX_BASIS', 'MODULE_SHIPPING_ITEM_ZONE', 'MODULE_SHIPPING_ITEM_SORT_ORDER');

    }

  }

?>
21 Oct 2011, 12:31 AM
#386
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

Could you go into phpMyAdmin and look at the table:
products

and look at the Products and their master_categories_id to see if they are correct?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 Oct 2011, 12:38 AM
#387
brobrow avatar

brobrow

New Zenner

Join Date:
Jun 2011
Posts:
13
Plugin Contributions:
0

Re: Different shipping methods for different categories

Yes, the master category id for product 676 is 31.

21 Oct 2011, 12:41 AM
#388
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

Using your FTP program, can you view the code in:
/includes/modules/shipping/item.php

and see what these lines read:

        $chk_products += $_SESSION['cart']->in_cart_check('master_categories_id','31');
        $chk_products += $_SESSION['cart']->in_cart_check('master_categories_id','32');
        $chk_products += $_SESSION['cart']->in_cart_check('master_categories_id','33');

do they say 31, 32 and 33?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 Oct 2011, 12:42 AM
#389
brobrow avatar

brobrow

New Zenner

Join Date:
Jun 2011
Posts:
13
Plugin Contributions:
0

Re: Different shipping methods for different categories

I do however have 25 records in the product table where master_category_id is 0.

I assume thats bad?

21 Oct 2011, 12:44 AM
#390
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

That would be bad ... :eek:

You need all of the master_categories_id to be correct and to see if you have other bad data such as the records in the:
products_to_categories

Bad data is just going to compound and continue to produce issues ...

What version of Zen Cart are you running?

Clean install or an Upgrade?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 Oct 2011, 12:57 AM
#391
brobrow avatar

brobrow

New Zenner

Join Date:
Jun 2011
Posts:
13
Plugin Contributions:
0

Re: Different shipping methods for different categories

Yikes, ok I got multiple issues going on at once :(

Im gonna go and update those records now. I imported them with apsona.

1.39h

Clean install.

I have used oscommerce data importer 2.2 to bring info over from our old website.

21 Oct 2011, 1:03 AM
#392
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

If you have data from old osc and imported etc. etc. and have bad data ... you really need to go through your database and make sure that all of the data is correct ...

Importing data may help straighten out something and may break others ...

I do not use the Import programs so I really cannot tell you if that is going to fix or break things ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 Oct 2011, 1:24 AM
#393
brobrow avatar

brobrow

New Zenner

Join Date:
Jun 2011
Posts:
13
Plugin Contributions:
0

Re: Different shipping methods for different categories

All working now!!!!!!!!

Thank you so much.

Fixed my products table. The entries were already in products to categories correctly.

Now the problem with the item.php was some screwy formatting thing with notepad++ and filezilla.

Closed the file re downloaded it and it put all that code on one line (hence it was commented out). When I downloaded it without closing it in notepad++ it didnt see any differences (it normally does if something is different).

Eevry time I ftp item.php with filezilla it keeps putting that section of code on one line. So weird, never had that happen before.

21 Oct 2011, 1:27 AM
#394
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

Thanks for the update that you have this corrected and working now ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 Oct 2011, 11:38 AM
#395
1uppromotions avatar

1uppromotions

New Zenner

Join Date:
Oct 2011
Location:
Ballajura, Perth, Western Australia
Posts:
8
Plugin Contributions:
0

Re: Different shipping methods for different categories

Hi,
I am also having trouble with the shipping problems.

I want to be able to assign specific shipping costs to each product .. Is this possible ??

If so can someone help me with HOW to do it PLEASE ????

Thanks in advance....

21 Oct 2011, 1:17 PM
#396
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

You can do this with the Per Unit perweightunit shipping module ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 Oct 2011, 11:29 PM
#397
brobrow avatar

brobrow

New Zenner

Join Date:
Jun 2011
Posts:
13
Plugin Contributions:
0

Re: Different shipping methods for different categories

Is it possible to check the products_options_values_id and use that to turn a shipping method on/off?

Two of our product attributes are too big to be shipped internationally, so I would like to disable shipping and show a message if someone adds one of these to cart to ship international.

22 Oct 2011, 12:26 AM
#398
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

Let's say you want to turn off the Flat Rate flat shipping module when you have the color red in the cart ...

You could customize the code:
/includes/modules/shipping/flat.php

If the setting for the Color where Option Name ID is 1 and the setting for Red where the Option Value ID is 16, you could use the new code in RED:

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

// bof: turn off for Option ID 1 and Option Value ID 16
      if (!IS_ADMIN_FLAG) {
        global $cart;
        $cnt_attribute = 0;
        $products = $_SESSION['cart']->get_products();
        for ($i=0, $n=sizeof($products); $i<$n; $i++) {
          if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
            foreach ($products[$i]['attributes'] as $option => $value) {
              // comment out echo when done testing
              echo 'I see: ' . $products[$i]['id'] . ' - ' . $option . ' - ' . $value . '<br>';
              if ($option == 1 and $value == 16) {
                $cnt_attribute += 1;
              }
            }
          }
        }
        if ($cnt_attribute > 0) {
          $this->enabled = false;
        }
      }
// eof: turn off for Option ID 1 and Option Value ID 16

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

22 Oct 2011, 2:21 AM
#399
brobrow avatar

brobrow

New Zenner

Join Date:
Jun 2011
Posts:
13
Plugin Contributions:
0

Re: Different shipping methods for different categories

AWESOME! Thanks so much. :clap:

Im playing around with it a bit, got it checking for multiple attributes and then it echos the product name(s).

Just gotta work out how to style the output on the checkout_shipping page.

Ill post my final code when im done.

22 Oct 2011, 2:28 AM
#400
ajeh avatar

ajeh

Oba-san

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

Re: Different shipping methods for different categories

The echo is more there to help you identify things ... so you really just need to comment that out once you have things working ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!