public static function getProperties($pid = 0, $prid = 0, $val_id = 0, $by = 'ppv.product_id', $by_sort = 0) { $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select(' ppv.id, ppv.property_id, ppv.value_id, ppv.text, p.edit_price, p.title, p.type, p.view, p.default, p.prefix, p.suffix ')->from('#__ksenmart_properties AS p')->leftjoin('#__ksenmart_product_properties_values AS ppv ON p.id=ppv.property_id'); if ($pid) { $query->where('ppv.product_id=' . $pid); } if ($by_sort) { switch ($by) { case 'ppv.id': $query->where('ppv.id=' . $by_sort); break; default: $query->where('ppv.product_id=' . $pid); break; } } $query->where('p.published=1')->group('ppv.property_id'); if ($prid) { $query->where('ppv.property_id=' . $prid); } $query->order('p.ordering'); $db->setQuery($query); $properties = $db->loadObjectList(); $properties = KSMProducts::getPropertiesChild($pid, $properties, $val_id); return $properties; }