- Posts: 171
- Thank you received: 9
Order_id tag in invoice number format
- pepecortez
-
Topic Author
- Offline
Less
More
12 years 6 days ago #173643
by pepecortez
Order_id tag in invoice number format was created by pepecortez
-- HikaShop version -- : 2.3.3.
-- HikaMarket version -- : 1.4.4
-- Joomla version -- : 3.3.4.
Hi,
We wanted to use {order_id} tag in in invoice number format, but there we can not set parameter size=5. But as we have {id size="5"} in order number format, we should need this size feature in invoice number as well. Could anyone help me how to solve that by adding a few lines of code in which file?
Also wanted to ask - from other reasons, but relating mainly to this, so maybe it's not a big problem for do not creating another thread for this question - in which file, on which lines does Hikashop generate the Order number? Maybe the first question's answer is the same for the this...
Thanks for your help in advance,
PePe
-- HikaMarket version -- : 1.4.4
-- Joomla version -- : 3.3.4.
Hi,
We wanted to use {order_id} tag in in invoice number format, but there we can not set parameter size=5. But as we have {id size="5"} in order number format, we should need this size feature in invoice number as well. Could anyone help me how to solve that by adding a few lines of code in which file?
Also wanted to ask - from other reasons, but relating mainly to this, so maybe it's not a big problem for do not creating another thread for this question - in which file, on which lines does Hikashop generate the Order number? Maybe the first question's answer is the same for the this...
Thanks for your help in advance,
PePe
Please Log in or Create an account to join the conversation.
12 years 5 days ago #173665
by nicolas
Replied by nicolas on topic Order_id tag in invoice number format
Hi,
Try to change the code:
to:
in the file administrator/components/com_hikashop/helpers/helper.php and that should allow you to use the size parameter for any field of the order, not just the id.
Try to change the code:
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);
}
}
}
Code:
if(preg_match_all('#\{([a-z_0-9]+) *(?:size=(?:"|\')(.*)(?:"|\'))? *\}#i',$format,$matches)){
foreach($matches[1] as $k => $match){
if(isset($data->$match)){
$copy = $data->$match;
if(!empty($matches[2][$k])){
$copy = sprintf('%0'.$matches[2][$k].'d', $copy);
}
$format = str_replace('{'.$match.'}',$copy,$format);
}else{
$format = str_replace('{'.$match.'}','',$format);
}
}
}
The following user(s) said Thank You: pepecortez
Please Log in or Create an account to join the conversation.
- pepecortez
-
Topic Author
- Offline
Less
More
- Posts: 171
- Thank you received: 9
11 years 11 months ago #175483
by pepecortez
Tried it out, but unfortunately it's not working...
"order_id size=5" text is taken to the invoice id, not the id.
Order id format is set to: HUPT/MR-{id size="5"}/{date format="d/m/Y"}
Invoice id format is set to: HUPT/MR-{order_id size="5"}/{date format="d/m/Y"}
Any ideas?
Replied by pepecortez on topic Order_id tag in invoice number format
nicolas wrote: Hi,
Try to change the code:to: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); } } }in the file administrator/components/com_hikashop/helpers/helper.php and that should allow you to use the size parameter for any field of the order, not just the id.Code:if(preg_match_all('#\{([a-z_0-9]+) *(?:size=(?:"|\')(.*)(?:"|\'))? *\}#i',$format,$matches)){ foreach($matches[1] as $k => $match){ if(isset($data->$match)){ $copy = $data->$match; if(!empty($matches[2][$k])){ $copy = sprintf('%0'.$matches[2][$k].'d', $copy); } $format = str_replace('{'.$match.'}',$copy,$format); }else{ $format = str_replace('{'.$match.'}','',$format); } } }
Tried it out, but unfortunately it's not working...
"order_id size=5" text is taken to the invoice id, not the id.
Order id format is set to: HUPT/MR-{id size="5"}/{date format="d/m/Y"}
Invoice id format is set to: HUPT/MR-{order_id size="5"}/{date format="d/m/Y"}
Any ideas?
Please Log in or Create an account to join the conversation.
11 years 11 months ago #175509
by nicolas
Replied by nicolas on topic Order_id tag in invoice number format
Hi,
Instead of the code:
please try with the code:
in the file administrator/components/com_hikashop/helpers/helper.php and that should work better.
Instead of the code:
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);
}
}
}
Code:
if(preg_match_all('#\{([a-z_0-9]+) *(?:size=(?:"|\')(.*)(?:"|\'))? *\}#i',$format,$matches)){
foreach($matches[1] as $k => $match){
$copy = @$data->$match;
if(!empty($matches[2][$k])){
$copy = sprintf('%0'.$matches[2][$k].'d', $copy);
}
$format = str_replace($matches[0][$k],$copy,$format);
}
}
The following user(s) said Thank You: pepecortez
Please Log in or Create an account to join the conversation.
- pepecortez
-
Topic Author
- Offline
Less
More
- Posts: 171
- Thank you received: 9
11 years 11 months ago #175614
by pepecortez
Replied by pepecortez on topic Order_id tag in invoice number format
Works like a charm!
Thanks again!
Thanks again!
Please Log in or Create an account to join the conversation.
11 years 1 month ago #212035
by lukas
Replied by lukas on topic Order_id tag in invoice number format
I have 2.5.5 version, and the code I don't find in the file.
Is there any trick for having id-size?
Thanks
Is there any trick for having id-size?
Thanks
Please Log in or Create an account to join the conversation.
11 years 1 month ago #212055
by nicolas
Replied by nicolas on topic Order_id tag in invoice number format
Hi,
There is no HikaShop 2.5.5 yet. The latest version of HikaShop is 2.5.0.
If you have the latest version of HikaShop, that modification is already in there so you can directly use the size attribute with the order_id tag, without changing any code.
There is no HikaShop 2.5.5 yet. The latest version of HikaShop is 2.5.0.
If you have the latest version of HikaShop, that modification is already in there so you can directly use the size attribute with the order_id tag, without changing any code.
Please Log in or Create an account to join the conversation.
Time to create page: 0.248 seconds