Restricting search to certain categories only - Ajax Pro

Please post your questions and problems with any of our extensions which you are using

Restricting search to certain categories only - Ajax Pro

Postby spike1968 » Tue Aug 04, 2020 5:15 pm

Hi Stan,

How would you suggest I restrict search in Ajax search pro to categories only.

I have tried setting "search current category only" but that doesn't work and I would want all the child categories returning results also.

Reason I ask is that I am trying to set up search to offer only products for categories set up for logged in customers only.

Suggestions. :)

Posts: 17
Joined: Thu Nov 24, 2016 10:14 am

Re: Restricting search to certain categories only - Ajax Pro

Postby admin » Mon Aug 10, 2020 11:27 am

hello Martyn, most of our software and extensions expect products to be associated with full path of the categories, so if you have a product assigned to "top->sub1->sub2->sub3" it should be also associated to to+sub1+sub2+sub3 (i.e. all of them)

for this to work fluently you'd need to:

- use canonical categories in product config, so that URL is always constant and there is just one canonical path (and canonical category) to the product

- possibly use our software to associate all products to their parent categories:

-- there is a button for this in OPC Utilities (All products to all of their parent categories -> click Action... )

-- there is asystme ready for cron to do this automatically:

for cpanel - you can create an executable in your /home/{user}/
Code: Select all

STAGINGPATH="/home/{your user}/public_html"

/usr/local/bin/php $STAGINGPATH/administrator/components/com_onepage/cli.php --task=to_parent_cats --override_jroot=$STAGINGPATH --debug=1 --return_status_json=0 --myurl=$URL --lang=en

or just use the above line in cron to run every hour to associate them automatically

the main reason for this is performance. if system was to collect all child categories and then iterate them and find all associated products, this would be many many times slower compared to just having them associated to every single node in their category path.

best regards, stan
Site Admin
Posts: 2620
Joined: Wed Jan 06, 2010 11:43 pm

Return to VirtueMart and Joomla Extensions (free or paid)