Hi,
I was trying to override includes/modules/notifications/n_checkout.php with templates/override/includes/modules/notifications/n_checkout.php without success. The former file does not seem overridden by the latter.
I'm doing so to change the subject of the order notification e-mail, in which I'd like to include the order number. Therefore, it wouldn't be enough to revise the language file.
Any advice will be highly appreciated.
Thanks, Eddy
Overriding includes/modules/notifications/n_checkout.php
- Kofod95
- VIP Member
- Posts: 675
- Joined: Sat Feb 06, 2021 7:38 pm
- Has thanked: 81 times
- Been thanked: 147 times
Re: Overriding includes/modules/notifications/n_checkout.php
PWA does it with hooks, I don't remember exactly how, but I could dig it up, next time I'm at my PC 
//Daniel

//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Here are a lot of corns: Phoenix user guide
-
- VIP Member
- Posts: 88
- Joined: Fri Nov 06, 2020 10:36 am
- Has thanked: 26 times
- Been thanked: 2 times
-
- PhoenixCart Developer
- Posts: 1416
- Joined: Sat Dec 21, 2019 8:08 am
- : Buy Me A Beverage
- Has thanked: 44 times
- Been thanked: 110 times
Re: Overriding includes/modules/notifications/n_checkout.php
Hook snippet from PWA:
If you need more modifications, you can make a renamed copy of the core module. You just need to leave in place line 17-18 to get it used on checkout:
Code: Select all
class hook_shop_siteWide_pwa {
public $version = '4.6.0.';
public function listen_orderMail($parameters) {
$products_review_links = HOOK_PWA_EMAIL_REVIEWS . "\n";
$email_order = &$parameters['email'];
$order = $parameters['order'];
$link = Guarantor::ensure_global('Linker')->build('ext/modules/content/reviews/write.php');
if (isset($_SESSION['customer_is_guest'])) {
$email_order = str_replace(MODULE_NOTIFICATIONS_CHECKOUT_TEXT_INVOICE_URL . ' ' . Guarantor::ensure_global('Linker')->build('account_history_info.php', ['order_id' => $order->get_id()]) . "\n", '', $email_order);
$email_order .= HOOK_PWA_EMAIL_WARNING . "\n\n" .
MODULE_NOTIFICATIONS_CHECKOUT_SEPARATOR . "\n";
if ($order->content_type !== 'physical') {
$email_order .= sprintf(HOOK_PWA_EMAIL_DOWNLOAD, Guarantor::ensure_global('Linker')->build('contact_us.php')) . "\n" .
MODULE_NOTIFICATIONS_CHECKOUT_SEPARATOR . "\n";
}
$reviews_key = Password::create_random(12);
$GLOBALS['db']->query(sprintf(<<<'EOSQL'
UPDATE orders
SET reviews_key = '%s'
WHERE customers_id = %d
AND orders_id = %d
EOSQL
, $GLOBALS['db']->escape($reviews_key), (int)$_SESSION['customer_id'], (int)$order->get_id()));
$link->set_parameter('pwa_id', $reviews_key);
}
if (MODULE_CONTENT_PWA_LOGIN_CHECKOUT_REGISTERED_REVIEW_LINKS === 'True') {
foreach ($order->products as $p) {
$products_review_links .= '<a href="' . $link->set_parameter('products_id', Product::build_prid($p['id'])) . '">' . $p['name'] . '</a>' . "\n";
}
$email_order .= $products_review_links . "\n" .
MODULE_NOTIFICATIONS_CHECKOUT_SEPARATOR . "\n";
}
}
If you need more modifications, you can make a renamed copy of the core module. You just need to leave in place line 17-18 to get it used on checkout:
Code: Select all
const TRIGGERS = [ 'checkout' ];
const REQUIRES = [ 'address', 'greeting', 'name', 'email_address' ];
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
-
- VIP Member
- Posts: 88
- Joined: Fri Nov 06, 2020 10:36 am
- Has thanked: 26 times
- Been thanked: 2 times
Re: Overriding includes/modules/notifications/n_checkout.php
Thank you very much Rainer!raiwa wrote: ↑Fri Jan 27, 2023 1:02 pm Hook snippet from PWA:Code: Select all
class hook_shop_siteWide_pwa { public $version = '4.6.0.'; public function listen_orderMail($parameters) { $products_review_links = HOOK_PWA_EMAIL_REVIEWS . "\n"; $email_order = &$parameters['email']; $order = $parameters['order']; $link = Guarantor::ensure_global('Linker')->build('ext/modules/content/reviews/write.php'); if (isset($_SESSION['customer_is_guest'])) { $email_order = str_replace(MODULE_NOTIFICATIONS_CHECKOUT_TEXT_INVOICE_URL . ' ' . Guarantor::ensure_global('Linker')->build('account_history_info.php', ['order_id' => $order->get_id()]) . "\n", '', $email_order); $email_order .= HOOK_PWA_EMAIL_WARNING . "\n\n" . MODULE_NOTIFICATIONS_CHECKOUT_SEPARATOR . "\n"; if ($order->content_type !== 'physical') { $email_order .= sprintf(HOOK_PWA_EMAIL_DOWNLOAD, Guarantor::ensure_global('Linker')->build('contact_us.php')) . "\n" . MODULE_NOTIFICATIONS_CHECKOUT_SEPARATOR . "\n"; } $reviews_key = Password::create_random(12); $GLOBALS['db']->query(sprintf(<<<'EOSQL' UPDATE orders SET reviews_key = '%s' WHERE customers_id = %d AND orders_id = %d EOSQL , $GLOBALS['db']->escape($reviews_key), (int)$_SESSION['customer_id'], (int)$order->get_id())); $link->set_parameter('pwa_id', $reviews_key); } if (MODULE_CONTENT_PWA_LOGIN_CHECKOUT_REGISTERED_REVIEW_LINKS === 'True') { foreach ($order->products as $p) { $products_review_links .= '<a href="' . $link->set_parameter('products_id', Product::build_prid($p['id'])) . '">' . $p['name'] . '</a>' . "\n"; } $email_order .= $products_review_links . "\n" . MODULE_NOTIFICATIONS_CHECKOUT_SEPARATOR . "\n"; } }
If you need more modifications, you can make a renamed copy of the core module. You just need to leave in place line 17-18 to get it used on checkout:Code: Select all
const TRIGGERS = [ 'checkout' ]; const REQUIRES = [ 'address', 'greeting', 'name', 'email_address' ];
- martindavinci
- VIP Member
- Posts: 24
- Joined: Mon Mar 08, 2021 8:33 am
Re: Overriding includes/modules/notifications/n_checkout.php
did it work for you? I am struggling with the same question in PC-1.0.8.19. Also here the confirmation is without the order number.