Example #1
0
 public function add()
 {
     $product_image = new ProductsCollection();
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $products = new ProductEntity();
         $products->setTitle($_POST['title'])->setDescription($_POST['description'])->setPrice($_POST['price']);
         if ($_FILES['image']['tmp_name'] != '') {
             $products->saveImage($_FILES['image']);
         }
         $product_image->save($products);
         header('Location: index.php?controller=products');
     }
     $this->loadView('cms/product_add');
 }