public function actionGetimg()
 {
     $criteria = new CDbCriteria();
     $criteria->addCondition('product_id=' . Yii::app()->getRequest()->getQuery('pid'));
     $model = Zoomproduct::model()->findAll($criteria);
     $repon = array();
     foreach ($model as $item) {
         $repon[] = array('id' => $item->id, 'name' => $item->name, 'nameimg' => str_replace(' ', '%20', $item->name), 'level' => $item->level, 'size' => $item->size, 'url' => Yii::app()->baseurl . '/images' . str_replace(' ', '%20', $item->url), 'del_url' => Yii::app()->baseurl . '/admin/zoomproduct/upload?_method=delete&file=' . str_replace(' ', '+', $item->name) . '&pid=' . $item->product_id);
     }
     print_r(json_encode($repon));
 }
 public static function getsmallImage($model, $paId = null)
 {
     $criteria = new CDbCriteria();
     $criteria->addCondition('product_id=' . $model->id);
     $objZoom = Zoomproduct::model()->findAll($criteria);
     $countZ = Zoomproduct::model()->count($criteria);
     if ($paId != null && $countZ == 0 && $model->id != $paId && _xls_get_conf('get_images_parent')) {
         $criteria = new CDbCriteria();
         $criteria->addCondition('product_id=' . $paId);
         $objZoom = Zoomproduct::model()->findAll($criteria);
         $countZ = Zoomproduct::model()->count($criteria);
     }
     $isLoadedByModuleZoom = false;
     $arrSmallImage = array();
     if ($countZ > 0) {
         foreach ($objZoom as $itemp) {
             $isLoadedByModuleZoom = true;
             $arrSmallImage[] = self::buildArrImage($itemp->url, $isLoadedByModuleZoom);
         }
     } else {
         $images = $model->ProductPhotos;
         return $images;
     }
     if (count($arrSmallImage) > 0) {
         return $arrSmallImage;
     } else {
         return false;
     }
 }
Пример #3
0
        echo $this->createUrl('zoomproduct/view?pid=' . $objProduct->id);
        ?>
';">
                <td class="span1">
					<?php 
        echo $objProduct->id;
        ?>
                </td>
                <td class="span1"><img src="<?php 
        echo $objProduct->SmallImage;
        ?>
" width="30px;" alt=""/></td>
				<?php 
        $rowImg = Yii::app()->db->createCommand()->from('xlsws_mod_zoomproduct')->where('product_id=:product_id', array(':product_id' => $objProduct->id))->queryRow();
        if ($rowImg) {
            $imgsrc = Zoomproduct::model()->resizeImage($rowImg['url'], 60, 60);
        } else {
            $imgsrc = Yii::app()->baseurl . '/images/no_product.png';
        }
        ?>
                <td class="span1"><img src="<?php 
        echo $imgsrc;
        ?>
" width="30px;" alt=""/></td>
                <td class="span4">
					<?php 
        echo _xls_truncate($objProduct->Title, 80);
        ?>
                </td>
                 <td class="span2"><?php 
        echo _xls_truncate($objProduct->Code, 80);