- Posts: 202
- Thank you received: 2
Add custom user field to Order Number format
I have created a custom user field named "Customer Number". This number matches our internal tracking system. Is there a way to include this field in the Custom Order Number Format? Ideally, my order number would be:
{customer_no}-{full date of order}-{sequential ID}
I can get the date and ID just as I'd like them, but can't figure out how (if) I can include the customer number.
Thanks!!!
Rick
Please Log in or Create an account to join the conversation.
If you add the code:
if(preg_match_all('#\{([a-z_0-9]+)\}#i',$format,$matches)){
foreach($matches[1] as $match){
if(isset($data->$match)){
$format = str_replace('{'.$match.'}',$data->$match,$format);
}else{
$format = str_replace('{'.$match.'}','',$format);
}
}
}
after the code:
if(strpos($format,'{automatic_code}')!==false){
$format = str_replace('{automatic_code}',hikashop::base($id),$format);
}
in the file administrator/components/com_hikashop/helpers/helper.php you will be able to add tags for your custom order fields: {custom_field_column_name}
We'll add that to next version.
Please Log in or Create an account to join the conversation.
Because of this, we can now perfectly match the online order numbers with our internally-generated ones. What a help!!!
FYI - I posted a review on the JED (username: momentis) yesterday. I wish I could have written more. In nearly 5 years working within Joomla I have come across very, very few developers as responsive, polite and talented!
Rick
Please Log in or Create an account to join the conversation.
Your code sets up the order number perfectly. However, the emails that are being generated do not include the custom field. Any way to add this?
Please Log in or Create an account to join the conversation.
Would there be a way, in future versions, to have the generated order number stored statically within the database whenever the order is created? That way the order number would be consistent across the application. Any changes made to the order number structure in the configuration settings would, therefore, only affect ongoing orders.
Just a suggestion!
Rick
Please Log in or Create an account to join the conversation.
So far, no one had a problem with that way of doing it... We'll see. If others have the same remark we might change the system in the future, we'll see
Please Log in or Create an account to join the conversation.
Anyway, is there a way to get the order number into the emails? It is not using the custom field.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
The order is now created.
This notification was for the order -04072011-00022 on the website thegragroup.com/storefront/
Total : $0.00
You can access the order details directly by clicking on the link below after logging in your back end:
thegragroup.com/storefront/administrator...ask=edit&order_id=22
The order number in the system is RLS-04072011-00022. Same in the email going to the person placing the order.
I am using the latest version of HikaShop on Joomla 1.6.1
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
{cust_code}-{date format="mdY"}-{id size="5"}
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
The modification I posted allows you to do it for custom order fields and not really for custom user fields. It's just that the information is loaded there in some places.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
It would work just fine if the order number was stored in the database
Please Log in or Create an account to join the conversation.