66 lines
1.6 KiB
PHP
66 lines
1.6 KiB
PHP
<?php
|
|
/*
|
|
* @version $Id: index.php 10381 2008-06-01 03:35:53Z $
|
|
* @package Carteasy
|
|
* @copyright Copyright (C) 2005 - 2011 Wlanium
|
|
* @license proprietary
|
|
* @author Thomas Bartelt
|
|
* Carteasy is a web shop system
|
|
*/
|
|
|
|
include_once './core/delivererhelper.class.php';
|
|
include_once './core/paymenthelper.class.php';
|
|
|
|
class CountryHelper {
|
|
|
|
//=========================================
|
|
//
|
|
// THIS CLASS IS STATIC ONLY
|
|
//
|
|
//=========================================
|
|
private function __construct() {}
|
|
|
|
private function __clone() {}
|
|
|
|
//=========================================
|
|
//
|
|
// THE PUBLIC INTERFACE
|
|
//
|
|
//=========================================
|
|
|
|
public static function get_delivery_and_shipping_info_for_all_countries() {
|
|
$db = Registry::get('base')->db;
|
|
$deliverer_array = DelivererHelper::get_deliverers_by_shipping_area_array();
|
|
$payment_array = PaymentHelper::get_payment_methods_by_shipping_area_array();
|
|
|
|
$sql = "SELECT * FROM countries";
|
|
|
|
$result = $db->query($sql);
|
|
|
|
if ($result->num_rows > 0 && $deliverer_array && $payment_array) {
|
|
while ($obj = $result->fetch_object()) {
|
|
$country_array[] = array('name' => $obj->name, 'id' => $obj->id, 'delivery_methods' => $deliverer_array[$obj->shipping_area_id], 'payment_methods' => $payment_array[$obj->shipping_area_id]);
|
|
}
|
|
|
|
return $country_array;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public static function get_shipping_area_by_country_id($country_id) {
|
|
$db = Registry::get('base')->db;
|
|
|
|
$sql = "SELECT * FROM countries WHERE id=".$country_id;
|
|
|
|
$result = $db->query($sql);
|
|
|
|
if ($result->num_rows > 0) {
|
|
return $result->fetch_object()->shipping_area_id;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
?>
|