public static function getAll($group_id = 1, $view = NULL) { global $lC_Database, $lC_Language; $Qcfg = $lC_Database->query('select * from :table_configuration where configuration_group_id = :configuration_group_id order by sort_order'); $Qcfg->bindTable(':table_configuration', TABLE_CONFIGURATION); $Qcfg->bindInt(':configuration_group_id', $group_id); $Qcfg->execute(); $result = array('entries' => array()); $result = array('aaData' => array()); while ($Qcfg->next()) { if ($Qcfg->valueProtected('configuration_title') == 'Zip Code' && STORE_COUNTRY != 223) { $title = 'Postal Code'; } else { $title = $Qcfg->valueProtected('configuration_title'); } $value = $Qcfg->valueProtected('configuration_value'); $configuration_group_id = $Qcfg->valueProtected('configuration_group_id'); if ($value == '-1') { $value = $lC_Language->get('parameter_false'); } elseif ($value == '0') { $value = $lC_Language->get('parameter_optional'); } elseif ($value == '1') { // Value 1 or true/yes fix. if ($configuration_group_id == 7) { $value = 1; } else { $value = $lC_Language->get('parameter_true'); } } else { if ($title == 'Country' || $title == 'Country of Origin') { $country = lc_get_country_data($value); $value = $country['countries_name']; } else { if ($title == 'Default Shipping Unit') { $wc = lc_get_weight_class_data($value); $value = $wc['weight_class_title']; } else { if (stristr($title, 'percentage')) { $value = $value . '%'; } else { if ($title == 'Zone') { $zn = lc_get_zone_data($value); $value = $zn['zone_name']; } } } } } $action = '<td class="align-right vertical-center">' . ' <span class="button-group compact" title="' . $_SESSION['admin']['access']['configuration'] . '">' . ' <a href="javascript:void(0);" class="button icon-pencil' . ((int) ($_SESSION['admin']['access']['configuration'] < 4) ? " disabled" : NULL) . '"' . ((int) ($_SESSION['admin']['access']['configuration'] < 4) ? NULL : ' onclick="editEntry(\'' . $Qcfg->valueInt('configuration_id') . '\')"') . '><span>' . (stristr($view, 'mobile-') ? NULL : $lC_Language->get('icon_edit')) . '</span></a>' . ' </span>' . '</td>'; $result['aaData'][] = array("{$title}", "{$value}", "{$action}"); $result['entries'][] = $Qcfg->toArray(); if (!lc_empty($Qcfg->value('use_function'))) { $result['entries'][sizeof($result['entries']) - 1]['configuration_value'] = lc_call_user_func($Qcfg->value('use_function'), $Qcfg->value('configuration_value')); } } $Qcfg->freeResult(); return $result; }
public static function getAddressBookData($customer_id, $address_book_id = null) { global $lC_Database; $Qab = $lC_Database->query('select ab.address_book_id, ab.entry_gender as gender, ab.entry_firstname as firstname, ab.entry_lastname as lastname, ab.entry_company as company, ab.entry_street_address as street_address, ab.entry_suburb as suburb, ab.entry_city as city, ab.entry_postcode as postcode, ab.entry_state as state, ab.entry_zone_id as zone_id, ab.entry_country_id as country_id, ab.entry_telephone as telephone_number, ab.entry_fax as fax_number, z.zone_code as zone_code, c.countries_name as country_title from :table_address_book ab left join :table_zones z on (ab.entry_zone_id = z.zone_id), :table_countries c where'); if (is_numeric($address_book_id)) { $Qab->appendQuery('ab.address_book_id = :address_book_id and'); $Qab->bindInt(':address_book_id', $address_book_id); } $Qab->appendQuery('ab.customers_id = :customers_id and ab.entry_country_id = c.countries_id'); $Qab->bindTable(':table_address_book', TABLE_ADDRESS_BOOK); $Qab->bindTable(':table_zones', TABLE_ZONES); $Qab->bindTable(':table_countries', TABLE_COUNTRIES); $Qab->bindInt(':customers_id', $customer_id); $Qab->execute(); if (is_numeric($address_book_id)) { $data = $Qab->toArray(); $data['zoneData'] = lc_get_zone_data($Qab->value('zone_id')); $Qab->freeResult(); return $data; } return $Qab; }