Jump to content

Edit History

GoPure Kratom

GoPure Kratom

I was able to make this code work, I got a couple of issues.

I want to replicate the same functionality when an order is changed to Payment Accepted in the BO, which does changes to a few tables.
When order status is changed to Payment Accepted in the BO, a new row is inserted to (at least) both ps_order_history and ps_order_invoice and the respective ps_orders entry is of course updated as well.

While experimenting with this code, I noticed a strange thing:

  • If include the $history->save(); - the row is created into ps_order_history , but not in ps_order_invoice
  • If I comment the $history->save(); - the row is created into ps_order_invoice, but not in ps_order_history

This seems super weird? Any ideas why this is happening? IMO both should be updated?

Also, are there any other tables that should be updated explicitly than the ones mentioned above?

 

I am also getting this error lot fo times:


Notice: Trying to get property 'precision' of non-object in /home/816694.cloudwaysapps.com/xxxx/public_html/classes/Context.php on line 498

Fatal error: Uncaught TypeError: Argument 1 passed to PrestaShop\PrestaShop\Core\Localization\CLDR\ComputingPrecision::getPrecision() must be of the type int, null given, called in /home/816694.cloudwaysapps.com/xxxx/public_html/classes/Context.php on line 498 and defined in /home/816694.cloudwaysapps.com/xxxx/public_html/src/Core/Localization/CLDR/ComputingPrecision.php:41 Stack trace: #0 /home/816694.cloudwaysapps.com/xxxx/public_html/classes/Context.php(498): PrestaShop\PrestaShop\Core\Localization\CLDR\ComputingPrecision->getPrecision() #1 /home/816694.cloudwaysapps.com/xxxx/public_html/classes/order/Order.php(1465): ContextCore->getComputingPrecision() #2 /home/816694.cloudwaysapps.com/xxxx/public_html/classes/order/Order.php(1353): OrderCore->setInvoiceDetails() #3 /home/816694.cloudwaysapps.com/xxxx/public_html/classes/order/OrderHistory.php(371): OrderCore->setInvoice() #4 /home/816694.cloudwaysapps.com/xxxx/public_html/yyyyyyyyy.php(13): OrderHistoryCore->changeIdOrderS in /home/816694.cloudwaysapps.com/xxxx/public_html/src/Core/Localization/CLDR/ComputingPrecision.php on line 41

 



Here's what I'm using (with 1.7.8.7):

<?php
require(dirname(__FILE__).'/config/config.inc.php');

echo 'Includes done'.'<br/>';
echo 'Order ID:'.$_GET["oid"].'<br/>';
echo 'Order Status:'.$_GET["status"].'<br/>';

$objOrder = new Order($_GET["oid"]);

$history = new OrderHistory();

$history->id_order = (int)$objOrder->id;
$history->changeIdOrderState($_GET["status"], (int)($objOrder->id)); //order status 2 = Payment Accepted

//$history->addWithemail(true);
$history->save();
?>

 

 

GoPure Kratom

GoPure Kratom

Hi all!

Running 1.7.5. upgraded to 1.7.8.7

This thread is interesting read while I'm trying to create some automation to change Order Status to 2|Payment Acccepted.
At easiest, I can just set the orders.current_state to 2, and this changes the orders status in the BO.
However, I noticed there is MUCH more to it.

I use a tool which can import payment information, based on which I can create SQL queries to update all the required tables and change payment status to paid (this option would not require any coding etc on Prestashop side which I would prefer).
Issue is I have not been able to find a complete documentation on what ALL changes should happen and to which tables.

I have noticed at least the following tables are involved:

  • order_history
  • order_invoice
  • order_payment
  • order_invoice_payment
  • ...

Questions 1: Is there clear documentation of all changes required to DB for changing order status to paid?

Question 2: Does any of the Prestashop web service calls handle ALL needed DB changed with one or few more simple calls?

Question 3: If I'd use a code based solution, does a hook or hooks (such as actionValidateOrder) do all these DB modifications automatically?

 

GoPure Kratom

GoPure Kratom

Hi all!

Running 1.7.5. upgraded to 1.7.8.7

This thread is interesting read while I'm trying to create some automation to change Order Status to 2|Payment Acccepted.
At easiest, I can just set the orders.current_state to 2, and this changes the orders status in the BO.
However, I noticed there is MUCH more to it.

I use a tool which can import payment information, based on which I can create SQL queries to update all the required tables and change payment status to paid (this option would not require any coding etc on Prestashop side which I would prefer).
Issue is I have not been able to find a complete documentation on what ALL changes should happen and to which tables.

I have noticed at least the following tables are involved:

  • order_history
  • order_invoice
  • order_payment
  • order_invoice_payment
  • ...

Questions 1: Is there clear documentation of all changes changing order status to paid?

Question 2: Does any of the Prestashop web service calls handle ALL needed DB changed with one or few more simple calls?

Question 3: If I'd use a code based solution, does a hook or hooks (such as actionValidateOrder) do all these DB modifications automatically?

 

×
×
  • Create New...