Jump to content

[Solved] updrade 1.41 checkout 1 page small issue


Recommended Posts

Hi

I finished to upgrade from V1.3.2 to 1.4.1 without any big problem.
Trying to use the new checkout function in one page.

I have only one small issue:
When user sign up, then order a new product, it show an error for the payment: Error: please choose a carrier.

But the carrier is already selected by default. users have to check again the carrier then the payment options appear.

Not a big problem but if someone have the same issue and found how to solve it, I will really appreciate.


Thanks

Link to comment
Share on other sites

Hi vince76,

After some analysis, I updated class Cart.php with the default Carrier ID in the getFields() function. This removed the error - the source of the error is OrderOpcController.php - _getPaymentMethods function. Here it checks for a valid id_carrier in the cart table.

I went with this solution because I wanted the checkout to be simple. I did not want my customers to be bothered about choosing a carrier.

Do think about this solution and only then implement it.

Cheers!
http://cosmetix.in

Link to comment
Share on other sites

Hi vince76,

After some analysis, I updated class Cart.php with the default Carrier ID in the getFields() function. This removed the error - the source of the error is OrderOpcController.php - _getPaymentMethods function. Here it checks for a valid id_carrier in the cart table.

I went with this solution because I wanted the checkout to be simple. I did not want my customers to be bothered about choosing a carrier.

Do think about this solution and only then implement it.

Cheers!
http://cosmetix.in


hello
could you please explain in more details your hack ?

thx
Link to comment
Share on other sites

My requirement was to show details of the default carrier in the single page checkout and avoid asking the customer to choose from options. I realized that when a customer adds a product to the cart, the id_carrier is 0 - probably because Prestashop wants the customer to choose the carrier. So, I had to change the 0 to my default id_carrier. This ensured that the carrier data was made available in the cart. The hack details are below:

Go to line 118 in {base_dir}Cart.php. In this function, put the cart_id of your default carrier. See line "changed by cosmetix" and the line below.

public function getFields()
{
parent::validateFields();

$fields['id_address_delivery'] = (int)($this->id_address_delivery);
$fields['id_address_invoice'] = (int)($this->id_address_invoice);
$fields['id_currency'] = (int)($this->id_currency);
$fields['id_customer'] = (int)($this->id_customer);
$fields['id_guest'] = (int)($this->id_guest);
$fields['id_lang'] = (int)($this->id_lang);
/*$fields['id_carrier'] = (int)($this->id_carrier); changed by cosmetix */
$fields['id_carrier'] = 9;
$fields['recyclable'] = (int)($this->recyclable);
$fields['gift'] = (int)($this->gift);
$fields['secure_key'] = pSQL($this->secure_key);
$fields['gift_message'] = pSQL($this->gift_message);
$fields['date_add'] = pSQL($this->date_add);
$fields['date_upd'] = pSQL($this->date_upd);

return $fields;
}

Hope this helps!

Link to comment
Share on other sites

  • 4 months later...

Please, I am a beginner, and have the same problem with "error: please choose a carrier". Can you tell me which files (or codes) must I take from SVN changeset 6203 to solve the problem, and where are these files?

Angel

 

----------------------

SOLVED

 

I already found the files !!!

As Thomas Didierjean said above:

"You can get the changed code from the "source" tab on the bug page"

 

However, I did not find the "source" tab because I did not have an account in http://forge.prestashop.com

Then I registered, and after it, I was able to view the two files I had to use...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...