- Posts: 20
- Thank you received: 0
User information in Invoice and order number
9 years 1 month ago #276095
by web-tiki
User information in Invoice and order number was created by web-tiki
-- HikaShop version -- : 3.1.1
-- Joomla version -- : 3.7.4
-- PHP version -- : 7.1
Hi,
I need to add information from a custom field (in the user table) to the invoice and order numbers.
Is this possible with HE?
-- Joomla version -- : 3.7.4
-- PHP version -- : 7.1
Hi,
I need to add information from a custom field (in the user table) to the invoice and order numbers.
Is this possible with HE?
Please Log in or Create an account to join the conversation.
9 years 1 month ago #276097
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic User information in Invoice and order number
Hello,
Yes it is possible with HikaShop but it would require a little view override for your invoice view(s) (they are two invoices, one in front end an another for the backend).
www.hikashop.com/support/documentation/1...-display.html#layout
Front-end : order / show
Backend : order / invoice
And you can access to the customer object (and its custom fields) via :
Regards,
Yes it is possible with HikaShop but it would require a little view override for your invoice view(s) (they are two invoices, one in front end an another for the backend).
www.hikashop.com/support/documentation/1...-display.html#layout
Front-end : order / show
Backend : order / invoice
And you can access to the customer object (and its custom fields) via :
Code:
$this->element->customer->...
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
The following user(s) said Thank You: web-tiki
Please Log in or Create an account to join the conversation.
9 years 1 month ago #276140
by web-tiki
Replied by web-tiki on topic User information in Invoice and order number
Thx for the answer, I see how to add the information to the invoice and order outputs.
But is it possible to change that number in the backend Where the orders are listed?
I would prefer to have the new order and invoice numbers stored in the database with the user information. Is that possible?
Is there a way to add custom user info in the order and invoice formats?
I saw here
could be used as an order number but the topic is old and I had no succes trying.
But is it possible to change that number in the backend Where the orders are listed?
I would prefer to have the new order and invoice numbers stored in the database with the user information. Is that possible?
Is there a way to add custom user info in the order and invoice formats?
I saw here
Code:
{user user_vat}-{id size="3"}-{date format="m-Y"}
Please Log in or Create an account to join the conversation.
9 years 1 month ago #276158
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Replied by Jerome on topic User information in Invoice and order number
Hello,
Okay ; you want to change the order number format !
Because you were talking about add information to the invoices I thought that you wanted to customized the invoices.
So, yes in HikaShop Essential you can change the format for the "order number" and "invoice number".
And you can use a special tag to access to user data, as you wrote:
Now if you want to use something from a user custom field, you need to replace "user_vat" but the namekey of your custom field.
The namekey is also called "column name" :
www.hikashop.com/support/documentation/1...ield-form.html#infos
Afterwards, please note that when you change the format, it will not affect the old orders and you need to create new orders to see the result.
Regards,
Okay ; you want to change the order number format !
Because you were talking about add information to the invoices I thought that you wanted to customized the invoices.
So, yes in HikaShop Essential you can change the format for the "order number" and "invoice number".
And you can use a special tag to access to user data, as you wrote:
Code:
{user user_vat}
The namekey is also called "column name" :
www.hikashop.com/support/documentation/1...ield-form.html#infos
Afterwards, please note that when you change the format, it will not affect the old orders and you need to create new orders to see the result.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
The following user(s) said Thank You: web-tiki
Please Log in or Create an account to join the conversation.
9 years 1 month ago - 9 years 1 month ago #276290
by web-tiki
Replied by web-tiki on topic User information in Invoice and order number
Thx for the info. It works fine for the order number but it fails for the invoice number.
This is the format I gave to both of the numbers :
Order number :
Invoice number :
For the invoice number,
doesn't output anything. Is there a workaround?
Also adding the user info gives an error on the checkout end step (after payement) :
I'm testing this out with the cheque payement method.
This is the format I gave to both of the numbers :
Order number :
Code:
{user user_type} - {date format="y m"} {id size="6"}
Code:
{user user_type} - {date format="y m"} {order_id size="6"}
For the invoice number,
Code:
{user user_type}
Also adding the user info gives an error on the checkout end step (after payement) :
Code:
Notice: Undefined property: stdClass::$order_user_id in SOMETHING_HERE\administrator\components\com_hikashop\helpers\helper.php on line 336
Last edit: 9 years 1 month ago by web-tiki.
Please Log in or Create an account to join the conversation.
9 years 1 month ago #276350
by nicolas
Replied by nicolas on topic User information in Invoice and order number
Hi,
Thanks for the details. The user tags are indeed no usable in some cases with the invoice number format setting.
Change the code:
to:
in the file administrator/components/com_hikashop/helpers/helper.php and that will fix the notice message and you'll be able to use the user tags in the invoice number format setting.
Thanks for the details. The user tags are indeed no usable in some cases with the invoice number format setting.
Change the code:
Code:
$userClass = hikashop_get('class.user');
$data->customer = $userClass->get($data->order_user_id);
Code:
$order_user_id = 0;
if(isset($data->order_user_id)) {
$order_user_id = $data->order_user_id;
} elseif(isset($data->old->order_user_id)) {
$order_user_id = $data->old->order_user_id;
} elseif(isset($data->order_id)) {
$orderClass = hikashop_get('class.order');
$orderData = $orderClass->get($data->order_id);
$order_user_id = $orderData->order_user_id;
}
if($order_user_id) {
$userClass = hikashop_get('class.user');
$data->customer = $userClass->get($order_user_id);
}
The following user(s) said Thank You: web-tiki
Please Log in or Create an account to join the conversation.
9 years 1 month ago #277048
by web-tiki
Replied by web-tiki on topic User information in Invoice and order number
Perfect thank you, this seems to works fine.
Will this change be pushed in the next hikashop release or will I have to redo this change after each update?
Will this change be pushed in the next hikashop release or will I have to redo this change after each update?
Please Log in or Create an account to join the conversation.
9 years 1 month ago #277052
by nicolas
Replied by nicolas on topic User information in Invoice and order number
Hi,
Yes, it will be included.
Yes, it will be included.
The following user(s) said Thank You: web-tiki
Please Log in or Create an account to join the conversation.
9 years 1 month ago #277194
by web-tiki
Replied by web-tiki on topic User information in Invoice and order number
Perfect,
Thx Nicolas and Jerome for your support.
Thx Nicolas and Jerome for your support.
Please Log in or Create an account to join the conversation.
Time to create page: 0.169 seconds