Wednesday, April 23, 2008

TUTOS - Blank Screen When You Add A New Bug

So I love TUTOS so far, except I encountered a bug when I entered a bug. I found the solution in their forum, but it was after searching google for a while with no luck I was about to post something for help when I noticed a post which had the answer.

Go into php/bugtracking/ folder.
edit bug.pinc

line 880 something...
$mail->resetBody();
change to
$mail->resetBodies();

delete all the echo or debugging information throughout the mess you have made trying to fix this.
Thats it!!

Labels: , , , , , , , , ,

Sunday, March 30, 2008

Subtotal Not Adding Up Correctly in PHP (with Items over 1000)

I am on a few list serves and occasionally I am able to get a few of the questions answered. I will post some of them on my blog occassionally in case you run into the same issues. In this case, one of my fellow programmers ran into an issue where his subtotals where not adding up properly. I had run into the same issue myself. Just read below. It is simply a matter or recognizing that your variable might be formatted to display with a comma, such as 1,432.12


----- Original Message -----
From: Matt
To: List
Cc: Mauricio
Sent: Sunday, March 30, 2008 11:48 PM
Subject: Re: it it a php bug? or am i just slow?

That was it!!

apparently the ',' was settype()ing it on the fly as a string, so when it came to the += it was evaluating wrong..

Many thanks Mauricio!

Mauricio Zuniga - Systems Engineer wrote:
also,
even though you are giving us the values,
could it be possible that you have your number formatted with a comma?
such as 1,321.43.
I once ran into an issue where my subtotals were not correct because of this...
----- Original Message -----
From:
To:
Cc:
Sent: Sunday, March 30, 2008 10:29 PM
Subject: Re: it it a php bug? or am i just slow?

I set up the following loop:
$item_price = 0;
$items = array(50, 100, 1357);
foreach ($items as $v) {
$item_price += $v;
echo "
$item_price";
}
and it gave the following output:
50
150
1507
which is what was expected.

Could you post the actual loop code you are using? Perhaps there is something there we can help with?

Daniel

Mattwrote:
Not sure if this is a bug in PHP, or if I'm just especially slow...

I've got a script that's calculating the total order for items in a cart. To do this it's doing a simple += on the variable $subtotal as it prints each row on the cart page, then it prints $subtotal in the appropriate spot at the end. So on its way through the loop that prints each row, right at the end of the loop it does:

$subtotal += $item_price;

Simple, straight forward, not a problem.

It works perfectly fine. IF the value of $item_price <= 999.99 (?!??!!!?!?!?!?)

Anything >= 1000.00 and it adds 1 to subtotal, not the $itemprice. (?!?!?!?)

I've echoed $item_price and $subtotal while the loop is printing, I get results as below:

// first iteration
echo $item_price; // 50.00
echo $subtotal; // 50.00

// second iteration
echo $item_price; // 100.00
echo $subtotal; // 150.00

// so far, so good, right?

// third iteration
echo $item_price; // 1357.00
echo $subtotal; // 151.00

/// what??

// fourth iteration
echo $item_price; // 100.00
echo $subtotal; // 251.00


Any ideas? The only option I've considered so far is chucking every computer in the house out the damn window and becoming a carpenter, but I'm still on the fence about that.


-M.E.


--
_________________________________________



--
_________________________________________




Labels: , , , , , , , , , , , ,

Tuesday, February 26, 2008

Fedex Track Service v2 : Cannot Authenticate

I was trying to deploy the track service via api for one of my clients and I was using the fedex php examples they provided. Unfortunately, I kept on getting an authentication error. It seemed the credentials Fedex had provided me where invalid. I tested this across several servers and then moved on to other api calls... it seemed it was the track service that was causing the issue.

After much debugging, support tickets, and hair turned white - we were finally able to get to the bottom of it. If you look in the wsdl, the call to the gateway is being made to

https:///gateway.fedex.com:443/web.services

try changing this to

https://gatewaybeta.fedex.com:443/web.services

the simple difference is the beta in 'gatewaybeta'. This routes you to the testing servers vs the production servers.

Hope this helps you. I spent days going back and forth on this.

Labels: , , , , , , , , , , , , , , , , ,