public function productAction()
 {
     $prodId = (int) $this->getRequestParam('id', 0);
     $productTbl = new Product();
     $product = $productTbl->getProduct($prodId);
     if (!$product) {
         $this->notFound();
     }
     $componentMenu = new TopMenuComponent($this);
     $componentMenuResp = $componentMenu->toString();
     $componentNotify = new NotifyComponent($this);
     $componentNotifyResp = $componentNotify->toString();
     $form = new ProductFormType($this);
     $form->fill($product);
     if ($_POST) {
         if ($form->fillAndIsValid()) {
             if ($idNew = $form->save()) {
                 if (is_array($idNew)) {
                     $idNew = $prodId;
                 }
                 $this->redirect('backend_product', array('id' => $idNew));
             }
         }
     }
     $formR = $form->render();
     $this->render(array('componentMenu' => $componentMenuResp, 'componentNotify' => $componentNotifyResp, 'form' => $formR), 'Backend/Product/product.html');
 }
Пример #2
0
 public function showProducts()
 {
     $productModel = new Product();
     $products = $productModel->getAllProducts(array(), 10);
     var_dump($products);
     die;
 }
Пример #3
0
 public function indexAction()
 {
     $prodId = (int) $this->getRequestParam('id', 0);
     $prodTbl = new Product();
     $product = $prodTbl->getProduct($prodId);
     $componentMenu = new TopMenuComponent($this);
     $componentMenuResp = $componentMenu->toString();
     if (!$product) {
         $this->notFound();
     }
     $this->render(array('product' => $product, 'leftMenu' => $componentMenuResp), 'App/Product/product.html');
 }