Friday, August 23, 2013

Setting up a Book Store Web Site in South Africa

My wife is a true bibliophile: she's mad about books. She works for Bookdealers, a group of bookshops around Joburg. In fact she managed the Bryanston branch, until it caught fire on 20th June.
The week before the fire there was a flood, and another fire. On top of that, one of the partners left; and he was the one who ran the Bookdealers web site. All the web site stock went with him. The flood had forced Bookdealers to remove all the books on sale on ABE Books, because the stock was in complete disarray as a result of the flood, and all the stock was in boxes. The same applied to everything offered for sale on Bid or Buy. Plus the guy who did the orders for these two sites took a month's leave. For the last 2 weeks the Bookdealers web site has been a single "under construction" page.
So they had to start from scratch. This has turned out to be a blessing in disguise, because they could use a newer cloud-based web solution, rather than the more traditional Drupal system used before. I had suggested using Squarespace, but its payment system works only in the USA. Then we heard about uShop, a South African cloud company that has partnered with both Shopify in Canada and PayFast in South Africa. I offered to check it out. That was less than a month ago. We'll probably go live next week. That's remarkable.
Did I say "we"? That would be my wife and myself. Penny has spent the last 4 weeks obtaining stock from the various branches and the warehouse, and scanning the covers. These get placed in a DropBox folder on her laptop. The file name matches the title of the book. Then she creates a text file with all the product details: title, subtitle, author, publisher, condition, price, etc. This is followed by a short description of the book. This is stored in the same folder as the scanned file.
In the meantime I had signed up for the free 2 week trial period on uShop, and started figuring out how to load the products and adjust the template to suit our needs. When I first looked at the sample pages on Shopify, I was delighted to see several example book stores. I wrote to a few of the sites, and the owner of Cookbook Village told me about the "Split" function. This was a revelation, because it introduced me to the whole concept of "filters" as used by the Shopify template language, called "liquid". Take a look at the image below (click on it for a full size view):
It shows a "product" page for one of the books, when you log in as an administrator. Notice how there is a "Name" field and a "Details" field, but no "Author" field. I used the "Split" function to divide the details field into three sections, using the "+++" string as a separator. Now part 1 is the standard product details, i.e. up to the first "+++" marker. Part 2 is the "author" section, i.e. between the first "+++" and the second "+++". Part 3 is the "blurb" or detailed description, and is everything that follows after the second "+++".
Now take a look at the template editor, and in this case we are looking at the section of the product page where the general "Details" information is placed. This has been substituted for the following code:
 {% assign words = product.description | split: '+++' %}
 {{ words.first }}
First, the variable "words" has been assigned the contents of "product.description", and then it has been split into pieces using the delimiter "+++". On the next line, part 1 is displayed, by using the phrase "words.first", or "words[0]" which would do the same thing. The code that follows is the code for the "Add to Cart" button, and then after that the blurb/description text is displayed, using "words.last". Here is the resulting product page, as shown in my web browser (click to see a full size image):
This is the store product page. Whenever you have a "was" price as well as the selling price, the template puts "Sale" over the top left of the picture. By fiddling with the template and the CSS, I could change the text to "Special Price", and move it up so it doesn't obscure the book picture. I also added some space between the two prices to make them easier to read.
Finally, I wanted to be able to display the categorisation(s) of the book, and allow the user to find other titles in the same category. The Shopify system uses "tags", and the category display page shows all the tags in use and allows you to filter by tag just by clicking on the tag. I copied this code and included it (with suitable modifications) in the product template.
Now take a look at the main page (click to see a full size image):
From left to right: the first highlighted text was to replace the heading "Featured Products" with "Titles of Interest" instead.
Next, to get all the pictures to look even and align left (each book is a different size) we simply changed the scan picture's canvas size so that it is as wide as it is tall, with the image part centered left. This allowed all the images to be treated eaqually, resulting in a neat, logical page.
Finally, I wanted to display the author name below the product name. The code shown here does it. As you can see, we use "words[1]" to get the middle part of the general description, and then strip out any html or line breaks using the liquid filters.
As you can see, none of this code is particularly difficult or earth-shattering. I used similar code in the "search results" page to remove the "+++" when search results are displayed. The entire Shopify experience has been enjoyable, getting to learn how the whole system hangs together, but knowing that understanding everything is not a requirement to getting the job done. I take no credit for the ease of use or technical excellence of the Shopify system, or the support and value-added services of uShop or PayFast. That's the great thing about cloud services: you get to benefit from the skills and expertise of others. I was able to apply my many years of experience in developing and running other web sites, to choose and tweak the templates, and get everything to work in a way that was straightforward enough for the bookshop manager to use and understand.
We don't have to worry about security patches or upgrading to the next version of Drupal or PHP or Apache or whatever. The cloud service is secure and reliable, and is updated for us as new features are rolled out to all the Shopify customers. Backups are done automatically, and the hosting system can handle surges in demand that would cause a conventional web server to fail.
All Bookdealers have to worry about is keeping the stock up to date, shipping the orders, and keeping the customer happy. I can monitor the web traffic using Google Analytics and Webmaster Tools, and the Bing tools. All the products that Bookdealers sells are automatically listed on the uPrice comparison engine, which is good for sales.
There are more aspects of the web store that we need to organise, but none of them is hampered by the technology. It's just a case of getting properly organised, and making sure people know what they need to do. After all, Bookdealers sell books, they're not a technology company.

See also: uShop: Cloud-based online shopping on my company web site. Hopefully I can do a few more online shopping sites that help small startup businesses.

Saturday, August 03, 2013

"Transgressors Will Be Prosecuted." Eventually. No, Really!

Alett Street Park is next door to the flats where I live. (Actually it should be Aleit Street park but what's a spelling mistake between illiterate friends?) There are two signs that spell out the rules of the park, and urges everyone to look after their park. It seems that the only people who don't give a damn about the park are the employees of the Joburg municipality.
If you call the number on the sign 011-375-5555 to report a bylaw violation (e.g. making a cooking fire) they refuse to log the call. Instead they get you to phone the Joburg Metro Police Department (JMPD) on 011-375-5819. This is the wrong number for bylaw enforcement. Instead you have to call the JMPD on 011-490-1630. I did all of this on Monday 22nd July 2013, after taking this picture. They asked me to send an email, which I did.
I reported that 4 men have been living in the park for several months. Every morning they make a cooking fire. ("No fires")
This photo shows 3 of them, and their large carrier bag they use to bring rubbish to the park, which they then sort, before removing some of it to sell. The rest gets dumped in the stream. ("No littering")
Shown here is their cooking fire, with a can of something on the boil, and a box of supplies. The wooden frame will be broken up and used for firewood. ("No fires") ("No littering") The email also pointed out that they sleep in the park, ("No sleeping") and do their laundry in the stream, which they then hang on the kids' jungle gym. I also pointed out that my wife has complained several times about this, and it has been going on for months. I sent it at 11am on Monday.
Another cooking fire, this time on Tuesday 23rd July. JMPD haven't opened or read the email yet.
Wednesday 24 July: The men have just brought a fresh load of rubbish for sorting. ("No littering")
Here they have hung some laundry on the jungle gym. Finally at 1.20pm on Wednesday, Ms Wisani Baloyi at the JMPD opens my email.
Thursday 25th July. Still no sign of the JMPD, and another cooking fire greets the day.
The fence on the left is the height of a door. Now compare it to the huge pile of rubbish next to the fence, next to the bridge where the stream goes from the park into the nature reserve on the left.
Friday 26th July. The JMPD is still dithering, and I photograph another cooking fire.
Later in the day an unidentified man (Mr Legoka Mangongwa?) from the JMPD phones to say they have "received a number of complaints" and would be "taking action", and would "let me know".
Saturday 27th July: On the left is yet another fire. In the middle, one of the men takes a short break after bringing in bags of rubbish (right) which his colleague is sorting.
Sunday 28th July: One of the men breaks off a tree branch and carries it to yet another cooking fire. Still no sign of the JMPD.
Monday 29th July: The first car tyre appears, right in the middle of the stream. And, of course, there is the daily cooking fire. It's been a week since I sent the email, and an SMS to the "Crime Line" on 32211.
Tuesday 30th July: Now there are two car tyres in the stream. Still no "action" from the JMPD.
Wednesday 31st July: Once again one of the men living in the park is seen tending his cooking fire. This is Africa, after all.
Thursday 1st August: Our customary fire ("No fires") and customary inactivity from the bylaw enforcement officials at the JMPD. I called 011-490-1630 to find out what's happening, but are told that "everyone is in a meeting". Municipal haste at its finest. I send a reminder email, and CC'd it to the Joburg Municipality PAIA contact official. I pointed out that it has been 10 days since my original complaint.
Meanwhile, the rubbish sorting continues, in the park, in full view of the public. They know they are violating the park rules, but they really don't give a damn. They just turn their faces away if you get too close with a camera.
Friday 2nd August. It's the end of the second week since notifying the JMPD, and I am getting fed up.
Here a man from the park is rummaging through our rubbish bins in the street looking for stuff he can salvage: metal, plastic bottles, etc. This is recycling, African style.
I wouldn't mind so much if they didn't use the park for their sorting area. Here they are just outside the park. The low wooden fence separates the park from the road. Why can't they sort their rubbish there?
Meanwhile, in the park itself, more washing on the jungle gym, and utensils and stuff out to dry. Nice of them to move in, uninvited.
After taking these pics I decided to call again. Perhaps they won't be in a meeting this time. Ms Wisani Baloyi tells me that a Mr Legoka Mangongwa is dealing with the matter, and he will have to contact me to let me know what is being done. Ms Baloyi tells me that complaints are supposed to be handled "within 3 days", but she can't tell me why this one has not.
I decided that it is time to find out who my Ward Councillor is. It turns out Ward 99's Councillor is Bruce Herbert, and his cell no is 083-274-3551. He also has a twitter feed at @Delta99Jozi. I send him an SMS to ask for his email address, and then send him a detailed email about the issue. I CC'd it to Ms Baloyi, who read it at 3.15pm. Still no word from Mr Mangongwa. Obviously no "Transgressors Will Be Prosecuted" by the JMPD in the park today.
Update Monday 5th August 4pm: No sign of the promised City Councillor, but Caiphus (0828031158) from "City Parks and JMPD" called to say he had just received my complaint, and would be sending some officers to investigate.
Update Tuesday 6th August 8am: Cllr Herbert arrived at the park and gave a verbal warning to the trasgressors, then phoned me to say that actually I'm in ward 98, and the Councillor for this ward is Laurette Van Zijl @lvz60 (082-330-0593) but that she has been on sick leave until very recently. The irony is that she is the DA spokesperson on the Environment. Hopefully the JMPD won't take too long to figure out where the park is. So far they have taken 15 days.


Update Wednesday 7 August: As promised by Cllr Herbert, the JMPD came during the night and arrested the vagrants. Today the park is almost back to normal, apart from the mess they 4 men made during their 3 month stay. I am planning to do something about it on Friday, which is a public holiday.
Update: By 11am there are 2 vagrants back in the park, with a lit fire and their rubbish ready for sorting. What do we do now? I send a new complaint to No wonder people start taking the law into their own hands.

The Cleanup ...

Thursday 8 August: I woke up to find a fire blazing in the park, close to the bridge into the nature reserve. Someone decided to torch the remaining rubbish left by the vagrants. It smells toxic with burning plastic, but I guess we'll just have to wait it out.
Friday 9 August: Gentle rain put paid to my plans to clean up the park on this public holiday. Fortunately the stream didn't flood and send all the rubbish into the nature reserve.
Saturday 10 August: Around 2pm I took a rubbish collection bin to the park and filled it and 2 more with junk: car tyres, firewood, metal and plastic rubbish. Two unemployed men in the park volunteered to help clean up, and the three of us got stuck in. We have cleaned up the worst of the mess, but could probably fill a few rubbish bags with smaller stuff. I'll leave that for another day. In the meantime, people have returned to the park and are enjoying it once more.

Warning: The NSA and 4 million other sick weirdos with "security clearance" have intercepted this page and know that you are reading it.