Jump to content

kongondo

PW-Moderators
  • Posts

    7,241
  • Joined

  • Last visited

  • Days Won

    137

kongondo last won the day on June 19 2022

kongondo had the most liked content!

Profile Information

  • Gender
    Not Telling
  • Location
    UK

Recent Profile Visitors

32,677 profile views

kongondo's Achievements

Hero Member

Hero Member (6/6)

8.1k

Reputation

78

Community Answers

  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.
×
×
  • Create New...