Page 1 of 1

Restricting search to certain categories only - Ajax Pro

PostPosted: Tue Aug 04, 2020 5:15 pm
by spike1968
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. :)

Cheers
Martyn

Re: Restricting search to certain categories only - Ajax Pro

PostPosted: Mon Aug 10, 2020 11:27 am
by admin
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}/cron.sh
Code: Select all
#!/bin/bash

STAGINGPATH="/home/{your user}/public_html"
URL=https://www.{domain}/

/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