- Posts: 27
- Thank you received: 0
item custom field in show order
- travelbaba
-
Topic Author
- Offline
Less
More
12 years 6 months ago #150825
by travelbaba
item custom field in show order was created by travelbaba
Hello,
I have an item custom field, a date.
The date appears in the email order, in the cart and that's fine.
But I would like also that appear in the /order/show and print invoice.
Do you have an idea?
THanks
Matteo
I have an item custom field, a date.
The date appears in the email order, in the cart and that's fine.
But I would like also that appear in the /order/show and print invoice.
Do you have an idea?
THanks
Matteo
Please Log in or Create an account to join the conversation.
12 years 5 months ago #150902
by Xavier
Replied by Xavier on topic item custom field in show order
Hi,
You have to edit the view "order / show" via the menu Display > Views and add the desired code in the desired place.
The value should be in the variable:
You have to edit the view "order / show" via the menu Display > Views and add the desired code in the desired place.
The value should be in the variable:
Code:
echo $product->order_product_CUSTOMFIELDNAME;
Please Log in or Create an account to join the conversation.
- travelbaba
-
Topic Author
- Offline
Less
More
- Posts: 27
- Thank you received: 0
12 years 5 months ago #150917
by travelbaba
Replied by travelbaba on topic item custom field in show order
THanks, I will try.
...let's say that I have several products, and every product has a different item custom fieldd ( example: Prod. A has a datapicker custom fiend that has a rande from april to june, Prod B only every monday, and so on).
you can imagine I cannot put every single custom code..... How can I write it?
Thanks
Matteo
...let's say that I have several products, and every product has a different item custom fieldd ( example: Prod. A has a datapicker custom fiend that has a rande from april to june, Prod B only every monday, and so on).
you can imagine I cannot put every single custom code..... How can I write it?
Thanks
Matteo
Please Log in or Create an account to join the conversation.
12 years 5 months ago #150921
by Xavier
Replied by Xavier on topic item custom field in show order
Hi,
You can probably set the non custom field columns of in an array, for example:
Then check like:
You can probably set the non custom field columns of in an array, for example:
Code:
$notCustom = array('order_product_name','order_product_code',...);
Code:
foreach($product as $key => $content){
if(!in_array($key,$notCustom)){
if(!empty($content)){
echo $product->$key;
}
}
}
Please Log in or Create an account to join the conversation.
- travelbaba
-
Topic Author
- Offline
Less
More
- Posts: 27
- Thank you received: 0
12 years 5 months ago #151057
by travelbaba
Replied by travelbaba on topic item custom field in show order
Works pretty well, only proble is that they are date values, so i get : 20140515000000 instead of: 2014-05-15
Please Log in or Create an account to join the conversation.
- travelbaba
-
Topic Author
- Offline
Less
More
- Posts: 27
- Thank you received: 0
12 years 5 months ago #151063
by travelbaba
Replied by travelbaba on topic item custom field in show order
Hello,
sorry for my bad php and english!
The solution with one item field works well, but my proble is follow:
- If the product is "tour to london" there is a datefield "date_london" to show in order;
- If the product is "tour to paris" there is a datefield "date_paris" to show in order;
- If the product is "tour to rome" there is a datefield "date_rome" to show in order and another field "time_rome";
Thanks
sorry for my bad php and english!
The solution with one item field works well, but my proble is follow:
- If the product is "tour to london" there is a datefield "date_london" to show in order;
- If the product is "tour to paris" there is a datefield "date_paris" to show in order;
- If the product is "tour to rome" there is a datefield "date_rome" to show in order and another field "time_rome";
Thanks
Please Log in or Create an account to join the conversation.
- travelbaba
-
Topic Author
- Offline
Less
More
- Posts: 27
- Thank you received: 0
12 years 5 months ago #151065
by travelbaba
Replied by travelbaba on topic item custom field in show order
For example, I've added this code to show the custom items in the product cart:
But of course is not working in Show Order...
Code:
foreach($this->itemFields as $field){
$namekey = $field->field_namekey;
if(!empty($row->$namekey)){
echo '<p style="margin-bottom:0px!important" class="hikashop_cart_item_'.$namekey.'">'.$this->fieldsClass->getFieldName($field).': '.$this->fieldsClass->show($field,$row->$namekey).'</p>';
}
}
}
But of course is not working in Show Order...
Please Log in or Create an account to join the conversation.
- travelbaba
-
Topic Author
- Offline
Less
More
- Posts: 27
- Thank you received: 0
12 years 5 months ago #151095
by travelbaba
Replied by travelbaba on topic item custom field in show order
I need your help!!!
I'm trying to do by myself but I cannot undestand:
I use your plugin advanced datepicker ( the one you've also adjusted me). le'ts' say I put date 16/04/2014
But when in the order > show i write : echo hikashop_getDate($product->data_tratte,'%d %B %Y ');
( the string could be also Y-m-d, makes no difference)
I get "17 Maggio 1994", a total nonsense.
If I dont use hikashop_getDate the timestamp is correct: 20140416000000
But my need is to put in every order the different item custom fields , that they are different for every product.
I'm trying to do by myself but I cannot undestand:
I use your plugin advanced datepicker ( the one you've also adjusted me). le'ts' say I put date 16/04/2014
But when in the order > show i write : echo hikashop_getDate($product->data_tratte,'%d %B %Y ');
( the string could be also Y-m-d, makes no difference)
I get "17 Maggio 1994", a total nonsense.
If I dont use hikashop_getDate the timestamp is correct: 20140416000000
But my need is to put in every order the different item custom fields , that they are different for every product.
Please Log in or Create an account to join the conversation.
12 years 5 months ago #151221
by Xavier
Replied by Xavier on topic item custom field in show order
Hi,
You can use:
echo date("Y-m-d",$product->$key);
In the order view you can find this kind of code:
I think that you can adapt in for your needs. As you can see it's $product->$namekey which is used instead of $row->namekey.
You can use:
echo date("Y-m-d",$product->$key);
In the order view you can find this kind of code:
Code:
if(hikashop_level(2) && !empty($this->fields['item'])){
foreach($this->fields['item'] as $field){
$namekey = $field->field_namekey;
if(!empty($product->$namekey) && strlen($product->$namekey)){
echo '<p class="hikashop_order_item_'.$namekey.'">'.$this->fieldsClass->getFieldName($field).': '.$this->fieldsClass->show($field,$product->$namekey).'</p>';
}
}
}
I think that you can adapt in for your needs. As you can see it's $product->$namekey which is used instead of $row->namekey.
Please Log in or Create an account to join the conversation.
- travelbaba
-
Topic Author
- Offline
Less
More
- Posts: 27
- Thank you received: 0
12 years 5 months ago #151248
by travelbaba
Replied by travelbaba on topic item custom field in show order
Hello,
works great!!!
Just for someone who has the same situation, Iv'e adjusted the code:
works great!!!
Just for someone who has the same situation, Iv'e adjusted the code:
Code:
foreach($this->fields['item'] as $field){
$namekey = $field->field_namekey;
if(!empty($product->$namekey)){
echo '<p class="hikashop_order_item_'.$namekey.'" style="font-size:18px">'.$this->fieldsClass->getFieldName($field).': '.$this->fieldsClass->show($field,$product->$namekey).'</p>';
}
}
Please Log in or Create an account to join the conversation.
Time to create page: 0.257 seconds