Display "Reason" field in "My orders"

  • Posts: 126
  • Thank you received: 2
12 years 3 months ago #60355

Hello,

When i changed the status for an order, i can add also a reason and notify the user. I would like to display this reason to users in "My order" area, where they can see details about own orders made.

How can i do this?

Thank you

Please Log in or Create an account to join the conversation.

  • Posts: 82819
  • Thank you received: 13366
  • MODERATOR
12 years 3 months ago #60417

Hi,

There is no option for that.

You would have to add such code in the file 'show' of the view 'order' via the menu Display->Views:

<?php
$database=& JFactory::getDBO();
$database->setQuery('SELECT * FROM '.hikashop_table('history').' WHERE history_order_id='.$this->order->order_id.' ORDER BY history_created DESC');
$order->history = $database->loadObjectList();
foreach($order->history as $history{ echo $history->history_reason; }
?>

Please Log in or Create an account to join the conversation.

  • Posts: 126
  • Thank you received: 2
12 years 2 months ago #61184

Many thanks for help, nicolas.

P.S: there is a missing ) after as $history. For anyone who need tabular info:

<?php
$database=& JFactory::getDBO();
$database->setQuery('SELECT *, from_unixtime(history_created) as ORDERDATE FROM '.hikashop_table('history').' WHERE history_order_id='.$this->order->order_id.' ORDER BY history_created DESC');
$order->history = $database->loadObjectList();
?>
<table class="hikashop_entries_table adminlist" cellpadding="1" width="100%">
<?php
foreach($order->history as $history) { echo '<tr><td>'.$history->ORDERDATE.'</td><td>'.$history->history_new_status.'</td><td>'.$history->history_reason.'</td></tr>'; }
?>
</table>

The following user(s) said Thank You: nicolas, pepecortez

Please Log in or Create an account to join the conversation.

Time to create page: 0.056 seconds
Powered by Kunena Forum