Jump to content

kongondo

PW-Moderators
  • Posts

    7,241
  • Joined

  • Last visited

  • Days Won

    137

Everything posted by kongondo

  1. Hi @alexm, Fixed in Padloper 008 released today.
  2. Hi @alexm, Finally, fixed in Padloper 008 released today!
  3. Fixed in Padloper 008 released today.
  4. Fixed in Padloper 008 released today.
  5. Hey @joe_g, Removing a product requires the ID of the item in the cart. Here's an example: <?php namespace ProcessWire; // ================== // Just an example; you might be getting your product using a different approach $product = $padloper->get("template=product,id=1190"); bd($product, __METHOD__ . ': $product at line #' . __LINE__); /** @var array $cartItems */ $cartItems = $padloper->getCart(); // ALL CART ITEMS bd($cartItems, __METHOD__ . ': $cartItems at line #' . __LINE__); // FILTER CART ITEMS TO get the one product you want // PHP 8.X /** @var array $productInCart */ $productInCart = array_filter($cartItems, fn ($item) => $item->product_id === $product->id); bd($productInCart, __METHOD__ . ': $productInCart - at line #' . __LINE__); if (!empty($productInCart)) { // get first matched item FROM ARRAY /** @var stdClass $productInCart */ $productInCart = reset($productInCart); bd($productInCart, __METHOD__ . ': $productInCart - RESET - at line #' . __LINE__); } else { // HANDLE THIS PRODUCT NOT FOUND IN CART } ?> <form method="post" class="padloper-cart-add-product flex ml-auto" action="<?= $config->urls->root ?>padloper/add/"> <?= $session->CSRF->renderInput() ?> <input type='hidden' name='product_id' value='<?= $product->id ?>' /> <input type="submit" value="Add"> </form> <!-- @NOTE: we need the ID of the item in the cart --> <form method="post" class="padloper-cart-remove-product flex ml-auto" action="<?= $config->urls->root ?>padloper/remove/"> <?= $session->CSRF->renderInput() ?> <input type='hidden' name='product_id' value='<?= $productInCart->id ?>' /> <input type="submit" value="Remove"> <?= $productInCart->id ?> </form> Please let me know if you need further assistance with this.
  6. <?php namespace ProcessWire; // empty the whole cart $padloper->cart->emptyCart();
  7. Yes, that link is only about adding. The argument you pass here should be the ID of the cart item, not the product ID, i.e., <?php namespace ProcessWire; // ================== /** @var array $cartItems */ $cartItems = $padloper->getCart(); bd($cartItems, __METHOD__ . ': $cartItems at line #' . __LINE__); foreach ($cartItems as $cartID => $cartItem) { /** @var stdClass $cartItem */ echo "The ID of the cart item is: {$cartID}<br>"; // OR // echo "The ID of the cart item is: {$cart->id}<br>"; // REMOVE CART ITEM $padloper->cart->removeProduct($cart->id); // OR // $padloper->cart->removeProduct($cartID); }
  8. Supplementary to our conversation via PM, please also see this topic:
  9. Hi J, This is a very good suggestion. Please check your PM. Thanks.
  10. Hi @joe_g, In-built discounts feature is a planned feature. For now, you can achieve this via a Hook. This is not a good way to do it, as you have now found out ๐Ÿ™‚. Implementation will (for now) be via a Hook. Before this though, you need to make a decision about the logic. For instance: Is the discount applied before or after tax? Is it applied (if relevant) pre- or post- shipping costs? This is especially relevant for 'fixed discount' type. Are you applying the discount automatically at checkout or via processing a form with an input(s) for discount code(s)? If the latter, you will need to process validity (e.g. discount available on system and is not expired, etc) and limits (e.g. used once only). How to manage the 'siblings' logic. Once you have the above decided, you can implement the logic by hooking into the 'price' during checkout. An example is provided in the docs here.
  11. Hi @gebeer, I cannot remember why I don't support it. I think it is just an oversight on my part. I will add this in the future. I used to have one in the docs but I cannot find that page now. I must have deleted it by mistake! Sorry. Better to add 'FieldtypeCheckbox' in the array in 'MediaManagerUtilities.php' around line #1814 (in the method allowedFieldTypes()). This is where I'll add it in a future release.
  12. Yes. The folder /site/modules/Padloper holds all Padloper modules. It is the parent folder for all Padloper modules including a module called Padloper ๐Ÿ™‚ as. you have undoubtedly found out.
  13. Hey @joe_g, I've just tested on my demo site and it works fine. I don't think Stripe would authorise a payment below $0.50 US anyway (CHF 0.10 is $0.11 US). Those have to do with Stripe itself. They inject the JS to build the Web Element. I have never been able out if I am able to 'mute' them. I'll see what I can do about this.
  14. Great catch! Will fix for next release, thanks.
  15. Exactly! It is a schema. Yes, you are right. Good idea. I had the same thought only yesterday ๐Ÿ™‚. Just to be clear though, that markup is just a demo and not a requirement as developers can use any templating and markup strategy that they want.
  16. No worries. Yeah, I made the video to demo possibilities. I should have been clearer that those addons were just demos and not official Padloper addons.
  17. Hi @joe_g, Yes, inventory has to be tracked for stock to decrease. This happens as soon as a payment is confirmed and checkout completes. You cannot delete a thread unless you are a moderator. But let's keep this thread in case it helps the next person ๐Ÿ˜„.
  18. Flutter has been busy ๐Ÿ™‚. Announcing Flutter 3.3 at Flutter Vikings Flutter Casual Games Toolkit (YT Quick Start Video) Introducing the Flutter News Toolkit Wonderous: Explore the World with Flutter: A reference app that shows how to develop tailored UI using Flutter (source code on GitHub) Announcing Flutter Forward: Register for the next Flutter event, streaming live from Nairobi, Kenya (25 January 2023)
  19. Hi @joe_g, The template file checkout.php does not control the form layout or inputs. For that, you need to use the template partial checkout-form-customer-details-html.php. Here's the one for demo-1 and here is one for demo-5. This is the inbuilt Padloper order customer form. I don't understand how and why this would affect your checkout process. Please explain. Thanks. Apologies that the documentation is still very sketchy!
  20. Hello @joe_g, Apologies. I updated demo-1 checkout form template file earlier but forgot to also update the template partial for customer details form. I have now fixed this. I will also need to fix those for demos 2 - 4 (inclusive). For info, please see the docs for allowed form inputs. Your 'country' <select> needs to have name='shippingAddressCountry'.
  21. Hello @joe_g, You need to create your own addons (although the inbuilt Payment Gateways - Stripe, PayPal and Invoice, are internal/core addons). Yes. I'll issue a fix so that you get a meaningful warning/error message if you don't have that folder created.
ร—
ร—
  • Create New...