Incorrect email subject line when sending wishlist emails

  • Posts: 19
  • Thank you received: 1
  • Hikamarket Frontedition Hikaserial Standard Hikashop Business
6 months 4 weeks ago #333707

-- HikaShop version -- : 4.4.1
-- Joomla version -- : 3.9.27
-- PHP version -- : 7.4.20
-- Browser(s) name and version -- : Firefox 90.0b6
-- Error-message(debug-mod must be tuned on) -- : No Error Message

When a wishlist email is sent, the subject line is exactly 'WISHLIST_SHARE_EMAIL_SUBJECT'.

In the database (hikashop_config table), we have
wishlist_share.subject = WISHLIST_SHARE_EMAIL_SUBJECT

In the administrator/components/com_hikashop/classes/mail.php line 78 (loadInfos() function), the 'subject' key is loaded from the config table and saved as $mail->subject. In our case, this means $mail->subject is the string 'WISHLIST_SHARE_EMAIL_SUBJECT'.

loadInfos() is called from get() (line 21 in mail.php).

The get() function, in turn, is called from administrator/components/com_hikashop/classes/cart.php line 4110 (loadNotification() function).

Lines 4111 to 4113 are as follows

 $subject = strtoupper($type).'_NOTIFICATION_SUBJECT';
  if(empty($mail->subject) || $mail->subject == $subject)
    $mail->subject = JText::sprintf($subject, $data->user->name, $data->user->user_email, $data->cart->cart_name);

To me, this will convert WISHLIST_SHARE_NOTIFICATION_SUBJECT to a string, and add the users' name, users' email and wishlist name only if
a) the $mail->subject is empty (in our case, it is 'WISHLIST_SHARE_EMAIL_SUBJECT' as defined in the config table)
b) the $mail->subject is the string 'WISHLIST_SHARE_NOTIFICATION_SUBJECT'

So, in our case, no translation is done, so the subject line remains 'WISHLIST_SHARE_EMAIL_SUBJECT', irrespective of any overrides we add.

I think line 4111 is not required and lines 4112 and 4113 should be
    $mail->subject = JText::sprintf($mail->subject, $data->user->name, $data->user->user_email, $data->cart->cart_name);

i.e. if we have read language constant from the config table that is not empty, then do the conversion on the data stored in $mail->subject.

As an aside, there does not appear to be anywhere on any of the Hikashop configuration pages where you can say what language constant is to be used for the wishlist subject line unless you edit the database directly.

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

  • Posts: 74542
  • Thank you received: 11498
6 months 4 weeks ago #333712


The code modification indeed does make sense so that the subject is properly converted and the variable available, instead of having to change the subject to the translation as per the code.
We'll add that modification on our end. Thanks for the feedback on the issue.
Regarding modifying the subject, in the menu System>Emails, you can edit each email sent by HikaShop, and the first input field there is the subject. When you save that form, it will modify wishlist_share.subject in hikashop_config.

The following user(s) said Thank You: speru

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

Time to create page: 0.060 seconds
Powered by Kunena Forum