Exemple #1
0
 public function actionIndex()
 {
     if (isset($_POST['deleteVariationID'])) {
         $session = new CHttpSession();
         $session->open();
         $aOrderVariations = $session['orderVariations'];
         unset($aOrderVariations[$_POST['deleteVariationID']]);
         $session['orderVariations'] = $aOrderVariations;
         echo 'success';
         exit;
     }
     /** @var $cs CClientScript */
     $cs = Yii::app()->clientScript;
     $cs->registerCssFile(Yii::app()->baseUrl . '/js/plugins/maximage/jquery.maximage.min.css');
     Yii::app()->clientScript->registerCoreScript('jquery.ui');
     Yii::app()->clientScript->registerCssFile(Yii::app()->clientScript->getCoreScriptUrl() . '/jui/css/base/jquery-ui.css');
     $cs->registerScriptFile(Yii::app()->baseUrl . '/js/plugins/maximage/jquery.maximage.min.js');
     $cs->registerScriptFile(Yii::app()->baseUrl . '/js/plugins/maximage/jquery.cycle.all.js');
     $cs->registerScriptFile(Yii::app()->baseUrl . '/js/plugins/jquery.easing.1.3.js');
     $cs->registerScriptFile(Yii::app()->baseUrl . '/js/catalog.min.js');
     $cs->registerScriptFile(Yii::app()->baseUrl . '/js/custom.js');
     $cs->registerCssFile(Yii::app()->baseUrl . '/js/plugins/to_ui_slider/css/ui.slider.extras.css');
     $cs->registerScriptFile(Yii::app()->baseUrl . '/js/plugins/to_ui_slider/js/selectToUISlider.jQuery.js');
     $session = new CHttpSession();
     $session->open();
     if (isset($session['orderVariations']) && is_array($session['orderVariations']) && count($session['orderVariations']) > 0) {
         $aOrderVariations = $session['orderVariations'];
         $aReadyVariations = array();
         foreach ($aOrderVariations as $variation_id) {
             $Product2variation = Product2variation::model()->find('variation_id=' . $variation_id);
             if (isset($Product2variation)) {
                 $product = ProductDescription::model()->find('product_id=' . $Product2variation['product_id'] . ' AND language_id=' . $this->language_id);
                 $category2product = Category2product::model()->find('product_id=' . $Product2variation['product_id']);
                 $category = CategoryDescription::model()->find('category_id=' . $category2product['category_id'] . ' AND language_id=' . $this->language_id);
                 $Variation = Variation::model()->find('variation_id=' . $variation_id);
                 $VariationDescription = VariationDescription::model()->find('variation_id=' . $variation_id . ' AND language_id=' . $this->language_id);
                 $aReadyVariations[$variation_id]['variation_image'] = $Variation['variation_image'];
                 $aReadyVariations[$variation_id]['variation_description'] = $VariationDescription['variation_description'];
                 $aReadyVariations[$variation_id]['product_name'] = $product['product_name'];
                 $aReadyVariations[$variation_id]['variation_name'] = $VariationDescription['variation_name'];
                 $aReadyVariations[$variation_id]['category_name'] = $category['category_name'];
             } else {
                 $aReadyVariations[$variation_id]['variation_image'] = 'no_image.jpg';
                 $aReadyVariations[$variation_id]['product_name'] = '';
                 $aReadyVariations[$variation_id]['variation_name'] = Yii::t('strings', "No longer exist");
             }
         }
     }
     $this->render('cart', array('aReadyVariations' => $aReadyVariations));
 }
 public function loadCatToProdModel($condition)
 {
     $model = Category2product::model()->find($condition);
     if ($model === null)
         throw new CHttpException(404, 'The requested page does not exist.');
     return $model;
 }