Jump to content

kongondo

PW-Moderators
  • Posts

    7,473
  • Joined

  • Last visited

  • Days Won

    144

Everything posted by kongondo

  1. Hi @alexm, This template file will receive $order as well as $orderLineItems, $orderCustomer and a bunch of other variables shown below: <?php namespace ProcessWire; /** @var WireData $order */ /** @var WireArray $orderLineItems */ /** @var float $orderSubtotal */ /** @var bool $isOrderGrandTotalComplete */ /** @var bool $isOrderConfirmed */ Payment info is in $order. We save the title of the payment method. You can use that by itself or use it to grab the payment gateway/method page itself (e.g. if you want the ID for some reason. Here's an example: <?php namespace ProcessWire; // COMPLETED ORDER /** @var WireData $order */ bd($order, __METHOD__ . ': $order at line #' . __LINE__); // PAYMENT GATEWAY/METHOD TITLE /** @var string $order->paymentMethod */ bd($order->paymentMethod, __METHOD__ . ': $order->paymentMethod at line #' . __LINE__); # OR ALIAS /** @var string $order->payment */ bd($order->payment, __METHOD__ . ': $order->payment at line #' . __LINE__); /** @var string $paymentGatewayTitle */ $paymentGatewayTitle = $order->payment; /// GET ID OF PAYMENT GATEWAY/METHOD /** @var int $paymentGatewayPageID */ $paymentGatewayPageID = (int)$padloper->getRaw("template=payment-provider,title={$paymentGatewayTitle}", 'id'); bd($paymentGatewayTitle, __METHOD__ . ': $paymentGatewayTitle at line #' . __LINE__); bd($paymentGatewayPageID, __METHOD__ . ': $paymentGatewayPageID at line #' . __LINE__); // IN CASE YOU WANT THE PAGE ITSELF FOR SOME REASON /** @var Page $paymentGatewayPage */ $paymentGatewayPage = $padloper->get("template=payment-provider,title={$paymentGatewayTitle}"); bd($paymentGatewayPage, __METHOD__ . ': $paymentGatewayPage at line #' . __LINE__); Hope this helps.
  2. Hi @Jan Fromm, That's the expected behaviour. This is because for a successful order checkout, when /checkout-custom/success/ is called, the order has been finalised hence Padloper clears the sessions related to the successful order. Hence, $padloper->getOrderTotalAmount() finds nothing. In fact, if you reload the page at this point, you will be redirected to the shop's homepage as their is no current 'cart'. There's at least two ways to do this. order-products-table.php template receives a number of template variables: <?php namespace ProcessWire; /** @var WireData $order */ /** @var WireArray $orderLineItems */ /** @var float $orderSubtotal */ /** @var bool $isOrderGrandTotalComplete */ /** @var bool $isOrderConfirmed */ We can use those to calculate the order amount minus taxes and shipping. Method #1: ADD TOTAL PRICE OF EACH LINE ITEM <?php namespace ProcessWire; // init empty total price $totalPriceMinusTaxesAndShipping = 0; foreach ($orderLineItems as $orderLineItem) { // @note: there are also aliases to line item 'totalPrice' // if you prefer, i.e. 'lineItemTotalPrice' and 'orderItemTotalPrice' // ------- // add price of each line item /** @var WireData $orderLineItem */ $totalPriceMinusTaxesAndShipping += (float) $orderLineItem->totalPrice; } // @debug: here is your total price without taxes and shipping // @note: if you applied discounts, those will be reflected in this value bd($totalPriceMinusTaxesAndShipping, __METHOD__ . ': $totalPriceMinusTaxesAndShipping at line #' . __LINE__); Method #2: GET ORDER SUBTOTAL AND MINUS ORDER TAX TOTALS <?php namespace ProcessWire; /** @var array $orderTaxTotalsArray */ // get all the taxes applied to order // this returns 'tax_name' => 'total_tax_applied' values $orderTaxTotalsArray = $padloper->getOrderTaxTotals($orderLineItems); // sum the tax totals $orderTaxTotals = array_sum($orderTaxTotalsArray); // $orderSubtotal = order_total + tax_total (it doesn't including shipping) // subtract taxes from order subtotal $totalPriceMinusTaxesAndShipping = (float) $orderSubtotal - $orderTaxTotals; // @debug: here is your total taxes bd($orderTaxTotals, __METHOD__ . ': $orderTaxTotals at line #' . __LINE__); // @debug: here is your total price without taxes and shipping bd($totalPriceMinusTaxesAndShipping, __METHOD__ . ': $totalPriceMinusTaxesAndShipping at line #' . __LINE__); Hope this helps.
  3. Hi @planmacher, I haven't tried, unfortunately. Maybe you could test for us? ?. Thanks. Please backup your existing site first, as usual.
  4. Yes indeed. Did you forget to attach the screenshots? ?. Issue is most like what @Spinbox mentioned. Hope it resolves your issue. I'll think about returning a meaningful error.
  5. Hi @Jan Fromm, Thanks for reporting this. Nope. Entirely my silly mistake. Nothing to do with your setup or Tracy ?. Forgot a 'check_access=0' in the selector to grab the line item to delete (since they are in admin). So, the reason it worked with 'Tracy enabled' is, I guess, you were logged in as a Superuser :-). Anyway, sorted for now. Please grab the updated files again. Not at all ?. Thanks.
  6. Hi @Jan Fromm This is because you are manually processing the cart and order. I have updated my post above to be clear that those steps refer to instances when cart and order are being processed via a checkout form. As stated in my post above, Padloper tries not to create order line items pages unnecessarily. When checkout is complete (if executed via checkout form), Padloper will clean up, removing any line items pages whose corresponding cart items were removed from the cart. In your case, you would have to do this manually since you are not going through the usual checkout process. I have now added a 2nd boolean parameter to PadloperCart::removeProduct that will tell it to also delete the order line item page associated with the cart item that is being removed. Hence, your solution would be: <?php namespace ProcessWire; $padloper->cart->removeProduct($cartRowID,true); I have updated the download. Please grab it from there as usual. Thanks.
  7. Hi @alexm, Yes, the method moved. It is in the docs here. However, currently something has messed up the JavaScript in the docs so the content is not loading. Here's the code from that example: <?php namespace ProcessWire; /** @var WireArray $orderLineItems */ $orderLineItems = $padloper->getOrderLineItems(); /** @var array $orderTaxTotals */ $orderTaxTotals = $padloper->getOrderTaxTotals($orderLineItems); foreach ($orderTaxTotals as $taxShortName => $taxValue) { echo "<span>{$taxShortName}: </span><span>" . $padloper->renderCartPriceAndCurrency($taxValue) . "</span><br>"; } Exactly.
  8. Theoretically, yes. However, you would need to be aware of any laws similar to the EU Digital Goods regulations. Not closely related, but I forgot to mention (and you are probably aware of this) that we also have tax overrides that can be applied per category of products or shipping. Glad you got it sorted.
  9. Hi @Jan Fromm, It does have an effect, unless I recently broke something ?. I've just tested the below and it works fine. Currently this is limited to the following: A product has been designated as NOT taxable. The product is specified as a digital product. The Charge EU Digital Goods VAT Taxes is ticked. The customer country is IN the EU (proceed to #6). The customer country is NOT in the EU (proceed to #7). (EU Digital Goods) Tax will be charged on this product. (unless it is a manual order and the order or the customer has been exempted from tax). Taxes will not be charged on this product (unless it was specified as taxable in #1). These complexities (at least currently) would have to be handled by the developer. I'm not sure that we currently have somewhere to hook into. I'll have a look.
  10. I am assuming you are using fetch() to send an Ajax request to some endpoint. ProcessWire will not recognise Ajax requests without the below in the header: 'X-Requested-With': 'XMLHttpRequest' The this will work: <?php if($config->ajax){ // handle ajax request here $id = (int) $input->some_input_with_id; }
  11. Thanks for confirming! Looking forward to seeing your 700+(??) variants ?. Probably the heat wave mate ?. Seriously though, glad it's working.
  12. Any reason why you installed the latest version on top of the older version instead of overwriting the files in the original install?
  13. Google threw up a few interesting results for JavaScript Kanban. jKanban: allows you to create and manage Kanban Board in your project. https://github.com/riktar/jkanban + demo http://www.riccardotartaglia.it/jkanban/ A codepen demo: https://codepen.io/karthikdevarticles/pen/PopxPwO
  14. Just a quick one ... This is two questions in one. Integration: Probably not the answer you are looking for but literally any JavaScript library can be integrated into the PW backend. There are various options here including a dedicated ProcessModule or an Inputfield (e.g. a runtime one). Update data in real time. Any JavaScript and newer libs like HTMX can easily do this. The bottom line is this: (a) An action happens on the client (b) JS listens to that action/event (c) optionally but ideally, check if the action is valid (e.g. was this field completed) (d) send the info to the backend - usually via ajax for the type of app you are building (e) the backend processes the action you have sent including validation + sanitization. If these pass, it takes an action, e.g. 'create a page' or 'update a field' (f) the server sends the response back to the client which is listening for a response from the ajax request. Traditionally/usually, the response is JSON but with HTMX, the response is HTML. (g) The client handles the response, in many cases, updating the DOM. That's it. Yes. Media Manager, for instance. You drop files and it will upload the files then create media pages off of that. Yes. ProcessWire itself to be honest. Basically $input, $sanitizer, $config->ajax and $pages are the usual tools. Not a reuse per se answer. Listening to drag and drop using JavaScript used to be a chore. With modern browsers, APIs exist to do it easily in vanilla JavaScript. If you wish to get a ready made solution searching for JavaScript drag and drop will yield some results. Personally, I'd go for htmx + vanilla JS drag and drop, or htmx + sortable combo (here's a Python example).
  15. Hi @alexm, Padloper Import API is now ready in Padloper 002 announced here. Here are the Import API docs.
  16. This thread is for me to announce Padloper releases (until I find a better way to do it). Please use your download link (sent to your email) to get the latest Padloper version. Please don't post your bug reports on this thread. Instead, create a new thread for that in this support forum. Thanks. Releases Release Sunday 12 June 2022: Padloper 002 Features Add Import API (currently for product-related imports only). This allows you to import items (attributes, categories, products, generate variants from scratch, etc) into your padloper shop. Please see the Import API documentation. Rest of the World Shipping Zone is now fully functional. Configurable dynamically loaded product variants. This is useful for cases where a product contains lots of variants. Editing such a product will slow down the browser considerable as all children pages (variants) will be loaded as well. Bug Fixes Please see the bug fixes prior to today's release date referenced in the bugs and fixes thread. --- Release Thursday 14 July 2022: Padloper 003 Features Add Addons Feature. This allows you to extend the functionality of your shop by developing, adding and activating addons (mini apps). The forum announcement about this feature is here. Please see the Addons documentation and the related Addons API documentation. A short demo of the feature is available here. Bug Fixes Please see the bug fixes for today's release date referenced in the bugs and fixes thread. Release Sunday 24 July 2022: Padloper 004 Features Update FieldtypePadloperOrder schema to include details about selected shipping rate name and delivery times. Amend single order view GUI to show order shipping rate name and delivery times. See the request details here. Make a number of methods hookable - for extra validation of custom form inputs and custom determination of whether to apply EU digital goods tax. See the request details here. Release Tuesday 30 August 2022: Padloper 005 Features Amend inventory GUI to allow non-editing of locked variants (similar to products without variants). Bug Fixes Please see the bug fixes for today's release date referenced in the bugs and fixes thread. Release Friday 23 September 2022: Padloper 006 Features Make PadloperProcessOrder::getOrderCustomer hookable. This has various uses, e.g. allows to initially pre-fill customer details to the order checkout form during order confirmation. Can be used, for instance, in conjunction with LoginRegister module. See the request details here. Demo code is available here. Bug Fixes Please see the bug fixes for today's release date referenced in the bugs and fixes thread. Release Tuesday 27 September 2022: Padloper 007 Features/Enhancements Don' t show product properties settings in General Settings > Standards Tab if product property feature was not installed. Bug Fixes Please see the bug fixes for today's release date referenced in the bugs and fixes thread. Release Sunday 08 January 2023: Padloper 008 Features/Enhancements Fix bugs related to the demo starter projects. Bug Fixes Please see the bug fixes for today's release referenced in the bugs and fixes thread. Release Sunday 05 May 2024: Padloper 009 Features/Enhancements Please see the dedicated thread here. Bug Fixes Please see the bug fixes for today's release referenced in the bugs and fixes thread.
  17. Hi @Kholja, Thanks for reporting. This has now been fixed in today's update. The issue was we were only checking for quantity=0 BUT NOT 'remove item' request as well. For information, this is how Padloper currently handles items removed/updated/added to the cart. Please note that below ONLY APPLIES to cart and order processing executed via an order checkout form (i.e., not if manually processing cart and order using the API). If at least one item is added to the cart AND the customer has started the checkout process by 'proceeding to confirmation', an order page is immediately created. The line item(s) is added to the order page. This allows for tracking abandoned carts. If an item is updated (increased quantity or decreased quantity BUT NOT ZERO quantity) in the cart: In the line item, there is nothing to do at this point. If an item is either removed OR quantity is ZERO, the item is removed from the cart but still we don't delete the corresponding line item in the order page. Instead, we hide it (it is a pending item). This caters for situations whereby the customer might decide to re-add the product to the cart after removing it completely. In such cases, we only need to unhide the line item in the order page instead of creating another page. When the order is completed, any hidden line item pages (pending items -> meaning they were not purchased) are deleted. I am mentioning the above, especially #3 since if you are manually getting and displaying (i.e., using $pages->find()) order overview before purchase is complete, you should not use include=all or include=hidden as that would display pending items to the customer. Use check_access=0 instead, or better, $padloper->find();
  18. Hi @Jan Fromm, That is the expected behaviour because variants are products in themselves. So, if you enable variants, it means you will in effect have several products (the variants) that can be enabled independently of each other. At this point, the main product's enabled status does not come into play. However, other shared fields are still relevant, e.g. properties, tax, etc. Hope this makes sense.
  19. @csaggo.com Thanks. Yes, like I stated, your issue is not related to JavaScript at all from what I can see. Thanks for confirming. This is indeed strange since the search for dimensions and properties is powered by ProcessWire itself. They are direct implementations of InputfieldPageAutocomplete. I don't think it is a language issue either as the selector passed to them is their template. I am wondering whether the dimension and property pages you created are not activated (by Padloper). Is this a multilingual site?
  20. Hi @Jan Fromm, Similar to the non-object issue, I have fixed this directly on your site files. I'll update the Padloper source files later and upload for downloading as usual. Could you please check that it works? Could you confirm that this doesn't work? I didn't find any issues with it. Thanks.
  21. Hi @Jan Fromm, I have now fixed this directly in the files on your site. I'll update the project Padloper files as well and upload the updated files for download, as usual. The issue was a NullPage was getting returned from a find; a non-existent page ID in the session. Maybe confirm that the products you render actually have their product->id rendered correctly.
  22. @csaggo.com, Yes, and they are. Properties apply to the product page itself and not variants. So, to be crystal clear, properties are always available to all products as long as you selected the 'properties' feature when installing Padloper ?. Correct. OK this and ... this...tell me your issue is not JavaScript related as per the #1 issue in the bugs and fixes thread. Again (sorry) to be crystal clear, your issue is: You click on 'add new property'. A new blank row for properties is added to the DOM. You try to search for a property (e.g. Breite) or a dimension (e.g. Milli) BUT NOTHING happens. Am I correct about 1 - 3 above? 4. Secondly, has this worked previously then it stopped working? Thanks.
  23. Hi @Jan Fromm, Thanks for reporting I'll have a look and get back to you.
  24. Glad you manage to catch it again! However, I am not sure what is going on there since $product->padloper_images should return a Pageimages object. I am wondering what your $product is in this case. I have not been able to reproduce this locally. I am wondering if we could again arrange a temporary access to your site for me to have a peek? Thanks.
  25. You are right. I should have been clearer. With respect to products, it will only get loaded if the product has the setting Enable Product Variants enabled. In your case, I am still confused though. Are you able or not able to add properties? If the answer is no to #1, what happens when you click on the link 'add new property'? If the answer to #2 is 'it adds a blank new property', is your issue then that when you type in either the 'property' or 'dimension' inputs, nothing happens? If you got to #4, does this happen to all products or main products or only products with variants? Thanks.
×
×
  • Create New...