コード例 #1
0
ファイル: setup.php プロジェクト: wardvanderput/SumoStore
 public function deinstall()
 {
     Sumo\Database::query("DROP TABLE IF EXISTS PREFIX_app_sisow");
     Sumo\Database::query("DROP TABLE IF EXISTS PREFIX_app_sisow_payments");
     Sumo\Database::query("DROP TABLE IF EXISTS PREFIX_app_sisow_payments_info");
     return true;
 }
コード例 #2
0
ファイル: setup.php プロジェクト: wardvanderput/SumoStore
 public function deinstall()
 {
     // Remove the settings table
     Sumo\Database::query("DROP TABLE IF EXISTS PREFIX_app_paymentpickup");
     // Remove translation values
     Sumo\Database::query("DELETE FROM PREFIX_tanslations WHERE key_id = :id", array('id' => Sumo\Database::query("SELECT id FROM PREFIX_translations_keys WHERE name = 'APP_PAYMENTPICKUP_TITLE'")->fetchColumn()));
     Sumo\Database::query("DELETE FROM PREFIX_tanslations WHERE key_id = :id", array('id' => Sumo\Database::query("SELECT id FROM PREFIX_translations_keys WHERE name = 'APP_PAYMENTPICKUP_ENABLE'")->fetchColumn()));
     Sumo\Database::query("DELETE FROM PREFIX_tanslations WHERE key_id = :id", array('id' => Sumo\Database::query("SELECT id FROM PREFIX_translations_keys WHERE name = 'APP_PAYMENTPICKUP_PAYMENT_STATUS'")->fetchColumn()));
     // Finally, remove translation keys
     Sumo\Database::query("DELETE FROM PREFIX_translations_keys WHERE name = 'APP_PAYMENTPICKUP_TITLE'");
     Sumo\Database::query("DELETE FROM PREFIX_translations_keys WHERE name = 'APP_PAYMENTPICKUP_ENABLE'");
     Sumo\Database::query("DELETE FROM PREFIX_translations_keys WHERE name = 'APP_PAYMENTPICKUP_PAYMENT_STATUS'");
     return true;
 }
コード例 #3
0
ファイル: model.php プロジェクト: wardvanderput/SumoStore
 public function select($fields = '*', $table = 'default', $where = '', $order = '')
 {
     if ($fields == '*' || empty($fields)) {
         $fields = '*';
     }
     $sql = 'SELECT ' . $fields . ' FROM ';
     if ($table == 'default' || empty($table)) {
         $table = $this->baseTable;
     }
     $sql .= $table;
     if (!empty($where)) {
         $sql .= ' WHERE ' . $where;
     }
     if (!empty($order)) {
         $sql .= ' ORDER BY ' . $order;
     }
     return Sumo\Database::fetchAll($sql);
 }
コード例 #4
0
ファイル: index.php プロジェクト: wardvanderput/SumoStore
 private function getData()
 {
     $cache = 'customer.newsletterbasic.' . json_encode($this->request->post);
     $data = Sumo\Cache::find($cache);
     if (!is_array($data) || !count($data)) {
         $data = array();
         $advanced = !empty($this->request->post['filter']) ? 1 : 0;
         $sql = "SELECT c.customer_id, c.firstname, c.lastname, c.email, c.gender, c.birthdate, a.country_id, c.newsletter, c.customer_group_id FROM PREFIX_customer AS c LEFT JOIN PREFIX_address AS a ON c.address_id = a.address_id WHERE status = 1";
         if ($advanced) {
             // Add filters
             if (empty($this->request->post['mail_type'])) {
                 $sql .= " AND newsletter = 1";
             }
             if (!empty($this->request->post['country'])) {
                 $sql .= " AND country_id = " . (int) $this->request->post['country'];
             }
             if (!empty($this->request->post['gender']) && $this->request->post['gender'] != 'b' && in_array($this->request->post['gender'], array('m', 'f'))) {
                 $sql .= " AND gender = '" . $this->request->post['gender'] . "'";
             }
             if (!empty($this->request->post['age'])) {
                 $check = explode('-', $this->request->post['age']);
                 if (count($check) == 2) {
                     $sql .= " AND (birthdate <= '" . date('Y-m-d', strtotime((int) $check[0] . ' years ago')) . "' AND birthdate >= '" . date('Y-m-d', strtotime((int) $check[1] . ' years ago')) . "')";
                 } else {
                     $sql .= " AND birthdate <= '" . date('Y-m-d', strtotime('55 years ago')) . "'";
                 }
                 $sql .= " OR birthdate = '0000-00-00'";
             }
         } else {
             switch ($this->request->post['to']) {
                 case 'newsletter':
                     $sql .= " AND newsletter = 1";
                     break;
                 case 'customer_group':
                     $sql .= " AND customer_group_id = " . (int) $this->request->post['customer_group_id'];
                     break;
                 default:
                     break;
             }
         }
         if (isset($this->request->post['start']) && isset($this->request->post['limit'])) {
             $sql .= ' LIMIT ' . (int) $this->request->post['start'] . ', ' . (int) $this->request->post['limit'];
         }
         $data = Sumo\Database::fetchAll($sql);
         Sumo\Cache::set($cache, $data);
     }
     return $data;
 }
コード例 #5
0
ファイル: setup.php プロジェクト: wardvanderput/SumoStore
 public function deinstall()
 {
     Sumo\Database::query("DROP TABLE IF EXISTS PREFIX_app_shippingweight");
     return true;
 }
コード例 #6
0
ファイル: index.php プロジェクト: wardvanderput/SumoStore
$config->set('config_ssl', $store['base_https']);
if (defined('ADMIN_REDIRECT')) {
    header('Location: ' . $config->get('base_http') . 'error/not_found');
    exit;
}
if (!defined('ADMIN_ENABLED')) {
    $config->set('admin_directory', 'admin');
}
Sumo\Cache::setStore('-1');
Sumo\Logger::info('Settings are set');
define('HTTP_SERVER', $store['base_https'] . $config->get('admin_directory') . '/');
define('HTTPS_SERVER', $store['base_https'] . $config->get('admin_directory') . '/');
define('HTTP_STYLE_BASE', $store['base_https']);
// Language, CLEANUP REQUIRED!!!
$languages = array();
foreach (Sumo\Database::fetchAll("SELECT * FROM PREFIX_language ORDER BY language_id") as $list) {
    $languages[$list['language_id']] = $list;
}
Sumo\Language::setup($languages[$config->get('language_id')]);
$lang = $languages[$config->get('language_id')];
setlocale(LC_TIME, '');
$locale = setlocale(LC_TIME, $lang['locale']);
$config->set('locale', $lang['locale']);
Sumo\Logger::info('Locale: ' . ($locale ? 'set' : 'failed'));
Sumo\Logger::info('Language created');
// Formatter
Sumo\Formatter::setup($config);
// Cache
Sumo\Cache::setStore('admin');
// Mail
Sumo\Mail::setup($config);
コード例 #7
0
ファイル: setup.php プロジェクト: wardvanderput/SumoStore
 public function deinstall()
 {
     Sumo\Database::query("DROP TABLE IF EXISTS PREFIX_app_widgetsimplefooter");
     return true;
 }
コード例 #8
0
ファイル: setup.php プロジェクト: wardvanderput/SumoStore
 public function deinstall()
 {
     Sumo\Database::query("DROP TABLE IF EXISTS PREFIX_app_banktransfer");
     return true;
 }
コード例 #9
0
ファイル: setup.php プロジェクト: wardvanderput/SumoStore
 public function deinstall()
 {
     Sumo\Database::query("DROP TABLE IF EXISTS PREFIX_app_cashondelivery");
     return true;
 }
コード例 #10
0
ファイル: products.php プロジェクト: wardvanderput/SumoStore
 public function getFilters($data)
 {
     if (empty($data['data']['filter_category_id'])) {
         return;
     }
     if (!empty($data['data']['filter_category_id'])) {
         $category_id = $data['data']['filter_category_id'];
     }
     if (empty($data['data']['start'])) {
         $data['data']['start'] = 0;
     }
     if (empty($data['data']['limit'])) {
         $data['data']['limit'] = 15;
     }
     if (empty($data['data']['sort'])) {
         $data['data']['sort'] = 'p.sort_order';
     }
     if (empty($data['data']['order']) || !in_array($data['data']['order'], array('ASC', 'DESC'))) {
         $data['data']['order'] = 'ASC';
     }
     $cache = 'wsp_filters_' . md5(json_encode($data));
     $result = Sumo\Cache::find($cache);
     if (is_array($result) && !empty($result)) {
         return $result;
     }
     $filters = Sumo\Database::fetchAll("SELECT a.attribute_group_id\n            FROM PREFIX_product_attribute AS pa\n            LEFT JOIN PREFIX_attribute AS a\n                ON a.attribute_id = pa.attribute_id\n            LEFT JOIN PREFIX_product_to_category AS ptc\n                ON ptc.product_id = pa.product_id\n            WHERE ptc.category_id = :cat\n                AND pa.language_id = :lang\n                ", array('cat' => $category_id, 'lang' => $this->config->get('language_id')));
     $result = array();
     foreach ($filters as $filter) {
         if (!isset($result[$filter['attribute_group_id']])) {
             $group = Sumo\Database::query("SELECT name FROM PREFIX_attribute_group_description WHERE attribute_group_id = :group AND language_id = :lang", array('group' => $filter['attribute_group_id'], 'lang' => $this->config->get('language_id')))->fetch();
             $result[$filter['attribute_group_id']]['name'] = $group['name'];
             $attributes = Sumo\Database::fetchAll("SELECT a.attribute_id, ad.name\n                    FROM PREFIX_attribute AS a\n                    LEFT JOIN PREFIX_attribute_description AS ad\n                        ON a.attribute_id = ad.attribute_id\n                    WHERE a.attribute_group_id  = :group\n                        AND ad.language_id      = :lang", array('group' => $filter['attribute_group_id'], 'lang' => $this->config->get('language_id')));
             foreach ($attributes as $list) {
                 if (isset($data['data']['filter_filter'][$list['attribute_id']])) {
                     $list['active'] = true;
                 }
                 $result[$filter['attribute_group_id']]['filters'][$list['attribute_id']] = $list;
             }
         }
     }
     Sumo\Cache::set($cache, $result);
     return $result;
 }