Example #1
0
 public function indexAction()
 {
     // Affiche de la liste des produits
     $products = new Application_Model_Products();
     $this->view->entries = $products->fetchAll();
     //Zend_Debug::dump($this->view->entries);
 }
Example #2
0
 public function productAction()
 {
     // action body
     $id = $this->_getParam('id', 0);
     $code = $this->_getParam('productcode', '');
     $product = new Application_Model_Products();
     if ($id > 0) {
         $this->_helper->json($product->find($id));
     }
     if ($code != '') {
         $code = trim($code);
         $where = "ProductCode='" . $code . "'";
         $info = $product->fetchAll('Id', $where);
         if (isset($info['products'][0]['Id'])) {
             $this->_helper->json($product->find($info['products'][0]['Id']));
         } else {
             $this->_helper->json('');
         }
     }
 }