Released: Pro2Store Version 2 BETA

Ray Lawlor
23 September 2021

We're now delighted to announce the arrival of the BETA version of the Pro2Store's next big step. That's right, Pro2Store V2 BETA is now available to everyone to test. Pro2Store V2 bring a huge amount of changes and upgrades, so if you have time please download and test and let us know what you think!

 V2 comes with too many changes to detail, but in this blog I'll try to outline the major changes, why I made them and why I think they are important going forward. Let's start with the backend.

Backend

The backend interface for Pro2Store has been completely redesigned and rewritten from the ground up. Here are the main points:

  • The backend is no longer an SPA (Single page application) built with Angular. We now use separate pages with a small VUE file being loaded on each page.
  • The backend is completely redesigned - it still uses UIKit but it has less reliance on the PrimeFaces framework. We still love PrimeFaces and we've used some of the PrimeVue components, but we've dropped over reliance on these. Now everything runs on UIKit we ( and other contributors) can edit the code etc as they see fit. 
  • We're improved searching and filtering as well as pagination
  • Since there is no longer an SPA for the backend, we've been able to partly use Joomla's MVC, which means you can now use your preferred WYSIWYG editor with Pro2Store and we've reverted to whatever Media manager you prefer to run the images.
  • This makes the transition to Joomla 4 much easier and many aspects of the BETA will already work on Joomla 4. However, please test on Joomla 3 for now, Joomla 4 compatibility is still being worked on! 

So why such a wholesale change?

We were finding that the build process for the Angular SPA was just too troublesome to work with overall. Even changing a language bug meant  we had to rebuild the entire Angular app and make a new release. And while we had scripts to do this automatically, the process was slowing down feature development too much.

We also found that helping out community was difficult. Because of the way modern JS frameworks are built, all the code is minified and packaged, this meant that, when one of our great community members found a bug, we couldn't simply fix it there and then for them, we needed to go back to the source code, find the bug, fix it and release, before the customer could fix their site!

This process just became too much... with V2... we use the (partly) the Joomla MVC, only the VUE code for a single page is minified, so bugs can be caught and fixed there and then.

Variants 

V2 brings with it the long awaited Variants system for products. We modelled this on the Shopify system to ensure the best UI for managing variants. Now you can set up different aspects to a product, say size and colour, and these automatically match using a Cartesian Product (very fancy!). This means you can now manage prices, stock levels and availabilities of variations of a product individually. Variants present as select drop downs on the frontend. You can even set the default values! :)

So what happens with "Product Options"?

We thought long and hard about whether to keep these in the system - at one point I completely deleted the code for the old Product Options System! But in the end we kept it in, but in a revised form. Now Product Options are simple "checkbox" options to an item. These can be used for things like "Add gift wrapping" or "Include installation". I.e. these can be used for little product add-ons that might be required. The bulk of the options will be controlled by the Variants system.

System Code

Non-developers might want to stop reading here... but I thought I'd share some notes on how the code has changed with V2. I'm really proud to be a self-taught developer, anyone who follows me on twitter will know that. But I do admit that I was never happy or proud of the code I'd written for Pro2Store V1. It was a battle to keep the bugs at bay. When I look back on 2020, I had the idea for Pro2Store and I simply wanted to "get it out there" as quickly as possible. That meant taking some shortcuts on code quality. 

But with V2, I've been able to completely refactor the code from top to bottom. Over 30,000 lines of code have been rewritten for V2. I've refactored all the old classes into Factory classes. This simplifies client code significantly, meaning the frontend code is much more reliable with fewer bugs.

This will also make it much easier for 3rd party devs to extend Pro2Store if they choose to. All classes within the system now have an associated "factory" with common methods throughout. Example:

V1:

// getting an order and updating its status

$order = new Order($order_id);

$order->status = "C";

$order->save();

V2:

// getting an order and updating its status

OrderFactory::get($order_id)->updateStatus("C");

For non-devs, you might not see an issue... but for developers this code is obvious... V1 instantiates an object class in client code, this is anti-pattern. V2, relies on the factory to create the Order object and calls a public function on the object.

The biggest change comes in the currency manager. Before, client code would need to do the work of figuring out what currency the customer had selected, and what currency was set up as the default:

V1:

$currencyHelper = new Currency();

$default = $currencyHelper->getDefault();

$current = $currencyHelper->currency;

if($default == $current) {

//etc.

}

 

V2:

// contains all properties for the currency including a boolean for if the current customer currency is the default.

$currency = CurrencyFactory::get(); 

 

Frontend 

The frontend elements still behave the same as in v1... the only difference is the updated client code "under the hood" ... no more instantiating objects in client code! So elements will be faster to load, and more bug free than before.

The Shortcodes system has been redesigned to use the new Factory Pattern and is much more reliable and bug free. 

Ready to jump in and test?

Get Pro2Store V2 here 


Latest Articles

| Ray Lawlor | News

Released: Pro2Store Version 2 BETA

We're now delighted to announce the arrival of the BETA version of the Pro2Store's next big step. That's right, Pro2Store V2 BETA is now available to everyone to test. Pro2Store V2 bring a huge amount of changes and upgrades, so if you have time please download and test and let us know what you think!

| Ray Lawlor | News

Pro2Store 1.5.0 Available Now

Hi Pro2Store community. We are happy to announce the immediate availability of Pro2Store Version 1.5.0. This release marks a "line in the sand" for Pro2Store, with lots of fixes and improvements, but also a launchpad for the 1.6 release.

| Ray Lawlor | News

Pro2Store 1.4.0 Available Now

Hi Pro2Store community. We are happy to announce the immediate availability of Pro2Store Version 1.4.0. This release marks a new direction for the frontend of Pro2Store as well as addressing a ton of bugs reported by you and our diligent Beta Testers.

An Ecommerce Platform for Yootheme Pro The first and only ecommerce system to work directly with Yootheme Pro for Joomla.

© 2021 Ray Lawlor - Pro2Store. All rights reserved. Powered by (but not affiliated with) YOOtheme.