manipulate search

  • Posts: 490
  • Thank you received: 2
7 years 5 months ago #253489

-- HikaShop version -- : 2.6.3
-- Joomla version -- : 3.4.5
-- PHP version -- : 5.5
-- Error-message(debug-mod must be tuned on) -- : none

hi

how do i manipulate the searches? i want to add paid results into the searches.

maybe on top and bottom of the results.

thanks

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

  • Posts: 81480
  • Thank you received: 13062
  • MODERATOR
7 years 5 months ago #253492

Hi,

On the searches of the Joomla search module ?
In that case, the order of the results depends on the order of the different plugins. And for the results of HikaShop it's either ordered based on the latest modification date, the creation date, the number of hits of the page, or alphabetically.
If you want to change the order of the product results in the search module of Joomla, you would have to change the code:

switch($ordering){
			case 'alpha':
				$order = 'a.product_name ASC';
				break;
			case 'newest':
				$order = 'a.product_modified DESC';
				break;
			case 'oldest':
				$order = 'a.product_created ASC';
				break;
			case 'popular':
				$order = 'a.product_hit DESC';
				break;
			case 'category':
			default:
				$order = 'a.product_name DESC';
				break;
		}
in the file plugins/search/hikashop_products/hikashop_products.php

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

  • Posts: 490
  • Thank you received: 2
7 years 5 months ago #253541

hi thanks

what about text filters?

how can i add random results on top and at the bottom of filter result?

example:

if i search "mobile phone" on the text filters the usual result will be

phone 1
phone 2
phone 2
phone 4

this is only an example. how can i add a preferred result like "preferred phone"? so it should look something like


preferred phone
phone 1
phone 2
phone 2
phone 4

the objective here is to add entries for paying customers to be on top of the search filter

thanks

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

  • Posts: 81480
  • Thank you received: 13062
  • MODERATOR
7 years 5 months ago #253552

Hi,

In that case I see several solutions but they will require some development.
You could have a small plugin and implement the onBeforeProductListingLoad trigger to change the MySQL loading the products:
www.hikashop.com/support/documentation/6...reProductListingLoad
For example, by modifying the $order variable which contains the "ORDER BY ... ASC/DESC" part of the query loading the results so that you would also base yourself on a custom product field.
Or for a more complex solution, you could implement the onHikashopBeforeDisplayView trigger to append the data of such products that you would load yourself into the $view->rows array of the view displaying the results:
www.hikashop.com/support/documentation/6...hopBeforeDisplayView
I would personally recommend the first approach which is much simpler and easier to implement.

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

  • Posts: 490
  • Thank you received: 2
7 years 5 months ago #254799

thank you

lets go with the easier one.

already so onBeforeCategoryListingLoad(&$filters).

is there a guideline on how to do this safely? which file and where is the file asociated with this? any samples where i can start?

thanks so much

Last edit: 7 years 5 months ago by ronron.

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

  • Posts: 81480
  • Thank you received: 13062
  • MODERATOR
7 years 5 months ago #254823

Hi,

You can see an example with this plugin:
www.hikashop.com/support/forum/4-how-to/...ale-date.html#128950

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

Time to create page: 0.065 seconds
Powered by Kunena Forum