Forums / Built-in Shipping and Payment Modules / Fixed Rate for light carts

Fixed Rate for light carts

Locked
Results 1 to 20 of 21
This thread is locked. New replies are disabled.
15 Sep 2007, 03:39
#1
jtcasinogames avatar

jtcasinogames

New Zenner

Join Date:
Sep 2007
Posts:
14
Plugin Contributions:
0

Fixed Rate for light carts

I want to offer a fixed rate of $6.00 for all carts who's weight is under 2 pounds. If over 2 pounds, I want to only offer UPS shipping.

How do I get the fixed rate NOT to appear as a choice for carts over 2 pounds.?
15 Sep 2007, 03:57
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: Fixed Rate for light carts

You'll have to edit code.

/includes/modules/shipping/flat.php
around line 55, you'll see this section. Add the line as shown:
        if ($check_flag == false) {
          $this->enabled = false;
        }
      }
      if ($_SESSION['cart']->show_weight() > 2) $this->enabled = false;
    }

// class methods
    function quote($method = '') {
15 Sep 2007, 04:19
#3
jtcasinogames avatar

jtcasinogames

New Zenner

Join Date:
Sep 2007
Posts:
14
Plugin Contributions:
0

Re: Fixed Rate for light carts

figures..
I am a TOTAL NOOB with this stuff.. I wouldn't even know where to start...
15 Sep 2007, 04:29
#4
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: Fixed Rate for light carts

Actually DrByte said it clear enough, read everything very carefully. If you still don't know what to do, you will have to get someone do it for you (a friend, or some freelancer)
16 Sep 2007, 02:44
#5
jtcasinogames avatar

jtcasinogames

New Zenner

Join Date:
Sep 2007
Posts:
14
Plugin Contributions:
0

Re: Fixed Rate for light carts

yellow1912:

Actually DrByte said it clear enough, read everything very carefully. If you still don't know what to do, you will have to get someone do it for you (a friend, or some freelancer)


Would I be using the flat rate module or the table rate module?
Seems like the table rate module allows input of cart weight..

As for editing the code, I don't even know how to access the code to edit it.
:no:
24 Sep 2007, 18:43
#6
jtcasinogames avatar

jtcasinogames

New Zenner

Join Date:
Sep 2007
Posts:
14
Plugin Contributions:
0

Re: Fixed Rate for light carts

DrByte:

You'll have to edit code.

/includes/modules/shipping/flat.php
around line 55, you'll see this section. Add the line as shown:
        if ($check_flag == false) {
          $this->enabled = false;
        }
      }
      if ($_SESSION['cart']->show_weight() > 2) $this->enabled = false;
    }

// class methods
    function quote($method = '') {



Ok.. I was able to add Dr. Bytes code in and it seems to work but although it works, I get the following error message in the Estimate Shipping Pop-up window when the user checks shipping costs... ( I notice it when using Internet explorer but have not noticed it using firefox.)

The error is:

Warning: usps(../admin/includes/functions/general.php): failed to open stream: No such file or directory in /hsphere/local/home/jtcasino/jtcasinogames.com/shop/includes/modules/shipping/usps.php on line 56 Warning: usps(): Failed opening '../admin/includes/functions/general.php' for inclusion (include_path='.:/hsphere/shared/apache/libexec/php4ext/php/') in /hsphere/local/home/jtcasino/jtcasinogames.com/shop/includes/modules/shipping/usps.php on line 56
24 Sep 2007, 18:48
#7
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: Fixed Rate for light carts

Check if this file exists:
admin/includes/functions/general.php

Reuploaded it if needed.
25 Sep 2007, 21:43
#8
jtcasinogames avatar

jtcasinogames

New Zenner

Join Date:
Sep 2007
Posts:
14
Plugin Contributions:
0

Re: Fixed Rate for light carts

yellow1912:

Check if this file exists:
admin/includes/functions/general.php

Reuploaded it if needed.


Yes.... That file is indeed there already
26 Sep 2007, 03:08
#9
jtcasinogames avatar

jtcasinogames

New Zenner

Join Date:
Sep 2007
Posts:
14
Plugin Contributions:
0

Re: Fixed Rate for light carts

yellow1912:

Check if this file exists:
admin/includes/functions/general.php

Reuploaded it if needed.



Yes, that file is there...

ALSO...
I notice in zen cart, I click on modules, then shipping and I get this error:

Fatal error: Call to a member function on a non-object in /hsphere/local/home/jtcasino/jtcasinogames.com/shop/includes/modules/shipping/usps.php on line 120
28 Sep 2007, 04:13
#10
jtcasinogames avatar

jtcasinogames

New Zenner

Join Date:
Sep 2007
Posts:
14
Plugin Contributions:
0

Re: Fixed Rate for light carts

To take this a step further... I just learned that my cart has not been accepting any orders ups, usps or any thing else since I put the suggested code in... Had to remove it all today so I am back to where I began...:censored:
28 Sep 2007, 04:33
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: Fixed Rate for light carts

JTCasinoGames:

/shop/includes/modules/shipping/usps.php on line 56
Where did you get your usps.php shipping module from?
What's *on* line 56 of that file?
If you turn off the USPS module, do things work properly?

JTCasinoGames:

Fatal error: Call to a member function on a non-object in /hsphere/local/home/jtcasino/jtcasinogames.com/shop/includes/modules/shipping/usps.php on line 120


What's on line 120 ?

In the master version of this module, those lines aren't trying to load any other files, and they aren't attempting to use external objects.
So, you've got something messed up in that file.


Furthermore, the code edit I offered you earlier has nothing to do with USPS, and making that change *only in the file I instructed* shouldn't have any effect on USPS.
28 Sep 2007, 23:15
#12
jtcasinogames avatar

jtcasinogames

New Zenner

Join Date:
Sep 2007
Posts:
14
Plugin Contributions:
0

Re: Fixed Rate for light carts

DrByte:

Where did you get your usps.php shipping module from?
What's *on* line 56 of that file?
If you turn off the USPS module, do things work properly?



What's on line 120 ?

In the master version of this module, those lines aren't trying to load any other files, and they aren't attempting to use external objects.
So, you've got something messed up in that file.


Furthermore, the code edit I offered you earlier has nothing to do with USPS, "and making that change *only in the file I instructed* shouldn't have any effect on USPS.



I asked the guy who is setting up my site:
He said:

"The usps.php file is the default one that came with zencart. Also, even if I try to put it on the flat.php (flat rate shipping), it's throwing the same error "
29 Sep 2007, 00:23
#13
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: Fixed Rate for light carts

JTCasinoGames:

... Also, even if I try to put it on the flat.php (flat rate shipping), it's throwing the same error "


What does he mean by "put it on the flat.php" ?
And does "throwing the same error" mean it's *exactly* the same, or just similar? Post the new error.
01 Oct 2007, 04:07
#14
jtcasinogames avatar

jtcasinogames

New Zenner

Join Date:
Sep 2007
Posts:
14
Plugin Contributions:
0

Re: Fixed Rate for light carts

DrByte:

What does he mean by "put it on the flat.php" ?
And does "throwing the same error" mean it's *exactly* the same, or just similar? Post the new error.

we were trying to get a flat rate for a item that would ship with a USPS flat rate box. The error messages we got were:

in zen cart when you select, modules then shipping we got:


Fatal error: Call to a member function on a non-object in /hsphere/local/home/jtcasino/jtcasinogames.com/shop/includes/modules/shipping/usps.php on line 120




on the website, when the customer opened the shipping estimator AND when they went to checkout, it showed the error:

Warning: usps(../admin/includes/functions/general.php): failed to open stream: No such file or directory in /hsphere/local/home/jtcasino/jtcasinogames.com/shop/includes/modules/shipping/usps.php on line 56 Warning: usps(): Failed opening '../admin/includes/functions/general.php' for inclusion (include_path='.:/hsphere/shared/apache/libexec/php4ext/php/') in /hsphere/local/home/jtcasino/jtcasinogames.com/shop/includes/modules/shipping/usps.php on line 56




These are the two errors we got.
Someone suggested that the general.php file might be missing. It was not.
01 Oct 2007, 08:37
#15
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: Fixed Rate for light carts

JTCasinoGames:

in zen cart when you select, modules then shipping we got:

Fatal error: Call to a member function on a non-object in /hsphere/local/home/jtcasino/jtcasinogames.com/shop/includes/modules/shipping/usps.php on line 120
Please post line 120 of that file. In fact, please zip up that file and post it as an attachment here.

JTCasinoGames:


on the website, when the customer opened the shipping estimator AND when they went to checkout, it showed the error:

Warning: usps([B]../admin/includes/functions/general.php): failed to open stream: No such file or directory in /hsphere/local/home/jtcasino/jtcasinogames.com/shop/includes/modules/shipping/usps.php on line 56
[/B]
It doesn't make any sense that the code would reference any admin files from the storefront. This suggests some odd customizations to your shipping module. Posting the file, as mentioned above, may help figure out what's happening.

By what method are you implementing code changes? Do you edit on a PC and then upload the changes via FTP? Which editor?
Or are you editing directly on the website with some sort of tool? Which tool?
01 Oct 2007, 22:56
#16
jtcasinogames avatar

jtcasinogames

New Zenner

Join Date:
Sep 2007
Posts:
14
Plugin Contributions:
0

Re: Fixed Rate for light carts

DrByte:

Please post line 120 of that file. In fact, please zip up that file and post it as an attachment here.

It doesn't make any sense that the code would reference any admin files from the storefront. This suggests some odd customizations to your shipping module. Posting the file, as mentioned above, may help figure out what's happening.

By what method are you implementing code changes? Do you edit on a PC and then upload the changes via FTP? Which editor?
Or are you editing directly on the website with some sort of tool? Which tool?



Here is is response:
"I do it both ways, sometimes directly on the server (notepad type) or sometimes notepad on my pc then upload...for some reason it's not seeing the other functions/classes it needs to function eventhough the setup is a default setup..."
02 Oct 2007, 06:01
#17
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: Fixed Rate for light carts

Um ... well ... that can't be the right file.

Line 120 is ... well ... blank.

and ... so is line 56.


There is some "difference" in line-endings around the line-120 mark, so I suppose it's possible that something's awry in the file. Reloading the original might help.

I'd be inclined to be reloading the files from the /includes/modules/shipping and /includes/languages/english/modules/shipping folders,
... and MAKE SURE you don't have extra unused files sitting in those folders, since they are "autoload"-type folders ... anything ending in .php will be run, even if the files are old, backups, testing, etc. So, don't keep backups in there. Keep them somewhere else.
23 Oct 2007, 03:54
#18
jtcasinogames avatar

jtcasinogames

New Zenner

Join Date:
Sep 2007
Posts:
14
Plugin Contributions:
0

Re: Fixed Rate for light carts

OK... got things back to the way they were. No more errors...
Gonna try this one more time if someone could help.

Here is what we are trying to do:

I enabled the Table Weight option.

I have it set that if the customers cart weighs 1 pound or LESS, they have the option of selecting a Table Rate Shipping fee of $6.

What I want to happen is if the cart is OVER 1 pound, I want this table rate option NOT to appear as a selection, leaving only the UPS shipping options I have already defined.

Thank you again for any help.. I am a total noob at this stuff...
27 Oct 2007, 17:48
#19
jtcasinogames avatar

jtcasinogames

New Zenner

Join Date:
Sep 2007
Posts:
14
Plugin Contributions:
0

Re: Fixed Rate for light carts

bump:cry::dontgetit
29 Oct 2007, 04:42
#20
jtcasinogames avatar

jtcasinogames

New Zenner

Join Date:
Sep 2007
Posts:
14
Plugin Contributions:
0

Re: Fixed Rate for light carts

Ok.
Just had my guy put the following line into my flat.php as Dr. Byte recomended.

if ($_SESSION['cart']->show_weight() > 2) $this->enabled = false

His response back to me was

"doesn't work still....the moment i add even this $_SESSION['cart']->show_weight() and try to open the control panel ->shipping area, it stops loading...I even uploaded a fresh flat.php and tried on another fresh install of the latest zencart but no luck...ask them where the calculate() function is, as it might not be called inside flat.php, the show_weight function/class is just running that function...."

Dr. Byte? or anyone else have a thought.