Welcome Guest, Not a member yet? Register   Sign In
subcategory solution
#2

[eluser]Twisted1919[/eluser]
I am not sure if this is what you want but :
Code:
class Products extends Controller(){


function __construct(){
    parent::Controller();
}

//Send every request to index
function _remap($method){
    $this->index();
}

function index(){
   $main_category = $this->uri->segment(2);
   $uriA  = $this->uri->segment(3);
   $uriB  = $this->uri->segment(4) ;
   $uriC = $this->uri->segment(5);
   //Next you would check to see if it requires products from a subcategory like
   //So let's assume this uri : /products/shoes/blue-shoes/summer-shoes/sandals.html
   if( ! empty($main_category) && ! empty($uriA) && ! empty($uriB) && ! empty($uriC) ){
   //If this is true then that means it requires a product from the category shoes , that is in subcat blue shoes that is in subcat summer shoes .
   $this->model->get_product($uriC);
   }elseif( ! empty($main_category) && ! empty($uriA) && ! empty($uriB) && empty($uriC) ){
   //This mean that a product from shoes that is in blue-shoes subcategory .
   $this->model->get_product($uriB);
   }elseif( ! empty($main_category) && !empty($uriA) && empty($uriB) && empty($uriC) ){
   //This means that requires a product that is directly in the shoes category .
   $this->model->get_product($uriA);  
   }
   else{
   show_error('The product was not found blah blah ...')
   }
}

}



Is this close to what you want ?


Messages In This Thread
subcategory solution - by El Forum - 04-17-2010, 05:12 AM
subcategory solution - by El Forum - 04-17-2010, 07:50 AM
subcategory solution - by El Forum - 04-17-2010, 11:48 AM
subcategory solution - by El Forum - 04-17-2010, 12:04 PM
subcategory solution - by El Forum - 04-17-2010, 12:53 PM
subcategory solution - by El Forum - 04-17-2010, 01:34 PM
subcategory solution - by El Forum - 04-17-2010, 01:39 PM
subcategory solution - by El Forum - 04-17-2010, 01:42 PM
subcategory solution - by El Forum - 04-17-2010, 01:53 PM
subcategory solution - by El Forum - 04-17-2010, 02:55 PM
subcategory solution - by El Forum - 04-17-2010, 05:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB