Press "Enter" to skip to content

Category: Life: Work and Techy

ClickCartPro: Extracting Sales Figures

If you want to get an idea of the stock you’ve sold using the ClickCartPro UK e-commerce software, then you may find the following SQL query useful. Run in phpMySQL to be able to export the data into a spreadsheet.

SELECT SUM(itemquan) as itemssold, count(*) AS timesordered, itemname, itemnum, itemopts, SUM(itemquan)/COUNT(*) AS average FROM `gbu0_orderitems` WHERE FROM_UNIXTIME(epochorder) BETWEEN ‘2007-01-01’ and ‘2008-12-31’ GROUP BY itemnum,itemopts ORDER BY itemssold DESC

What does this mean?
Well, “SUM(itemquan) AS itemssold” grabs the number of items sold, “count(*) AS timesordered” grabs the number of times that item has actually been ordered (as an order could be for 2 or more items), “itemname, itemnum, itemopts” grabs the items name, item number and the options ordered (handy for sizes), “SUM(itemquan)/COUNT(*) AS average” works out the average number of items per order, “FROM `gbu0_orderitems`” says to look at the order table (ok, I’m not distinguishing between cancelled, pending and completed orders at the moment), “FROM_UNIXTIME(epochorder) BETWEEN ‘2007-01-01’ and ‘2008-12-31′” says to only include orders placed between the 1st of January 2007 and the 31st of December 2008 and “GROUP BY itemnum,itemopts ORDER BY itemssold DESC” means group the items for the counts by the item number and options and then order everything by the number of times sold in decending order.

Facebook: Copyrighted Content

I’ve just answered a post on LinkedIn where somebody asked (in the “Casual Games” discussion group):

“There is a hacked flash version of one of our games listed as an application at facebook. I could not find any real support contact information at the facebook website. Just FAQs and canned responses. Do you know anybody working at facebook whom I could contact in this matter? Thank you!”

As I think this may be an issue I’ll have to look at in the future, I’m copying my reply here:

You’ll probably be best sending them a DMCA (Digital Millennium Copyright Act) request as detailed on http://www.facebook.com/copyright.php and their form on http://www.facebook.com/copyright.php#/copyright.php?notify=1 . (See also http://www.facebook.com/help.php?topic=copyright )

As long as you provide the full details requested (including detailing the exact URL the content can be found: “A page on your site…” isn’t detailed enough to be an official request). Basically, if the DMCA is sent and is correctly detailed (see http://www.blogherald.com/2008/08/04/dmca-safe-harbor-part-two-the-dmca-checklist/ ), then Facebook may then become liable for any penalties for copyright breaches from 14 working days from that point (as, by notifying them via a DMCA complaint, they then lose the “safe harbour” provision for user generated content).

If the content is hosted by a third party (which may be difficult to tell if it is integrated using the FBML canvas frame method: if it’s integrated via an iFrame, it should be easier to tell: if you want assistance, feel free to contact me with the page on Facebook and I’ll try to help), then you can also contact the third party webhost/ISP for assistance.

e-Commerce: ClickCartPro making all product ids safe

Basically, in ClickCartPro product “identifers” can not have spaces, commas, full stops or brackets in them (basically only the letters A-z, numbers and underscores) and they have to be a maximum length (I’m not sure what the exact maximum is).

If you are maintaining an “established” store (i.e. one with products) where a number of products are showing up on the front end, but when you try to “Add to cart” they don’t appear in the cart then this is probably the problem. To “fix” it (this is more a work around), run the following UNREVERSABLE MySQL code (i.e. make sure you have a backup before hand):

create table temp_replacetest(id varchar(250),hash char(32));
INSERT INTO temp_replacetest (SELECT id,md5(id) from gbu0_prod);
update gbu0_prod,temp_replacetest SET gbu0_prod.xprod=replace(gbu0_prod.xprod,temp_replacetest.id,temp_replacetest.hash) where temp_replacetest.id IN (gbu0_prod.xprod);
drop table temp_replacetest;
update gbu0_prod set id=md5(id);
select id,xprod from gbu0_prod

This will set all product ids to be md5 hashes which, since they only consist of 32 numbers or the letters a-f, are “safe” to use as product identifiers.

e-Commerce: Changing the VAT Rate in ClickCartPro (UK Edition)

If you are using the UK edition of Kryptonic’s ClickCartPro ecommerce system (sold by Greenbarn Web) and you still haven’t updated the VAT rates in it to take into account the reduction in UK VAT on the 1st of December from 17.5% to 15%, then here’s how to do it.

To change the VAT rate in ClickCartPro from 17.5% to 15% (or vice versa), just login to the admin panel (normally via http://www.example.com/admin.php ) and select from the left hand menu “Commerce: Orders and Checkout” (it should be the third option down) and then “Manage EU Tax Rates”. You’ll probably see three rates “High Rate”, “Low Rate” and “Zero Rate”. If you select “Update” next to “High Rate”. In the “EU Tax Rate” box, you should see the current rate of VAT being shown and be able to adjust it to 15%. Click “Submit” and it should take immediate effect.