Пример #1
0
 public function getItem($pk = null)
 {
     if ($item = parent::getItem($pk)) {
         if (!isset($item->tax_rate_id) || $item->tax_rate_id == 0) {
             $item->tax_rate_id = JFactory::getApplication()->input->getInt('tax_rate_id');
         }
         return $item;
     } else {
         return false;
     }
 }
Пример #2
0
 public function getItem($pk = null)
 {
     if ($item = parent::getItem($pk)) {
         if ((!isset($item->categories) || !is_array($item->categories)) && isset($item->id)) {
             $this->_db->setQuery('SELECT category_id FROM #__djc2_items_categories WHERE item_id=\'' . $item->id . '\'');
             $item->categories = $this->_db->loadColumn();
         }
         return $item;
     } else {
         return false;
     }
 }
Пример #3
0
 public function getItem($pk = null)
 {
     if ($item = parent::getItem($pk)) {
         if ((!isset($item->categories) || !is_array($item->categories)) && isset($item->id)) {
             $this->_db->setQuery('SELECT category_id FROM #__djc2_items_categories WHERE item_id=\'' . $item->id . '\'');
             $item->categories = $this->_db->loadColumn();
         }
         if (!isset($item->location) || !is_array($item->location)) {
             $location = array('address' => null, 'city' => null, 'postcode' => null, 'country' => null, 'state' => null, 'latitude' => null, 'longitude' => null, 'phone' => null, 'fax' => null, 'mobile' => null, 'website' => null, 'email' => null);
             foreach ($location as $k => $v) {
                 if (isset($item->{$k})) {
                     $location[$k] = $item->{$k};
                 }
             }
             $item->location = $location;
         }
         if (!is_array($item->group_id)) {
             $query = $this->_db->getQuery(true);
             /*$query->select ('distinct f.group_id');
             		$query->from('#__djc2_items_extra_fields AS f');
             		$query->join('LEFT','#__djc2_items_extra_fields_values_text AS vt ON f.id=vt.field_id AND vt.item_id='.(int)$item->id);
             		$query->join('LEFT','#__djc2_items_extra_fields_values_int AS vi ON f.id=vi.field_id AND vi.item_id='.(int)$item->id);
             		$query->join('LEFT','#__djc2_items_extra_fields_values_date AS vd ON f.id=vd.field_id AND vd.item_id='.(int)$item->id);
             		$query->where('vt.value IS NOT NULL OR vi.value IS NOT NULL OR vd.value IS NOT NULL');
             		*/
             $query->select('distinct group_id');
             $query->from('#__djc2_items_groups');
             $query->where('item_id=' . (int) $item->id);
             $this->_db->setQuery($query);
             $item->group_id = $this->_db->loadColumn();
         }
         return $item;
     } else {
         return false;
     }
 }