Welcome Guest, Not a member yet? Register   Sign In
Javascript validation doesn't work
#2

[eluser]akho[/eluser]
here is my shop

Code:
<?php

class Shop extends CI_Controller {

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

    function index(){
    //use this for your home page
        $data['title'] = "Welcome to Claudia's Kids";
        $data['navlist'] = $this->MCats->getCategoriesNav();
        $data['mainf'] = $this-> MProducts-> getMainFeature();
        $skip = $data['mainf']['id'];
        $data['sidef'] = $this-> MProducts->getRandomProducts(3,$skip);
        $data['main'] = 'home';
        $this-> load-> vars($data);
        $this-> load-> view('template');
    }
    
    function cat($id){
    //use this for the category page
        //$cat = $this-> MCats-> getCategory($this-> uri-> segment(3));
        $cat = $this-> MCats-> getCategory($id);
        if (!count($cat)){
            redirect('shop/index','refresh');
        }
        $data['title'] = "Claudia's Kids | ". $cat['name'];
        if ($cat['parentid'] < 1){
            //show other categories
            $data['listing'] = $this-> MCats-> getSubCategories($id);
            $data['level'] = 1;
        }else{
            //show products
            $data['listing'] = $this-> MProducts->getProductsByCategory($id);
            $data['level'] = 2;
        }
        $data['category'] = $cat;
        $data['main'] = 'category';
        $data['navlist'] = $this-> MCats-> getCategoriesNav();
        $this-> load-> vars($data);
        $this-> load-> view('template');
    }
    
    function subcat(){
    //use this for the subcategory view
    }
    
    function product($id){
    //use this for the product view
        $product = $this-> MProducts-> getProduct($id);
        if (!count($product)){
            redirect('shop/index','refresh');
        }
        $data['grouplist'] = $this-> MProducts-> getProductsByGroup(3,$product['grouping'],$id);
        $data['product'] = $product;
        $data['title'] = "Claudia's Kids | ". $product['name'];
        $data['main'] = 'product';
        $data['navlist'] = $this-> MCats-> getCategoriesNav();
        $this-> load-> vars($data);
        $this-> load-> view('template');
    }
    
    function cart($productid=0){
    //use this for the shopping cart view
        if ($productid > 0){
            $fullproduct = $this-> MProducts-> getProduct($productid);
            $this-> MOrders-> updateCart($productid,$fullproduct);
            redirect('shop/product/'.$productid, 'refresh');
        }else{
            $data['title'] = "Claudia's Kids | Shopping Cart";
            if (count($_SESSION['cart']) == true){
                $data['main'] = 'shoppingcart';
                $data['navlist'] = $this-> MCats-> getCategoriesNav();
                $this-> load-> vars($data);
                $this-> load-> view('template');
            }else{
                redirect('shop/index','refresh');
            }
        }
    }
    
    function search(){
    //use this for the search results
        if ($this-> input-> post('term')){
            $data['results'] = $this-> MProducts-> search($this-> input-> post('term'));
        }else{
            redirect('shop/index','refresh');
        }
        $data['main'] = 'search';
        $data['title'] = "Claudia's Kids | Search Results";
        $data['navlist'] = $this-> MCats-> getCategoriesNav();
        $this-> load-> vars($data);
        $this-> load-> view('template',$data);
    }
    
    function ajax_cart(){
        //$this-> load-> model('MOrders','',TRUE);
        return $this-> MOrders-> updateCartAjax($this-> input-> post('ids'));
    }
    function ajax_cart_remove(){
        return $this-> MOrders-> removeLineItem($this-> input-> post('id'));
    }
    function about_us(){
    //use this for the about_us page
    }
    
    function contact (){
    //use this for the contact page
    }
    
    function privacy(){
    //use this for the privacy page
    }
}


Messages In This Thread
Javascript validation doesn't work - by El Forum - 04-12-2011, 04:28 AM
Javascript validation doesn't work - by El Forum - 04-12-2011, 04:29 AM
Javascript validation doesn't work - by El Forum - 04-12-2011, 04:30 AM
Javascript validation doesn't work - by El Forum - 04-12-2011, 04:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB