public static function getProduct($id) { self::onExecuteBefore(array(&$id)); global $ext_name; $old_ext_name = $ext_name; $ext_name = 'ksenmart'; $db = JFactory::getDBO(); $params = JComponentHelper::getParams('com_ksenmart'); $query = $db->getQuery(true); $query = KSMProducts::setProductMainImageToQuery($query); $query->select('`p`.*')->select($db->qn(array('m.title', 'u.form1'), array('manufacturer_title', 'unit')))->from($db->qn('#__ksenmart_products', 'p'))->leftjoin($db->qn('#__ksenmart_manufacturers', 'm') . ' ON ' . $db->qn('p.manufacturer') . '=' . $db->qn('m.id'))->leftjoin($db->qn('#__ksenmart_product_units', 'u') . ' ON ' . $db->qn('p.product_unit') . '=' . $db->qn('u.id'))->where($db->qn('p.id') . '=' . $db->q($id))->group($db->qn('p.id')); $db->setQuery($query); $row = $db->loadObject(); if ($row && !empty($row)) { $row->properties = KSMProducts::getProperties($id); if (empty($row->folder)) { $row->folder = 'products'; } if (empty($row->filename)) { $row->filename = 'no.jpg'; } if ($row->product_packaging == 0) { $row->product_packaging = 1; } $row->product_packaging = rtrim(rtrim($row->product_packaging, '0'), '.'); if ($row->parent_id > 0) { $row->parent = self::getProduct($row->parent_id); } self::productPricesTransform($row); $row->link = JRoute::_('index.php?option=com_ksenmart&view=product&id=' . $row->id . ':' . $row->alias . '&Itemid=' . KSSystem::getShopItemid()); $row->mini_small_img = KSMedia::resizeImage($row->filename, $row->folder, $params->get('mini_thumb_width'), $params->get('mini_thumb_height'), json_decode($row->params, true)); $row->small_img = KSMedia::resizeImage($row->filename, $row->folder, $params->get('thumb_width'), $params->get('thumb_height'), json_decode($row->params, true)); $row->img = KSMedia::resizeImage($row->filename, $row->folder, $params->get('middle_width'), $params->get('middle_height'), json_decode($row->params, true)); $row->img_link = KSMedia::resizeImage($row->filename, $row->folder, $params->get('full_width', 900), $params->get('full_height', 900)); $row->rate = KSMProducts::getProductRate($row->id); $row->add_link_cart = KSFunctions::getAddToCartLink($row->price, 2); $row->tags = new JHelperTags(); $row->tags->getItemTags('com_ksenmart.product', $row->id); } $ext_name = $old_ext_name; self::onExecuteAfter(array(&$row)); return $row; }