Current File : /home/karenpetzb/application/models/PromoCommand.php
<?php
class PromoCommand extends Zend_Db_Table
{
    protected $_name = 'promo_command';
    protected $_primary = 'ID';

	/*
	 * Remise selon le nombre de produits
	 */
    public function getRemiseCommandByProductQte($reference, $qte) {   try {
    	return $this->select()->where("CHILDREFERENCE = ?", $reference)->where("CHILDNBR <= ?", $qte)->query()->fetch(); 
   		} catch (Zend_Exception $e) { return array(); }
    }
    
    /*
	 * Remise selon le TOTAL HT
	 */
    public function getRemiseCommandByTotalHT($totalHT) { try {
    	return $this->select()->where("MONTANTEQUAL < ?", $totalHT)->order('MONTANTEQUAL DESC')->query()->fetch(); 
   		} catch (Zend_Exception $e) { return array(); }
    }
     
    /*
	 * Remise de toute les commandes
	 */
    public function getRemiseCommandByAll() { try {
    	return $this->select()->where("isALL IS NOT NULL")->query()->fetch();  
   		} catch (Zend_Exception $e) { return array(); }
    }
     
    /*
	 * Si la commande est valid
	 */
    public function getCommandValid() { try {
    	return $this->select()->where('MONTANTVALID IS NOT NULL')->query()->fetch();  
   		} catch (Zend_Exception $e) { return array(); }
    }
     
}
?>