Jump to content

[solved] After server change: Property OrderPayment->amount is not valid


oliiix

Recommended Posts

Hello Everyone

I have switched from a shared hosting to a VPS server. I use the same php version and the settings should also all be as they should for running prestashop.

Now what is strange is that I cannot use any other payment methods than my bitcoin payment module and bankwire (i also have banktransfer which is a copy of bankwire but with additional fees on it for swiss customers). Everything works but the module universal payment methods didn't. I thought that's no problem I just have to use another module for the payment methods I created with univ. pay. But it looks as if the problem is bigger.

When I try to complete the order with the universal payment method (I just added 1 payment option: cash on collection) OR when I try to use the "Cash on Delivery" module (after removing! the univ.pay module) from prestashop itself I get the following error message (URL: https://domain.tld/shop/de/module/cashondelivery/validation):

[PrestaShopException]

Property OrderPayment->amount is not valid
at line 909 in file classes/ObjectModel.php

The full error page is at the bottom

I cannot find any information related to OrderPayment->amount not valid. I tried opening all the php files that are listed on this exceptions page and searched for variables with weird/wrong values, but couldn't find any. I replaced the ObjectModel.php class with an older one and I'm at an end of what I could do to try and solve this. As said, I even tried to use the standard "Cash on Delivery" module from prestashop and it's showing the exact same error. I also removed any modules which generate any overrides, but this also didn't help.

Weird is that the order comes through and is listed in the backoffice under orders but without assigned order state. The payment method is correct, the PRICE is actually also correct (even though the exception lets me think it's about the amount of money that might be wrong). So I tried to hard code in the order state id to use but this also doesn't help.

Does someone know where I might look to figure this out? Is there a PHP/Apache module missing or too much? Or tell me how you would investigate such an exception. I guess I have to start rebuilding the shop from scratch if there are no solutions to be found which would be quite some pain.

 

Thanks a lot for trying to help!!

Oli

 

 

[PrestaShopException]

Property OrderPayment->amount is not valid
at line 909 in file classes/ObjectModel.php

904.             }
905. 
906.             $message = $this->validateField($field, $this->$field);
907.             if ($message !== true) {
908.                 if ($die) {
909.                     throw new PrestaShopException($message);
910.                 }
911.                 return $error_return ? $message : false;
912.             }
913.         }
914. 
  • ObjectModelCore->validateFields - [line 246 - classes/ObjectModel.php]
    241.      * @return array All object fields
    242.      * @throws PrestaShopException
    243.      */
    244.     public function getFields()
    245.     {
    246.         $this->validateFields();
    247.         $fields = $this->formatFields(self::FORMAT_COMMON);
    248. 
    249.         // For retro compatibility
    250.         if (Shop::isTableAssociated($this->def['table'])) {
    251.             $fields = array_merge($fields, $this->getFieldsShop());
    
  • ObjectModelCore->getFields - [line 652 - classes/ObjectModel.php]
    647. 
    648.         if (Shop::checkIdShopDefault($this->def['table']) && !$this->id_shop_default) {
    649.             $this->id_shop_default = (in_array(Configuration::get('PS_SHOP_DEFAULT'), $id_shop_list) == true) ? Configuration::get('PS_SHOP_DEFAULT') : min($id_shop_list);
    650.         }
    651.         // Database update
    652.         if (!$result = Db::getInstance()->update($this->def['table'], $this->getFields(), '`'.pSQL($this->def['primary']).'` = '.(int)$this->id, 0, $null_values)) {
    653.             return false;
    654.         }
    655. 
    656.         // Database insertion for multishop fields related to the object
    657.         if (Shop::isTableAssociated($this->def['table'])) {
    
  • ObjectModelCore->update - [line 369 - modules/modrefchange/modrefchange.php]
    364. 			$transaction_id = $order_payment->getByOrderReference($params['order']->reference);
    365. 			$params['order']->reference = $this->generateReferenceFromID($params['order']->id, $params['cart']->id, $params['order']->reference);
    366. 			if(count($transaction_id)){
    367. 				foreach($transaction_id as $transaction){
    368. 					$transaction->order_reference = $params['order']->reference;
    369. 					$transaction->update();
    370. 				}
    371. 			}
    372. 			$params['order']->update();
    373. 			return;
    374. 		} else {
    
  • Modrefchange->hookactionValidateOrder - [line 587 - classes/Hook.php] - [1 Arguments]
    582.             }
    583.         }
    584. 
    585.         // Immediately return the result if we do not log performances
    586.         if (!Module::$_log_modules_perfs) {
    587.             return $module->{$method}($params);
    588.         }
    589. 
    590.         // Store time and memory before and after hook call and save the result in the database
    591.         $time_start = microtime(true);
    592.         $memory_start = memory_get_usage(true);
    
  • HookCore::coreCallHook - [line 542 - classes/Hook.php] - [3 Arguments]
    537.                     Tools::waitUntilFileIsModified($moduleInstance->push_filename, $moduleInstance->push_time_limit);
    538.                 }
    539. 
    540.                 // Call hook method
    541.                 if ($hook_callable) {
    542.                     $display = Hook::coreCallHook($moduleInstance, 'hook'.$hook_name, $hook_args);
    543.                 } elseif ($hook_retro_callable) {
    544.                     $display = Hook::coreCallHook($moduleInstance, 'hook'.$retro_hook_name, $hook_args);
    545.                 }
    546. 
    547.                 // Live edit
    
  • HookCore::exec - [line 666 - classes/PaymentModule.php] - [2 Arguments]
    661.                     Hook::exec('actionValidateOrder', array(
    662.                         'cart' => $this->context->cart,
    663.                         'order' => $order,
    664.                         'customer' => $this->context->customer,
    665.                         'currency' => $this->context->currency,
    666.                         'orderStatus' => $order_status
    667.                     ));
    668. 
    669.                     foreach ($this->context->cart->getProducts() as $product) {
    670.                         if ($order_status->logable) {
    671.                             ProductSale::addProductSale((int)$product['id_product'], (int)$product['cart_quantity']);
    
  • PaymentModuleCore->validateOrder - [line 68 - modules/cashondelivery/controllers/front/validation.php] - [9 Arguments]
    63. //                        echo '$customer->secure_key<br />'.$customer->secure_key."<br /><hr /><br />";
    64. //                        echo '(int)$this->context->cart->id<br />'.(int)$this->context->cart->id."<br /><br />";
    65. //                        echo '(int)$this->module->id<br />'.(int)$this->module->id."<br /><br />";
    66. //                        echo '(int)$this->module->currentOrder<br />'.(int)$this->module->currentOrder."<br /><br />";
    67. //                        die();
    68. 			this->module->validateOrder((int)$this->context->cart->id, 21, $total, $this->module->displayName, null, array(), null, false, $customer->secure_key);
    69. 			Tools::redirectLink(__PS_BASE_URI__.'order-confirmation.php?key='.$customer->secure_key.'&id_cart='.(int)$this->context->cart->id.'&id_module='.(int)$this->module->id.'&id_order='.(int)$this->module->currentOrder);
    70. 		}
    71. 	}
    72. 
    73. 	/**
    
  • CashondeliveryValidationModuleFrontController->postProcess - [line 178 - classes/controller/Controller.php]
    173.             if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) {
    174.                 $this->setMedia();
    175.             }
    176. 
    177.             // postProcess handles ajaxProcess
    178.             $this->postProcess();
    179. 
    180.             if (!empty($this->redirect_after)) {
    181.                 $this->redirect();
    182.             }
    183. 
    
  • ControllerCore->run - [line 367 - classes/Dispatcher.php]
    362.             if (isset($params_hook_action_dispatcher)) {
    363.                 Hook::exec('actionDispatcher', $params_hook_action_dispatcher);
    364.             }
    365. 
    366.             // Running controller
    367.             $controller->run();
    368.         } catch (PrestaShopException $e) {
    369.             $e->displayMessage();
    370.         }
    371.     }
    372. 
    
  • DispatcherCore->dispatch - [line 28 - index.php]
    23. *  @license    http://opensource.org/licenses/osl-3.0.php  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();
    
Edited by oliiix (see edit history)
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...