Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A new Hook like productIsAvailable in Isotope\Module\ProductList #2042

Closed
tsarma opened this issue May 16, 2019 · 4 comments
Closed

A new Hook like productIsAvailable in Isotope\Module\ProductList #2042

tsarma opened this issue May 16, 2019 · 4 comments

Comments

@tsarma
Copy link
Contributor

tsarma commented May 16, 2019

I am suggesting to introduce a new hook inside Isotope\Module\ProductList::compile() right before the foreach ($arrProducts as $objProduct) { similar to isotope hook "productIsAvailable" from Isotope\Model\Product\Standart::isAvailableForCollection()

if (isset($GLOBALS['ISO_HOOKS']['productIsAvailableCheck']) && is_array($GLOBALS['ISO_HOOKS']['productIsAvailableCheck'])) {
    foreach ($GLOBALS['ISO_HOOKS']['productIsAvailableCheck'] as $callback) {
        $objCallback = \System::importStatic($callback[0]);
        $arrProducts = $objCallback->{$callback[1]}($arrProducts);
    }
}

The present isotope hook "productIsAvailable" is useless in some case when you wanted to list the products dynamically depending on some condition (like get parameter), since the Product Ids are already cached inside iso_productcache.

@fritzmg
Copy link
Contributor

fritzmg commented May 16, 2019

We use the generateProductList for such cases. However, this is not quite the same as productIsAvailable of course.

@tsarma
Copy link
Contributor Author

tsarma commented May 16, 2019

@fritzmg : Thanks, I saw that but didn't pay much attention, because I was a fixed on the idea of eliminating unwanted entries right up front the heavy foreach loop.

@tsarma tsarma closed this as completed May 16, 2019
@Toflar
Copy link
Member

Toflar commented May 17, 2019

You can also write your own product list module and override the findProducts() method :-)

@tsarma
Copy link
Contributor Author

tsarma commented May 17, 2019

@Toflar, Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants