public function actionChecktrans()
    {
                    $postedData = $this->getPostedData();
        $product_id = $postedData['productId'];
//       $values=array();
         $condition = 'product_id=' .$product_id;                                    
                                            $criteria = new CDbCriteria;
                                            $criteria->condition = $condition;                                                                                
                                            $Prdprice = Productcategory::model()->findAll( $criteria );     
                                            $mastercate = Masterproductcategory::model()->findAll( $criteria );  
                                       if(count($Prdprice)>0) {                                           
                                           $categoryFlag=(object)["flag"=>false,"catId"=>$mastercate[0]->category_id];
//                                           $values[]=$categoryFlag;     
                                              }                     
                                     
                                        else
                                         $categoryFlag=(object)["flag"=>false];
                                         echo json_encode($categoryFlag);
                                         
                                       }
Exemplo n.º 2
0
<?php

$trad_prod = Productcategory::model()->findAll(array("condition" => "sub=" . getParam('subcat') . " and oid = " . getFranchiseId()));
?>
<script src="<?php 
echo getThemeUrl() . '/js/option/jssor.core.js';
?>
"></script>
<script src="<?php 
echo getThemeUrl() . '/js/option/jssor.utils.js';
?>
"></script>
<script src="<?php 
echo getThemeUrl() . '/js/option/jssor.slider.js';
?>
"></script>
<script>
    var products = [];
    jQuery(document).ready(function($) {
        var options = {
            $AutoPlay: false, //[Optional] Whether to auto play, to enable slideshow, this option must be set to true, default value is false
            $AutoPlaySteps: 1, //[Optional] Steps to go for each navigation request (this options applys only when slideshow disabled), the default value is 1
            $AutoPlayInterval: 6000, //[Optional] Interval (in milliseconds) to go for next slide since the previous stopped if the slider is auto playing, default value is 3000
            $PauseOnHover: 1, //[Optional] Whether to pause when mouse over if a slider is auto playing, 0 no pause, 1 pause for desktop, 2 pause for touch device, 3 pause for desktop and touch device, default value is 1

            $ArrowKeyNavigation: true, //[Optional] Allows keyboard (arrow key) navigation or not, default value is false
            $SlideDuration: 500, //[Optional] Specifies default duration (swipe) for slide in milliseconds, default value is 500
            $MinDragOffsetToSlide: 20, //[Optional] Minimum drag offset to trigger slide , default value is 20
            //$SlideWidth: 600,                                 //[Optional] Width of every slide in pixels, default value is width of 'slides' container
            //$SlideHeight: 300,                                //[Optional] Height of every slide in pixels, default value is height of 'slides' container
            $SlideSpacing: 0, //[Optional] Space between each slide in pixels, default value is 0
 public static function getTradSubMenus()
 {
     $menus = Productcategory::model()->with(array('count'))->findAll(array('condition' => "type = 0 and sub = 0"));
     //        e($menus);
     return Productcategory::model()->with(array('count'))->findAll(array('condition' => "type = 0 and sub = 0"));
 }
 public function actionCustomerReply()
 {
     $this->layout = '//layouts/maindate';
     if (isset($_POST['customer']) && isset($_POST['customer']['ajax'])) {
         $customer_questions = $this->loadModel(getCurCusId());
         $customer_questions->provisional_date = isset($_POST['customer']['provisional_date']) ? $_POST['customer']['provisional_date'] : "";
         $customer_questions->call_date = isset($_POST['customer']['call_date']) ? $_POST['customer']['call_date'] : "";
         if ($customer_questions->provisional_date) {
             $temp = array();
             $date = explode('/', $customer_questions->provisional_date);
             if (count($date) == 3) {
                 $temp[] = $date[1];
                 $temp[] = $date[0];
                 $temp[] = $date[2];
                 $temp = implode('/', $temp);
                 $customer_questions->provisional_date = $temp;
             }
         }
         if ($customer_questions->call_date) {
             $temp = array();
             $date = explode('/', $customer_questions->call_date);
             if (count($date) == 3) {
                 $temp[] = $date[1];
                 $temp[] = $date[0];
                 $temp[] = $date[2];
                 $temp = implode('/', $temp);
                 $customer_questions->call_date = $temp;
             }
         }
         //			p($customer_questions->attributes);
         $customer_questions->save();
         $menus = isset(Yii::app()->session['menus']) ? Yii::app()->session['menus'] : array();
         if (count($menus)) {
             $menus_keys = array_keys($menus);
             $delSelMenu = SelectedCategories::model()->deleteAll(" user_id =" . getCurCusId() . " and cat_id not in (" . implode(',', $menus_keys) . ")");
         }
         //            p($delSelMenu);
         foreach ($menus as $key => $value) {
             $sel_cat = SelectedCategories::model()->findByAttributes(array('user_id' => getCurCusId(), 'cat_id' => $key));
             if (!$sel_cat) {
                 $sel_cat = new SelectedCategories();
             }
             $productsIds = CJSON::encode($value['like']);
             $sel_cat->attributes = $value;
             $sel_cat->user_id = getCurCusId();
             $sel_cat->cat_id = $key;
             $sel_cat->like = $sel_cat->like ? 1 : 0;
             $sel_cat->product_ids = $productsIds;
             $sel_cat->save(false);
         }
         $selected_product = isset(Yii::app()->session['sel_prod_n']) ? Yii::app()->session['sel_prod_n'] : array();
         if (count($selected_product)) {
             $delSelProd = SelProducts::model()->deleteAll("cus_id = " . getCurCusId() . ' and product_id not in (' . implode(',', $selected_product) . ')');
         }
         if (count($selected_product)) {
             $selected_product = array_unique($selected_product);
         }
         foreach ($selected_product as $pid) {
             $selPro = SelProducts::model()->findByAttributes(array('product_id' => $pid, 'cus_id' => getCurCusId()));
             if (!$selPro) {
                 $selPro = new SelProducts();
             }
             $selPro->product_id = $pid;
             $selPro->cus_id = getCurCusId();
             $selPro->save(false);
         }
         //            p($selPro->attributes,0);
         //            p(CActiveForm::validate($selPro->attributes));
         unset(Yii::app()->session['sel_prod_n']);
         unset(Yii::app()->session['menus']);
         echo json_encode(array('success' => 1));
         exit;
     }
     DynamicCall::GetEdit1stPdf(getCurCusId());
     $id = getParam('id');
     $customer = Customer::model()->findByPk($id);
     $magic_spoon = MagicSpool::model()->findAll(array('select' => 'one,two,three,four,five', 'condition' => 'cus_id=:cus_id', 'limit' => 1, 'params' => array(':cus_id' => $id)));
     $menus = isset(Yii::app()->session['menus']) ? Yii::app()->session['menus'] : array();
     $items = array();
     $allItems = $temp = array();
     foreach ($menus as $key => $value) {
         $arrr = explode(',', getAllowedCategoriesId());
         if (in_array($key, $arrr)) {
             unset($menus[$key]);
             continue;
         }
         $product_category = Productcategory::model()->findByPk($key);
         $menus[$key] = array_merge($product_category->attributes, $value);
         $allItems = array_merge($value['like'], $allItems);
     }
     foreach ($menus as $menu) {
         $temp[$menu['order']] = $menu;
     }
     /*        e($temp);
             if (count($temp))
                 ksort($temp);          
     			$menus = $temp;                
     */
     foreach ($allItems as $i) {
         $product = Product::model()->findByPk($i);
         if ($product) {
             $items[] = $product;
         }
     }
     ksort($items);
     /*        $temp = array();
             foreach ($items as $item):
                 foreach ($item as $i):
                     $temp[] = $i;
                 endforeach;
             endforeach;
             $items = $temp; */
     $this->render('customerreply', array('magic_spoon' => $magic_spoon, 'menus' => $menus, 'items' => $items, 'customer' => $customer));
 }
<?php

$trad_prod = Productcategory::model()->findAll(array("condition" => "type=1 and sub!= 0 and sub!= 22", "order" => "`order` asc"));
//e($trad_prod);
?>
<script src="<?php 
echo getThemeUrl() . '/js/option/jssor.core.js';
?>
"></script>
<script src="<?php 
echo getThemeUrl() . '/js/option/jssor.utils.js';
?>
"></script>
<script src="<?php 
echo getThemeUrl() . '/js/option/jssor.slider.js';
?>
"></script>
<script>
    var products = [];
    jQuery(document).ready(function($) {
        var options = {
            $AutoPlay: false, //[Optional] Whether to auto play, to enable slideshow, this option must be set to true, default value is false
            $AutoPlaySteps: 1, //[Optional] Steps to go for each navigation request (this options applys only when slideshow disabled), the default value is 1
            $AutoPlayInterval: 6000, //[Optional] Interval (in milliseconds) to go for next slide since the previous stopped if the slider is auto playing, default value is 3000
            $PauseOnHover: 1, //[Optional] Whether to pause when mouse over if a slider is auto playing, 0 no pause, 1 pause for desktop, 2 pause for touch device, 3 pause for desktop and touch device, default value is 1

            $ArrowKeyNavigation: true, //[Optional] Allows keyboard (arrow key) navigation or not, default value is false
            $SlideDuration: 500, //[Optional] Specifies default duration (swipe) for slide in milliseconds, default value is 500
            $MinDragOffsetToSlide: 20, //[Optional] Minimum drag offset to trigger slide , default value is 20
            //$SlideWidth: 600,                                 //[Optional] Width of every slide in pixels, default value is width of 'slides' container
            //$SlideHeight: 300,                                //[Optional] Height of every slide in pixels, default value is height of 'slides' container
Exemplo n.º 6
0
    public function saveOrUpdatePrdprcCat($model, $extcatid = null, $newcatid)
    {
        $product_id = $model->product_id;
        $productprice_id = $model->id;
        $result = array();
        if(!empty($extcatid))
        {
            $condition = 'product_id=' . $product_id;
            $condition .= ' AND productprice_id = ' . $productprice_id;
            $condition .= ' AND category_id = ' . $extcatid;

            $criteria = new CDbCriteria;
            $criteria->select = array( 'id' );
            $criteria->condition = $condition;
            $result = Productcategory::model()->findAll( $criteria );   
        }
        if(count($result) > 0)
        {
            $prdcat = Productcategory::model()->findByPk( $result[0]->id );
        }
        else
        {
            $prdcat = new Productcategory;
        }
        $prdcat->product_id = $product_id;
        $prdcat->productprice_id = $productprice_id;
        $prdcat->category_id = $newcatid;
        $rtn = $prdcat->save();
        if(!$rtn)
        {
            $this->msg = $prdcat->getErrors();
        }
        return $rtn;
    }
 public function actionMenu($id)
 {
     Productcategory::getTradSubMenus();
     if (getParam('menu')) {
         $currentMenu = Productcategory::model()->findByPk(getParam('menu'));
     }
     $criteria = new CDbCriteria();
     $criteria->order = '`order` asc';
     $criteria->compare('sub', 0);
     $criteria->compare('display_in_menu', 1);
     $menus = Productcategory::model()->findAll($criteria);
     //        e($menus);
     if (!isset($currentMenu)) {
         $currentMenu = current($menus);
     }
     DynamicCall::GetEdit1stPdf(getCurCusId());
     if (!$currentMenu->type) {
         $this->render('menu', array('id' => $id, 'menus' => $menus, 'currentMenu' => $currentMenu));
     } else {
         $this->render('traditional', array('id' => $id, 'menus' => $menus, 'currentMenu' => $currentMenu));
         //            $this->render('subcategories', array('id' => $id, 'menus' => $menus, 'currentMenu' => $currentMenu));
     }
 }
Exemplo n.º 8
0
 public static function syncCat($categories)
 {
     e($categories);
     foreach ($categories as $category) {
         $cat = Productcategory::model()->findByPk($category->id);
         if (!$cat) {
             $cat = new Productcategory();
             $cat->id = $category->id;
         }
         $cat->name = $category->name;
         $cat->desc = $category->cat_descp;
         $cat->type = $category->pid;
         if ($cat->save()) {
             DynamicCall::syncProd($cat->id, $category->pid);
         }
     }
 }
Exemplo n.º 9
0
 public static function syncSubCat($catid, $oid)
 {
     $url = 'http://mccreative.jaspersonline.co.uk/api/products/getSubMenus/' . $catid . '/' . $oid;
     $results = self::getData($url);
     //        e($results);
     if (!$results->count) {
         return false;
     }
     $ii = 1;
     //        e($results->data);
     foreach ($results->data as $result) {
         $subcat = Productcategory::model()->findByPk($oid . $result->id);
         if (!$subcat) {
             $subcat = new Productcategory();
             $subcat->id = $oid . $result->id;
         }
         $subcat->jaspers_id = $result->id;
         $subcat->name = $result->name;
         if (!$subcat->image) {
             $subcat->image = "http://bmsdev.jaspersonline.co.uk/store/products/order_images/{$result->id}.jpg";
         }
         $subcat->desc = $result->description;
         $subcat->type = 0;
         $subcat->sub = $catid;
         $subcat->oid = $oid;
         if ($subcat->save()) {
             //                e($result->id, 0);
             self::syncProd($oid, $result, $subcat);
         }
         //            if ($subcat->save())
         //                self::syncProd($oid, $result, $subcat);
         //            else
         //                e('not saved');
         $ii++;
     }
     //        e('end');
 }
Exemplo n.º 10
0
 public function actionMenu_old($id)
 {
     Productcategory::getTradSubMenus();
     if (getParam('menu')) {
         $currentMenu = Productcategory::model()->findByPk(getParam('menu'));
     }
     if (getParam('subcat')) {
         $currentMenu = Productcategory::model()->findByPk(getParam('subcat'));
     }
     $criteria = new CDbCriteria();
     $criteria->order = '`order` asc';
     $criteria->compare('oid', 0);
     $criteria->addCondition('id != 17');
     $criteria->compare('type', 0, false, '>');
     $menus = Productcategory::model()->findAll($criteria);
     if (!isset($currentMenu)) {
         $currentMenu = Productcategory::model()->findByPk(1092507461);
     }
     DynamicCall::GetEdit1stPdf(getCurCusId());
     if ($currentMenu->type == 1) {
         $this->render('menu', array('id' => $id, 'menus' => $menus, 'currentMenu' => $currentMenu));
     } elseif ($currentMenu->type == 2) {
         $this->render('subcategories', array('id' => $id, 'menus' => $menus, 'currentMenu' => $currentMenu));
     } else {
         $this->render('traditional', array('id' => $id, 'menus' => $menus, 'currentMenu' => $currentMenu));
     }
 }
/**
* Returns the data model based on the primary key given in the GET variable.
* If the data model is not found, an HTTP exception will be raised.
* @param integer the ID of the model to be loaded
*/
public function loadModel($id)
{
$model=Productcategory::model()->findByPk($id);
if($model===null)
throw new CHttpException(404,'The requested page does not exist.');
return $model;
}