Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Extra Order Fee not apply to certain products?

Extra Order Fee not apply to certain products?

Views: 1,861

Results 1 to 20 of 22
17 Oct 2012, 3:33 AM
#1
leevalentine001 avatar

leevalentine001

New Zenner

Join Date:
Oct 2012
Posts:
7
Plugin Contributions:
0

Extra Order Fee not apply to certain products?

Hi,

I was asked by a client to add an additional fee for any orders going to a certain state (Western Australia) due to quarantine fees.

They sell seeds, but they also have a couple of books they also sell which don't need the additional fee added and would like to remove the fee only from those products.

Is this possible? Please note that my PHP skills are very limited, so if there's PHP editting involved, please specify exactly which file name and where to find it.

I should also note they are running v1.3.9h.

Thanks in advance,

Lee

18 Oct 2012, 3:23 AM
#2
leevalentine001 avatar

leevalentine001

New Zenner

Join Date:
Oct 2012
Posts:
7
Plugin Contributions:
0

Re: Extra Order Fee not apply to certain products?

Okay, I just had a thought... since there's only about 3 - 4 products that don't need the fee applied, would it be possible to edit the code in ot_extraorderfee.php to ignore those few product ID's?

I've been staring at the file for half hour now and my PHP/SQL skills are far too limited to work out how to do this. Can anyone open up their copy of the file and see if they can see a way to do it? It would be greatly appreciated.

Lee

18 Oct 2012, 3:55 AM
#3
ajeh avatar

ajeh

Oba-san

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

Re: Extra Order Fee not apply to certain products?

What happens on a mixed cart that has those 3-4 Products and 3-4 other Products that do need to have the fee?

18 Oct 2012, 4:06 AM
#4
leevalentine001 avatar

leevalentine001

New Zenner

Join Date:
Oct 2012
Posts:
7
Plugin Contributions:
0

Re: Extra Order Fee not apply to certain products?

The fee will still be applied. Basically, the company sells grass seeds. As long as there are grass seeds in the order, there needs to be a flat charge of $27 applied to the total order, no matter how many items are entered.

Eg. 1 x 1kg bag of grass seed = $27 fee applied to total order
1 x book = no fee applied
1 x 1kg bag of grass seed + book = $27 fee applied to total order
3 x 1kg bag of seed + 2 x 5kg bag of seed + 2 books + bottle of herbicide = $27 fee applied to total order

If you get what I mean.

I'm thinking the easiest way to do this would be to stop the fee applying to any categories apart from the 2 that contain grass seed products. Ie. There's only 4 active categories total and only 2 contain products that require the extra fee. As long as the fee is still applied even when a non-fee item is in the cart, that would work fine. I'm just not sure how to write it.

18 Oct 2012, 5:21 AM
#5
leevalentine001 avatar

leevalentine001

New Zenner

Join Date:
Oct 2012
Posts:
7
Plugin Contributions:
0

Re: Extra Order Fee not apply to certain products?

Haha, I only just realized that you are the person who wrote this module! Luck is on my side if I have the modules creator helping me out!

I'm thinking this query...

$check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_ORDER_TOTAL_EXTRAORDERFEE_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");

... could be edited to exclude a category id with something like "categories_id from categories". But seeing as that query is just selecting a zone, I'm not sure if it's possible to have it ignore a category or a product. That may have to be some kind of check that occurs just before the extra order fee is applied, for example (in pseudo-code) "if the category id from table category is equal to 1 or 3 then extra order fee equals null". Is this possible?

18 Oct 2012, 1:27 PM
#6
ajeh avatar

ajeh

Oba-san

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

Re: Extra Order Fee not apply to certain products?

This can be done by checking the master_categories_id of the Products in the categories that should not have the fee (usually the categories_id) by customizing the code with the code in RED:

// eof: check zone and add extra fee

[B]// bof: add extra control
    // check the count of a specific field
    // if only products from master_categories_id 10 and 12 are in the cart then do not show
    $chk_cat = 0;
    // check how many Products are in the cart for master_categories_id 10 and 12
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','10');
    $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','12');
    // if these are the only Products then turn off the extra fee module
    if ($chk_cat > 0 && $_SESSION['cart']->count_contents() == $chk_cat) {
      $pass = false;
    }
// eof: add extra control
[/B]
        if ($pass == true) {

NOTE: before using this new code, do you use this module with a Zone added to it for the extra order fee?

18 Oct 2012, 9:23 PM
#7
leevalentine001 avatar

leevalentine001

New Zenner

Join Date:
Oct 2012
Posts:
7
Plugin Contributions:
0

Re: Extra Order Fee not apply to certain products?

Hi Ajeh,

Thanks so much for your help. As it is set up currently, I have 2 zones defined. One for all of Australia (as they do not ship internationally) and another just for Western Australia (which the module is attached to). Will the above code still work in this situation or is there a workaround if not?

Thanks again!

Lee

18 Oct 2012, 9:37 PM
#8
leevalentine001 avatar

leevalentine001

New Zenner

Join Date:
Oct 2012
Posts:
7
Plugin Contributions:
0

Re: Extra Order Fee not apply to certain products?

Whoo! It seems to work great, just had to replace the category ID's in your code with the ones I needed it to ignore in the clients site. Now all I need to do is find where to change the text for 'extra order fee' which I imagine is defined in languages somewhere. Thanks so much, I hope this helps others in the future too! :D

18 Oct 2012, 11:59 PM
#9
ajeh avatar

ajeh

Oba-san

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

Re: Extra Order Fee not apply to certain products?

Thanks to you I have found a ... er ... umm ... bug in my code ... :eek:

When you do not use a Zone ... the code breaks ... :lookaroun

I kinda, sorta, forgot to check what happens when there isn't a Zone set and never made allowances for it ...

Hate when I do that ... back to the drawing board and hope to get some new code posted soon to fix that ...

19 Oct 2012, 4:23 AM
#10
leevalentine001 avatar

leevalentine001

New Zenner

Join Date:
Oct 2012
Posts:
7
Plugin Contributions:
0

Re: Extra Order Fee not apply to certain products?

Haha, well, glad I could help? :P

When you fix it up, let me know, I wouldn't mind seeing what changes have been made. The client I'm using the plug in for will never have that problem though, so this still works perfectly for what they need. Thanks for the help by the way, I just paid them a visit and got today's pay from them :P :P :P

19 Oct 2012, 4:50 AM
#11
ajeh avatar

ajeh

Oba-san

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

Re: Extra Order Fee not apply to certain products?

Glad that all is right in the world and I will post that this is fixed as soon as I am done testing it ... thanks again!

20 Oct 2012, 2:07 AM
#12
ajeh avatar

ajeh

Oba-san

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

Re: Extra Order Fee not apply to certain products?

The updated version has been posted to the add on plugins at:
http://www.zen-cart.com/downloads.php?do=file&id=1407

and should run fine with v1.3.9h, but backup your old files before installing ... :cool:

29 Oct 2012, 3:49 PM
#13
amyn avatar

amyn

New Zenner

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

Re: Extra Order Fee not apply to certain products?

This add-on is what I need, except for the fact that I need to use it as an option not automatically added in. Is there a way to do that or another add-on that will help me achieve this?

29 Oct 2012, 4:14 PM
#14
ajeh avatar

ajeh

Oba-san

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

Re: Extra Order Fee not apply to certain products?

Could you expand a bit on what you are needing to do with this? :lookaroun

29 Oct 2012, 4:25 PM
#15
amyn avatar

amyn

New Zenner

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

Re: Extra Order Fee not apply to certain products?

I need an optional delivery confirmation charge. I am already using the optional shipping insurance module and am trying to clone that now to work as the delivery charge, but was wondering if this extra order fee could work as well as an optional feature instead of adding automatically into the order total.

It may be best if I keep trying to clone the optional shipping insurance module since it already has the "optional" feature built in, than trying to change this extra order fee module. Not sure...

29 Oct 2012, 4:39 PM
#16
ajeh avatar

ajeh

Oba-san

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

Re: Extra Order Fee not apply to certain products?

The Extra Order Fee is not optional from the customer's stand point ... so you are better off building your Order Total module from the optional shipping insurance module as the base foundation will be there ...

29 Oct 2012, 5:38 PM
#17
amyn avatar

amyn

New Zenner

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

Re: Extra Order Fee not apply to certain products?

Thanks for the direction. I was able to clone the Optional Shipping Insurance. It seems to be working well. :clap:

29 Oct 2012, 5:46 PM
#18
ajeh avatar

ajeh

Oba-san

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

Re: Extra Order Fee not apply to certain products?

Excellent job! :cool:

Perhaps you will consider adding that to our add on Plugins ...

29 Oct 2012, 7:37 PM
#19
amyn avatar

amyn

New Zenner

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

Re: Extra Order Fee not apply to certain products?

It's possible. I have never done that before but I could try. I would need to clean up my modifications a little bit and read through those submission requirements and learn exactly how to package it properly, even if it is just a clone I suppose.

29 Oct 2012, 7:52 PM
#20
ajeh avatar

ajeh

Oba-san

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

Re: Extra Order Fee not apply to certain products?

Often times, those clones help others in better understanding of how something works and seeing how they can expand an add on plugin to their specific needs ...

And, for you ... think of all the fun you get to have in tidying things up to make this a handy dandy add on plugin for others ... :lookaroun