Added missing files...

This commit is contained in:
franck
2013-09-17 17:31:22 +02:00
parent 4731929a70
commit c8baa38fed
11 changed files with 1042 additions and 7 deletions

View File

@@ -46,7 +46,8 @@ class Product extends BaseProduct
/**
* @return the current default category for this product
*/
public function getDefaultCategory() {
public function getDefaultCategory()
{
// Find default category
$default_category = ProductCategoryQuery::create()
->filterByProductId($this->getId())
@@ -61,8 +62,8 @@ class Product extends BaseProduct
*
* @param integer $categoryId the new default category id
*/
public function setDefaultCategory($categoryId) {
public function setDefaultCategory($categoryId)
{
// Unset previous category
ProductCategoryQuery::create()
->filterByProductId($this->getId())
@@ -85,11 +86,17 @@ class Product extends BaseProduct
/**
* Calculate next position relative to our default category
*/
protected function addCriteriaToPositionQuery($query) {
// TODO: Find the default category for this product,
// and generate the position relative to this category
protected function addCriteriaToPositionQuery($query)
{
// Retrourver les produits qui ont la même categorie par defaut
$produits = ProductCategoryQuery::create()
->filterByCategory($this->getDefaultCategory())
->filterByDefaultCategory(true)
->select('product_id')
->find();
// Filtrer la requete sur ces produits
if ($produits != null) $query->filterById($produits);
}
/**