<?php /** * @package E-Commerce WD * @author Web-Dorado * @copyright (C) 2014 Web-Dorado. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html * * 2015.10.11 FT imageSlider display if count($images) > 1 **/ defined('_JEXEC') || die('Access Denied'); WDFHelper::add_css('css/' . WDFInput::get_controller() . '/' . $this->_layout . '_imagesviewer.css'); WDFHelper::add_script('js/' . WDFInput::get_controller() . '/' . $this->_layout . '_imagesviewer.js'); $theme = $this->theme; $product_row = $this->product_row; $images = WDFJson::decode($product_row->images); if ($product_row->label_thumb != '') { switch ($product_row->label_thumb_position) { case 0: $label_position_class = 'wd_align_tl'; break; case 1: $label_position_class = 'wd_align_tr'; break; case 2: $label_position_class = 'wd_align_bl'; break; case 3: $label_position_class = 'wd_align_br'; break; }
private function add_product_related_products($product_rows) { $db = JFactory::getDbo(); $query = $db->getQuery(true); for ($i = 0; $i < count($product_rows); $i++) { $product_row = $product_rows[$i]; $query->clear(); $query->select('T_PRODUCTS.id'); $query->select('T_PRODUCTS.name'); $query->select('T_PRODUCTS.images'); $query->from('#__ecommercewd_products AS T_PRODUCTS'); $query->where('T_PRODUCTS.category_id = ' . $product_row->category_id); $query->where('T_PRODUCTS.id <> ' . $product_row->id); $query->where('T_PRODUCTS.published = 1'); $query->order('RAND() LIMIT 0, 15'); $db->setQuery($query); $related_product_rows = $db->loadObjectList(); if ($db->getErrorNum()) { return false; } // add data foreach ($related_product_rows as $related_product_row) { // link $related_product_row->link = JRoute::_('index.php?option=com_' . WDFHelper::get_com_name() . '&controller=products&task=displayproduct&product_id=' . $related_product_row->id); // image $related_product_row->images = WDFJson::decode($related_product_row->images); $related_product_row->image = count($related_product_row->images) > 0 ? $related_product_row->images[0] : ''; } $product_row->related_products = $related_product_rows; } }
<!-- subcategory panel --> <div class="wd_shop_panel_product wd_shop_subcategory_container panel panel-default"> <div class="panel-body"> <a class="btn btn-link" href="<?php echo $subcategory->url; ?> " title="<?php echo $subcategory->name; ?> "> <!-- image --> <div class="wd_shop_subcategory_image_container wd_center_wrapper"> <?php $images = WDFJson::decode($subcategory->images); if (empty($images) == false) { ?> <div> <img src="<?php echo $images[0]; ?> " class="wd_align_center_block img-responsive" alt="<?php echo $subcategory->name; ?> "> </div> <?php } else {
private function get_category_products($category_id, $count) { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('id'); $query->select('name'); $query->select('images'); $query->from('#__ecommercewd_products'); $query->where('category_id = ' . $category_id); $query->where('published = 1'); $query->order('ordering ASC'); if ($count) { $db->setQuery($query, 0, $count); } else { $db->setQuery($query); } $rows = $db->loadObjectList(); if ($db->getErrorNum()) { return false; } // additional data foreach ($rows as $row) { // url $row->url = JRoute::_('index.php?option=com_' . WDFHelper::get_com_name() . '&controller=products&task=displayproduct&product_id=' . $row->id); // image $row->images = WDFJson::decode($row->images); $row->image = empty($row->images) == false ? $row->images[0] : ''; } return $rows; }
public function ajax_getcompareproductrow() { WDFInput::set('tmpl', 'component'); $model = WDFHelper::get_model('products'); $product_row = $model->get_product_view_product_row(); echo WDFJson::encode($product_row); die; }