Fun: Playing Whack-A-Mouse Seventeen Hours A Day

December 6th, 2008 by Richy B. No comments »

Yes, I’ve mis-quoted Weird Al’s “Your Horoscope for today”, what ya goin do, sue me? I’m gonna sue sue, yes I’m gonna sue, Sue Sue yeah I might even sue you.

Ehm..

Sorry, please don’t sue me even though I had a Weird Al moment there. To distract you – here’s something SHINY! Oooh, shinyness and KITTY! What more could somebody ask for for the weekend?

PHP: Zend_Dojo_Form SubmitButton not showing

December 5th, 2008 by Richy B. No comments »

In version 1.7.0 of the Zend Framework, specifically the Zend_Dojo_Form_Element_SubmitButton class (which makes the Zend_Form use the Dojo Javascript library), there is a small bug which prevents the label section of the Submit button being shown.

To work around this, just add something like:
$eElement->setDijitParam(‘label’,’Submit label’);
to work around the issue.

This is a known issue in the Zend Framework and will be fixed in the next release… If, however, like me you have spent a good hour or so trying to find out why your implementation doesn’t work and other demonstrations on the internet do, well now you should be able to find out why!

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

December 5th, 2008 by Richy B. No comments »

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.

PHP: Difference in Dates Using Zend_Date

December 4th, 2008 by Richy B. 1 comment »

I’ve had to write some code recently that handles peoples ages based on their date of births… Something simple you expect, until you realise that PHP can’t really deal with years before 1970 (due to UNIX date time restrictions). Luckily Zend_Date (in the Zend Framework) comes to hand to help!

But how do you actually turn a date in the format YYYY-MM-DD into a difference in years? Well, here’s how! We’re relying on the date to be consistently 10 characters long in the format YYYY-MM-DD with any unused date “zerod” out (for example, if we are using OpenID which allows people to “hide” parts of their DOB):

if (preg_match('/^([1-2][0-9][0-9][0-9])\-([0-1][0-9])\-([0-3][0-9])$/',$sDob,$aMatches)) {
    $iYear=$aMatches[1];
    $iMonth=$aMatches[2];
    if ($iMonth<1 || $iMonth>12) {
        // Set a minimum/standard month for this calculation
        $iMonth=1;
    }//end if ($iMonth<1 || $iMonth>12) {
    $iDay=$aMatches[3];
    if ($iDay<1 || $iDay>31) {
        // Set a minimum/standard day of the month for this calculation
        $iDay=1;
    }//end if ($iDay<1 || $iDay>31) {
    // If anybody was born before 1850 or after 3,000 (say they have a time machine)
    // then, sorry, they'll have to check their date of birth elsewhere!
    if ($iYear>1850 && $iYear<3000) {         if (checkdate($iMonth,$iDay,$iYear)) {             $cNowDate=new Zend_Date();             $cUserDate=new Zend_Date(Array('year'=>$iYear,'month'=>$iMonth,'day'=>$iDay));
            // Sanity check that the date the user entered is actually in the past!
            // No future time travellers welcome here!
            if ($cNowDate->isLater($cUserDate)) {
                $cDifference=$cNowDate->subDate($cUserDate);
                $aDifference=$cDifference->toArray();
                print 'Year difference is:'.$aDifference['year'];
            }//end if ($cNowDate->isLater($cUserDate)) {
        }//end if (checkdate($iMonth,$iDay,$iYear)) {
    }//end if ($iYear>1850 && $iYear<3000) {  }//end if (preg_match

Book Review: php|architect’s Guide to E-commerce Programming with Magento

November 30th, 2008 by Richy B. No comments »

I’ve decided to switch the back end of my side-line e-commerce dance wear and leisure wear clothing site from ClickCartPro to Magento. Why? Well, Magento is cheaper (moot point as I’ve already brought the licence for ClickCartPro), Open Source (so’s ClickCartPro), is more flexible (so it seems), has more options and it’s another shopping cart system for me to learn and have experience with (plus it does seem to be growing in popularity quite a bit).

However, the switch has come with a price: it’s quite a complex bit of kit! So, since Waterstones had an offer on and I needed to buy some other books I purchased php|architect’s Guide To E-Commerce Programming with Magento from them (Waterstones’ price is £19.99 and Amazon’s is £18.99: both with free shipping. It’s also available as a PDF for $29.99 from the publisher’s site). Why did I buy this book? Well, it was the only Magento book Waterstones (or Amazon) had!
» Read more: Book Review: php|architect’s Guide to E-commerce Programming with Magento

gamy-dance
%d bloggers like this: