Skip to content

Instantly share code, notes, and snippets.

@nclundsten
Created July 12, 2013 19:39
Show Gist options
  • Save nclundsten/5987164 to your computer and use it in GitHub Desktop.
Save nclundsten/5987164 to your computer and use it in GitHub Desktop.
<?php
//speckcatalog product mapper
public function getByCategoryId($categoryId, $siteId=1)
{
$table = $this->getTableName();
$linker = 'catalog_category_product';
$joinString = $linker . '.product_id = ' . $table . '.product_id';
$where = array(
'category_id' => $categoryId,
'website_id' => $siteId
);
$select = $this->getSelect()
->join($linker, $joinString)
->where($where);
if ($this->enabledOnly()) {
$select->where(array('enabled' => 1));
}
return $this->selectManyModels($select);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment