Tooltip text in order confirmation email

  • Posts: 33
  • Thank you received: 0
12 years 10 months ago #42274

Hi,

I've set up tooltips for product custom fields which I've added in the language file. This works fine in the cart as it does not show the tooltip code, but unfortunately in the order confirmation emails the whole tooltip string is shown, like so:

Party Banners - Ruby Anniversary: 2m - Gloss

{tip You can choose from various design templates and colour schemes (see template samples).}Template / Colour{/tip}: Balloons - Red

{tip We can print your banner with or without a photo.}Photo Required{/tip}: Yes

{tip We accept files in various formats. Please see our FAQs for further information on sending artwork.}Send Artwork{/tip}: Electronically

{tip You can choose to have an electronic pdf proof sent via e-mail. Printed proofs are available for an additional cost (see FAQs).}Proof Required?{/tip}: Yes


How do I show only custom field name and the chosen option instead of the whole tooltip string?

Thanks very much for your help!
Johanna

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

  • Posts: 83103
  • Thank you received: 13418
  • MODERATOR
12 years 10 months ago #42411

You will have to edit the email via the menu System->Emails and change the code:
$fieldsClass->getFieldName($field)

to:
$fieldsClass->getFieldName(preg_replace('#{.*}#U','',$field))

Last edit: 12 years 10 months ago by nicolas.

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

  • Posts: 33
  • Thank you received: 0
12 years 10 months ago #43409

Hi Nicholas,

Thanks for your help. I changed the code and now get the following error upon clicking 'next' in the checkout:

Parse error: syntax error, unexpected '.' in /home/idesign1/public_html/test/media/com_hikashop/mail/order_admin_notification.html.modified.php on line 98

This is what the code looks like now after the changes, I must have done something wrong:

<td>
<p><?php echo $item->order_product_name; ?></p><?php
if(!empty($itemFields)){
foreach($itemFields as $field){
$namekey = $field->field_namekey;
if(empty($item->$namekey)) continue;
echo '<p>'.$fieldsClass->getFieldName(preg_replace('#{.*}#U','',$field));.': '.$fieldsClass->show($field,$item->$namekey).'</p>';
}
} ?>
</td>

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

  • Posts: 83103
  • Thank you received: 13418
  • MODERATOR
12 years 10 months ago #43419

Sorry, The semi colon at the end should not be added.

Do like that:
echo '<p>'.$fieldsClass->getFieldName(preg_replace('#{.*}#U','',$field)).': '.$fieldsClass->show($field,$item->$namekey).'</p>';

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

  • Posts: 33
  • Thank you received: 0
12 years 10 months ago #43428

Hi Nicolas,

Thank you for your fast reply! I've made the changes and now get a different error:

Catchable fatal error: Object of class stdClass could not be converted to string in /home/idesign1/public_html/test/media/com_hikashop/mail/order_creation_notification.html.modified.php on line 70

I've copied the code exactly as you've given it in the 'order creation notification' email.

Thanks for your help!
Johanna

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

  • Posts: 83103
  • Thank you received: 13418
  • MODERATOR
12 years 10 months ago #43434

Ah yes, try like that:

echo '<p>'.preg_replace('#{.*}#U','',$field->field_realname).': '.$fieldsClass->show($field,$item->$namekey).'</p>';

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

  • Posts: 33
  • Thank you received: 0
12 years 10 months ago #43435

Hi Nicolas,

Just changed it to the new code, saved and tried putting an order through, but get an error again at the last stage just before being sent to page which says 'wait to be redirected to PayPal':

Parse error: syntax error, unexpected '.' in /home/idesign1/public_html/test/media/com_hikashop/mail/order_admin_notification.html.modified.php on line 98

Really hope this can be solved, thanks so much for your time!

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

  • Posts: 83103
  • Thank you received: 13418
  • MODERATOR
12 years 10 months ago #43438

I don't see why it would do that with my last code. Could you double check ?

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

  • Posts: 33
  • Thank you received: 0
12 years 10 months ago #43440

Hi Nicolas,

I've got the following code now in the 'order creation notification' email:

<td>
<p><?php echo $item->order_product_name; ?></p><?php
if(!empty($itemFields)){
foreach($itemFields as $field){
$namekey = $field->field_namekey;
if(empty($item->$namekey)) continue;
echo ''.preg_replace('##U','',$field->field_realname).': '.$fieldsClass->show($field,$item->$namekey).'';
}
} ?>
</td>

I've tried and still won't work, I get the same error. Do I need to change this code elsewhere as well?? I'm not sure on that.

If you want to try it out, here is the site: www.idesignorkney.co.uk/test/
The products are in 'online' products, the steps are all working as they should otherwise, apart from the last step before PayPal.

Thank you, Nicolas!

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

  • Posts: 83103
  • Thank you received: 13418
  • MODERATOR
12 years 10 months ago #43442

Ah yes, if you look at the error message it's in the order admin notification while you're changing the order creation email. That's probably why you still have the error.

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

  • Posts: 33
  • Thank you received: 0
12 years 10 months ago #43834

Thank you so much, Nicolas, this now works just fine apart from one tiny cosmetic issue. The product options now appear like this in the order emails:

Design Template Colour Scheme Diamond Anniversary: Balloons - SilverPhoto Required: YesSend Artwork if applicable: ElectronicallyProof Required: Yes

How do I create a space or | symbol between the different options, for instance it would need a space between 'Silver' and 'Photo' above and so on.

Many thanks for all your help!

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

  • Posts: 83103
  • Thank you received: 13418
  • MODERATOR
12 years 10 months ago #44022

Instead of :
echo ''.preg_replace('##U','',$field->field_realname).': '.$fieldsClass->show($field,$item->$namekey).'';

you can use:
echo ' | '.preg_replace('##U','',$field->field_realname).': '.$fieldsClass->show($field,$item->$namekey).'';

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

  • Posts: 33
  • Thank you received: 0
12 years 9 months ago #45094

Thank you very much, Nicolas!

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

Time to create page: 0.080 seconds
Powered by Kunena Forum