oc-shopaholic / oc-orders-shopaholic-plugin

🛒 Orders (cart) extension for Shopaholic plugin
https://octobercms.com/plugin/lovata-ordersshopaholic
GNU General Public License v3.0
27 stars 18 forks source link

Display order history on account page #136

Open PubliAlex opened 3 years ago

PubliAlex commented 3 years ago

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 :

Thank you for your advices

aarjona1991 commented 3 years ago

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

\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