Current File : /home/karenpetzb/application/models/PromoProduct.php |
<?php
class PromoProduct extends Zend_Db_Table
{
protected $_name = 'promo_productchild';
protected $_primary = 'ID';
/*
* Promotion selon la reference d'un produit
*/
public function getRemiseByProductReference($reference) {
try { return $this->select()->where("REFERENCE = ?", $reference)->query()->fetch();
} catch (Zend_Exception $e) { return array(); }
}
/*
* Promotion selon la marque d'un produit
*/
public function getRemiseByProductBrend($idbrend) {
try {
return $this->select()->where("IDBREND = ?", $idbrend)->query()->fetch();
} catch (Zend_Exception $e) { return array(); }
}
/*
* Promotion selon la category d'un produit
*/
public function getRemiseByProductCategory($idcategory) {
try { return $this->select()->where("IDCATEGORY = ?", $idcategory)->query()->fetch();
} catch (Zend_Exception $e) { return array(); }
}
/*
* Promotion selon la qte d'un produit
*/
public function getRemisesByProductQte($reference, $qte) {
try { return $this->select()->where("CHILDREFPROMO = ?", $reference)->where("CHILDREFPROMONB <= ?", $qte)->query()->fetchAll();
} catch (Zend_Exception $e) { return array(); }
}
/*
* Promotion selon la date de promotion d'un produit
*/
public function getRemiseByProductDateBetween($date) {
try { return $this->select()->where("DATEPROMOSTART <= ?", $date)->where("DATEPROMOEND >= ?", $date)->query()->fetch();
} catch (Zend_Exception $e) { return array(); }
}
}
?>