I am trying to add custom link in account dashboard of customer account navigation. Used below code to add link on left side in my layout/default.xml
<body>
<referenceBlock name="customer_account_navigation">
<block class="Magento\Customer\Block\Account\SortLinkInterface" name="history-link">
<arguments>
<argument name="path" xsi:type="string">orderview/history/index</argument>
<argument name="label" xsi:type="string">Order History</argument>
<argument name="sortOrder" xsi:type="number">50</argument>
</arguments>
</block>
</referenceBlock>
</body>
And added below code in my layout/oderview_history_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>
<title>Order History</title>
</head>
<update handle="customer_account"/>
<body>
<referenceBlock name="page.main.title">
<action method="setPageTitle">
<argument translate="true" name="title" xsi:type="string">Order History</argument>
</action>
</referenceBlock>
<referenceContainer name="content">
<block class="Vendor\Module\Block\Order\History" name="module.history" cacheable="false" template="history.phtml"/>
</referenceContainer>
</body>
I am able to add the link successfully and my template file is loading there,
In my template file i am looking for code to show all the orders, invoice and shipments in table view along with the pagination and filters.
Like the My Orders history page of default magento2, but here can we show all orders, invoice and shipments in table view one after the other?
Is something that can be achieved? Please anyone suggest me on this. Thanks
1 Answer 1
You can try this way. It will work for you. Update your referenceContainer like below in layout file.
<referenceContainer name="content">
<block class="Magento\Sales\Block\Order\History" name="sales.order.history.custom" cacheable="false">
<container name="sales.order.history.info.custom" as="info.custom" label="Order History Info"/>
<container name="sales.order.history.extra.column.header.custom" as="extra.column.header.custom" label="Order History Extra Column Header"/>
<block class="Magento\Sales\Block\Order\History\Container"
name="sales.order.history.extra.container.custom" as="extra.container.custom">
<block class="Magento\Framework\View\Element\Template"
name="sales.order.history.extra.container.data.custom" as="extra.container.data.custom"/>
</block>
</block>
</referenceContainer>
Let me know if you have any issue.
-
How to get the order history and invoice history in phtnl file? Right now I am able to load my template fileJafar Pinjar– Jafar Pinjar2018年10月16日 04:09:34 +00:00Commented Oct 16, 2018 at 4:09
-
Did you update reference container with the referenceContainer which I wrote in answer. It will give you order grid with pagination.Ramkishan Suthar– Ramkishan Suthar2018年10月16日 05:51:47 +00:00Commented Oct 16, 2018 at 5:51
-
hi @Ramkishan, Yes it gave me order grid, pls read my question, I am loading custom phtml file, where i am looking for code to get all the orders, invoice and shipments in a grid view, is like that can be done? can we define some function in my custom block file to get orders, invoice n shipments, and those can be retrieved in template file?Jafar Pinjar– Jafar Pinjar2018年10月16日 06:04:18 +00:00Commented Oct 16, 2018 at 6:04
-
Do you want to show shipment and invoice grid as well in this page\?Ramkishan Suthar– Ramkishan Suthar2018年10月16日 06:11:25 +00:00Commented Oct 16, 2018 at 6:11
-
yes , in same page itself, can we do that? without affecting for orders pagination?Jafar Pinjar– Jafar Pinjar2018年10月16日 06:12:13 +00:00Commented Oct 16, 2018 at 6:12
Explore related questions
See similar questions with these tags.