- Posts: 8
- Thank you received: 0
Custom fields on product page
14 years 10 months ago - 14 years 10 months ago #31106
by pamolade
Custom fields on product page was created by pamolade
Hi.
I use the business edition. I have added a custom field to some of the shops products, and i am now having trouble seeing the input data from these fields.
Further more i want to add the input to the confirmation email and the admin mail.
Like this:
Item_________________Quantity________Price________Total
Nokia 3310__________62______________210$_______13.200,-
Name: SAM {Costum field info}
Nokia 6210__________2_______________280$________560,-
Name: SAM {Costum field info}
I'm new to php, so i haven't been able to do this by myself:(
I use the business edition. I have added a custom field to some of the shops products, and i am now having trouble seeing the input data from these fields.
Further more i want to add the input to the confirmation email and the admin mail.
Like this:
Item_________________Quantity________Price________Total
Nokia 3310__________62______________210$_______13.200,-
Name: SAM {Costum field info}
Nokia 6210__________2_______________280$________560,-
Name: SAM {Costum field info}
I'm new to php, so i haven't been able to do this by myself:(
Last edit: 14 years 10 months ago by pamolade.
Please Log in or Create an account to join the conversation.
14 years 10 months ago #31116
by nicolas
Replied by nicolas on topic Re: Custom fields on product page
Hi,
First, you need to edit your emails vi the menu System->Emails, there, you can do like that:
<?php
$productClass = hikashop_get('class.product');
$product = $productClass->get($item->product_id);
echo $product->CUSTOM_FIELD_COLUMN_NAME; ?>
Don't forget to replace CUSTOM_FIELD_COLUMN_NAME by the column name of your custom field.
First, you need to edit your emails vi the menu System->Emails, there, you can do like that:
<?php
$productClass = hikashop_get('class.product');
$product = $productClass->get($item->product_id);
echo $product->CUSTOM_FIELD_COLUMN_NAME; ?>
Don't forget to replace CUSTOM_FIELD_COLUMN_NAME by the column name of your custom field.
Please Log in or Create an account to join the conversation.
14 years 10 months ago #31193
by pamolade
Replied by pamolade on topic Re: Custom fields on product page
Whats second? Because this didn't work
Please Log in or Create an account to join the conversation.
14 years 10 months ago #31221
by nicolas
Replied by nicolas on topic Re: Custom fields on product page
There is actually no second 
That's all you need to do but make sure that you add that code inside of the foreach which loops through the products of the order. Like that for example:
foreach($data->cart->products as $item){
?>
<tr>
<td>
<?php
$productClass = hikashop_get('class.product');
$product = $productClass->get($item->product_id);
echo $product->CUSTOM_FIELD_COLUMN_NAME; ?>
That's all you need to do but make sure that you add that code inside of the foreach which loops through the products of the order. Like that for example:
foreach($data->cart->products as $item){
?>
<tr>
<td>
<?php
$productClass = hikashop_get('class.product');
$product = $productClass->get($item->product_id);
echo $product->CUSTOM_FIELD_COLUMN_NAME; ?>
Please Log in or Create an account to join the conversation.
14 years 10 months ago - 14 years 10 months ago #31287
by pamolade
Replied by pamolade on topic Re: Custom fields on product page
Sorry, but I'm not that experienced in php.. I haven't made any other changes in the php, so this is the only need i have.
Would you be kind to send me the complete email with the text from above? My custom field name is: mereinfo
In advance, Thanks!
Would you be kind to send me the complete email with the text from above? My custom field name is: mereinfo
In advance, Thanks!
Last edit: 14 years 10 months ago by pamolade.
Please Log in or Create an account to join the conversation.
14 years 10 months ago #31297
by nicolas
Replied by nicolas on topic Re: Custom fields on product page
In your email,
replace the code:
foreach($data->cart->products as $item){
?>
<tr>
<td>
by:
foreach($data->cart->products as $item){
?>
<tr>
<td>
<?php
$productClass = hikashop_get('class.product');
$product = $productClass->get($item->product_id);
echo $product->mereinfo; ?>
and that will display your custom product field.
If that doesn't work, are you sure that your custom field is of the table "product" ?
Could you do a screenshot of your custom field options ?
replace the code:
foreach($data->cart->products as $item){
?>
<tr>
<td>
by:
foreach($data->cart->products as $item){
?>
<tr>
<td>
<?php
$productClass = hikashop_get('class.product');
$product = $productClass->get($item->product_id);
echo $product->mereinfo; ?>
and that will display your custom product field.
If that doesn't work, are you sure that your custom field is of the table "product" ?
Could you do a screenshot of your custom field options ?
Please Log in or Create an account to join the conversation.
14 years 10 months ago #31312
by pamolade
Replied by pamolade on topic Re: Custom fields on product page
Please Log in or Create an account to join the conversation.
14 years 10 months ago #31344
by nicolas
Replied by nicolas on topic Re: Custom fields on product page
So yo'ure talking about a custom item field where the user can enter some text on the product page ?
In that case, that is already displayed automatically in the email if the user enters something in the field. There is nothing to do.
In that case, that is already displayed automatically in the email if the user enters something in the field. There is nothing to do.
Please Log in or Create an account to join the conversation.
14 years 10 months ago #31345
by nicolas
Replied by nicolas on topic Re: Custom fields on product page
So yo'ure talking about a custom item field where the user can enter some text on the product page ?
In that case, that is already displayed automatically in the email if the user enters something in the field. There is nothing to do.
In that case, that is already displayed automatically in the email if the user enters something in the field. There is nothing to do.
Please Log in or Create an account to join the conversation.
Time to create page: 0.203 seconds