Jump to content

Error 500 When using Paypal Express checkout button


patuga

Recommended Posts

I could never complete an order on my store with the express checkout button. i thought that now after they added the button to the cart instead of only the product page, that this problem would get fixed.

i don't know why, but i always get an error 500 when i'm on the last step of the payment. i see the screen with the total amount, my info etc, but when i click continue an error 500 appears.

 

it seems this is an old problem. but no one has any information about it.

i get these errors:

[PrestaShopException]
The length of property Address->postcode is currently 17 chars. It must be between 0 and 12 chars.
at line 954 in file classes/ObjectModel.php

949.             }
950. 
951.             $message = $this->validateField($field, $this->$field);
952.             if ($message !== true) {
953.                 if ($die) {
954.                     throw new PrestaShopException($message);
955.                 }
956.                 return $error_return ? $message : false;
957.             }
958.         }
959. 

ObjectModelCore->validateFields - [line 272 - classes/ObjectModel.php]
267.      * @return array All object fields
268.      * @throws PrestaShopException
269.      */
270.     public function getFields()
271.     {
272.         $this->validateFields();
273.         $fields = $this->formatFields(self::FORMAT_COMMON);
274. 
275.         // For retro compatibility
276.         if (Shop::isTableAssociated($this->def['table'])) {
277.             $fields = array_merge($fields, $this->getFieldsShop());

ObjectModelCore->getFields - [line 529 - classes/ObjectModel.php]
524. 
525.         // Database insertion
526.         if (Shop::checkIdShopDefault($this->def['table'])) {
527.             $this->id_shop_default = (in_array(Configuration::get('PS_SHOP_DEFAULT'), $id_shop_list) == true) ? Configuration::get('PS_SHOP_DEFAULT') : min($id_shop_list);
528.         }
529.         if (!$result = Db::getInstance()->insert($this->def['table'], $this->getFields(), $null_values)) {
530.             return false;
531.         }
532. 
533.         // Get object id in database
534.         $this->id = Db::getInstance()->Insert_ID();

ObjectModelCore->add - [line 174 - classes/Address.php] - [2 Arguments]
169.     /**
170.      * @see ObjectModel::add()
171.      */
172.     public function add($autodate = true, $null_values = false)
173.     {
174.         if (!parent::add($autodate, $null_values)) {
175.             return false;
176.         }
177. 
178.         if (Validate::isUnsignedId($this->id_customer)) {
179.             Customer::resetAddressCache($this->id_customer, $this->id);

AddressCore->add - [line 487 - classes/ObjectModel.php] - [2 Arguments]
482.      * @return bool Insertion result
483.      * @throws PrestaShopException
484.      */
485.     public function save($null_values = false, $auto_date = true)
486.     {
487.         return (int)$this->id > 0 ? $this->update($null_values) : $this->add($auto_date, $null_values);
488.     }
489. 
490.     /**
491.      * Adds current object to the database
492.      *

ObjectModelCore->save - [line 129 - modules/paypal/controllers/front/ecScOrder.php]
124.                 $orderAddress->phone = $ship_addr->Phone;
125.             }
126. 
127.             $orderAddress->id_customer = $customer->id;
128.             $orderAddress->alias = 'Paypal_Address '.($count);
129.             $orderAddress->save();
130.             $id_address = $orderAddress->id;
131.         }
132. 
133.         $this->context->cart->id_address_delivery = $id_address;
134.         $this->context->cart->id_address_invoice = $id_address;

PaypalEcScOrderModuleFrontController->postProcess - [line 242 - classes/controller/Controller.php]
237.             if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) {
238.                 $this->setMedia();
239.             }
240. 
241.             // postProcess handles ajaxProcess
242.             $this->postProcess();
243. 
244.             if (!empty($this->redirect_after)) {
245.                 $this->redirect();
246.             }
247. 

ControllerCore->run - [line 428 - classes/Dispatcher.php]
423.             if (isset($params_hook_action_dispatcher)) {
424.                 Hook::exec('actionDispatcher', $params_hook_action_dispatcher);
425.             }
426. 
427.             // Running controller
428.             $controller->run();
429. 
430.             // Execute hook dispatcher after
431.             if (isset($params_hook_action_dispatcher)) {
432.                 Hook::exec('actionDispatcherAfter', $params_hook_action_dispatcher);
433.             }

DispatcherCore->dispatch - [line 28 - index.php]
23.  * @license   https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
24.  * International Registered Trademark & Property of PrestaShop SA
25.  */
26. 
27. require(dirname(__FILE__).'/config/config.inc.php');
28. Dispatcher::getInstance()->dispatch();

 

 

paypal-error.jpg

Link to comment
Share on other sites

all those errors are happening because of the address i had on my test paypal account. once i removed the extra text from the zip code it worked.

The way to fix it is to change the file classes/address.php so that the zip code lenght is bigger than before. by default it's only 12 chars. i changed it to 32 :P i think it should be enough.

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...