Jump to content

Padloper 010 Released


kongondo
 Share

Recommended Posts

Padloper 010

Padloper 010 (aka Padloper 2 version 010) is ready for download.

Requirements

  1. PHP>= 8.2.0
  2. ProcessWire>=3.0.200

Maintenance

Padloper 010 is mainly a maintenance release:

  1. Fixes money rounding bugs found in Padloper 009 (and earlier). 
  2. Adds the Money for PHP Library to handle monetary values in an easy and powerful way.
  3. Fixes money math issues when prices include tax.
  4. For the sake of internal maintenance, reorganises files and directory structure. 

Money Matters

Specifically regarding 'prices include tax', and I will be adding this to the docs, it is important that you display your prices in the frontend in a way that doesn't confuse consumers. This is not unique to Padloper but a general e-commerce issue. This means making careful decisions around displaying unit vs total prices as well as whether to include notes about potential rounding pence/cents issues in your shop's policy documents. Due to rounding issues (pence, cents, etc) when it comes to money, especially if quantity is more than 1, the math might look off. I.e., (item * quantity) + tax IS NOT NECESSARILY EQUAL TO (item + tax) * quantity. See this article for a thorough discussion.

Breaking Changes

There are a few unavoidable breaking changes due to code rationalisation.

API

Some API had to be changed for maintenance and usage simplicity reasons. This affects checkout, cart and discounts. For instance:

<?php

namespace ProcessWire;


# OLD API
$checkout = $padloper->checkout;
$response = $checkout->render($options);

# NEW API
// $response = $padloper->render($options);// this will be deprecated in a future release
$response = $padloper->renderCheckout($options);


##########

# OLD API
$cartRender = $padloper->cartRender;
$content = $cartRender->editCart();

# NEW API
$content = $padloper->editCart();

##########

# OLD API
$cartRender = $padloper->cartRender;
$content = $cartRender->viewCart();

# NEW API
$content = $padloper->viewCart();

HOOKS

Backend hooks rename:

// OLD NAMING FORMAT
PadloperProcessRenderXXX
e.g. PadloperProcessRenderOrders

// NEW NAMING FORMAT
PadloperAdminRenderXXX
e.g. PadloperAdminRenderOrders

Other hooks rename:

// OLD NAMING FORMAT
PadloperXXX::methodName
e.g. PadloperUtilities::getProductWeight, PadloperCart::getProductPrice

// NEW NAMING FORMAT
Padloper::methodName
e.g. Padloper::getProductWeight, Padloper::getProductPrice

 

Upgrading

Replace all files (not overwrite!). This is because some files have been deprecated, renamed or moved. Safest way to upgrade is to get rid of all existing Padloper files and folders under /site/modules/Padloper/ and then copy over the new 010 files and folders then do a module refresh.

New Features

The two new features are:

  1. $padloper->money(); More information will be added to docs.
  2. Bank Name as a property (bankAccountName) in the return value of $padloper->getShopBankDetails();. See request in this topic.

Next Steps

As mentioned in Padloper 009 topic, the focus now will be the documentation.

Any questions or issues, please let me know.

Thanks.

Edited by kongondo
  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

@kongondo I am still on 008 (well as you know somewhere between 8 and 9 😅) - should I go through 009 to get to 010?

I'm thinking probably yes - if it enables me to better understand all the changes with the amount of custom tweaks I have on my site and make sure they all get re-applied.

  • Like 1
Link to comment
Share on other sites

Hi @Pete,

On 9/8/2024 at 4:19 PM, Pete said:

should I go through 009 to get to 010?

Defo! And carefully! 😀.

On 9/8/2024 at 4:19 PM, Pete said:

enables me to better understand all the changes with the amount of custom tweaks I have on my site and make sure they all get re-applied.

Yes. But we need to come up with a way to have your custom tweaks applied without touching Padloper itself. Are you able to capture these in one document? Even a git diff would do, but an annotated document is better, i.e. did this here, because...etc.

Thanks!

  • Like 1
Link to comment
Share on other sites

I think for mine what I'll need to do is a diff between the last unaltered source code I have and my code to play "spot the difference" then I can write it in a doc and send it to you. Some were improvements that might be beneficial to all, others were workarounds for very specific things... and others still were files written for you but only for my project so sounds like a bit of a nightmare to update without losing anything (hence why I've been putting it off if I'm honest).

I'll need to get it done this month at any rate so I'll let you know. At least when I have the doc I'll also know what to check for on each update.

Link to comment
Share on other sites

Great stuff!

I had some problems when having FormBuilderProcessorStripe installed. It couldn't find the module's file. I just removed the module completly so can't give any more insights.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...