- Posts: 145
- Thank you received: 6
Show custom field in invoices
5 years 1 month ago #335154
by levelup
Life is the unique stage of our art. Everyone sings their own song and leaves the stage. The stage is always permanent. Blessed is that song that people remember.
Show custom field in invoices was created by levelup
-- HikaShop version -- : 4.4.3
-- Joomla version -- : 3.9.27
-- PHP version -- : 5.6
Hi
I create a custom field with name "user_code_melli" in user table (attached picture 1).
I add this to invoices in hikashop config -> main -> Checkout tab -> ADDRESS & SHIPPING section (attached picture 2).
but don't show anything.
Thanks for your help
-- Joomla version -- : 3.9.27
-- PHP version -- : 5.6
Hi
I create a custom field with name "user_code_melli" in user table (attached picture 1).
I add this to invoices in hikashop config -> main -> Checkout tab -> ADDRESS & SHIPPING section (attached picture 2).
Code:
{user_code_melli}
Thanks for your help
Life is the unique stage of our art. Everyone sings their own song and leaves the stage. The stage is always permanent. Blessed is that song that people remember.
Please Log in or Create an account to join the conversation.
5 years 1 month ago #335158
by nicolas
Replied by nicolas on topic Show custom field in invoices
Hi,
You can only use custom fields of the "address" table in the "address format" setting.
If you want to add a custom user field in the invoice that you can get with the "invoice" button of your backend, you need to edit the file order / invoice.php via the menu Display>Views and add such code:
where xxx is to be replaced by the column name of your custom user field "user_code_melli".
You can only use custom fields of the "address" table in the "address format" setting.
If you want to add a custom user field in the invoice that you can get with the "invoice" button of your backend, you need to edit the file order / invoice.php via the menu Display>Views and add such code:
Code:
<?php echo $this->element->customer->xxx; ?>
The following user(s) said Thank You: levelup
Please Log in or Create an account to join the conversation.
4 years 8 months ago #338812
by levelup
Life is the unique stage of our art. Everyone sings their own song and leaves the stage. The stage is always permanent. Blessed is that song that people remember.
Replied by levelup on topic Show custom field in invoices
Hi
I did this before in HikaShop 4.2.2 and it worked. But it seems that in HikaShop 4.4.5 has changed in Joomla 4. I can not find order / invoice.php via the menu Display>Views.
I did this before in HikaShop 4.2.2 and it worked. But it seems that in HikaShop 4.4.5 has changed in Joomla 4. I can not find order / invoice.php via the menu Display>Views.
Life is the unique stage of our art. Everyone sings their own song and leaves the stage. The stage is always permanent. Blessed is that song that people remember.
Please Log in or Create an account to join the conversation.
4 years 8 months ago #338818
by nicolas
Replied by nicolas on topic Show custom field in invoices
Hi,
It's still there though.
Please double check.
Note also that you have filters on the top right corner of the listing.
If you have a filter on the frontend template, you won't see the view files of the backend like this one for example.
It's still there though.
Please double check.
Note also that you have filters on the top right corner of the listing.
If you have a filter on the frontend template, you won't see the view files of the backend like this one for example.
The following user(s) said Thank You: levelup
Please Log in or Create an account to join the conversation.
4 years 8 months ago #338839
by levelup
Life is the unique stage of our art. Everyone sings their own song and leaves the stage. The stage is always permanent. Blessed is that song that people remember.
Replied by levelup on topic Show custom field in invoices
i want show user custom field in front end invoice.
Life is the unique stage of our art. Everyone sings their own song and leaves the stage. The stage is always permanent. Blessed is that song that people remember.
Please Log in or Create an account to join the conversation.
4 years 8 months ago #338851
by nicolas
Replied by nicolas on topic Show custom field in invoices
Hi,
What I gave before on this thread was for the invoice available in the backend.
For the invoice in the frontend, you need to do the same modification but in the view file order / show.php for your frontend template.
What I gave before on this thread was for the invoice available in the backend.
For the invoice in the frontend, you need to do the same modification but in the view file order / show.php for your frontend template.
The following user(s) said Thank You: levelup
Please Log in or Create an account to join the conversation.
4 years 6 months ago - 4 years 6 months ago #339950
by levelup
Life is the unique stage of our art. Everyone sings their own song and leaves the stage. The stage is always permanent. Blessed is that song that people remember.
Replied by levelup on topic Show custom field in invoices
Hi
i was create user custom field named user_code_melli and want to show in backend-> order-> edit in Customer section. How can I do this? I think I should change the order/show_user.php file.
I used this
and that
But it does not work. what code should I use?
i was create user custom field named user_code_melli and want to show in backend-> order-> edit in Customer section. How can I do this? I think I should change the order/show_user.php file.
I used this
Code:
<tr><td><?php echo $this->user->user_code_melli ?>{user_code_melli}</td></tr>
Code:
<tr><td><?php echo JText::_('USER_CODE_MELLI').': '.$this->element->customer->user_code_melli; ?></td></tr>
Life is the unique stage of our art. Everyone sings their own song and leaves the stage. The stage is always permanent. Blessed is that song that people remember.
Last edit: 4 years 6 months ago by levelup.
Please Log in or Create an account to join the conversation.
4 years 6 months ago - 4 years 6 months ago #339957
by nicolas
Replied by nicolas on topic Show custom field in invoices
Hi,
Check the code already in order / show_user.php
You can see this line:
or this one:
So you can see that the user data is in $this->order->customer
So you can do this:
Check the code already in order / show_user.php
You can see this line:
Code:
<td><span id="hikashop_order_customer_name"><?php echo @$this->order->customer->name; ?></span></td>
Code:
<td><span id="hikashop_order_customer_email"><?php echo @$this->order->customer->user_email; ?></span></td>
So you can do this:
Code:
<tr class="hikashop_order_customer_melli">
<td class="key"><label><?php echo JText::_('USER_CODE_MELLI');?></label></td>
<td><span id="hikashop_order_customer_melli"><?php echo @$this->order->customer->user_code_melli; ?></span></td>
</tr>
Last edit: 4 years 6 months ago by nicolas.
The following user(s) said Thank You: levelup
Please Log in or Create an account to join the conversation.
Time to create page: 0.193 seconds