2121
2222namespace Mageplaza \AjaxLayer \Plugin \Controller \Category ;
2323
24- use Magento \Framework \Json \Helper \Data ;
2524use Mageplaza \AjaxLayer \Helper \Data as LayerData ;
2625
2726/**
3029 */
3130class View
3231{
33- /**
34- * @var Data
35- */
36- protected $ _jsonHelper ;
37-
3832 /**
3933 * @var LayerData
4034 */
@@ -43,14 +37,11 @@ class View
4337 /**
4438 * View constructor.
4539 *
46- * @param Data $jsonHelper
4740 * @param LayerData $moduleHelper
4841 */
4942 public function __construct (
50- Data $ jsonHelper ,
5143 LayerData $ moduleHelper
5244 ) {
53- $ this ->_jsonHelper = $ jsonHelper ;
5445 $ this ->_moduleHelper = $ moduleHelper ;
5546 }
5647
@@ -64,18 +55,13 @@ public function afterExecute(\Magento\Catalog\Controller\Category\View $action,
6455 {
6556 if ($ this ->_moduleHelper ->ajaxEnabled () && $ action ->getRequest ()->isAjax ()) {
6657 $ navigation = $ page ->getLayout ()->getBlock ('catalog.leftnav ' );
67- $ products = $ page ->getLayout ()->getBlock ('category.products ' );
58+ $ products = $ page ->getLayout ()->getBlock ('category.products ' );
59+ $ result = ['products ' => $ products ->toHtml (), 'navigation ' => $ navigation ->toHtml ()];
6860 if ($ this ->_moduleHelper ->getConfigValue ('mpquickview/general/enabled ' )) {
6961 $ quickView = $ page ->getLayout ()->getBlock ('mpquickview.quickview ' );
70- $ result = [
71- 'products ' => $ products ->toHtml (),
72- 'navigation ' => $ navigation ->toHtml (),
73- 'quickview ' => $ quickView ->toHtml ()
74- ];
75- } else {
76- $ result = ['products ' => $ products ->toHtml (), 'navigation ' => $ navigation ->toHtml ()];
62+ $ result ['quickview ' ] = $ quickView ->toHtml ();
7763 }
78- $ action ->getResponse ()->representJson ($ this -> _jsonHelper -> jsonEncode ($ result ));
64+ $ action ->getResponse ()->representJson (LayerData:: jsonEncode ($ result ));
7965 } else {
8066 return $ page ;
8167 }
0 commit comments