コード例 #1
0
ファイル: ProductController.php プロジェクト: htom78/XZB2c
 public function loadModel()
 {
     if ($this->_model === null) {
         if (isset($_GET['product'])) {
             $this->_model = product_entity::model()->findByAttributes(array('product_SEF' => $_GET['product']));
         }
         if ($this->_model === null) {
             throw new CHttpException(404, 'The requested page does not exist.');
         }
     }
     return $this->_model;
 }
コード例 #2
0
ファイル: CategoryController.php プロジェクト: htom78/XZB2c
 public function actionView()
 {
     $model = $this->loadModel();
     if ($model->seo) {
         $this->installMeta($model->seo->attributes);
     }
     $criteria = new CDbCriteria(array('condition' => 'm2.category_ID =' . $model->category_ID, 'join' => 'left join {{category_product}} as m2 ON t.product_ID=m2.product_ID', 'order' => 'product_update DESC'));
     $view = 'view';
     $count = product_entity::model()->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = 20;
     $pages->applyLimit($criteria);
     $dataProvider = new CActiveDataProvider('product_entity', array('pagination' => $pages, 'criteria' => $criteria));
     $this->render('view', array('model' => $model, 'dataProvider' => $dataProvider));
 }
コード例 #3
0
ファイル: cart.php プロジェクト: htom78/XZB2c
 public function updateQty($qty, $product_ID, $operator = 'up')
 {
     if (intval($qty) <= 0) {
         return $this->deleteProduct(intval($product_ID));
     } else {
         $result = $this->containProduct($product_ID);
         //if has contain product,update qty
         if ($result) {
             if ($operator == 'up') {
                 $product = product_entity::model()->findByPk($product_ID);
                 $newQty = $result['quantity'] + intval($qty);
                 if ($newQty > $product->product_quantity || $product->product_quantity < 5) {
                     return FALSE;
                 }
                 $updateCommand = '`Quantity`+' . intval($qty);
             } else {
                 if ($operator == 'down') {
                     $newQty = $result['quantity'] - intval($qty);
                     $updateCommand = '`Quantity`-' . intval($qty);
                 } else {
                     return FALSE;
                 }
             }
             if ($newQty <= 0) {
                 return $this->deleteProduct(intval($product_ID));
             } else {
                 $req = Yii::app()->db->createCommand("Update {{cart_product}} SET Quantity={$updateCommand}" . " WHERE cart_ID={$this->cart_ID} AND product_ID={$product_ID}");
                 $req->execute();
             }
         } else {
             //add new product to cart
             $product = product_entity::model()->findByPk($product_ID);
             if ($qty > $product->product_quantity || $product->product_quantity < 5) {
                 return FALSE;
             }
             $req = Yii::app()->db->createCommand("INSERT INTO {{cart_product}} (`cart_ID`,`product_ID`,`quantity`)" . " VALUES ('{$this->cart_ID}','{$product->product_ID}','{$qty}')");
             $req->execute();
         }
         $this->cart_update = date('Y-m-d H:i:s');
         return $this->update();
     }
 }
コード例 #4
0
ファイル: _daliyProduct.php プロジェクト: htom78/XZB2c
<div class="side_box mb_12 side_deals">
    <div class="side_title">Daily Deals</div>
    <div class="side_deals_box">
        <ul class="nav2">
            <?php 
foreach (product_entity::model()->daliy(4)->findAll() as $row) {
    echo <<<HTML
<li>
 <a class="p_l_img" href="{$row->getUrl()}"><img alt="{$row->gallery->base->image_label}" src="{$row->gallery->base->getSmall()}"></a>
                      <div>
                    <a class="p_l_title" href="{$row->getUrl()}">{$row->product_name}</a>
                     <span class='p_l_desc'>{$row->product_short_description}</span>
                    <span class="linegray">\${$row->getRegularPrice()}</span><span class="orange">\${$row->getSpecialPrice()}</span></div>
                    <a class="button button_cart_m mt_10" href="/product/cart/id/{$row->product_ID}/qty/{$row->stock->stock_min_qty_cart}"></a>
                   <a class="button button_checko_m mt_10 ml_6" href="/product/checkout/id/{$row->product_ID}/qty/{$row->stock->stock_min_qty_cart}"></a>
               
 </li>

HTML;
}
?>

           </ul>
        <div class="fix"></div>
    </div>
</div>


コード例 #5
0
ファイル: index.php プロジェクト: htom78/XZB2c
</div>

<div class="content_box mb_12 prduct_list">
    <h2>Newarrival nds card</h2>

   <?php 
$this->widget('TradeList', array('dataProvider' => new CActiveDataProvider('product_entity', array('criteria' => product_entity::model()->latest(12))), 'itemView' => '_product', 'template' => "{items}"));
?>

    <div class="fix"></div>
</div>

<div class="content_box mb_12 prduct_list">
    <h2>Featured Products</h2>
      <?php 
$this->widget('TradeList', array('dataProvider' => new CActiveDataProvider('product_entity', array('criteria' => product_entity::model()->feature())), 'itemView' => '_product', 'template' => "{items}"));
?>
   
    <div class="fix"></div>
</div>

<div class="content_box mb_12 index_desc" id="i_tabs">

    <h2><a href="javascript://;" class="i_d_sel">Why Us</a> <a href="javascript://;">Guarantee</a> <a href="javascript://;" class="i_d_last">Professional Service</a></h2>

    <div class="i_d_box  i_d_box1">
        <img src="/images/index_help_icon1.gif" alt="" />
        <p> In recent years competition has grown rapidly and with so many companies to choose from,Why us?
            CARDSNDS.COM tries to integrate the industry resource to provide our customer
            all the accessories for the most popular Video Game consoles: Nintendo Wii, Microsoft XBox 360, Sony PSP, Sony PlayStation 3, Nintendo DS, Nintendo GBA, and more,
            at the most preferential price, reliable quality and considerate service.
コード例 #6
0
ファイル: ProductController.php プロジェクト: htom78/XZB2c
 public function loadModel()
 {
     if ($this->_model == null) {
         if (isset($_GET['id'])) {
             $condition = '';
             $this->_model = product_entity::model()->findByPk($_GET['id'], $condition);
         }
         if ($this->_model == null) {
             throw new CHttpException(404, "The requested page does not exist!");
         }
     }
     return $this->_model;
 }