How do I add fields to filter orders by?

  • Posts: 76
  • Thank you received: 2
9 years 8 months ago #195543

-- url of the page with the problem -- : www.claycellar.co.uk
-- HikaShop version -- : 2.3.0
-- Joomla version -- : 2.5.14
-- Browser(s) name and version -- : Firefox

Hi there,

I want to be able to filter my orders by billing address. i.e. enter a name/postcode in the filter field and get all orders who's billing address satisfies this. Our odd arrangement has customers each with many billing addresses.

I'm aware this will need some coding, so am really just asking for pointers to "start the trail".

Is it as simple as adding some extra fields to a list that already exists somewhere? I'm guessing not...

Many thanks,

Jonathan

Last edit: 9 years 8 months ago by jberry210490.

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

  • Posts: 13201
  • Thank you received: 2322
9 years 8 months ago #195549

Hi,

You will have to edit the view "order / listing" in the backend template and in the file "administrator/components/com_hikashop/views/order/view.html.php", function "listing()" load the address table, etc.

The following user(s) said Thank You: jberry210490

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

  • Posts: 76
  • Thank you received: 2
9 years 8 months ago #195767

Thanks for this. It helped me get the job done much faster than it would have otherwise taken.

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

  • Posts: 17
  • Thank you received: 0
8 years 10 months ago #225460

Hello Xavier,

(first of all happy new year !)

I am struggling with a similar need.
I am using Hikashop Business 2.6.0
I would like to add a "shipping method" filter in the orders listing page (in the backend)

I already did modify the view "order / listing" in order to get what you can see in the attached image. (new column with orders shipping id)

Could you be more explicit concerning the changes to operate in order to get the additional "shipping method" filter ?
I also would lke to replace the shipping methods ids with their actual names.
For that purpose I tried with that in the order listing view :

<td class="hikashop_order_shipping_value">	
	<?php if(!empty($row->order_shipping_method)){
		if(!empty($this->shippings[$row->order_shipping_id])){
			echo $this->shippings[$row->order_shipping_id]->shipping_name;
		}elseif(!empty($this->shippings[$row->order_shipping_method])){
			echo $this->shippings[$row->order_shipping_method]->shipping_name;
		}else{
			echo $row->order_shipping_id;
		}
	} ?>
</td>

and added :
$shippings= $pluginClass->getMethods('shipping');
in the "administrator/components/com_hikashop/views/order/view.html.php", function "listing()"

But this keeps showing only the shipping_id and not the shipping_name...

The additional toolbar button I would like to add (see image) should probably be the subject of another post right ?

Thank you for your help.

Attachments:
Last edit: 8 years 10 months ago by maxlamenaxme.

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

  • Posts: 82868
  • Thank you received: 13375
  • MODERATOR
8 years 10 months ago #225517

Hi,

you need to add the line:

$this->assignRef('shippings", $shippings);
after the line:
$shippings= $pluginClass->getMethods('shipping');
otherwise, $shippings won't be available as $this->shippings in the view file.

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

  • Posts: 17
  • Thank you received: 0
8 years 10 months ago #225763

Thank you very much ! It works like a charm !

You just made a little mistake with the quote : $this->assignRef('shippings', $shippings);

Also, I would like to add the filter on top of the page (similar to the payment method drop down filter) to show only orders with such or such shipping method.

Could you help me with that ?

Thanks a lot again !

Last edit: 8 years 10 months ago by maxlamenaxme.

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

  • Posts: 82868
  • Thank you received: 13375
  • MODERATOR
8 years 10 months ago #225823

Hi,

Ah yes, sorry for the typo.

Regarding the addition of a filter for the orders, you can add code similar to the payment dropdown after the line:
echo $this->payment->display("filter_payment",$this->pageInfo->filter->filter_payment,false);

Like that:
$shipping = hikashop_get('type.shipping');
$this->assignRef('shipping',$shipping);
echo $this->shipping->display("filter_shipping",$this->pageInfo->filter->filter_shipping,false);

But then, to have it processed by the MySQL query loading the orders, you can't do that in a view override.
So you would have to either hack the file administrator/components/com_hikashop/views/order/view.html.php with code similar to what is there for the payment, or create a new hikashop plugin implementing the onBeforeOrderListing trigger in order to add your filter to the query via the plugin.

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

  • Posts: 17
  • Thank you received: 0
8 years 10 months ago #227139

Ok thank you, I understand but my php/mySQL level is not sufficient to allow me to do that without a little bit more help. (sorry for than, I'm just a mechanical engineer... ;) )

I think the best option for me would be the plugin option.

Tell me if I am wrong but I noticed that the payment filter also works with the acymailing plugin when adding users in the lists through filters.
I think taking the plugin option would allow me to use the shipping method filter also in acymailing. Right ?

I am then trying to locate where the payment filter plugin is to copy its code and transform it in shipping filter plugin.

Could you help me with that please ?

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

  • Posts: 82868
  • Thank you received: 13375
  • MODERATOR
8 years 10 months ago #227141

Hi,

There is no shipping filter plugin. The code is directly in the core files of HikaShop as you can see in the view.html.php file.
And you won't be able to use the payment plugin in AcyMailing by doing that. You would have to modify the AcyMailing HikaShop plugin in that case.

If you're not a developer, I'm afraid you'll have to contact one in order to help you with all that as it's more complex than just one or two lines of code.
You can potentially contact our partners on this page for that:
www.hikashop.com/home/our-partners.html

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

  • Posts: 17
  • Thank you received: 0
8 years 10 months ago #227207

You are right, I just figured after writing my message that these filters were coded directly in the core files.

I will give it a try all the same, I sleep very little maybe that will allow me to make it.

Thank for the contacts, if necessary I will contact them.

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

Time to create page: 0.090 seconds
Powered by Kunena Forum