- Posts: 26
- Thank you received: 3
Display product custom fields in product contact form
5 years 10 months ago #327826
by multigeo
Display product custom fields in product contact form was created by multigeo
-- HikaShop version -- : 4.4.0
-- Joomla version -- : 3.9.23
-- PHP version -- : 7.3.7
-- Browser(s) name and version -- : not relevant
-- Error-message(debug-mod must be tuned on) -- : none
Hi Guys,
I would like to display the contents of the product custom fields on the contact form of the product.
I checked the docs and forum, but did not find what I'm looking for, so I hope you can help.
The URL I entered above shows what the product page looks like - it's currently in "catalog mode".
We would like to allow a visitor to enter available info about the picture and stimulate this by showing all we already know (which is mainly in custom fields).
I have tried creating custom contact fields, which works, but I would then need to transfer the values of the product custom fields to the form, but I cannot find the proper way to access the custom fields of the product.
Getting values into the form is not the problem, getting the right values there, that's my problem.
Again, I hope you can give me a little push in the proper direction.
Cheers,
André
-- Joomla version -- : 3.9.23
-- PHP version -- : 7.3.7
-- Browser(s) name and version -- : not relevant
-- Error-message(debug-mod must be tuned on) -- : none
Hi Guys,
I would like to display the contents of the product custom fields on the contact form of the product.
I checked the docs and forum, but did not find what I'm looking for, so I hope you can help.
The URL I entered above shows what the product page looks like - it's currently in "catalog mode".
We would like to allow a visitor to enter available info about the picture and stimulate this by showing all we already know (which is mainly in custom fields).
I have tried creating custom contact fields, which works, but I would then need to transfer the values of the product custom fields to the form, but I cannot find the proper way to access the custom fields of the product.
Getting values into the form is not the problem, getting the right values there, that's my problem.
Again, I hope you can give me a little push in the proper direction.
Cheers,
André
Please Log in or Create an account to join the conversation.
5 years 10 months ago #327828
by nicolas
Replied by nicolas on topic Display product custom fields in product contact form
Hi,
Supposing that your custom contact fields are named xxx and yyy and that the corresponding custom product fields are named xxx_product and yyy_product, then, you should be able to do that by changing the code:
$itemData = @$formData->$fieldName;
to:
$column_name = $fieldName.'_product';
$itemData = @$this->product->$column_name;
in the file "contact" of the view "product" via the menu Display>Views.
Supposing that your custom contact fields are named xxx and yyy and that the corresponding custom product fields are named xxx_product and yyy_product, then, you should be able to do that by changing the code:
$itemData = @$formData->$fieldName;
to:
$column_name = $fieldName.'_product';
$itemData = @$this->product->$column_name;
in the file "contact" of the view "product" via the menu Display>Views.
The following user(s) said Thank You: multigeo
Please Log in or Create an account to join the conversation.
5 years 10 months ago #327839
by multigeo
Replied by multigeo on topic Display product custom fields in product contact form
Great! Thanks Nicholas.
That was just what I needed, problem solved!
Only some CSS tweaking left and I'm done
That was just what I needed, problem solved!
Only some CSS tweaking left and I'm done
The following user(s) said Thank You: Philip
Please Log in or Create an account to join the conversation.
Time to create page: 0.067 seconds