0

I have 3 modules overridden from

CatalogSearch,

Catalog and

LayeredNaviagation

In my 4th module, i just need to render the products after hitting the below URL(page shows blank) which is rendering from the 1st 3 modules properly.

http://localhost:1338/magento2x_3/merchandisingpage/result/index/product/test

UPDATED

etc/frontend/router

route id="merchandisingpage" frontName="merchandisingpage"

etc/di.xml

//Have given the preference type for all the modules overridden in 1st 3 modules.
//Need clarification as this can be done!

4th module Vendor\Module\Controller\Result\Index.php

class Index extends \Magento\Framework\App\Action\Action
{
   public function execute()
   {
      $query = $this->request->getParam('q');   
    $q = $this->request; 
    $re =  array();
    $re = $q->getParams();   

    $re['filters'] = true;
    $re['q'] = $re['product'];  
     unset($re['product']);
    $payload = $re;  
      ....
   }
}

\Vendor\Module\view\frontend\layout\merchandisingpage_result_index.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="3columns" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
    <action method="setTitle">
        <argument name="title" xsi:type="string">Merchandising</argument>
    </action>
</head>
<body>
    <referenceBlock name="search.result">
      <action method="setTemplate">
            <argument name="template" xsi:type="string">Vendor_Module1::result.phtml</argument>
      </action>
    </referenceBlock>
    <referenceBlock class=" before="-" name="catalogsearch.leftnav">
      <action method="setTemplate">
            <argument name="template" xsi:type="string">Vendor_Module2::layer/view.phtml</argument>
      </action>
    </referenceBlock>
    <referenceBlock class=" name="product_list_toolbar" >
      <action method="setTemplate">
        <argument name="template" xsi:type="string">Vendor_Module3::product/list/toolbar.phtml</argument>
      </action>
    </referenceBlock>
</body>

I need to get the products rendered in frontpage.

I get blank screen, without errors or exception.

0

You need to recompile the Magento project::

sudo php /[your project dir like : var/www/project_name]/bin/magento setup:di:compile

  • i ran setup upgrade @Aashish..i dont think we need to run di:compile each time...its not working..i still get blank page – Sushivam Aug 16 '16 at 11:50
  • After upgrade or making any di.xml its necessary to run compilation. – Ashish Jagnani Aug 16 '16 at 11:52
  • I ran...i still get blank page after di:compile, clear var gen, cache – Sushivam Aug 16 '16 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.