/**
  * BasketForm
  * Display the shopping basket.
  * 
  * @return Form
  */
 public function BasketForm()
 {
     /* Initiate our form, hiding form actions. */
     $form = BasketForm::create($this, 'BasketForm', false);
     /* Force POST and Strict Method Check */
     $form->setFormMethod('POST');
     $form->setStrictFormMethodCheck(true);
     /* Return the form */
     return $form;
 }
 function filterShoppingCartWorkout($filterChain)
 {
     if (isset($_POST['ajax']) && strpos($_POST['ajax'], 'buy-form') === 0) {
         $model = new BasketForm();
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     if (isset($_GET['ajax']) && $_GET['ajax'] === 'basket' && $_GET['operation'] === 'clear') {
         Yii::app()->shoppingCart->clear();
     }
     if (isset($_POST['BasketForm'])) {
         $model = new BasketForm();
         $model->attributes = $_POST['BasketForm'];
         if ($model->validate()) {
             list($class, $id) = preg_split('/_/', $model->id);
             $cart = Yii::app()->shoppingCart;
             $class = new $class();
             $cart->put($class->findByPk($id), $model->quantity);
         } else {
             echo CActiveForm::validate($model);
             Yii::app()->end();
         }
     }
     $filterChain->run();
 }
 /**
  * BasketForm
  * Display the shopping basket.
  * 
  * @return Form
  */
 public function BasketForm()
 {
     /**
      * If basket has items, show them.
      */
     if ($this->is_basket_full()) {
         /* Initiate our form. */
         $form = BasketForm::create($this, 'BasketForm');
         /* Force POST and Strict Method Check */
         $form->setFormMethod('POST');
         $form->setStrictFormMethodCheck(true);
         /* Return the form */
         return $form;
     } else {
         return false;
     }
 }