Jump to content

[PrestaShopException] Error when creating a partial refund


5haun

Recommended Posts

Hi all

Can someone help me please? I get this error message when I try create a partial refund and re-stock products:

[PrestaShopException]

Property OrderSlip->number is empty
at line 846 in file classes/ObjectModel.php

840. 841. 			$message = $this->validateField($field, $this->$field);842. 			if ($message !== true)843. 			{844. 				if ($die)845. 					throw new PrestaShopException($message);846. 				return $error_return ? $message : false;847. 			}848. 		}849. 850. 		return true;
  • ObjectModelCore->validateFields - [line 260 - classes/ObjectModel.php]
    254. 	 *255. 	 * @return array All object fields256. 	 */257. 	public function getFields()258. 	{259. 		$this->validateFields();260. 		$fields = $this->formatFields(self::FORMAT_COMMON);261. 262. 		// For retro compatibility263. 		if (Shop::isTableAssociated($this->def['table']))264. 			$fields = array_merge($fields, $this->getFieldsShop());
  • ObjectModelCore->getFields - [line 464 - classes/ObjectModel.php]
    458. 		}459. 		460. 		// Database insertion461. 		if (Shop::checkIdShopDefault($this->def['table']))462. 			$this->id_shop_default = min($id_shop_list);463. 		if (!$result = ObjectModel::$db->insert($this->def['table'], $this->getFields(), $null_values))464. 			return false;465. 466. 		// Get object id in database467. 		$this->id = ObjectModel::$db->Insert_ID();468. 
  • ObjectModelCore->add - [line 254 - classes/order/OrderSlip.php]
    248. 		$orderSlip->amount = (float)($amount);249. 		$orderSlip->shipping_cost = false;250. 		$orderSlip->shipping_cost_amount = (float)($shipping_cost_amount);251. 		$orderSlip->conversion_rate = $currency->conversion_rate;252. 		$orderSlip->partial = 1;253. 		if (!$orderSlip->add())254. 			return false;255. 256. 		$orderSlip->addPartialSlipDetail($order_detail_list);257. 		return true;258. 	}
  • OrderSlipCore::createPartialOrderSlip - [line 645 - controllers/admin/AdminOrdersController.php] - [4 Arguments]
    639. 							$order->weight = sprintf("%.3f ".Configuration::get('PS_WEIGHT_UNIT'), $order_carrier->weight);							640. 					}																		641. 642. 					if ($amount > 0)643. 					{644. 						if (!OrderSlip::createPartialOrderSlip($order, $amount, $shipping_cost_amount, $order_detail_list))645. 							$this->errors[] = Tools::displayError('You cannot generate a partial credit slip.');646. 647. 						// Generate voucher648. 						if (Tools::isSubmit('generateDiscountRefund') && !count($this->errors))649. 						{
  • AdminOrdersControllerCore->postProcess - [line 171 - classes/controller/Controller.php]
    165. 			// setMedia MUST be called before postProcess166. 			if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className)))167. 				$this->setMedia();168. 169. 			// postProcess handles ajaxProcess170. 			$this->postProcess();171. 172. 			if (!empty($this->redirect_after))173. 				$this->redirect();174. 175. 			if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className)))
  • ControllerCore->run - [line 373 - classes/Dispatcher.php]
    367. 			// Execute hook dispatcher368. 			if (isset($params_hook_action_dispatcher))369. 				Hook::exec('actionDispatcher', $params_hook_action_dispatcher);370. 371. 			// Running controller372. 			$controller->run();373. 		}374. 		catch (PrestaShopException $e)375. 		{376. 			$e->displayMessage();377. 		}
  • DispatcherCore->dispatch - [line 54 - admin/index.php]
    48. 	$_POST['controller'] = strtolower($_POST['tab']);49. if (!isset($_REQUEST['controller']) && isset($_REQUEST['tab']))50. 	$_REQUEST['controller'] = strtolower($_REQUEST['tab']);51. 52. // Prepare and trigger admin dispatcher53. Dispatcher::getInstance()->dispatch();
Edited by 5haun (see edit history)
Link to comment
Share on other sites

  • 1 month later...

 

try changing this line of code in class OrderSlip::createPartialOrderSlip

(line 245)    $currency = new Currency($order->id_currency);

by this:

(line 245)    $currency = new Currency($order->id_currency, null, $order->id_shop);

 

Thank you for your reply but I reinstalled the shop and that fixed the problem. Thanks anyway

Link to comment
Share on other sites

×
×
  • Create New...