Turn a boolean to Yes when email is sent

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:

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.

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?

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.

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

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

can you help

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

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);

This would make the table name ‘ps_ps_orders’

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

I resolved it, thank you

1 Like
Sponsor our Newsletter | Privacy Policy | Terms of Service