<?php 
/****************************************************************/
/*          e-mo.pl © 2017                                      */
/*          http://www.e-mo.com.pl                              */
/*          e-mail: info@e-mo.pl                                */
/*          produkt: Action2osCommerce                          */
/*          wersja: 1.9.7                                       */
/*          webserwis: oscGold                                  */
/*          sciezka: https://www.e-mo.com.pl/plikit,1918,533545b244d7d.php*/
/*          data: 2017-09-25                                    */
/*          godz: 10:45:39                                      */
/****************************************************************/



class specials { 
	public $Conn = 0;
	public $errMsg = '';
	public $errNo= 0;
	public $specials_id=0;
	public $products_id=0;
	public $specials_new_products_price='';
	public $specials_date_added=0;
	public $specials_last_modified=0;
	public $expires_date=0;
	public $date_status_change=0;
	public $status=0;
        public $date_end = '';

	public function Dodaj(){
		$zwrot=true;
		$query="INSERT INTO  `specials` (
                    `products_id` ,
                    `specials_new_products_price` ,
                    `specials_date_added` ,
                    `specials_last_modified` ,
                    `expires_date` ,
                    `date_status_change` ,
                    `status` ,
                    `customers_groups_id` ,
                    `customers_id`) VALUES (  
                    :products_id,  
                    :specials_new_products_price, 
                    now() , 
                    now() ,  
                    :date_end ,
                    now(),  
                    '1', 
                    '0',  
                    '0')";
		$sth = $this->Conn->prepare($query);

		$sth->bindParam(':products_id', $this->products_id, PDO::PARAM_INT);
		$sth->bindParam(':specials_new_products_price', $this->specials_new_products_price, PDO::PARAM_STR);
                $sth->bindParam(':date_end', $this->date_end, PDO::PARAM_STR);
		$sth->execute();

		if($sth->errorCode() != 0){
			$zwrot=false;
			$this->errMsg = $sth->errorInfo();
			$this->errNo = $sth->errorCode();
		}

		 return $zwrot;
	
	}
	public function Usun(){
		$zwrot=true;
		$query="Delete from specials Where products_id=:products_id";

		$sth = $this->Conn->prepare($query);
		$sth->bindParam(':products_id', $this->products_id, PDO::PARAM_INT);

		$sth->execute();

		if($sth->errorCode() != 0){
			$zwrot=false;
			$this->errMsg = $sth->errorInfo();
			$this->errNo = $sth->errorCode();
		}

		 return $zwrot;
	 } 

}


?>
