Custom Email based on Category ID

  • Posts: 13
  • Thank you received: 2
  • Hikamarket Multivendor Hikaserial Standard Hikashop Business
9 years 6 months ago #202091

-- HikaShop version -- : 2.4.0
-- Joomla version -- : 3.4.1
-- PHP version -- : 5.4.40
-- Browser(s) name and version -- : Firefox 38.0.1

Hello,

We using the Business edition and would like to have the Order Administrator Notification email sent to additional email addresses based upon the Category ID of the product sold.

We're not sure what data structure to make the checks on in the Preload of this email.

We would like to do something like the following, but would appreciate a correction for the reference ($item, $data, or $this with final subelement):

if ($this->element->category_id == 'xx') {
$this->mailer->addBCC('This email address is being protected from spambots. You need JavaScript enabled to view it.');
} elseif ($this->element->category_id == 'yy') {
$this->mailer->addBCC('This email address is being protected from spambots. You need JavaScript enabled to view it.');
} else {
$this->mailer->addBCC('This email address is being protected from spambots. You need JavaScript enabled to view it.');
}

Will this work in this admin notification email? Or do we need to reference $data or $item instead to access the category_id?

And finally, is this the correct way to add an email address to the recipient list? Or do we have to add to the customer email instead (in the order creation email preload) using code such as:

$data->customer->user_email .= ',This email address is being protected from spambots. You need JavaScript enabled to view it.';

Thanks in advance for your answer.

Please Log in or Create an account to join the conversation.

  • Posts: 82910
  • Thank you received: 13379
  • MODERATOR
9 years 6 months ago #202103

Hi,

There is no category_id in any variable of the email. So that would require to load the list of all the categories of all the products of the order with a MySQL query to the database and then do your checks on them.
And do you send that to all the email addresses of all the categories of all the products of the order ?
So your code won't be that simple...

A simpler alternative would be to use HikaMarket Multivendor, create one vendor for each email address and assign each vendor to his products. The vendors would then automatically be notified of the purchase of their products (and they wouldn't even see the other products of other vendors in the notifications).

Please Log in or Create an account to join the conversation.

  • Posts: 13
  • Thank you received: 2
  • Hikamarket Multivendor Hikaserial Standard Hikashop Business
9 years 6 months ago #202607

Thanks for the info and recommendation. I see how complex this would get because of a mix of categories and products possibly being present in an order.

We ordered Multi-Vendor and look forward to using your existing integrated solutions!

Please Log in or Create an account to join the conversation.

Time to create page: 0.061 seconds
Powered by Kunena Forum