Reputation: 1695
When a customer places an order I'm trying to add in the rewards points they've earned to their order email.
I know the email for the reward points is sent from
/admin/model/sale/customer.php
so when I update a customer's reward points manually it mails them with the correct information.
And the email for the order is: /catalog/model/checkout/order.php
So I just need to get the information the admin file gets and add it into the order.
I've added the appropriate information into the order.tpl and I've added the following into the /model/sale/order.php:
$template->data['rewardpoints'] = "";
I just now need to put something in place of the quotes and return the reward points the customer has earned.
Ideally how much points the customer earned for this purchase and how much they have in total, but failing that just the points they have in total will suffice.
Anyone any ideas?
Hope that's clear enough.
-James
Upvotes: 1
Views: 1589
Reputation: 393
First, you have to create a simple VQMod, which will add reward points to corresponding controller/model (checkout/order in your case). And only then you can add 'rewardpoints' value to template.
Get reward points for particular order from model:
$this->load->model('sale/customer');
$rewardpoints = $this->model->getTotalCustomerRewardsByOrderId($order_id);
Assign the value in controller:
$template->data['rewardpoints'] = $rewardpoints;
Add it to template:
echo "You got ".$rewardpoints."points, mon!";
Booya!
Upvotes: 2