display a custom product field in email

  • Posts: 6
  • Thank you received: 0
7 years 4 months ago #272896

-- HikaShop version -- : 2.6.3
-- Joomla version -- : 3.7.2
-- PHP version -- : 5.6
-- Browser(s) name and version -- : latest Firefox
-- Error-message(debug-mod must be tuned on) -- : none

Hi,

I created a custom field 'productlabel' in the product table, to add some product properties.

But when I insert {LINEVAR:product.productlabel} in the admin mail section, nothing is displayed in the mail.
When I test with {LINEVAR:product.product_id} it works.
So how do I display a custom product field in email?

Rhanks in advance,

Eric

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
7 years 4 months ago #272900

Hello,

Please be sure to enter the custom field "namekey" and not a "label".
It's also called the "column name" in the custom field configuration :
www.hikashop.com/support/documentation/1...ield-form.html#infos

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 6
  • Thank you received: 0
7 years 4 months ago #272975

Hi Jerome

In my case they are identical. The 'Label' = 'Productlabel' and the 'Column name' = 'productlabel'.
That's why i tried to display it in the mails with {LINEVAR:product.productlabel}.
But nothing shows.
Are those custom fields from the product table being read by the "Preload version"?

Regards,

Eric

Last edit: 7 years 4 months ago by vectoronline.

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

  • Posts: 82864
  • Thank you received: 13372
  • MODERATOR
7 years 4 months ago #272977

Hi,

I don't see why it wouldn't work.
The custom fields are loaded like the other fields of the hikashop_product table for the tags.
Can you provide a screenshot of the settings of your custom field ?

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

  • Posts: 6
  • Thank you received: 0
7 years 4 months ago #273049

Hi,

Here is the screenshot.
Just to be sure I turned eveything on.

Attachments:
Last edit: 7 years 4 months ago by vectoronline.

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

  • Posts: 6
  • Thank you received: 0
7 years 4 months ago #273066

Hi,

I just found it! It works for the main product without variants.
And it does NOT work for variants! I checked the database and the custom field of all variants are empty.

So the question now is: how can I display a custom field of a variant product in the mails?

Last edit: 7 years 4 months ago by vectoronline.

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

  • Posts: 82864
  • Thank you received: 13372
  • MODERATOR
7 years 4 months ago #273082

Hi,

That's the same tag. You just need to fill the custom field value in the variant itself.

If your question is "how can I display the value of the custom field of the main product when a variant is bought but the code of the product when it's not a variant but a product", that would require some custom coding in the "preload" section of the email.
It would be better to have a developer do it for you, because while it's not so complex, it will require proper development and debugging to make sure it works and I can't give you the code to add as I don't know without spending some time doing that development work, but that's outside of standard support.

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

  • Posts: 6
  • Thank you received: 0
7 years 4 months ago #273125

Hi Nicolas,

Thanks for your answer. I think we will have to fill all variants manually. I just did not realize that that is possible!
I had assumed that the only 'extra' in a variant is what you add in the variant itself, like sizes, colours, etc.
But it turns out that a variant is a full copy of the 'master product' record in the datanase.

Best regards,

Eric

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
7 years 4 months ago #273128

Hello,

Variants are products in the database ; but they might not contain all information and when there are some "blanks", HikaShop can load the information from the parent product (also called "main product").
In the email, because you have access to the raw data, the information from the parent product is not directly available.
You can see to customize the email preload in order to process the data and copy what you need for the variant products ; the other solution is like you wrote, to also have the information in the variant product.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

Time to create page: 0.076 seconds
Powered by Kunena Forum