Skip to main content

HikaShop GeoLocation data display on Order page in admin area

More
9 years 4 weeks ago #277249 by Vershinina
Hello,

I can't understand how to display the HikaShop GeoLocation data (from HikaShop GeoLocation plugin) on order page in admin area.

I found this template:
/administrator/components/com_hikashop/views/order/tmpl/form.php

Where I can see:
Code:
<tr> <td class="key"> <?php echo JText::_( 'IP' ); ?> </td> <td><?php echo $this->order->order_ip; if(!empty($this->order->geolocation) && $this->order->geolocation->geolocation_country!='Reserved'){ echo ' ( '.$this->order->geolocation->geolocation_city.' '.$this->order->geolocation->geolocation_state.' '.$this->order->geolocation->geolocation_country.' )'; } ?></td> </tr>

But when I open an order from the Orders page:
/administrator/index.php?option=com_hikashop&ctrl=order

via this link:
/administrator/index.php?option=com_hikashop&ctrl=order&task=edit&cid[]=X

the other order view template is used, not form.php.

I have two questions:
  1. how can I display GeoLocation data on order edit page in admin area?
  2. where form.php order view template is used?

The HikaShop GeoLocation plugin params:
  1. Orders geolocation = Yes
  2. Customers geolocation = Yes
  3. Geolocation service = Both
  4. API key is filled

I can see GeoLocation data on user edit page in admin area:
/administrator/index.php?option=com_hikashop&ctrl=user&task=edit&cid=X

for example:
IP X.X.X.X ( Chula Vista CA United States )

Thus, the plugin works fine and successfully store the data.

Thanks in advance!

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

More
9 years 4 weeks ago #277278 by nicolas
Hi,

You're right, the new order edition view is missing the IP/geolocation data which was displayed before in the old order edition view that you found.
Add the code:
Code:
function onHikashopBeforeDisplayView(&$view) { $app = JFactory::getApplication(); if(!$app->isAdmin()) return true; if(empty($view->order->order_ip)) return; $viewName = $view->getName(); $layoutName = $view->getLayout(); if($viewName != 'order' || $layoutName != 'show') return true; $data = $view->order->order_ip; if(!empty($view->order->geolocation) && $view->order->geolocation->geolocation_country!='Reserved'){ $data .= ' ( '.$view->order->geolocation->geolocation_city.' '.$view->order->geolocation->geolocation_state.' '.$view->order->geolocation->geolocation_country.' )'; } $view->extra_data['user']['ip'] = array( 'title' => JText::_( 'IP' ), 'data' => $data ); }
before the line:
Code:
function onAfterOrderCreate(&$order,&$send_email){
in the file plugins/hikashop/geolocation/geolocation.php and that should add back the geolocation data to the new edition view too.
When changing the code of the view to the new one, we added the triggers so that the plugins could themselves add their data to the view, but we forgot to update the geolocation plugin to add its data through the trigger.

Thanks for the catch !

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

More
9 years 4 weeks ago #277317 by Vershinina
Thank you, everything works fine now.

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

Time to create page: 0.198 seconds
Powered by Kunena Forum