0

I'm trying to add a custom tab to the Customer account page. I followed the Mageplaza guide here, however I'm having two issues.

First the menu item is added properly, but it points to routename/customer/index/ instead of the correct path (I changed it in the customer_account.xml file).

If type out the correct link, the page loads, but it bring up my second issue. On the page I'm getting an undefined error:

Exception #0 (Exception): Notice: Undefined property: Magento\Framework\View\Element\Template::$getProductCollection in D:\xampp73\htdocs\testm2\app\code\Msquared\CustPriceRange\view\frontend\templates\custpricerange.phtml on line 22

Here's a link to the module GitHub repo.

I'm running a local XAMPP copy of M2.3.4 on PHP 7.3.

Any help would be appreciated.

1

1 Answer 1

0

If you have created module the same as this GitHub repo. you have to update the below code in your

app/code/Msquared/CustPriceRange/view/frontend/layout/custpricerange_customer_index.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
   <update handle="customer_account" />

   <head>
      <script src="Msquared_CustPriceRange::js/cpr.js" />
   </head>

   <body>
      <referenceBlock name="page.main.title">
         <action method="setPageTitle">
            <argument translate="true" name="title" xsi:type="string">Custom Price Range</argument>
         </action>
      </referenceBlock>
      <referenceContainer name="content">
         <block class="Msquared\CustPriceRange\Block\CustPriceRange" name="custpricerange" template="Msquared_CustPriceRange::custpricerange.phtml">
         </block>
      </referenceContainer>
   </body>
</page>

Hope this will work for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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