Рекурсия при использовании хука products_collection.prepared Принято

2

При использование хука products_collection.prepared по инструкции: 

https://developers.webasyst.ru/hooks/shop/products_collection.prepared/

public function productsCollectionPrepared($collection) {    
    $collection->orderBy('price'); 
}

Происходит бесконечная рекурсия (лог ниже):

скорее всего ошибка в этом месте https://github.com/webasyst/shop-script/blob/master/lib/classes/shopProductsCollection.class.php#L1456


$this->prepared_event = true; должен присваиваться до вызова хука, иначе в хуке он (prepared_event) всегда будет false

Fatal error: Maximum function nesting level of '256' reached, aborting! in /wa-system/waSystem.class.php on line 69

14 0.1876 12407640 shopFrontendAction->setCollection( ) .../shopFrontendCategory.action.php:129
15 0.1899 12672952 shopProductsCollection->getProducts( ) .../shopFrontend.action.php:61
16 0.1899 12673144 shopProductsCollection->getSQL( ) .../shopProductsCollection.class.php:1548
17 0.1914 12696128 waSystem->event( ) .../shopProductsCollection.class.php:1455
18 0.1914 12696640 waEvent->run( ) .../waSystem.class.php:1571
19 0.1915 12697936 waEvent->runPlugins( ) .../waEvent.class.php:88
20 0.1933 12875064 shopEchoPlugin->productsCollectionPrepared( ) .../waEvent.class.php:238
21 0.1933 12875472 shopProductsCollection->orderBy( ) .../shopTraitCollection.class.php:37
22 0.1967 13111008 shopProductsCollection->getSQL( ) .../shopProductsCollection.class.php:1386
23 0.1967 13111104 waSystem->event( ) .../shopProductsCollection.class.php:1455
24 0.1967 13111616 waEvent->run( ) .../waSystem.class.php:1571
25 0.1968 13112896 waEvent->runPlugins( ) .../waEvent.class.php:88
26 0.1970 13115232 shopEchoPlugin->productsCollectionPrepared( ) .../waEvent.class.php:238
27 0.1970 13115360 shopProductsCollection->orderBy( ) .../shopTraitCollection.class.php:37
28 0.1970 13115520 shopProductsCollection->getSQL( ) .../shopProductsCollection.class.php:1386
29 0.1970 13115616 waSystem->event( ) .../shopProductsCollection.class.php:1455
30 0.1970 13116128 waEvent->run( ) .../waSystem.class.php:1571
31 0.1971 13117408 waEvent->runPlugins( ) .../waEvent.class.php:88
32 0.1973 13119744 shopEchoPlugin->productsCollectionPrepared( ) .../waEvent.class.php:238

0 комментариев

    Добавить комментарий

    Чтобы добавить комментарий, зарегистрируйтесь или войдите