Jump to content

kongondo

PW-Moderators
  • Posts

    7,379
  • Joined

  • Last visited

  • Days Won

    139

Posts posted by kongondo

  1. 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.

    • Thanks 1
  2. Hey @alexm,

    2 hours ago, alexm said:

    Just a quick thought. "Mark as delivered" on orders would probably be better as "Mark as despatched"?

    Makes more sense. It's a nothing kind of point, but I do think it makes more sense. What say you?

    I see your point. I'll need to have a think. Padloper currently has a number of statuses for payment, order and shipment. Not all are currently in use/editable but we'll work them in in the future. There is a status for 'shipped' which would equate to your 'despatched', i.e. on its way. Delivered is exactly that; 'someone received the shipment' {unless....don't get me started about Evri, Amazon and you-know-who-stole-your-parcel'} 😁

    3 hours ago, alexm said:

    Also... If you do mark as delivered and then confirm. when you come back to the order it still has the "Mark as delivered" action.

    I'll add to my TODO list. Good catch, ta.

    • Like 1
  3. 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.

    • Like 1
  4. Hi @David Karich,

    19 hours ago, David Karich said:

    1. what about focus points, can I define them differently on a per page basis? Or is a set focus the same for all instances of the image? If so, I would like to see this feature that I can define a different focus per page where I use an image.

    I would have to look into this since I haven't worked with focus points before. My guess is that they are saved with the image, in which case they will be saved with the record for the original image in the MM page (i.e., not the page where the MM image is referenced in an MM Inputfield). I'll see if/how I can extend FieldtypeMediaManager to store focus information (and perhaps other info developers might be interested in) which you will be able to access via the MM object.

    19 hours ago, David Karich said:

    2. if I buy a license for the current version now, will it be updateable for the new version or are there any breakers here. I'm building a new project with thousands of images to be managed through the MM, so if in half a year, or whenever the new version is ready, a complete reinstall or upload is necessary, I'd rather wait until you have the new version ready.

    I am hoping there will be no need for breaking changes. However, until I finish building it, I cannot promise. If such changes are inevitable, I'll provide code for migration. However, with the minimal progress I've made so far, I haven't encountered any breaking changes.

  5. 6 minutes ago, Jim Bailie said:

    Two months or less? 😜

    Tight! Perhaps I could start with a soft upgrade/update that includes a hook that will allow you to retain names but not sure how this would work at the moment.

    Having said that, you can achieve what you need manually (not ideal, I know)....by opening the media for editing (in MM), uploading your new image and deleting the old one. 
    Save and you are done. In future I'll think of how one can drag and drop over an existing media to replace it.

  6. Hi all,

    Media Manager Next/013

    Sorry I haven't posted here in a while. 

    I am currently working on the next version of Media Manager. It will part be refactoring and part be some new (some requested) features. I have been having some very helpful conversations with a number of you. Below are the current plans for the next version. Any other thoughts and/or ideas I should consider? It is a bit of work so I might have to stretch this into several updates (versions). Thanks.

    New Features

    1. Upload from external sources (Amazon, Google, etc.).
    2. Point media to external resource (e.g. to a video in YT, Vimeo, etc.).
    3. Independently set media title on upload 
    4. Improve/extend media filter/profiles to MM Inputfields (possibly pick and apply a profile from a list) (thanks @gebeer)
    5. PDF thumb preview (thanks @gebeer)
    6. Upload and replace media (for single media MM inputfields).
    7. API (thanks @MrSnoozles)
    8. Any other thoughts.....?

    Refactor

    1. Remove dependency on JqueryFileUpload
    2. Remove dependency on jQuery -> use htmx and alpine JS instead. Easier to maintain for me as well as more flexibility.
    3. Improved preview of media and their properties.
    4. Better preview of media before upload.
    5. Redesigned GUI - Intuitive (like GDrive(?)), do away with media menus (use filters instead), need oMedia is just media.
    6. Remove/reduce use of modals.
    7. Allow grouping of media (link an album) <- not yet confirmed if will be implemented
    8. Implement hookable methods to allow easier developer control for those who need advanced/custom control of their MM.

    A number of reported bug fixes as well.

    ETA? I cannot give a firm date about this, sorry.

    • Like 3
    • Thanks 1
  7. On 2/15/2023 at 9:55 AM, gebeer said:

    Hi, bringing this up again because I found the reason. On install of MM, the children under Admin->MediaManager got named "media-manager--image", --audio etc. No idea how this happended, though.

    Great work! Thanks @gebeer. I wonder if sanitizer name has something to do with this? 

    On 2/15/2023 at 9:55 AM, gebeer said:

    A check in MediaManagerActions.php around  L1575  for $parent instancof NullPage or the like would be great to at least issue a warning.

    Thanks for the suggestion. Noted for the next version.

    On 2/23/2023 at 6:23 AM, gebeer said:

    In this case a duplicate image was ignored for upload. Are these JSON responses supposed to be shown as messages in the GUI? If not, it would be awesome if they could be shown to the user.

    They are meant to show after bulk actions such has publishing, deleting, etc. as well as when uploads are done via drag and drop (in single or all media pages and when uploading directly to an MM Inpufield). In my testing now, I see the notifications in the GUI (upper right) except for when uploading via drag and drop in the single or all media pages in MM. I'll look into this in the next version.

  8. On 2/23/2023 at 7:20 PM, Jim Bailie said:

    @kongondo Pre-sale question: Does MM have a setting for overwriting existing files/images when updating? It seems like it would.

    As an example let's say I have tiger.jpg and want to update the image with lion.jpg...but keep the name tiger.jpg while displaying the new lion.jpg...does that make sense 🤨

    Hi @Jim Bailie,

    Apologies for the delay in responding. Thanks for the interest in MM. There is a setting for what to do when an attempt is made to upload a media whose filename matches one that already exists in the Media Library. The current options are skip  / rename /  replace. This currently does not cover your use case. This is because currently the media page is automatically created (on upload) off of the file name. Hence, in your case, lion.jpg would create a new media page title Lion.

    A similar request to yours has been made with respect to replacing the media in a Media Manager inputfield that stores only one image. In order to replace the media, one has to first delete the existing single media. It would be more intuitive and easier to (similar to PW) to just delete the existing media by the new one.

    I am currently working on a new version of Media Manager that amongst other things will have an option to give uploaded media custom names instead of grabbing this from the file name. I can add your scenario usage to the TODO list for this next version.

    • Like 1
  9. On 2/16/2023 at 8:16 PM, Spinbox said:

    Do you have a eta for this feature? 🤗

    I am hoping very soon. I am currently working on a 'Gift Cards/Vouchers' feature after which I'll work on 'Discounts'.

    • Like 1
  10. Hi @Spinbox,

    The usual ProcessWire page view, edit, add, etc. permissions apply. The generic 'padloper-shop' permission will not cover all use cases especially since Padloper pages are live under admin in the pages tree. I suggest you create a role(s) for your use case and apply the appropriate permissions to this role. Please see roles and permissions docs for detailed information Please note that although those docs also detail how to use the API, you can use the ProcessWire GUI to accomplish this task. This:

    Quote

    Roles are assigned to users, but they are also assigned to templates that have access control enabled. As stated earlier, this is how you limit access (view, edit, create, add, etc.) to certain pages, or groups of pages, in your site. By default, access control is not enabled for a template. When not enabled, pages using the template inherit access from the closest parent page that has access control enabled.

    might be handy. Perhaps you can target the top most parent page with a padloper template, i.e. /shop/padloper/. It uses the template 'padloper'

    Hope this helps, otherwise let me know if you get stuck.

    • Like 1
  11. 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.

  12. 1 minute ago, joe_g said:

    Thanks, I'm mostly looking for a way to remove a product from the cart, I can't seem to find thatin the link you attached

    JJ

    Yes, that link is only about adding.

    27 minutes ago, joe_g said:
    $padloper->cart->removeProduct(1043);

    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);
    }

     

  13. Hi @joe_g,

    4 hours ago, joe_g said:

    What's the best way for me to go about this?

    In-built discounts feature is a planned feature. For now, you can achieve this via a Hook.

    4 hours ago, joe_g said:

    I guess one way to do this (without an actual discount system) would be to automatically generate 3 products, one with the original price, and two with the discounts.

    This is not a good way to do it, as you have now found out 🙂.

    4 hours ago, joe_g said:

    The client wants to sell workshops for kids, and give discounts for siblings, X% for the first sibling and Y% for two or more siblings.

    Implementation will (for now) be via a Hook. Before this though, you need to make a decision about the logic. For instance:

    1. 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.
    2. 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).
    3. 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.

×
×
  • Create New...