- Posts: 8
- Thank you received: 0
Display user custom field data in checkout cart
11 years 6 months ago #194870
by AMAN
Display user custom field data in checkout cart was created by AMAN
-- url of the page with the problem -- :
atelieraman.com
-- HikaShop version -- : 2.4.0
-- Joomla version -- : 3.4.0
Hi,
I am collecting some measurements from the user in the user table through custom fields. I need those measurements to appear in the cart at checkout, in a column after the product name and before the quantity and price. I have found the checkout cart view, but how do I call the data from the fields?
Also, is there any way I can have multiple measurement sets that the user can choose form, like I can have multiple addresses?
Thanks,
Irina
-- HikaShop version -- : 2.4.0
-- Joomla version -- : 3.4.0
Hi,
I am collecting some measurements from the user in the user table through custom fields. I need those measurements to appear in the cart at checkout, in a column after the product name and before the quantity and price. I have found the checkout cart view, but how do I call the data from the fields?
Also, is there any way I can have multiple measurement sets that the user can choose form, like I can have multiple addresses?
Thanks,
Irina
Please Log in or Create an account to join the conversation.
11 years 6 months ago #194895
by nicolas
Replied by nicolas on topic Display user custom field data in checkout cart
Hi,
In the checkout/cart view, that you can edit under the menu Display>Views, you can use such code:
<?php
$user = hikashop_loadUser(true);
echo $user->custom_field;
?>
Where custom_field is the column name of your custom field of the table user.
The custom user fields do not support multiple sets of data per user like custom address fields, which are made for that. I don't see an easy way to do that for custom user fields beside creating several times the same fields.
In the checkout/cart view, that you can edit under the menu Display>Views, you can use such code:
<?php
$user = hikashop_loadUser(true);
echo $user->custom_field;
?>
Where custom_field is the column name of your custom field of the table user.
The custom user fields do not support multiple sets of data per user like custom address fields, which are made for that. I don't see an easy way to do that for custom user fields beside creating several times the same fields.
The following user(s) said Thank You: AMAN
Please Log in or Create an account to join the conversation.
11 years 6 months ago #195188
by AMAN
Replied by AMAN on topic Display user custom field data in checkout cart
That works great, thank you!
Can you also give me the code for displaying the custom filed label as well as the value?
Thank you so much for your help!
Irina
Can you also give me the code for displaying the custom filed label as well as the value?
Thank you so much for your help!
Irina
Please Log in or Create an account to join the conversation.
11 years 6 months ago #195209
by AMAN
Replied by AMAN on topic Display user custom field data in checkout cart
Can you please also let me know how to make that show up in the email notification as well?
Please Log in or Create an account to join the conversation.
11 years 6 months ago #195228
by AMAN
Replied by AMAN on topic Display user custom field data in checkout cart
Thank you so much for your help!
Another question now, since I can't write php: how can I display the content of a custom field from a previous checkout step in the checkout cart?
I have an observations custom field in the fields checkout view, and I want to show those observations in a td in the cart in the last checkout step.
Thanks!
Another question now, since I can't write php: how can I display the content of a custom field from a previous checkout step in the checkout cart?
I have an observations custom field in the fields checkout view, and I want to show those observations in a td in the cart in the last checkout step.
Thanks!
Please Log in or Create an account to join the conversation.
11 years 6 months ago #195239
by AMAN
Replied by AMAN on topic Display user custom field data in checkout cart
Ok,I inserted this code:
<?php
$user = hikashop_loadUser(true);
echo $user->custom_field;
?>
in the backend, order_additional view, to preserve the measurements. The problem is that is reading the info of the admin not of the customer. What modifications should I make to read the customer's data?
Thanks!
<?php
$user = hikashop_loadUser(true);
echo $user->custom_field;
?>
in the backend, order_additional view, to preserve the measurements. The problem is that is reading the info of the admin not of the customer. What modifications should I make to read the customer's data?
Thanks!
Please Log in or Create an account to join the conversation.
11 years 6 months ago #195273
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic Display user custom field data in checkout cart
Hi,
Yes in the email you can also use PHP yes (but the "loadUser" will load the current user).
So you can use $data->customer to access to the order customer.
Or you can also use the HikaShop email tags like
Regards,
Yes in the email you can also use PHP yes (but the "loadUser" will load the current user).
So you can use $data->customer to access to the order customer.
Or you can also use the HikaShop email tags like
Code:
{VAR:user.custom_field}
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
The following user(s) said Thank You: AMAN
Please Log in or Create an account to join the conversation.
Time to create page: 0.190 seconds