Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to test a magento class thru command line for Ozzy
require_once 'app/Mage.php';
// this class is loaded in app/code/local/Paquin/Ozzy.php
$ozzy = new Paquin_Ozzy('json2.json');

This comment has been minimized.

Copy link
Owner Author

@joshribakoff joshribakoff commented Oct 9, 2013

class Paquin_Ozzy
    function categoryIdsToShow($userID)
        $cacheFile = Mage::getBaseDir()."/var/cache/$userID";

        if(file_exists($cacheFile)) {
            echo "cache hit!\n";
            return unserialize(file_get_contents($cacheFile));

        $array = $this->hitTheAPI();
        file_put_contents($cacheFile, serialize($array));
        return $array;

    function hitTheAPI()
        echo "API hit!\n";
        return array(1,2,3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.