Hi, I'm a complete newbie to PrestaShop and OOP and would appreciate some help.
I am trying to write a override to the mailalerts module to be able to send a notification email to either the supplier or the manufacturer of the product which is ordered.
I know you can add a merchant email but the problem is that we will have many different manufacturers and suppliers from which the customer can order directly and I don't want to send everyone the email only the specific Supplier/manufacturer.
So far I made overrides for MailAlerts.php and mailalerts.php in a mailalerts folder, deleted cache and it all works fine.
In the MailAlert.php override I'm trying to use the product-id to first get either the supplier_id or the manufacturer_id and then use that to go to address database to get the correct email (I made a custom field for that and that all works fine)
First problem is here....... how do I echo out the variables I created here to see if that it actually makes the call to the database and get the right values?
I have tried :
$Mail = new Mail ();
$Mail->manufacturer_mails;
$Mail->supplier_mails;
---- nothing -because it needs the product_id, I think?
also tried echo'ing from within the class and even tried making a function but I'm not sure how to call that function so ....still... nothing.
MailAlert.php
Second problem:
I then went and modified alerts.php and basically copied everything that was done to merchants_mails to try and get it to work here...mainly because I have very little idea of how this is supposed to be....
I did manage to echo out the variables from the __construct functions and it does give me the merchant_mails but my $manufacturer_mails and $supplier_mails are empty.
mailalerts.php
At the moment or before I started messing everything up the code would run but gives me a:
Fatal error: Undefined class constant 'TYPE_TEXT' in /blah blah/site/classes/PaymentModule.php on line 506
which is..
if (count($product_var_tpl_list) > 0) {
$product_list_txt = $this->getEmailTemplateContent('order_conf_product_list.txt', Mail::TYPE_TEXT, $product_var_tpl_list);
$product_list_html = $this->getEmailTemplateContent('order_conf_product_list.tpl', Mail::TYPE_HTML, $product_var_tpl_list);
}
Sorry the code is very messy as I've tried about a hundred different ways to get the values......
I would greatly apprecciate any help!
Thank you
Ari