- Posts: 2
- Thank you received: 0
HikaShop GeoLocation data display on Order page in admin area
- Vershinina
-
Topic Author
- Offline
Less
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:
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:
The HikaShop GeoLocation plugin params:
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!
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:
- how can I display GeoLocation data on order edit page in admin area?
- where form.php order view template is used?
The HikaShop GeoLocation plugin params:
- Orders geolocation = Yes
- Customers geolocation = Yes
- Geolocation service = Both
- 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.
9 years 4 weeks ago #277278
by nicolas
Replied by nicolas on topic HikaShop GeoLocation data display on Order page in admin area
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:
before the line:
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 !
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
);
}
Code:
function onAfterOrderCreate(&$order,&$send_email){
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.
- Vershinina
-
Topic Author
- Offline
Less
More
- Posts: 2
- Thank you received: 0
9 years 4 weeks ago #277317
by Vershinina
Replied by Vershinina on topic HikaShop GeoLocation data display on Order page in admin area
Thank you, everything works fine now.
Please Log in or Create an account to join the conversation.
Time to create page: 0.198 seconds