Skip to content

Instantly share code, notes, and snippets.

@dragoonis
Created April 22, 2011 00:55
Show Gist options
  • Save dragoonis/935797 to your computer and use it in GitHub Desktop.
Save dragoonis/935797 to your computer and use it in GitHub Desktop.
<?php
function compare() {
$sLevel = $this->get(__FUNCTION__, '');
$iCatID = $this->get($sLevel, 0);
if(empty($sLevel)) {
throw new PPI_Exception('Unable to locate compare function\'s category level.');
}
if(empty($iCatID) || $iCatID < 1) {
throw new PPI_Exception('Unable to locate category ID');
}
switch($sLevel) {
case 'topcat':
$sLevel = 'topcat_id';
break;
case 'catzero':
$sLevel = 'catzero_id';
break;
case 'page':
$sLevel = 'page_id';
break;
default:
throw new PPI_Exception('Invalid Category Specified');
break;
}
$oProduct = new APP_Model_Product();
$aProducts = $oProduct->getProducts(array(
'level' => $sLevel,
'cat_id' => $iCatID,
'get_spec' => 2,
'get_offers' => 1,
'get_reviews' => 1,
'max_items' => 5
));
$this->addStylesheet('compare.css');
$this->load('product/compare', compact('aProducts'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment