Changeset 423 for 2.0

Show
Ignore:
Timestamp:
05/12/08 18:28:15 (2 months ago)
Author:
pablo
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 2.0/trunk/app/app_controller.php

    r418 r423  
    2828         
    2929        var $helpers = array('Html','Javascript'); 
    30         //var $uses = array('Setting'); 
    31  
    32         /* Enabling Json handler */ 
    33         var $components = array('RequestHandler'); 
    34         function setContent() { 
    35                 $this->RequestHandler->setContent('json', 'text/x-json'); 
    36         } 
    3730         
    3831        /** 
     
    4336         function beforeFilter() {       
    4437         
    45                 // Json setup 
    46                 $this->setContent(); 
    47          
    48          
    4938                // load configuration settings and save them globally 
    5039                 
     
    5241                // PS_INSTALLED needs to be defined in database.php.  this is done by the installer 
    5342                if (defined('PS_INSTALLED')) { 
     43                         
    5444                        App::import('Model', 'Setting'); 
    5545                        $setting =& new Setting(); 
     
    5949                        Configure::write($settings); 
    6050                } 
    61                         
     51         
    6252                // request login if admin route 
    6353                if (isset($this->params[Configure::read('Routing.admin')])) { 
    64                         $this->checkSession(); 
     54                        $this->checkAdminSession(); 
    6555                } 
    6656         } 
    6757 
     58        /** 
     59         * Called before every render. 
     60         * 
     61         */      
    6862         function beforeRender() { 
    6963 
     
    7468         } 
    7569 
    76         function checkSession() 
     70 
     71        /** 
     72        * Validation for admin users  
     73        */ 
     74        function checkAdminSession() 
    7775    { 
    7876        // If the session info hasn't been set... 
     
    8583        else return true; 
    8684    } 
     85 
     86 
     87        /** 
     88        * Customer validation 
     89        */ 
     90    function checkSession() 
     91    { 
     92        // If the session info hasn't been set... 
     93        if (!$this->Session->check('Customer')) 
     94        { 
     95            // Force the user to login 
     96            $this->redirect('/store/login'); 
     97            exit(); 
     98        } 
     99    } 
    87100 } 
    88101 ?> 
  • 2.0/trunk/app/config/routes.php

    r395 r423  
    4343 * developement. 
    4444 */ 
    45       Router::connect('/tests', array('controller' => 'tests', 'action' => 'index')); 
     45//    Router::connect('/tests', array('controller' => 'tests', 'action' => 'index')); 
    4646         
    47 /**  
    48  * Adding Json parser extension  
    49 **/      
    50         Router::parseExtensions('json');  
    5147?> 
  • 2.0/trunk/app/controllers/categories_controller.php

    r409 r423  
    11<?php 
    2 /* SVN FILE: $Id:$ */ 
     2/* SVN FILE: $Id$ */ 
    33/** 
    44 * 
     
    9090                        $this->redirect(array('action'=>'index')); 
    9191                } 
     92                 
     93                $category = $this->Category->read(null, $id); 
     94                if ($category['Category']['handle'] == 'home') { 
     95                        $this->Session->setFlash(__('Category \'home\' must not be deleted.', true)); 
     96                        $this->redirect(array('action'=>'index'));                       
     97                } 
    9298                if ($this->Category->del($id)) { 
    9399                        $this->Session->setFlash(__('Category deleted', true)); 
  • 2.0/trunk/app/controllers/customer_addresses_controller.php

    r414 r423  
    5252                        } else { 
    5353                                $this->Session->setFlash(__('The CustomerAddress could not be saved. Please, try again.', true)); 
     54                                $customer_id = $this->data['CustomerAddress']['customer_id'];            
    5455                        } 
    5556                } 
     57                else { 
     58                        $customer_id = $this->passedArgs['customer_id'];                 
     59                } 
    5660 
    57                 $customer_id = $this->passedArgs['customer_id']; 
    5861                $this->set('customer_id', $customer_id); 
    5962                 
  • 2.0/trunk/app/controllers/customers_controller.php

    r416 r423  
    9292                } 
    9393        } 
    94  
    9594} 
    9695?> 
  • 2.0/trunk/app/controllers/order_items_controller.php

    r414 r423  
    4747 
    4848        function admin_add($order_id=null) { 
     49                 
     50                 
    4951                if (!empty($this->data)) { 
    5052                        $this->OrderItem->create(); 
     
    5456                        } else { 
    5557                                $this->Session->setFlash(__('The OrderItem could not be saved. Please, try again.', true)); 
     58                                $order_id = $this->data['OrderItem']['order_id']; 
    5659                        } 
    5760                } 
     61                else { 
     62                        $order_id = $this->passedArgs['order_id'];                       
     63                } 
     64                $this->set('order_id', $order_id); 
    5865                 
    5966                $orderShipments = $this->OrderItem->OrderShipment->find('list'); 
    60                 $order_id = $this->passedArgs['order_id']; 
    61                 $this->set('order_id', $order_id); 
    6267                $productItems = $this->ProductItem->find('list'); 
    6368                $this->set(compact('orderShipments', 'productItems')); 
  • 2.0/trunk/app/controllers/store_controller.php

    r416 r423  
    5555                                          'Order', 
    5656                                          'OrderItem', 
     57                                          'OrderStatus', 
    5758                                          'Country', 
    5859                                          'Zone', 
    59                                           'ShippingRate' 
     60                                          'ShippingRate', 
     61                                          'Customer', 
     62                                          'CustomerAddress' 
    6063                                          ); 
    6164         
     
    6467        * 
    6568        */ 
    66         function index() { 
     69        function index($category_handle=null) { 
    6770                 
    6871                $this->redirect(array('action' => 'browse', 'home')); 
     
    141144                $this->set('products', $this->Cart->get_contents());             
    142145                $this->set('cart_total', $this->Cart->cart_total()); 
     146 
     147                // turn off minicart 
     148                $this->set('mini_cart', true); 
    143149                 
    144150                // set page title 
    145151                $this->pageTitle = Configure::read('Store.name') .  ' - ' . __('Shopping Cart', true); 
    146152        } 
    147          
    148         /** 
    149         * Checkout method, saves the order, order_items, and initial status. 
    150         * 
    151         */ 
    152         function checkout() { 
     153                         
     154        /** 
     155        * Ajax update of state select box 
     156        * 
     157        */ 
     158        function update_select_state() { 
     159                if (!empty($this->data['Customer']['billing_country_id']) || !empty($this->data['Customer']['shipping_country_id'])) { 
     160                        $country_id = $this->data['Customer']['billing_country_id'] ?  
     161                                                  $this->data['Customer']['billing_country_id'] :  
     162                                                  $this->data['Customer']['shipping_country_id']; 
     163                        $options = $this->Zone->find("list", array("country_id='$country_id'")); 
     164                        $this->set('options', $options); 
     165                }                
     166        } 
     167         
     168        /** 
     169        * RequestActionable mini_cart action 
     170        * 
     171        */ 
     172        function mini_cart() { 
     173                 
     174                $cart = array(); 
     175                $cart['cart_total'] = $this->Cart->cart_total(); 
     176                $cart['num_items'] = $this->Cart->num_items(); 
     177                 
     178                $this->set('cart', $cart); 
     179         
     180                if(isset($this->params['requested'])) {  
     181                        return $cart;  
     182                }        
     183        } 
     184         
     185        /** 
     186         * Returns threaded list of categories for navigation menu 
     187         * 
     188         * @return unknown 
     189         */ 
     190        function category_menu() { 
     191                 
     192                $categories = $this->Category->find('all',   
     193                     array('fields' => array('name', 'handle', 'lft', 'rght'), 'order' => 'lft ASC', 'conditions' => 'Category.active=1'));      
     194 
     195                if(isset($this->params['requested'])) {  
     196                        return $categories;  
     197                } 
     198                $this->set('categories', $categories);   
     199        }  
     200 
     201 
     202        /** 
     203        * Gather customer information and create customer record. 
     204        */ 
     205        function register() { 
    153206         
    154207                // set page title 
    155                 $this->pageTitle = Configure::read('Store.name') .  ' - ' . __('Checkout', true); 
     208                $this->pageTitle = Configure::read('Store.name') .  ' - ' . __('Register', true); 
    156209 
    157210                if (!$this->Session->read('Cart')) { 
     
    160213                }  
    161214                 
     215                // get customer information 
     216                $registration = $this->Session->read('Registration'); 
     217                 
     218                // build drop down lists                 
    162219                $this->set('countries', $this->Country->find("list")); 
     220                $this->set('states', $this->Zone->find("list")); 
    163221                $this->set('cart_items', $this->Cart->get_contents());           
    164222                $this->set('cart_total', $this->Cart->cart_total()); 
     
    166224                // save order 
    167225                if (!empty($this->data)) { 
     226                         
     227                        $customer = $this->data;         
     228 
     229                        // set email and password from previos page. 
     230                        $customer['Customer']['email']= $registration['Customer']['email']; 
     231                        $customer['Customer']['password']= $registration['Customer']['password']; 
     232                         
     233                        // need to resolve text versions of country and state 
     234                        $state = $this->Zone->read(null, $customer['Customer']['billing_state_id']); 
     235                        $customer['Customer']['zone_id'] = $customer['Customer']['billing_state_id']; 
     236                        $customer['Customer']['country_id'] = $customer['Customer']['billing_country_id']; 
    168237                                                 
    169                         // save order data 
    170                         $order = $this->data;    
    171                          
    172238                        // If shipping is the same as billing, let's copy it. 
    173                         if ($order['Order']['copy']) { 
    174                                 $order['Order']['shipping_company'] = $order['Order']['billing_company']; 
    175                                 $order['Order']['shipping_last_name'] = $order['Order']['billing_last_name']; 
    176                                 $order['Order']['shipping_first_name'] = $order['Order']['billing_first_name']; 
    177                                 $order['Order']['shipping_phone'] = $order['Order']['billing_phone']; 
    178                                 $order['Order']['shipping_address_1'] = $order['Order']['billing_address_1']; 
    179                                 $order['Order']['shipping_address_2'] = $order['Order']['billing_address_2']; 
    180                                 $order['Order']['shipping_city'] = $order['Order']['billing_city']; 
    181                                 $order['Order']['shipping_country_id'] = $order['Order']['billing_country_id']; 
    182                                 $order['Order']['shipping_state_id'] = $order['Order']['billing_state_id']; 
    183                                 $order['Order']['shipping_zip'] = $order['Order']['billing_zip']; 
    184                         } 
    185                         $order['OrderItems'] = $this->Session->read('Cart'); 
    186                         $this->Session->write('Order', $order); 
    187                          
    188                         // redirect to payment page 
    189                         $this->redirect(array('action'=>'payment'), null, true);                 
     239                        if ($customer['Customer']['copy']) { 
     240                                $customer['CustomerShipping']['shipping_company'] = $customer['Customer']['billing_company']; 
     241                                $customer['CustomerShipping']['shipping_last_name'] = $customer['Customer']['billing_last_name']; 
     242                                $customer['CustomerShipping']['shipping_first_name'] = $customer['Customer']['billing_first_name']; 
     243                                $customer['CustomerShipping']['shipping_phone'] = $customer['Customer']['billing_phone']; 
     244                                $customer['CustomerShipping']['shipping_address_1'] = $customer['Customer']['billing_address_1']; 
     245                                $customer['CustomerShipping']['shipping_address_2'] = $customer['Customer']['billing_address_2']; 
     246                                $customer['CustomerShipping']['shipping_city'] = $customer['Customer']['billing_city']; 
     247                                $customer['CustomerShipping']['zone_id'] = $customer['Customer']['billing_state_id']; 
     248                                $customer['CustomerShipping']['country_id'] = $customer['Customer']['billing_country_id']; 
     249                                $customer['CustomerShipping']['shipping_zip'] = $customer['Customer']['billing_zip']; 
     250                        } 
     251                        else { 
     252                                $customer['CustomerShipping']['shipping_company'] = $customer['Customer']['shipping_company']; 
     253                                $customer['CustomerShipping']['shipping_last_name'] = $customer['Customer']['shipping_last_name']; 
     254                                $customer['CustomerShipping']['shipping_first_name'] = $customer['Customer']['shipping_first_name']; 
     255                                $customer['CustomerShipping']['shipping_phone'] = $customer['Customer']['shipping_phone']; 
     256                                $customer['CustomerShipping']['shipping_address_1'] = $customer['Customer']['shipping_address_1']; 
     257                                $customer['CustomerShipping']['shipping_address_2'] = $customer['Customer']['shipping_address_2']; 
     258                                $customer['CustomerShipping']['shipping_city'] = $customer['Customer']['shipping_city']; 
     259                                $customer['CustomerShipping']['country_id'] = $customer['Customer']['shipping_country_id']; 
     260                                $customer['CustomerShipping']['zone_id'] = $customer['Customer']['billing_state_id']; 
     261                                $customer['CustomerShipping']['shipping_zip'] = $customer['Customer']['shipping_zip']; 
     262                        } 
     263                         
     264                        // validate order data 
     265                        if ($this->Customer->save($customer['Customer'])) { 
     266                                 
     267                                $customer_id = $this->Customer->id; 
     268                                $customer['CustomerShipping']['customer_id'] = $customer_id; 
     269                                if ($this->CustomerAddress->save($customer['CustomerShipping'])) { 
    190270                                         
    191                 } 
     271                                        // Record saved, redirect to payment page. 
     272                                        $customer = $this->Customer->read(null, $customer_id); 
     273 
     274                                        $this->Session->write('Customer', $customer); 
     275                                        $this->redirect(array('controller'=>'checkout', 'action'=>'index'), null, true);                                                 
     276                                         
     277                                } 
     278                                else { 
     279                                        $this->Session->setFlash(__('There were errors processing your data. Please see below.', true));                 
     280                                } 
     281                        } 
     282                        else { 
     283                                $this->Session->setFlash(__('There were errors processing your data. Please see below.', true)); 
     284                        } 
     285                } 
     286                 
     287        }        
     288 
     289        /** 
     290        * login function 
     291        *  
     292        */ 
     293        function login() {                       
     294                 
     295                //Don't show the error message if no data has been submitted. 
     296                $this->set('error', false); 
    192297                                 
    193                  
    194         } 
    195          
    196         /** 
    197         * Payment method, part 2 of the checkout process: user selects shipping method and selects 
    198         * to process payment.  
    199         *  
    200         * Import to point out that taxes are calculated based on where products are shipping to. 
    201         * 
    202         */ 
    203         function payment() { 
    204  
    205                 if (!$this->Session->read('Cart')) { 
    206                         $this->Session->setFlash('Your shopping cart has expired.'); 
    207                         $this->redirect(array('action'=>'index'), null, true); 
    208                 }  
     298        // If a user has submitted form data: 
     299        if (!empty($this->data)) 
     300        { 
     301                        // check if this is a login attempt. 
     302                        if (!empty($this->data['Customer']['login'])) { 
    209303                                 
    210                 // get cart info 
    211                 $this->set('cart_items', $this->Cart->get_contents());           
    212                 $this->set('cart_total', $this->Cart->cart_total()); 
    213  
    214                 // get order info 
    215                 $order = $this->Session->read('Order'); 
    216                  
    217                  
    218                 // TAXES 
    219                  
    220                 $zone_tax = $this->Tax->zone_tax_total($order['Order']['shipping_state_id'], $this->Cart->cart_total()); 
    221                 $country_tax = $this->Tax->country_tax_total($order['Order']['shipping_country_id'], $this->Cart->cart_total()); 
    222  
    223                 // calculate taxes and total 
    224                 $cart_total = $this->Cart->cart_total(); 
    225                 $order_total = $cart_total + $country_tax + $zone_tax; 
    226                  
    227                 // assign totals 
    228                 $this->set('country_tax', $country_tax); 
    229                 $this->set('zone_tax', $zone_tax); 
    230                 $this->set('order_total', $order_total); 
    231                          
    232                 // SHIPPING 
    233                  
    234                 // calculate shipping. 
    235                 $cart_weight = $this->Cart->cart_weight(); 
    236                 // lookup shipping rates for given weight 
    237                 $conditions = array('start' => "< $cart_weight", 'end' => ">= $cart_weight", 'country_id' => $order['Order']['shipping_country_id']); 
    238                 $shipping_rates = $this->ShippingRate->find('all', $conditions, null, 'price ASC'); 
    239                 //build select list 
    240                 foreach ($shipping_rates as $shipping_rate) { 
    241                         $rates[$shipping_rate['ShippingRate']['id']] = $shipping_rate['ShippingRate']['name'] . " - " . $shipping_rate['ShippingRate']['price']; 
    242                 } 
    243                 $this->set('shipping_rates', $rates); 
    244                                  
    245                 // save order 
    246                 if (!empty($this->data)) { 
    247                          
    248                         $zone = $this->Zone->findById($order['Order']['billing_state_id']); 
    249                         $order['Order']['billing_state'] = $zone['Zone']['code']; 
    250                         $order['Order']['billing_country'] = $zone['Country']['iso_code_2']; 
    251                          
    252                         $zone = $this->Zone->findById($order['Order']['shipping_state_id']); 
    253                         $order['Order']['shipping_state'] = $zone['Zone']['code']; 
    254                         $order['Order']['shipping_country'] = $zone['Country']['iso_code_2']; 
    255                                                  
    256                         // save tax info to Order session 
    257                         $order['Order']['subtotal'] = $cart_total; 
    258                         // save shipping information to Order session 
    259                         $shipping = $this->ShippingRate->findById($this->data['Payment']['shipping_rate']); 
    260                         $shipping_total = $shipping['ShippingRate']['price']; 
    261                         $order['Order']['shipping'] = $shipping_total; 
    262                          
    263                         $order['Order']['zone_tax'] = $zone_tax; 
    264                         $order['Order']['country_tax'] = $country_tax; 
    265  
    266                         $order['Order']['total'] = $cart_total + $zone_tax + $country_tax + $shipping_total; 
    267                                                  
    268                         $this->Session->write('Order', $order); 
    269                          
    270                         // HOOK for payment processor plugin redirect 
    271                         $this->redirect('/paypal'); 
    272                          
    273                         /* 
    274                         $order = $this->data;    
    275                         $order['OrderItems'] = $this->Session->read('Cart'); 
    276                         $this->Session->write('Order', $order); 
    277                                                  
    278                         // save the order_item data 
    279                         $this->cleanUpFields(); 
    280                         $this->OrderItem->create(); 
    281                         if ($this->OrderItem->save($this->data)) { 
    282                                 $this->Session->setFlash('The OrderItem has been saved'); 
    283                                 $this->redirect(array('action'=>'index'), null, true); 
    284                         } else { 
    285                                 $this->Session->setFlash('The OrderItem could not be saved. Please, try again.'); 
    286                         } 
    287                         */                       
    288                 } 
    289                                  
    290                  
    291         } 
    292          
    293         /** 
    294         * Ajax update of state select box 
    295         * 
    296         */ 
    297         function update_select_state() { 
    298                 if (!empty($this->data['Order']['billing_country_id']) || !empty($this->data['Order']['shipping_country_id'])) { 
    299                         $country_id = $this->data['Order']['billing_country_id'] ?  
    300                                                   $this->data['Order']['billing_country_id'] :  
    301                                                   $this->data['Order']['shipping_country_id']; 
    302                         $options = $this->Zone->find("list", array("country_id='$country_id'")); 
    303                         $this->set('options', $options); 
    304                 }                
    305         } 
    306          
    307         /** 
    308         * RequestActionable mini_cart action 
    309         * 
    310         */ 
    311         function mini_cart() { 
    312                  
    313                 $cart = array(); 
    314                 $cart['cart_total'] = $this->Cart->cart_total(); 
    315                 $cart['num_items'] = $this->Cart->num_items(); 
    316                  
    317                 $this->set('cart', $cart); 
    318          
    319                 if(isset($this->params['requested'])) {  
    320                         return $cart;  
    321                 }        
    322         } 
    323          
    324         /** 
    325          * Returns threaded list of categories for navigation menu 
    326          * 
    327          * @return unknown 
    328          */ 
    329         function category_menu() { 
    330                  
    331                 $categories = $this->Category->find('all',   
    332                      array('fields' => array('name', 'handle', 'lft', 'rght'), 'order' => 'lft ASC', 'conditions' => 'Category.active=1'));      
    333  
    334                 if(isset($this->params['requested'])) {  
    335                         return $categories;  
    336                 } 
    337                 $this->set('categories', $categories);   
    338         }  
     304                        // First, let's see if there are any users in the database 
     305                // with the username supplied by the user using the form: 
     306 
     307                $someone = $this->Customer->findByEmail($this->data['Customer']['login_email']); 
     308 
     309                // At this point, $someone is full of user data, or its empty. 
     310                // Let's compare the form-submitted password with the one in 
     311                // the database. 
     312 
     313                if(!empty($someone['Customer']['password']) &&  
     314                                                $someone['Customer']['password'] == $this->data['Customer']['login_password']) { 
     315 
     316                                                // We do not want to store password in the session.  
     317                                                unset($someone['Customer']['login_password']); 
     318                                $this->Session->write('Customer', $someone); 
     319 
     320                                                // login valid 
     321                                                if ($this->Session->check('Cart')) { 
     322                                        $this->redirect(array('controller'=>'checkout', 'action' => 'index')); 
     323                                                } 
     324                                                else { 
     325                                        $this->redirect(array('controller'=>'account','action' => 'index')); 
     326                                                } 
     327 
     328                } 
     329                // Else, they supplied incorrect data: 
     330                else { 
     331                        $this->set('error', true); 
     332                } 
     333                        } 
     334                        else { 
     335                                // not a login attempt, redirect to registration 
     336                                $registration = $this->data; 
     337                                $this->Session->write('Registration', $registration); 
     338                                $this->redirect('register'); 
     339                        } 
     340                } 
     341    } 
     342 
     343        /** 
     344        * logout  
     345        * 
     346        */ 
     347    function logout() { 
     348         
     349        // Redirect users to this action if they click on a Logout button. 
     350        // All we need to do here is trash the session information: 
     351 
     352        $this->Session->delete('Customer'); 
     353        $this->Session->delete('Cart'); 
     354        $this->Session->delete('Order'); 
     355 
     356        $this->Session->setFlash('You\'ve successfully logged out.');  
     357 
     358        // And we should probably forward them somewhere, too... 
     359      
     360        $this->redirect('/'); 
     361    } 
     362 
    339363 
    340364} 
  • 2.0/trunk/app/controllers/users_controller.php

    r416 r423  
    8686        function login() 
    8787    { 
     88                $this->pageTitle = "Login"; 
    8889                $this->layout = 'admin_login'; 
    8990                 
     
    124125                // to a landing page for the application. 
    125126 
    126                 $this->redirect('/admin/settings/'); 
     127                $this->redirect('/admin/orders/'); 
    127128            } 
    128129            // Else, they supplied incorrect data: 
  • 2.0/trunk/app/models/brand.php

    r409 r423  
    2828 
    2929        var $name = 'Brand'; 
     30         
     31        var $validate = array( 
     32                'name' => VALID_NOT_EMPTY, 
     33                'handle' => VALID_NOT_EMPTY, 
     34        ); 
    3035 
    3136        //The Associations below have been created with all possible keys, those that are not needed can be removed 
  • 2.0/trunk/app/models/category.php

    r414 r423  
    3131         
    3232        var $validate = array( 
    33                 'handle' => array( 
    34                         VALID_NOT_EMPTY 
    35                 ), 
    36                 'name' => array( 
    37                         VALID_NOT_EMPTY 
    38                 ), 
    39                 'active' => array( 
    40                         VALID_NOT_EMPTY 
    41                 ) 
     33                'handle' => VALID_NOT_EMPTY, 
     34                'name' => VALID_NOT_EMPTY, 
     35                'active' => VALID_NOT_EMPTY, 
    4236        ); 
    4337 
  • 2.0/trunk/app/models/country.php

    r416 r423  
    2929        var $name = 'Country'; 
    3030        var $validate = array( 
    31                 'name' => array( 
    32                         VALID_NOT_EMPTY 
    33                 ), 
    34                 'iso_code_2' => array( 
    35                         VALID_NOT_EMPTY 
    36                 ), 
    37                 'active' => array( 
    38                         VALID_NOT_EMPTY 
    39                 ) 
     31                'name' => VALID_NOT_EMPTY, 
     32                'iso_code_2' => VALID_NOT_EMPTY, 
     33                                        array(  
     34                                                        'rule' => array('maxLength', 2)  
     35                                                ), 
     36                'iso_code_3' => VALID_NOT_EMPTY, 
     37                                            array(  
     38                                                        'rule' => array('maxLength', 3)  
     39                                                ), 
     40                'active' => VALID_NOT_EMPTY, 
    4041        ); 
    4142 
  • 2.0/trunk/app/models/customer.php

    r416 r423  
    4141            'required' => true 
    4242        ),  
    43                 'billing_last_name' => array( 
    44                         'rule' => 'alphaNumeric' 
    45         ),       
    46                 'billing_first_name' => array( 
    47                         'rule' => 'alphaNumeric' 
    48         ),       
    49                 'billing_phone' => array( 
    50                         'rule' => 'alphaNumeric' 
    51         ),       
    52                 'billing_address_1' => array( 
    53                         'rule' => 'alphaNumeric' 
    54         ),       
    55                 'billing_city' => array( 
    56                         'rule' => 'alphaNumeric' 
    57         ),       
    58                 'zone_id' => array('_extract'), 
    59                 'country_id' => array('_extract'), 
    60                 'billing_zip' => array( 
    61                         'rule' => array('postal', null, 'us') 
    62         ) 
     43                'billing_last_name' => VALID_NOT_EMPTY, 
     44                'billing_first_name' => VALID_NOT_EMPTY, 
     45                'billing_phone' => VALID_NOT_EMPTY, 
     46