Jump to content

Check out on Prestashop Version 1.4.8.2 Fatal Error with Voucher


Recommended Posts

I hope someone can help me? I am operating Prestashop Version 1.4.8.2. I have the PayPal payment gateway module that came with the program. I have a couple issues here. When selecting a product and checking out normally, there is no problem. However, if I should use a voucher for a specific amount say $50.00, when posted in the cart the amount is $48 and some change not $50. If I should choose to continue anyway, when I get to the final phase of checking out, the voucher is subtracted and not totally used up and the cart goes into a fatal error. Can someone tell me if there is an easy fix for this, or what the problem might be?

 

 

Thanks in advance,

 

Steve

Link to comment
Share on other sites

Ive got the same setup as you with 1.4.8.2 and paypal. I havent had any preset amounts for vouchers yet, just percentages..but Im wondering.. what do you have for the setting when setting up the voucher about what to do with whats left.. and.. is there any info other than fatal error? Like any programming details, can you tell what page is throwing it, maybe which module or any log errors?

 

Just pre-solving as Im afraid I will probably run into this sooner or later as well.

Link to comment
Share on other sites

I am told that is the voucher amount is not used up it will create a balance for the customer to use next time they purchase. This will happen until such time as the entire amount of the voucher has been used up. I have tested mine and the only part of the vouchers not working is the predetermined amount. The percentages and free shipping part work for me just not the fixed amount. Also when it goes into fatal error, it goes to a blank page on my site and just says fatal erro, no code given. I did speak with prestashop and they informed me that this issue would be fixed in Prestasho version 1.5 when it is released.

Link to comment
Share on other sites

A quick update.. I restored my live site to my development area and tested this. This is an error and an issue as you noted as I reproduced it exactly as you described. I will see if there is something I can code up to solve this, no promises, but I will be working on it today. I noticed a few things so far in testing.

 

1. If the voucher amount is more than the cart amount it will fatal error no matter what the behavior.

2. If the voucher amount is less than the cart amount it appears not to fail, however, with my setup so far I have not completely validated this.

 

It appears to be that processing a $0 cart crashes the paypal module. That is the tack I am taking at present.

 

This issue can not be left for 1.5 as I am not sure I will be upgrading any time in the near future.

 

I will post further updates or a fix when I come up with them.

  • Like 1
Link to comment
Share on other sites

Here is an update..no solution yet.

 

I found a crumb as to where the problem is coming from but not the source quite yet.. being a noob at this, it is taking a while to track down all the rabbit holes PS jumps through to make its magic happen.

 

In the file /controllers/ParentOrderController.php around line 156 or so is this.


protected function _checkFreeOrder()
{
	if (self::$cart->getOrderTotal() <= 0)
	{

		$order = new FreeOrder();
		$order->free_order_class = true;
// error here
		$order->validateOrder((int)(self::$cart->id), Configuration::get('PS_OS_PAYMENT'), 0, Tools::displayError('Free order', false), null, array(), null, false, self::$cart->secure_key);

		return (int)Order::getOrderByCartId((int)self::$cart->id);


	}
	return false;
}

 

The function validateOrder under the "// error here" I added is what is failing but I havent found that function yet.

 

If I remark that line it tries to go to paypal.. but thats not really what needs to happen.

 

I realized that this isnt really linked to paypal or vouchers.. it is simply choking, as I had suspected, because the cart value is 0.

 

I just tried creating a $0 product with $0 shipping, no voucher, and got the same fatal error result.

 

In other words, no matter what pay module you use, and regardless of vouchers or anything else, if you have a cart and the total is $0, when the client tries to complete the transaction, PrestaShop will have a fatal error.

 

I ended up with a massive headache and gave up for today. More hunting in a day or two as tomorrow is my birthday and Im not beating my head on this for that :)

  • Like 1
Link to comment
Share on other sites

I have the same problem Fatal error............. like you said it appears to happen when cart = $0 I was trying to ship something for free to a customer by Using a 100% off coupon and a Free shipping coupon.

Link to comment
Share on other sites

Well.. I decided ta add this to the bug tracker and found a couple things.

 

First, its already in there.

 

Second, the error stems from exactly where I thought in that function ans under any $0 cart instance or negative amount.

 

Third, unless I am mistaken, this is all I can find about the fix, a quote from another 1.4 user:

 

As per Damien METZGER said "Was already fixed in 1.5"

 

The bug is listed as fixed but I cant seem to find the update for 1.4

 

Surely..surely.. they wouldnt let this bug live in all the 1.4.x's out there.. surely..

 

Throw us 1.4.8.2 people a bone here guys..

 

Here is a bug tracker link saying its fixed.. (resolved)

http://forge.prestas...owse/PSCFI-5814

Link to comment
Share on other sites

I replaced with the information in the thread, however it did work but did not give the remaining value of the voucher. So if the voucher is $50.00 and the product is $5.00, there should be a balance of $45.00. With the code from the link, it uses the whole voucher and does not give any amount back. As I said I am not real good with writing the codes but there might be somewhere else that needs a modifications also.

Link to comment
Share on other sites

  • 1 month later...

Comment out this part in classes/PayMentModule.php (validateOrder function)

 

if (!$this->active)

die(Tools::displayError());

 

Free order will work again...

 

is this true??

i also found http://forge.prestashop.com/browse/PSCFI-5887

 

THANK YOU!!

it did so, and i go through ... but what does that mean for "production"??

 

 

$cart = new Cart((int)($id_cart));

// Does order already exists ?

/* if (!$this->active)

die(Tools::displayError()); */

 

 

i also found http://forge.prestashop.com/browse/PSCFI-5887

Edited by eltnap (see edit history)
Link to comment
Share on other sites

  • 3 years later...
×
×
  • Create New...