My initial action before I started working on an improve shopping cart implementation was to create a couple tests so I can actually verify that things are still good. This has helped greatly in preserving existing functionality (the cart related code in ZenMagick does work as wrapper around Zen Cart’s shopping cart data) while allowing to re-use the same classes in conjunction with the new shopping cart service.
I still haven’t solved the questions around what to do with anonymous users where no cart data is written to the database, but that can wait a bit longer.
The tests are a bit tricky to run, because it is easy to get session and database out of sync (currently all testing is done while being logged in). Also, the tests do add one of each product of the demo store into the cart which doesn’t help the performance of the tests…
Right now I am about to check in the first milestone in this epic battle (reading zen cart source is not much fun); the tests claim that all cart items of products that I managed to add grammatically (iterating from 1-200) have the correct price. I realize that this is not 100% yet (adding is done purely with the attribute defaults, which might not cover all possible combinations). Still a good start!
I am slowly diving deeper into the shopping cart code and not all is good. One of my main complains so far would be that the two tables that are used to store cart contents are linked by customer id and not via a unique cart id. Having a unique id would be much nicer and allow things like wishlist, etc without the need to create new tables.
As it stands, the database is only written for registered and logged in users. Data of anonymous users is kept in the session. While this is good from a database maintenance point of view, it makes the handling more tricky. Even with 2 or three additional queries to load the cart contents for every request the new code will use considerably less queries than the current Zen Cart code.
There is going to be a new shopping cart service to load carts based on accountId (until I can come up with a simple solution to use a cart id…). Most of the work is centered around making the existing classes ZMShoppingCart and ZMShoppingCartItem work with both the current code where they act as wrapper around zen cart code and also with the new service.
The item class is all good to go. Next I have to decide whether to spart on the cart class or fix a couple outstanding bugs in the new service – attribute handling is not easy!
Anyhow, good to see progress in that area that will make pages faster, in particular when the cart sidebox is active and every page will access the cart contents.
It’s been a while since my last post and it is about time to write some more about the upcoming release. Yes, it is coming, honestly
I’ve spend the last two weeks squashing bugs and regressions stemming from the changes to form field names and url mappings. There were also a few places where core code was still using deprecated code. Obviously, removing the deprecated methods/functions did reveal that!
Right now I’ve started looking at improving the shopping cart and checkout, in particular the number of SQL queries and performance generally. However, even though I made some good progress (including the obligatory new test case) I feel that it would be better to get the last big batch of template changes out into the wild.
So, bottom line is that the next release is not far away. In fact, I am aiming for the next weekend, but I won’t promise anythings.
Those that are curious might want to take a peek at the CHANGELOG to see what coming their way. (In contrast to some other projects I try to make the development process as transparent as possible…)