Forums / Built-in Shipping and Payment Modules / Exclude FREE SHIPPING on Two Items

Exclude FREE SHIPPING on Two Items

Results 1 to 17 of 17
06 Mar 2012, 17:48
#1
kstew923 avatar

kstew923

New Zenner

Join Date:
Mar 2011
Posts:
25
Plugin Contributions:
0

Exclude FREE SHIPPING on Two Items

I am so confused on how to do this.... I have two items (in separate categories) that I need to Exclude from the free shipping module due to their weight however both items cost exceeds $100. (Orders over $100 qualify free shipping)

Item ID_70
Item ID_22

www.N o r v e l l P r o S t o r e .com

It has been over a year since we set up our store so being well versed in the zen cart modules has left my brain.

Thank You in advance to anyone who may be able to assist me in answering the above.

Thanks
Kristi
kristi(at)norvelltanning(dot)com
06 Mar 2012, 17:53
#2
ajeh avatar

ajeh

Oba-san

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

Re: Exclude FREE SHIPPING on Two Items

Which method of Free Shipping are you using? :unsure:

It appears to be the Free Shipping Options freeoptions based on Total >= XX.XX
06 Mar 2012, 17:56
#3
ajeh avatar

ajeh

Oba-san

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

Re: Exclude FREE SHIPPING on Two Items

Also what happens when I have products over $100.00 plus these 2 Products? :unsure:
06 Mar 2012, 18:08
#4
kstew923 avatar

kstew923

New Zenner

Join Date:
Mar 2011
Posts:
25
Plugin Contributions:
0

Re: Exclude FREE SHIPPING on Two Items

Good question! In theory if the purchase met the $100 and either of these two products were then added to the cart, we would then honor the free shipping. Our shipping special states that these two items do not qualify for the total to earn free shipping.

Does this make sense?
06 Mar 2012, 18:11
#5
kstew923 avatar

kstew923

New Zenner

Join Date:
Mar 2011
Posts:
25
Plugin Contributions:
0

Re: Exclude FREE SHIPPING on Two Items

Yes we are using the Free Shipping Options freeoptions based on Total >= XX.XX
06 Mar 2012, 18:20
#6
ajeh avatar

ajeh

Oba-san

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

Re: Exclude FREE SHIPPING on Two Items

Okay so if the scenario would be:

1 Other Products is $100.00 - YES Free Shipping Option

2 Other Products is $3.95 and these 2 Products are $350 - NO Free Shipping Option

3 Other Products is $100.00 and these 2 Products are $350 making order $450 - YES Free Shipping Option

Is this correct?
06 Mar 2012, 19:07
#7
kstew923 avatar

kstew923

New Zenner

Join Date:
Mar 2011
Posts:
25
Plugin Contributions:
0

Re: Exclude FREE SHIPPING on Two Items

Exactly.
06 Mar 2012, 19:35
#8
ajeh avatar

ajeh

Oba-san

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

Re: Exclude FREE SHIPPING on Two Items

You can customize the Free Shipping Options freeoptions by customizing the code around line 77 ...
/includes/modules/shipping/freeoptions.php

For example, if you wanted products_id 6 and 12 to not be used in the calculation you can use the code in RED:
//bof: reduce price for products_id 6 and 12
      // disabled if nothing validates for total, weight or item
      if ($this->enabled) {
        global $cart;
        $products = $_SESSION['cart']->get_products();
//echo '<pre>'; echo var_dump($products); echo '</pre>' . '<br><br>';
        $reduce_price = 0;
        for ($i=0, $n=sizeof($products); $i<$n; $i++) {
//echo 'Products ID: ' . $products[$i]['id'] . ' Price: ' . $products[$i]['final_price'] * $products[$i]['quantity'] . ' name: ' . $products[$i]['name'] . ' categories_id: ' . $products[$i]['category'] . ' categories_name: ' . zen_get_categories_name($products[$i]['category']) . '<br>';
        if ($products[$i]['id'] == 6 || $products[$i]['id'] == 12) {
          $reduce_price += ($products[$i]['final_price'] * $products[$i]['quantity']);
        }
      }
//echo 'Reduce Price: ' . $reduce_price . '<br>';

        if ($this->ck_freeoptions_total) {
          switch (true) {
          case ((MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN !='' and MODULE_SHIPPING_FREEOPTIONS_TOTAL_MAX !='')):
// free shipping total should not need adjusting
//            if (($_SESSION['cart']->show_total() - $reduce_price - $_SESSION['cart']->free_shipping_prices()) >= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN and ($_SESSION['cart']->show_total() - $reduce_price - $_SESSION['cart']->free_shipping_prices()) <= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MAX) {
            if (($_SESSION['cart']->show_total() - $reduce_price) >= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN and ($_SESSION['cart']->show_total() - $reduce_price) <= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MAX) {
              $this->ck_freeoptions_total = true;
            } else {
              $this->ck_freeoptions_total = false;
            }
            break;
          case ((MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN !='')):
//            if (($_SESSION['cart']->show_total() - $reduce_price - $_SESSION['cart']->free_shipping_prices()) >= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) {
            if (($_SESSION['cart']->show_total() - $reduce_price) >= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MIN) {
              $this->ck_freeoptions_total = true;
            } else {
              $this->ck_freeoptions_total = false;
            }
            break;
          case ((MODULE_SHIPPING_FREEOPTIONS_TOTAL_MAX !='')):
//            if (($_SESSION['cart']->show_total() - $reduce_price - $_SESSION['cart']->free_shipping_prices()) <= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MAX) {
            if (($_SESSION['cart']->show_total() - $reduce_price) <= MODULE_SHIPPING_FREEOPTIONS_TOTAL_MAX) {
              $this->ck_freeoptions_total = true;
            } else {
              $this->ck_freeoptions_total = false;
            }
            break;
          }
        }
//eof: reduce price for products_id 6 and 12
06 Mar 2012, 19:42
#9
kstew923 avatar

kstew923

New Zenner

Join Date:
Mar 2011
Posts:
25
Plugin Contributions:
0

Re: Exclude FREE SHIPPING on Two Items

will try and let you know what happens - that you so much for all of your help!!
06 Mar 2012, 19:45
#10
kstew923 avatar

kstew923

New Zenner

Join Date:
Mar 2011
Posts:
25
Plugin Contributions:
0

Re: Exclude FREE SHIPPING on Two Items

This may be a dumb question but do you know the general location of this file?? I don't dig around in the code hardly ever for fear i will break the store :)
06 Mar 2012, 19:46
#11
kstew923 avatar

kstew923

New Zenner

Join Date:
Mar 2011
Posts:
25
Plugin Contributions:
0

Re: Exclude FREE SHIPPING on Two Items

nevermind I found it :)
06 Mar 2012, 19:52
#12
ajeh avatar

ajeh

Oba-san

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

Re: Exclude FREE SHIPPING on Two Items

Do not forget to change the 6 and 12 to your products_id ...
06 Mar 2012, 19:54
#13
kstew923 avatar

kstew923

New Zenner

Join Date:
Mar 2011
Posts:
25
Plugin Contributions:
0

Re: Exclude FREE SHIPPING on Two Items

This does not seem to be working properly. I have changed the code as provided on the page located @
catalog / includes / modules / shipping / freeoptions . php

Is this the correct location?
06 Mar 2012, 19:57
#14
kstew923 avatar

kstew923

New Zenner

Join Date:
Mar 2011
Posts:
25
Plugin Contributions:
0

Re: Exclude FREE SHIPPING on Two Items

It is still showing the "Free Shipping" option at checkout but is calculating the shipping below where the shipment type is selected.
06 Mar 2012, 20:28
#15
kstew923 avatar

kstew923

New Zenner

Join Date:
Mar 2011
Posts:
25
Plugin Contributions:
0

Re: Exclude FREE SHIPPING on Two Items

ugh i feel stupid! change the product id #
06 Mar 2012, 20:33
#16
kstew923 avatar

kstew923

New Zenner

Join Date:
Mar 2011
Posts:
25
Plugin Contributions:
0

Re: Exclude FREE SHIPPING on Two Items

DISCO!!! Works perfectly. If in the if future I need to add an additional product would I just add those ID# into the string??


//bof: reduce price for products_id 70 and 22 and ##
      // disabled if nothing validates for total, weight or item
      if ($this->enabled) {
        global $cart;
        $products = $_SESSION['cart']->get_products();
//echo '<pre>'; echo var_dump($products); echo '</pre>' . '<br><br>';
        $reduce_price = 0;
        for ($i=0, $n=sizeof($products); $i<$n; $i++) {
//echo 'Products ID: ' . $products[$i]['id'] . ' Price: ' . $products[$i]['final_price'] * $products[$i]['quantity'] . ' name: ' . $products[$i]['name'] . ' categories_id: ' . $products[$i]['category'] . ' categories_name: ' . zen_get_categories_name($products[$i]['category']) . '<br>';
        if ($products[$i]['id'] == 70 || $products[$i]['id'] == 22 || $products[$i]['id'] == ##) {
          $reduce_price += ($products[$i]['final_price'] * $products[$i]['quantity']);
        }
06 Mar 2012, 22:34
#17
ajeh avatar

ajeh

Oba-san

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

Re: Exclude FREE SHIPPING on Two Items

That is correct ...

Thanks for the update that this is working for you ... :smile: