Turn a boolean to Yes when email is sent


#1

Hi Experts,
I have created a column in Prestashop orders table called “notified”.
I have a button when you click it will send an email to the client.
I would like to add a notification acknowledgment by turning the Notified from No to Yes as it is sent manually using that button.

Check the screenshot:
Capture


#2

You have to look for a way to update the value and it has been a LONG time since I worked within a prestashop system to know what that looks like.


#3

Hello, Thank you dear astonecipher for your response, that’s what I’m looking for, at the time when the email is sent it should change notified from no to yes.
i guess it should be within this function, but how to code it, that’s the problem

public function notifySeller()

Or should it be an sql query to modify the bool?


#4

It will have to be a sql query to do the update. Where that lives, or if it even currently exists, I couldn’t tell you.


#5

Hello,
I can tell you the database name, table etc…

DB: presta
table: ps_orders
column: notified [boolean]

can you help


#6

Hello,
from my SQL terminal, I did a test and it worked

UPDATE ps_orders SET notified = 1 WHERE id_order = 380;

Now how can I inject the sql query into the code please


#7

public function sellerOrder($idOrder)
{

	**$sql = Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'ps_orders` SET `notified` = 1 WHERE `id_order` = $idOrder');**
	
    $order = new Order($idOrder);
    $cart = new Cart((int) $order->id_cart);

#8

This would make the table name ‘ps_ps_orders’


#9

I changed it to '. DB_PREFIX .'orders`
Still it doesn’t update order 380 notified to yes.


#10

I resolved it, thank you