- Posts: 103
- Thank you received: 5
use "date format" twice for numbers
7 years 7 months ago #303608
by n00bster
use "date format" twice for numbers was created by n00bster
-- HikaShop version -- : 4.0.2
hi. i need to get this type of order and invoice number:
but it looks like that only one "date format" placeholder are working in the number fields, is this a bug or a feature?
the output is:
hi. i need to get this type of order and invoice number:
Code:
{date format="dm"}-AB{date format="y"}-{order_id}
{date format="dm"}-RE{date format="y"}-{order_id}
the output is:
Code:
0802-AB{date format="y"}-13
0802-RE{date format="y"}-13
Please Log in or Create an account to join the conversation.
7 years 7 months ago - 7 years 7 months ago #303609
by nicolas
Replied by nicolas on topic use "date format" twice for numbers
Hi,
It's neither a bug nor a feature. It's something we just didn't thought would be needed and thus isn't implemented.
Now looking at the code it should be quite easy to add.
Change the code:
to:
in the file administrator/components/com_hikashop/helpers/helper.php and that should do it.
It's neither a bug nor a feature. It's something we just didn't thought would be needed and thus isn't implemented.
Now looking at the code it should be quite easy to add.
Change the code:
Code:
if(preg_match('#\{date *format ?= ?(?:"|\')(.*)(?:"|\') *\}#Ui',$format,$matches)) {
$format = str_replace($matches[0],date($matches[1],$data->order_modified),$format);
}
Code:
if(preg_match_all('#\{date *format ?= ?(?:"|\')(.*)(?:"|\') *\}#Ui',$format,$matches)) {
foreach($matches[0] as $k => $match) {
$format = str_replace($match,date($matches[1][$k],$data->order_modified),$format);
}
}
Last edit: 7 years 7 months ago by Jerome.
The following user(s) said Thank You: n00bster
Please Log in or Create an account to join the conversation.
7 years 7 months ago #303627
by n00bster
Replied by n00bster on topic use "date format" twice for numbers
your snippet works perfect. is this code getting in the core?
Please Log in or Create an account to join the conversation.
7 years 7 months ago #303653
by nicolas
Replied by nicolas on topic use "date format" twice for numbers
Hi,
Now that you confirmed it works, yes, it will be in the next version
Now that you confirmed it works, yes, it will be in the next version
The following user(s) said Thank You: n00bster
Please Log in or Create an account to join the conversation.
Time to create page: 0.199 seconds