oc-orders-shopaholic-plugin
oc-orders-shopaholic-plugin copied to clipboard
Display order history on account page
Hello,
I'm new to shopaholic and I can't find the infos in the documentation (about that, is there a documentation ? the shopaholic.one website says everything is documented, but I can't find documentation anywhere...)
My purpose is to develop a complete user dashboard to let customers :
- view and edit their profile
- view and edit their addressbook
- view and track their order history (track page, cancel orders etc...)
Thank you for your advices
Hi @PubliAlex, i was in the same situation......... in my case i created the solution on mine own using the Order model and the user email(beacuse is unique)
In my "theme > layout > main.htm" i put this in the php block
-
first import the model to use
use Lovata\OrdersShopaholic\Models\Order;
-
then paste this method
\System\Classes\MarkupManager::instance()->registerCallback(function($manager){ $manager->registerFunctions([ 'getOrdersByUserId' => function($mail){ if ($mail != null) { $obOrdersList = Order::all()->where('user.email', $mail); return $obOrdersList; }else{ return; } }, ]); });
then in my profile page i call the function like this
{% set orderList = getOrdersByUserId(user.email) %}
once you put this you can iterate trough the orders of this user