Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. <?xml version="1.0"?>
  2. <!--
  3. /**
  4. * Copyright © 2015 Magento. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. -->
  8. <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
  9. <type name="MagentoCatalogModelResourceModelProductCollection">
  10. <plugin name="sidebarFilters" type="SebwiteSidebarModelPluginSidebarFilter"/>
  11. </type>
  12. </config>
  13.  
  14. <?php namespace SebwiteSidebarModelPlugin;
  15.  
  16. use MagentoCatalogModelResourceModelProductCollection as ProductCollection;
  17.  
  18. class SidebarFilter
  19. {
  20. /**
  21. * aroundAddFieldToFilter method
  22. *
  23. * @param MagentoCatalogModelResourceModelProductCollection $collection
  24. * @param Closure $proceed
  25. * @param $fields
  26. * @param null $condition
  27. *
  28. * @return MagentoCatalogModelResourceModelProductCollection
  29. */
  30. public function aroundAddFieldToFilter(ProductCollection $collection, Closure $proceed, $fields, $condition = null)
  31. {
  32. // Here we can modify the collection
  33.  
  34. return $fields ? $proceed($fields, $condition) : $collection;
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement