I want to add Order search functionality in customer account My Orders section. As if customer have many orders so they dont need to navigate instead of they can search by orders like this –
http://demo.dckap.com/m2/sales/order/history/
I tried to get customer session in Magento_Sales/templates/order/history.phtml
page but its not working.
Is there any way we can pass input search box value to order object ?
Or Load customer orders collection ?
2
Answers
This is my solution to load logged In customer orders collection -
Then after that I have replace order collection with my order collection
$order_collection
to get desired search order value from text box.you need to override few files. you can try with below code, it should work.
for view access, override
canView()
function defined inMagentoSalesControllerAbstractControllerOrderViewAuthorization.php
and finally add below line
Next you will need to override history.phtml and add your search boxes inside form. you can set action like below
Hope this helps!!