lat9 / gpsf

An update to the previous Numinix version, now supporting Zen Carts 1.5.6 and above (including 1.5.8a) as well as PHP versions 5.6 through 8.2.
GNU General Public License v2.0
2 stars 2 forks source link

exclude categories: slow for many categories #37

Closed torvista closed 5 months ago

torvista commented 6 months ago

Not that I use this, but as an example, for a feed of one product, with a p2c table of 387232 entries, feed generation goes from 0 to 14 seconds (on a local pc).

I changed $where .= ' AND p2c.categories_id NOT IN (' . GPSF_NEG_CATEGORIES . ')'; to $where .= ' AND p.master_categories_id NOT IN (' . GPSF_NEG_CATEGORIES . ')'; and it was instant again.

Also perhaps some sanitation/checking should be done on that constant....

torvista commented 6 months ago

I've modified this, so a category id with a wildcard "12*" will omit all the products in the subcategories. Saves a lot of typing!

lat9 commented 6 months ago

... and since p.master_categories_id is where the product's category-description comes from, this makes immense sense!

I'll do the same for the previous 'bit', checking for the GPSF_POS_CATEGORIES.

lat9 commented 6 months ago

Not that I use this, but as an example, for a feed of one product, with a p2c table of 387232 entries, feed generation goes from 0 to 14 seconds (on a local pc).

I changed $where .= ' AND p2c.categories_id NOT IN (' . GPSF_NEG_CATEGORIES . ')'; to $where .= ' AND p.master_categories_id NOT IN (' . GPSF_NEG_CATEGORIES . ')'; and it was instant again.

Also perhaps some sanitation/checking should be done on that constant....

You'll know soon enough if the various constants haven't been set correctly; sanitization would be a change over and above the performance-related fix that'll be in this correction.