alexm Posted March 3, 2023 Share Posted March 3, 2023 Hey again @kongondo, I don't know whether I'm tired/burnt out at this hour, or if I'm missing something, but only the Country seems to show on the order page not the customer's full shipping and billing address (screenshot attached) But if you click "print invoice" the full address displays. 1 Link to comment Share on other sites More sharing options...
kongondo Posted March 3, 2023 Share Posted March 3, 2023 Hi @alexm, On 3/3/2023 at 10:57 PM, alexm said: I don't know whether I'm tired/burnt out at this hour, or if I'm missing something, but only the Country seems to show on the order page not the customer's full shipping and billing address (screenshot attached) Nope, it's not you, it's me :-). This is by design. I cannot recall what my thought process was then but now that you mention it, I think it makes sense to show the full shipping address. Unless others have a strong opinion, I'll change it to that. If there are strong opinions otherwise, then we can make it configurable or hookable. Will add to my TODO. Meanwhile, if you really must change it now, gimme a shout. 1 Link to comment Share on other sites More sharing options...
alexm Posted March 4, 2023 Author Share Posted March 4, 2023 @kongondo Yeah, I think it would be nice to be able to see the shipping and billing address on the order page at a glance, but as you say it would be interesting to get the others opinions. Also as I'm creating an active orders and past orders view for customers on their account dashboard and I can't currently see how I can get their billing and shipping address details from padloper_order. Is there a way of me grabbing the shipping and billing address for an order to output with relative ease? 1 Link to comment Share on other sites More sharing options...
kongondo Posted March 4, 2023 Share Posted March 4, 2023 6 hours ago, alexm said: Also as I'm creating an active orders and past orders view for customers on their account dashboard and I can't currently see how I can get their billing and shipping address details from padloper_order. Is there a way of me grabbing the shipping and billing address for an order to output with relative ease @alexm. Customer details live in the field 'padloper_order_customer'. Example: <?php namespace ProcessWire; /** @var Page $orderPage */ $orderPage = $padloper->get("id=3207");// order page ID /** @var WireData $orderCustomer */ $orderCustomer = $orderPage->padloper_order_customer; $out = ""; $out .= $orderCustomer->firstName; $out .= $orderCustomer->middleName; $out .= $orderCustomer->lastName; $out .= $orderCustomer->email; $out .= $orderCustomer->isTaxExempt; // PRIMARY ADDRESS $out .= $orderCustomer->shippingAddressFirstName; $out .= $orderCustomer->shippingAddressMiddleName; $out .= $orderCustomer->shippingAddressLastName; $out .= $orderCustomer->shippingAddressPhone; $out .= $orderCustomer->shippingAddressCompany; $out .= $orderCustomer->shippingAddressLineOne; $out .= $orderCustomer->shippingAddressLineTwo; $out .= $orderCustomer->shippingAddressCity; $out .= $orderCustomer->shippingAddressRegion; $out .= $orderCustomer->shippingAddressCountry; echo $out; // ------ // ETC @see: https://docs.kongondo.com/api/order.html#padloper-getordercustomer for full list of properties. Note that getOrderCustomer() cannot be used in this case. That is only available during an order session. However, the customer properties remain the same, i.e. firstName, billingAddressPostalCode, etc. 1 Link to comment Share on other sites More sharing options...
alexm Posted March 19, 2023 Author Share Posted March 19, 2023 @kongondo Apologies for slow reply!! Thank you so much Link to comment Share on other sites More sharing options...
alexm Posted March 19, 2023 Author Share Posted March 19, 2023 @kongondo I can't seem to get orderLineItemsPages. Sorry about this. On the active/past orders page I have the following // where $order is the $order page object $orderLineItems = $padloper->getOrderLineItemsPages($order); Link to comment Share on other sites More sharing options...
kongondo Posted March 20, 2023 Share Posted March 20, 2023 Hi @alexm, On 3/19/2023 at 1:25 PM, alexm said: // where $order is the $order page object $orderLineItems = $padloper->getOrderLineItemsPages($order); This wont work (as you found out ?). getOrderLineItemsPages() only works with a current order session. It won't work in the backend. On 3/19/2023 at 1:25 PM, alexm said: I can't seem to get orderLineItemsPages. They are right there in front of you ?. They are children of $order. So: <?php namespace ProcessWire; /** @var PageArray $orderLineItemsPages */ $orderLineItemsPages = $order->children("check_access=0"); ? Link to comment Share on other sites More sharing options...
alexm Posted March 20, 2023 Author Share Posted March 20, 2023 @kongondo ?? Oh, looking at the code, I thought you code pass it an order page!! How embarrassing that it's that obvious. I genuinely want to bury my head!!! Sorry for wasting your time bro. Can I help with your documentation perhaps? I could add to it and you could correct my solutions as you go? ? 1 Link to comment Share on other sites More sharing options...
kongondo Posted March 21, 2023 Share Posted March 21, 2023 Hi @alexm, 22 hours ago, alexm said: Oh, looking at the code, I thought you code pass it an order page!! Yes it does. But that's because at that point it is dealing with an order session, so it doesn't know what the order page is. Hence, the order page is retrieved from the session and passed to it. In your case, since you are creating a dashboard, this is decoupled from any session and you can just retrieve any order you want directly (using their ID). 22 hours ago, alexm said: How embarrassing that it's that obvious. I genuinely want to bury my head!!! Been there, done that...?. Naah, you are good. 22 hours ago, alexm said: Sorry for wasting your time bro. NP. 22 hours ago, alexm said: Can I help with your documentation perhaps? I could add to it and you could correct my solutions as you go? ? Thanks for the offer. I am currently favouring video docs. Been working on this (slow though!) and hope to start releasing soon (although tempted to ask chatGPT do it for me! ?) 1 Link to comment Share on other sites More sharing options...
alexm Posted April 5, 2023 Author Share Posted April 5, 2023 On 3/20/2023 at 5:44 PM, kongondo said: They are right there in front of you ?. They are children of $order. So: <?php namespace ProcessWire; /** @var PageArray $orderLineItemsPages */ $orderLineItemsPages = $order->children("check_access=0"); I can see that I can grab the title from this, but what would be the easiest way of outputting the price for each line item? Link to comment Share on other sites More sharing options...
alexm Posted April 5, 2023 Author Share Posted April 5, 2023 And quantity of course. Link to comment Share on other sites More sharing options...
alexm Posted April 5, 2023 Author Share Posted April 5, 2023 Got it $orderItem->padloper_order_line_item 1 Link to comment Share on other sites More sharing options...
kongondo Posted April 5, 2023 Share Posted April 5, 2023 (edited) 4 hours ago, alexm said: Got it $orderItem->padloper_order_line_item Yep. 4 hours ago, alexm said: but what would be the easiest way of outputting the price for each line item? Remember there are a number of price-related properties., e.g. unit_price, unit_price_with_tax, total_price, total_price_with_tax, total_price_discounted, etc. Pick one that is most suitable for your needs. Also, remember that orders are permanent records. Prices, title, etc, reflect the state of the corresponding product at the time of purchase. Edited April 5, 2023 by kongondo 1 Link to comment Share on other sites More sharing options...
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