alexm Posted November 27, 2022 Posted November 27, 2022 Is there any info on field names for grabbing details from orders yet? I think it's not in the docs and is TBD. I'd like to output stuff like total, items, shipping type and payment type basically on a customer dashboard
kongondo Posted November 27, 2022 Posted November 27, 2022 Hi @alexm, 2 hours ago, alexm said: Is there any info on field names for grabbing details from orders yet? I think it's not in the docs and is TBD. Yeah, sorry, not yet in the docs. 2 hours ago, alexm said: I'd like to output stuff like total, items, shipping type and payment type basically on a customer dashboard The code below can get you started. It finds all orders of the logged in user. <?php namespace ProcessWire; /** @var PageArray $customerOrders */ $customerOrders = $padloper->find("template=order, order_customer.userID={$user}"); # ALTERNATIVE SELECTORS // $customerOrders = $padloper->find("template=order, order_customer.user_id={$user}"); // $customerOrders = $padloper->find("template=order, order_customer.userID={$user->id}"); // $customerOrders = $padloper->find("template=order, order_customer.user_id={$user->id}"); You can also use $padloper->findRaw() if you will be expecting lots of orders per customer. Order totals , shipping and payment info will be on the order themselves. Items are the children of the order pages. Line items info will be at the line items level. Let me know if you need more info. Thanks. 1
alexm Posted November 27, 2022 Author Posted November 27, 2022 @kongondo Ta very muchly! I'll take a wee nosey in a bit.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now