Beispiel #1
0
 public static function getList(&$params)
 {
     if (!class_exists('VmConfig')) {
         return;
     }
     VmConfig::loadConfig();
     JFactory::getLanguage()->load('com_virtuemart');
     $items = array();
     $list = array();
     $_catids = $params->get('catid');
     settype($_catids, 'array');
     $catids = self::_getPublishCategories($_catids);
     if (empty($catids)) {
         return;
     }
     $limitation = (int) $params->get('source_limit', 8);
     $desc_maxlength = $params->get('item_desc_max_characs', 50);
     $source_group = null;
     $ordering_direction = $params->get('product_ordering_direction');
     $source_order = $params->get('source_order', 'group.featured');
     $p_special = $params->get('show_front');
     $categoryModel = VmModel::getModel('Category');
     $categoryModel->_noLimit = true;
     if (!empty($catids)) {
         $catids = self::_getChildCategories($catids, $params);
         $productModel = VmModel::getModel('Product');
         $productModel = new VirtuemartModelProductExtend();
         $productModel->filter_order = $source_order;
         $productModel->specail_product = $p_special;
         $productModel->ordering_direction = $ordering_direction;
         $items = $productModel->getProductListing($source_group, $limitation, true, true, false, true, $catids);
         $productModel->addImages($items);
         $ratingModel = VmModel::getModel('ratings');
         foreach ($items as $item) {
             $item->title = $item->product_name;
             $item->id = $item->virtuemart_product_id;
             $item->description = $item->product_desc;
             self::getVmImages($item, $params);
             $item->short_desc = self::_cleanText($item->product_s_desc);
             $item->_description = self::_cleanText($item->description);
             $item->_description = $item->_description != '' ? self::truncate($item->_description, $desc_maxlength) : self::truncate($item->short_desc, $desc_maxlength);
             $item->vote = $ratingModel->getVoteByProduct($item->virtuemart_product_id);
             $item->rating = $ratingModel->getRatingByProduct($item->virtuemart_product_id);
             $list[] = $item;
         }
     }
     return $list;
 }
Beispiel #2
0
 public static function getList(&$params, $getC = 0)
 {
     if (!class_exists('VmConfig')) {
         return;
     }
     VmConfig::loadConfig();
     JFactory::getLanguage()->load('com_virtuemart');
     $items = array();
     $list = array();
     $_list = array();
     $catids = array();
     $catids[] = $params->get('catid');
     $categoryModel = VmModel::getModel('Category');
     $categoryModel->_noLimit = true;
     if ($params->get('item_categori_title_display') == 0) {
         $S_cid = $params->get('catid');
         $child_catid = self::getCategoryTree($S_cid, 0);
         $catid_s = array();
         $catid_s[] = $S_cid;
         if (count($child_catid) > 0) {
             foreach ($child_catid as $i) {
                 $catid_s[] = $i->virtuemart_category_id;
             }
         }
         $return_category = array();
         foreach ($catid_s as $id) {
             $tg = array();
             $tg[] = $id;
             $return_category[] = self::_getCategoryInfor($tg, $params)[0];
         }
         if ($getC == 1) {
             return $return_category;
         }
     }
     settype($catids, 'array');
     $limitation = (int) $params->get('source_limit', 8);
     $desc_maxlength = $params->get('item_desc_max_characs', 50);
     $source_group = null;
     $ordering_direction = $params->get('product_ordering_direction');
     $source_order = $params->get('source_order', 'product_name');
     $p_special = $params->get('show_front');
     $c_id = $params->get('catid');
     $additional_catids = array();
     $categories = array();
     if (!empty($catids)) {
         if ($params->get('show_child_category_products', 1) == 1 && (int) $params->get('levels', 0) > 0) {
             $levels = $params->get('levels', 1) ? $params->get('levels', 1) : 9999;
             foreach ($catids as $catid) {
                 $items = $categoryModel->getCategoryTree($catid, 0);
                 $categoryModel->_noLimit = true;
                 if (!empty($items)) {
                     foreach ($items as $category) {
                         $condition = $category->level <= $levels;
                         if ($condition) {
                             $additional_catids[] = $category->virtuemart_category_id;
                         }
                     }
                 }
             }
             $catids = array_unique(array_merge($catids, $additional_catids));
         }
         $productModel = VmModel::getModel('Product');
         $productModel = new VirtuemartModelProductExtend();
         $productModel->filter_order = $source_order;
         $productModel->specail_product = $p_special;
         $productModel->ordering_direction = $ordering_direction;
         if ($limitation == 0) {
             $productModel->_noLimit = true;
         } else {
             $productModel->_noLimit = false;
         }
         $items = $productModel->getProductListing($source_group, $limitation, true, true, false, true, $catids);
         $productModel->addImages($items);
         $ratingModel = VmModel::getModel('ratings');
         foreach ($items as $item) {
             $item->title = $item->product_name;
             $item->id = $item->virtuemart_product_id;
             $item->description = $item->product_desc;
             self::getVmImages($item, $params);
             $item->short_desc = self::_cleanText($item->product_s_desc);
             $item->_description = self::_cleanText($item->description);
             $item->_description = $item->_description != '' ? self::truncate($item->_description, $desc_maxlength) : self::truncate($item->short_desc, $desc_maxlength);
             $item->vote = $ratingModel->getVoteByProduct($item->virtuemart_product_id);
             $item->rating = $ratingModel->getRatingByProduct($item->virtuemart_product_id);
             $list[] = $item;
         }
     }
     return $list;
 }
Beispiel #3
0
 public static function _getProductInfor($catids, $params)
 {
     $limitation = (int) $params->get('source_limit', 8);
     $desc_maxlength = $params->get('item_desc_max_characs', 50);
     $source_group = null;
     $ordering_direction = $params->get('product_ordering_direction');
     $source_order = $params->get('source_order', 'group.featured');
     $p_special = $params->get('show_front');
     $list = array();
     $productModel = VmModel::getModel('Product');
     $productModel = new VirtuemartModelProductExtend();
     $productModel->filter_order = $source_order;
     $productModel->specail_product = $p_special;
     $productModel->ordering_direction = $ordering_direction;
     $items = $productModel->getProductListing($source_group, $limitation, true, true, false, true, $catids);
     $productModel->addImages($items);
     $ratingModel = VmModel::getModel('ratings');
     foreach ($items as $item) {
         $item->title = $item->product_name;
         $item->id = $item->virtuemart_product_id;
         $item->description = $item->product_desc;
         self::getVmImages($item, $params);
         $item->short_desc = self::_cleanText($item->product_s_desc);
         $item->_description = self::_cleanText($item->description);
         $item->_description = $item->_description != '' ? self::truncate($item->_description, $desc_maxlength) : self::truncate($item->short_desc, $desc_maxlength);
         $item->vote = $ratingModel->getVoteByProduct($item->virtuemart_product_id);
         $item->rating = is_object($ratingModel->getRatingByProduct($item->virtuemart_product_id)) ? $ratingModel->getRatingByProduct($item->virtuemart_product_id)->rating : '0';
         $list[] = $item;
     }
     return $list;
 }
Beispiel #4
0
 public static function _getProductInfor($catids, $params, $field_order = null)
 {
     VmConfig::loadJLang('com_virtuemart', true);
     VmConfig::loadConfig();
     if ($catids == '*') {
         $_catids = $params->get('catid');
         $catids = self::_getChildCategories($_catids, $params);
         $catids = self::_getPublishCategories($catids);
     }
     if (empty($catids)) {
         return;
     }
     if ($catids == '*') {
         $limitation = 999;
     } else {
         $limitation = (int) $params->get('source_limit', 8);
     }
     $source_group = null;
     $ordering_direction = $params->get('product_ordering_direction');
     //$source_order = $params->get('source_order','group.featured');
     $p_special = $params->get('show_front');
     $categoryModel = VmModel::getModel('Category');
     $categoryModel->_noLimit = true;
     settype($catids, "array");
     $catids = self::_getChildCategories($catids, $params);
     $list = array();
     if (!empty($catids)) {
         $productModel = VmModel::getModel('Product');
         $productModel = new VirtuemartModelProductExtend();
         $productModel->filter_order = $field_order;
         $productModel->specail_product = $p_special;
         $productModel->ordering_direction = $ordering_direction;
         $desc_maxlength = $params->get('item_des_maxlength');
         $items = $productModel->getProductListing($source_group, $limitation, true, true, false, true, $catids);
         $productModel->addImages($items);
         $ratingModel = VmModel::getModel('ratings');
         foreach ($items as $item) {
             $item->title = $item->product_name;
             $item->id = $item->virtuemart_product_id;
             $item->description = $item->product_desc;
             self::getVmImages($item, $params);
             $item->short_desc = self::_cleanText($item->product_s_desc);
             $item->_description = self::_cleanText($item->description);
             $item->_description = $item->_description != '' ? self::truncate($item->_description, $desc_maxlength) : self::truncate($item->short_desc, $desc_maxlength);
             $item->vote = $ratingModel->getVoteByProduct($item->virtuemart_product_id);
             $item->rating = $ratingModel->getRatingByProduct($item->virtuemart_product_id);
             $list[] = $item;
         }
     }
     return $list;
 }