예제 #1
0
//auto_start
$auto_start = $params->get('auto_start', 1);
//butlet and next back
$next_back = $params->get('next_back', 0);
$butlet = $params->get('butlet', 1);
//Option for content
$showReadmore = $params->get('show_readmore', '1');
$showTitle = $params->get('show_title', '1');
$show_category_name = $params->get('show_category_name', 0);
$show_category_name_as_link = $params->get('show_category_name_as_link', 0);
$showPrice = $params->get('show_price');
$showDate = $params->get('show_date', '0');
$showManufacturer = $params->get('show_manufacturer', '0');
$show_intro = $params->get('show_intro', '0');
//Option for image
$thumbWidth = (int) $params->get('thumbnail_width', 200);
$thumbHeight = (int) $params->get('thumbnail_height', 150);
$image_crop = $params->get('image_crop', '0');
$show_image = $params->get('show_image', '0');
$showViewDetails = $params->get('show_view_details', '1');
$showAddToCart = $params->get('show_add_to_cart', '1');
$showReviewCount = $params->get('show_review_count', 1);
$showRating = $params->get('show_rating', 1);
//Get tmpl
$align_image = strtolower($params->get('image_align', "center"));
$layout = $params->get('layout', 'default');
modBtProductSliderHelper::fetchHead($params);
require JModuleHelper::getLayoutPath('mod_bt_productslider', '/themes/' . $layout . '/' . $layout);
?>

예제 #2
0
 /**
  * get the list of k2 items
  *
  * @param JParameter $params;
  * @return Array
  */
 public function getList()
 {
     if (!is_dir(JPATH_ADMINISTRATOR . '/components/com_virtuemart')) {
         return array();
     }
     $params =& $this->_params;
     /**
      * Get data 
      */
     $db = JFactory::getDBO();
     $data = array();
     //select from
     $source = trim($this->_params->get('source', 'vm_categories'));
     if ($source == 'vm_categories') {
         $catids = $this->_params->get('vm_categories', '');
     } else {
         if ($this->_params->get('vm_ids', '')) {
             $ids = preg_split('/,/', $this->_params->get('vm_ids', ''));
             $ids_tmp = array();
             foreach ($ids as $id) {
                 $ids_tmp[] = (int) trim($id);
             }
         }
     }
     if ($source == 'vm_categories' && $catids && $this->_params->get('limit_items_for_each')) {
         foreach ($catids as $catid) {
             $query = $this->buildQuery($catid);
             $db->setQuery($query);
             $data = array_merge($data, $db->loadObjectlist());
         }
     } else {
         if ($source == 'vm_categories' && $catids) {
             $query = $this->buildQuery($catids);
             $db->setQuery($query);
             $data = array_merge($data, $db->loadObjectlist());
         } else {
             if ($source == 'vm_ids' && $ids_tmp && count($ids_tmp)) {
                 $query = $this->buildQuery(false, $ids_tmp);
                 $db->setQuery($query);
                 $data = array_merge($data, $db->loadObjectlist());
             } else {
                 $query = $this->buildQuery(false, false);
                 $db->setQuery($query);
                 $data = array_merge($data, $db->loadObjectlist());
             }
         }
     }
     $this->reloadProducts($data);
     if (empty($data)) {
         return array();
     }
     /**
      * Get display and config params 
      */
     /* title */
     $isStrips = $params->get("auto_strip_tags", 1);
     $stringtags = '';
     if ($isStrips) {
         $allow_tags = $params->get("allow_tags", '');
         $stringtags = '';
         if (!is_array($allow_tags)) {
             $allow_tags = explode(',', $allow_tags);
         }
         foreach ($allow_tags as $tag) {
             $stringtags .= '<' . $tag . '>';
         }
     }
     /* intro */
     $maxDesciption = $params->get('description_max_chars', 100);
     $limitDescriptionBy = $params->get('limit_description_by', 'char');
     $isThumb = $params->get('image_thumb', 1);
     $dateFormat = $params->get('date_format', 'DATE_FORMAT_LC3');
     foreach ($data as $key => &$product) {
         $product->link = JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $product->id . '&virtuemart_category_id=' . $product->category_id);
         if ($this->_params->get('show_add_to_cart', 1)) {
             $product->add_to_cart = modBtProductSliderHelper::addtocart($product);
         }
         if ($this->_params->get('show_intro')) {
             if ($limitDescriptionBy == 'word') {
                 $product->description = self::substrword($product->introtext, $maxDesciption, '...', $isStrips, $stringtags);
             } else {
                 $product->description = self::substring($product->introtext, $maxDesciption, '...', $isStrips, $stringtags);
             }
         }
         if ($this->_params->get('show_category_name_as_link')) {
             $product->category_link = JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $product->category_id);
         }
         //if show image
         if ($this->_params->get('show_image')) {
             $product->thumbnail = explode(',', $product->thumbnail);
             $thumbnail = '';
             foreach ($product->thumbnail as $tmpThumbnail) {
                 $type = explode('.', $tmpThumbnail);
                 $type = strtolower($type[count($type) - 1]);
                 if (in_array($type, array('jpg', 'jpeg', 'png', 'png'))) {
                     $thumbnail = $tmpThumbnail;
                     break;
                 }
             }
             $product->thumbnail = $thumbnail;
             $product = $this->generateImages($product, $isThumb);
         }
         if ($this->_params->get('show_manufacturer')) {
             //link to detail page
             $product->manufacturer_link = JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_manufacturer_id=' . $product->virtuemart_manufacturer_id);
             //link to manufacturer's product page
             //$product->manufacturer_link = JRoute::_('index.php?option=com_virtuemart&view=manufacturer&virtuemart_manufacturer_id=' . $product->virtuemart_manufacturer_id);
         }
     }
     return $data;
 }