News:

Support the VirtueMart project and become a member

Main Menu

Different confirmation mail for different shopperer group

Started by servlet, March 29, 2014, 09:33:33 AM

Previous topic - Next topic

servlet

Is there a way to send different confirmation mail for different shopperer group?
Он-лайн магазин за фототапети http://mishelfoster.com

K&K media production

You can write a own override with a if request to the shoppergroup and then load different layout files.

servlet

Thank you for replay.
I can write 2 html templates but I cannt write php if request.
If someone have a time to do it...
Он-лайн магазин за фототапети http://mishelfoster.com

K&K media production

add this to your mail_html.php to load different template overrides:


$shopperGroupModel = VmModel::getModel('shoppergroup');
$shopperGroups = $shopperGroupModel->getShoppergroupById($this->orderDetails['details']['BT']->virtuemart_user_id);
$shopperGroupArray = array();
foreach($shopperGroups as $shopperGroup) {
$shopperGroupArray[] = $shopperGroup['virtuemart_shoppergroup_id'];
}

if (in_array('2', $shopperGroupArray)) {
echo $this->loadTemplate('shopperaddresses2');
} else {
echo $this->loadTemplate('shopperaddresses1');
}


In this example the script is looking if the user is in shopper group with ID 2. If it's true, the view "shopperaddresses2" will be displayed, else "shoppergroup1".

To test your mails without sending a mail use this url and replace the orderID and orderpass with one existing order from your shop

index.php?option=com_virtuemart&view=invoice&layout=mail_html&order_number=xxxxxxx&order_pass=p_xxxxx&tmpl=component