Current File : /home/karenpetzb/application/models/utils/Item.php |
<?php
class Item {
var $idProduit;
var $idChild;
var $qteChild;
var $nom;
var $descshort;
var $navnom;
var $url;
var $designation;
var $stock = 1;
var $isAccessoire = 'N';
var $selectedOption = "";
function Item() { }
function getItemInfo($idChild, $qteChild, $isAccessoire, $selectedOption) {
$sql = "
SELECT p.NOM NOM, p.NAVNOM NAVNOM, p.DESCRIPTIONSHORT DESCSHORT, p.ID IDPRODUCT, pic.URL URL, pc.DESIGNATION DESIGNATION, p.STOCK STOCK
FROM productchild pc
LEFT JOIN product p ON p.ID = pc.IDPRODUCT
LEFT JOIN picture pic ON pic.IDPRODUCT = p.ID
WHERE pc.ID = ".$idChild."
AND p.isACTIVE = 0
AND pic.POSITION = 1
";
$productChild = new ProductChild();
$result = $productChild->getAdapter()->fetchRow($sql);
$this->idChild = $idChild;
$this->qteChild = $qteChild;
$this->idProduit = $result['IDPRODUCT'];
$this->nom = $result['NOM'];
$this->descshort = $result['DESCSHORT'];
$this->navnom = $result['NAVNOM'];
$this->url = $result['URL'];
$this->designation = $result['DESIGNATION'];
$this->stock = $result['STOCK'];
$this->isAccessoire = $isAccessoire;
$this->selectedOption = $selectedOption;
}
public function toString() {
return $this->nom." - ".$this->idChild." : ".$this->qteChild."<br>";
}
public function isItemAccessoire() {
if ($this->isAccessoire == "Y") { return true; }
return false;
}
}
?>