Exemple #1
0
 /**
  * Delete product
  * @param integer id of product
  * @return void
  */
 public function delete($id)
 {
     // Check user permission
     if (user::is_got()) {
         // Settings
         $this->set_title(Kohana::lang('eshop.delete_product'));
         $this->add_breadcrumb(Kohana::lang('eshop.delete_product'), url::current());
         if ($_POST) {
             if (isset($_POST['yes'])) {
                 // clicked on yes = delete
                 $cat = $this->products->get_product_cat($id);
                 $cat = $cat[0];
                 $status = $this->products->delete_data($id);
                 // Also delte images if deletition was successful
                 if ($status == TRUE) {
                     gallery::delete_images($id, 'products');
                 }
                 url::redirect('/cat/' . $cat . '/' . cat::get_name($cat));
             } else {
                 url::redirect('/product/' . $id . '/' . string::to_url(product::get_name($id)));
             }
         }
         // page
         $this->template->content = new View('admin/product_delete');
     } else {
         url::redirect('/denied');
     }
 }
Exemple #2
0
    echo $row['price'];
    ?>
,- <?php 
    echo Kohana::lang('eshop.currency');
    ?>
</strong>
			<div class="cleaner">&nbsp;</div>
			<?php 
    echo $row['short_description'];
    ?>
			<div class="order-buttons">
				<a class="button" href="/product/<?php 
    echo $row['id'];
    ?>
/<?php 
    echo string::to_url($row['name']);
    ?>
"><?php 
    echo Kohana::lang('eshop.detail');
    ?>
</a>
				<a class="button" href="/cart/add/<?php 
    echo $row['id'];
    ?>
"><?php 
    echo Kohana::lang('eshop.add_to_cart');
    ?>
</a>
			</div>
		</div>
	</div>