コード例 #1
0
 public function deleteManufacturer($manufacturer_id)
 {
     $this->query("DELETE FROM PREFIX_manufacturer WHERE manufacturer_id = " . (int) $manufacturer_id);
     $this->query("DELETE FROM PREFIX_manufacturer_to_store WHERE manufacturer_id = " . (int) $manufacturer_id);
     $this->query("DELETE FROM PREFIX_url_alias WHERE query = 'manufacturer_id=" . (int) $manufacturer_id . "'");
     Cache::removeAll();
 }
コード例 #2
0
ファイル: cache.php プロジェクト: wardvanderput/SumoStore
 public function remove()
 {
     if ($this->request->server['REQUEST_METHOD'] == 'POST') {
         Cache::removeAll(true);
         Language::rebuildCacheFor($this->config->get('language_id'));
         $files = $this->scan(DIR_IMAGE . 'cache/*', array());
         $check = array();
         if (is_array($files)) {
             foreach ($files as $file) {
                 @unlink($file);
             }
         }
         $this->response->setOutput(json_encode(Logger::get('warning')));
     }
 }
コード例 #3
0
ファイル: status.php プロジェクト: wardvanderput/SumoStore
 public function update()
 {
     Cache::removeAll();
     $type = !empty($this->request->post['type']) ? $this->request->post['type'] : '';
     $id = !empty($this->request->post['id']) ? $this->request->post['id'] : 0;
     if (!empty($this->request->get['new'])) {
         $names = $this->request->post['name'];
         if (is_array($names) && count($names) && !empty($type) && in_array($type, $this->types)) {
             $id = 0;
             foreach ($names as $lang => $name) {
                 Database::query("INSERT INTO PREFIX_" . $type . "\n                        SET language_id = :lang,\n                            name        = :name", array('lang' => $lang, 'name' => $name));
                 if (!$id) {
                     $id = Database::lastInsertId();
                 } else {
                     Database::query("UPDATE PREFIX_" . $type . " SET " . $type . "_id = :new WHERE " . $type . "_id = :old", array('old' => Database::lastInsertId(), 'new' => $id));
                 }
             }
         }
         $this->redirect('index', '', 'SSL');
         exit;
     } else {
         if (empty($type) || empty($id) || !in_array($type, $this->types)) {
             return;
         }
         $data = array();
         parse_str(str_replace('amp;', '', $this->request->post['data']), $data);
         if ($type == $data['type']) {
             foreach ($data['name'] as $lang => $name) {
                 Database::query("UPDATE PREFIX_" . $type . "\n                        SET     name                    = :name\n                        WHERE   language_id             = :lang\n                        AND     " . $type . "_id = :id", array('name' => $name, 'lang' => $lang, 'id' => $id));
             }
         } else {
             if (in_array($data['type'], $this->types)) {
                 $id = 0;
                 foreach ($data['name'] as $lang => $name) {
                     Database::query("INSERT INTO PREFIX_" . $data['type'] . "\n                        SET language_id = :lang,\n                            name        = :name", array('lang' => $lang, 'name' => $name));
                     if (!$id) {
                         $id = Database::lastInsertId();
                     } else {
                         Database::query("UPDATE PREFIX_" . $data['type'] . " SET " . $data['type'] . "_id = :new WHERE " . $data['type'] . "_id = :old", array('old' => Database::lastInsertId(), 'new' => $id));
                     }
                 }
             }
         }
     }
     $this->response->setOutput('OK');
 }
コード例 #4
0
ファイル: cms.php プロジェクト: wardvanderput/SumoStore
 public function remove($type, $id)
 {
     if ($type == 'blog') {
         $this->query("DELETE FROM PREFIX_blog WHERE blog_id = :id", array('id' => $id));
     } else {
         $this->query("DELETE FROM PREFIX_information WHERE parent_id = :id", array('id' => $id));
         $this->query("DELETE FROM PREFIX_information WHERE information_id = :id", array('id' => $id));
     }
     Cache::removeAll();
 }
コード例 #5
0
ファイル: product.php プロジェクト: wardvanderput/SumoStore
 public function deleteProduct($product_id)
 {
     $this->query("DELETE FROM PREFIX_product WHERE product_id = " . (int) $product_id);
     $this->query("DELETE FROM PREFIX_product_attribute WHERE product_id = " . (int) $product_id);
     $this->query("DELETE FROM PREFIX_product_description WHERE product_id = " . (int) $product_id);
     $this->query("DELETE FROM PREFIX_product_discount WHERE product_id = " . (int) $product_id);
     $this->query("DELETE FROM PREFIX_product_image WHERE product_id = " . (int) $product_id);
     $this->query("DELETE FROM PREFIX_product_option_value_description WHERE value_id IN (SELECT value_id FROM PREFIX_product_option_value WHERE option_id IN (SELECT option_id FROM PREFIX_product_option WHERE product_id = " . (int) $product_id . "))");
     $this->query("DELETE FROM PREFIX_product_option_value WHERE option_id IN (SELECT option_id FROM PREFIX_product_option WHERE product_id = " . (int) $product_id . ")");
     $this->query("DELETE FROM PREFIX_product_option_description WHERE option_id IN (SELECT option_id FROM PREFIX_product_option WHERE product_id = " . (int) $product_id . ")");
     $this->query("DELETE FROM PREFIX_product_option WHERE product_id = " . (int) $product_id);
     $this->query("DELETE FROM PREFIX_product_related WHERE product_id = " . (int) $product_id);
     $this->query("DELETE FROM PREFIX_product_related WHERE related_id = " . (int) $product_id);
     $this->query("DELETE FROM PREFIX_product_special WHERE product_id = " . (int) $product_id);
     $this->query("DELETE FROM PREFIX_product_to_category WHERE product_id = " . (int) $product_id);
     $this->query("DELETE FROM PREFIX_product_to_download WHERE product_id = " . (int) $product_id);
     $this->query("DELETE FROM PREFIX_product_to_store WHERE product_id = " . (int) $product_id);
     $this->query("DELETE FROM PREFIX_review WHERE product_id = " . (int) $product_id);
     $this->query("DELETE FROM PREFIX_url_alias WHERE query = 'product_id=" . (int) $product_id . "'");
     Cache::removeAll();
 }
コード例 #6
0
ファイル: category.php プロジェクト: wardvanderput/SumoStore
 public function updateStatus($category_id, $status = 1)
 {
     if ($status) {
         $check = $this->query("SELECT parent_id FROM PREFIX_category WHERE category_id = :id", array('id' => $category_id))->fetch();
         if ($check['parent_id']) {
             $check = $this->query("SELECT status FROM PREFIX_category WHERE category_id = :id", array('id' => $check['parent_id']))->fetch();
             if (!$check['status']) {
                 return false;
             }
         }
     }
     $this->query("UPDATE PREFIX_category\n            SET status          = :status,\n                date_modified   = :date\n            WHERE category_id   = :id", array('status' => $status, 'date' => date('Y-m-d H:i:s'), 'id' => $category_id));
     if (!$status) {
         foreach ($this->fetchAll("SELECT category_id FROM PREFIX_category WHERE parent_id = :id", array('id' => $category_id)) as $cat) {
             $this->updateStatus($cat['category_id'], 0);
         }
     }
     Cache::removeAll();
     return true;
 }
コード例 #7
0
ファイル: language.php プロジェクト: wardvanderput/SumoStore
 public function duplicateLanguage($originalID)
 {
     $data = $this->getLanguage($originalID);
     $translations = $this->fetchAll("SELECT key_id, value FROM PREFIX_translations WHERE language_id = :id", array('id' => $originalID));
     $newLanguageID = $this->addLanguage($data);
     foreach ($translations as $list) {
         $list['languageID'] = $newLanguageID;
         $this->query("INSERT INTO PREFIX_translations SET key_id = :key_id, value = :value, language_id = :languageID", $list);
     }
     Cache::removeAll(true);
 }
コード例 #8
0
ファイル: return.php プロジェクト: wardvanderput/SumoStore
 public function addReturnHistory($return_id, $data)
 {
     $this->query("UPDATE PREFIX_return\n            SET return_status_id    = :status_id,\n                date_modified       = :date\n            WHERE return_id         = :id", array('status_id' => $data['return_status_id'], 'date' => date('Y-m-d H:i:s'), 'id' => $return_id));
     if (!isset($data['notify'])) {
         $data['notify'] = 0;
     }
     $data['date'] = date('Y-m-d H:i:s');
     $data['return_id'] = $return_id;
     $this->query("INSERT INTO PREFIX_return_history\n            SET return_id           = :return_id,\n                return_status_id    = :return_status_id,\n                notify              = :notify,\n                comment             = :comment,\n                date_added          = :date", $data);
     if ($data['notify']) {
         $return_data = $this->getReturn($return_id);
         Mailer::setCustomer($return_data);
         Mailer::setReturn($return_data);
         $mail = Mailer::getTemplate('update_return_status_' . $data['return_status_id']);
         if (!empty($data['comment'])) {
             $mail['content'] = str_replace('{hasComments}', $data['comment'] . '<br /><br />', $mail['content']);
         } else {
             $mail['content'] = str_replace('{hasComments}', '', $mail['content']);
         }
         Mail::setTo($return_data['email']);
         Mail::setSubject($mail['title']);
         Mail::setHTML($mail['content']);
         Mail::send();
     }
     Cache::removeAll();
 }
コード例 #9
0
ファイル: customer.php プロジェクト: wardvanderput/SumoStore
 public function deleteReward($order_id)
 {
     $this->query("DELETE FROM PREFIX_customer_reward WHERE order_id = '" . (int) $order_id . "'");
     Cache::removeAll();
 }
コード例 #10
0
ファイル: customer.php プロジェクト: wardvanderput/SumoStore
 public function editNewsletter($newsletter)
 {
     $this->query("UPDATE PREFIX_customer SET newsletter = :news WHERE customer_id = :cid", array('news' => $newsletter, 'cid' => $this->customer->getId()));
     Cache::removeAll();
 }
コード例 #11
0
ファイル: country.php プロジェクト: wardvanderput/SumoStore
 public function deleteCountry($country_id)
 {
     $this->query("DELETE FROM PREFIX_country WHERE country_id = " . (int) $country_id);
     Cache::removeAll();
 }
コード例 #12
0
ファイル: order.php プロジェクト: wardvanderput/SumoStore
    public function updateStatus($order_id, $status_id, $extra = '', $notify = null)
    {
        if ($status_id == 1) {
            $notify = true;
        } else {
            $old = $this->get($order_id);
            if (!isset($old['status_id']) || isset($old['status_id']) && isset($data['status_id']) && $old['status_id'] != $data['status_id']) {
                //$this->updateStatus($order_id, !empty($data['status_id']) ? $data['status_id'] : 1, !empty($data['status']['comment']) ? $data['status']['comment'] : !empty($data['comment']) ? $data['comment'] : '');
                if ($notify == null) {
                    $notify = $this->config->get('customer_notify_email');
                }
            } else {
                //$this->updateStatus($order_id, 1, !empty($data['comment']) ? $data['comment'] : '');
                if ($notify == null) {
                    $notify = false;
                }
            }
        }
        $this->query("UPDATE PREFIX_orders\n            SET order_status    = :status\n            WHERE order_id      = :id", array('status' => $status_id, 'id' => $order_id));
        if ($notify || $this->config->get('admin_notify_email')) {
            $template = Mailer::getTemplate('update_order_status_' . $status_id);
            $content = $template['content'];
            if ($status_id == 1) {
                $this->load->model('account/order');
                $orderInfo = $this->model_account_order->getOrder($order_id);
                Mailer::setOrder($orderInfo);
                // Grab order totals
                foreach ($this->model_account_order->getOrderTotals($order_id) as $total) {
                    if (!empty($total['label_inject'])) {
                        $label = sprintf(Language::getVar($total['label'] . '_INJ'), $total['label_inject']);
                    } else {
                        $label = Language::getVar($total['label']);
                    }
                    $totals[] = array_merge($total, array('label' => $label));
                }
                // Grab order products
                foreach ($this->model_account_order->getOrderProducts($order_id) as $product) {
                    $price = $product['price'] * (1 + $product['tax_percentage'] / 100);
                    $products[] = array_merge($product, array('price' => Formatter::currency($price), 'total' => Formatter::currency($price * $product['quantity']), 'return' => $this->url->link('account/return/insert', 'order_id=' . $orderInfo['order_id'] . '&product_id=' . $product['product_id'], 'SSL')));
                }
                /**
                 * Parse address info
                 */
                // 1. Shipping
                $shippingAddress = str_replace('{address_1}', '{address_1} {number}{addon}', $orderInfo['customer']['shipping_address']['address_format']);
                foreach ($orderInfo['customer']['shipping_address'] as $key => $value) {
                    $shippingAddress = str_replace('{' . $key . '}', $value, $shippingAddress);
                }
                // 2. Payment
                $paymentAddress = str_replace('{address_1}', '{address_1} {number}{addon}', $orderInfo['customer']['payment_address']['address_format']);
                foreach ($orderInfo['customer']['payment_address'] as $key => $value) {
                    $paymentAddress = str_replace('{' . $key . '}', $value, $paymentAddress);
                }
                // Remove remaining vars and excessive line breaks
                $shippingAddress = preg_replace("/\\{([a-z0-9_\\-]+)\\}/", '', $shippingAddress);
                $shippingAddress = preg_replace("/[\r\n]+/", "\n", $shippingAddress);
                // Remove remaining vars and excessive line breaks
                $paymentAddress = preg_replace("/\\{([a-z0-9_\\-]+)\\}/", '', $paymentAddress);
                $paymentAddress = preg_replace("/[\r\n]+/", "\n", $paymentAddress);
                // Other data
                $order_date = Formatter::date(time());
                $order_id = str_pad($order_id, 6, 0, STR_PAD_LEFT);
                $payment_method = $orderInfo['payment']['name'];
                $shipping_method = $orderInfo['shipping']['name'];
                $order_view = '<hr />
<div class="row">
    <div class="col-sm-6">
        <h4>' . Language::getVar('SUMO_NOUN_INVOICE_ADDRESS') . '</h4>
        <p>' . nl2br($paymentAddress) . '</p>
    </div>

    <div class="col-sm-6">
        <h4>' . Language::getVar('SUMO_NOUN_SHIPPING_ADDRESS') . '</h4>
        <p>' . nl2br($shippingAddress) . '</p>
    </div>
</div>
<hr>
<div class="row">
    <div class="col-sm-6">
        <dl class="info">
            <dt>' . Language::getVar('SUMO_NOUN_ORDER_NO') . ':</dt>
            <dd>' . $order_id . '</dd>
        </dl>
    </div>
    <div class="col-sm-6">
        <dl class="info">
            <dt>' . Language::getVar('SUMO_NOUN_ORDER_DATE') . ':</dt>
            <dd>' . $order_date . '</dd>
        </dl>
    </div>
</div>
<table class="table" style="margin-top: 30px; font-size: 100%;">
    <thead>
        <tr>
            <th style="width: 65px; font-size: 14px;">' . Language::getVar('SUMO_NOUN_QUANTITY') . '</th>
            <th>' . Language::getVar('SUMO_NOUN_PRODUCT') . '</th>
            <th style="width: 75px;">' . Language::getVar('SUMO_NOUN_MODEL') . '</th>
            <th class="text-right" style="width: 75px;">' . Language::getVar('SUMO_NOUN_PRICE') . '</th>
            <th class="text-right" style="width: 75px;">' . Language::getVar('SUMO_NOUN_TOTAL') . '</th>
            <th style="width: 30px;"></th>
        </tr>
    </thead>
    <tbody>';
                foreach ($products as $product) {
                    $order_view .= '
        <tr>
            <td>' . $product['quantity'] . '</td>
            <td>' . $product['name'] . '</td>
            <td>' . $product['model'] . '</td>
            <td class="text-right">' . $product['price'] . '</td>
            <td class="text-right">' . $product['total'] . '</td>
        </tr>';
                }
                $order_view .= '
    </tbody>
</table>
<hr>
<div class="row">
    <div class="col-sm-6">
        <div class="content">
            <dl class="info">
                <dt>' . Language::getVar('SUMO_NOUN_PAYMENT_BY') . ':</dt>
                <dd>' . $payment_method . '</dd>
            </dl>

            <dl class="info">
                <dt>' . Language::getVar('SUMO_NOUN_SHIPPING_METHOD') . ':</dt>
                <dd>' . $shipping_method . '</dd>
            </dl>
        </div>
    </div>
    <div class="col-sm-6">
        <div class="content pull-right">';
                foreach ($totals as $total) {
                    $order_view .= '
            <dl class="info">
                <dt>' . $total['label'] . ':</dt>
                <dd class="text-right" style="min-width: 75px; padding-right: 38px;">' . $total['value_hr'] . '</dd>
            </dl>';
                }
                $order_view .= '
        </div>
    </div>
</div>';
            }
            if (!empty($content)) {
                if ($notify) {
                    $data = $this->get($order_id);
                    Mailer::setCustomer($data['customer']);
                    Mailer::setOrder(array('order_id' => $order_id));
                    $template = Mailer::getTemplate('update_order_status_' . $status_id);
                    $content = $template['content'] = str_replace('{hasComments}', '<br />' . $extra, $template['content']);
                    if ($status_id == 1) {
                        $template['content'] = str_replace('{orderView}', $order_view, $template['content']);
                    }
                    Mail::setTo($data['customer']['email']);
                    Mail::setSubject($template['title']);
                    Mail::setHtml($template['content']);
                    Mail::send();
                }
                if ($this->config->get('admin_notify_email')) {
                    $sendTo = array($this->config->get('email'));
                    $extraMails = $this->config->get('extra_notify_email');
                    if (!empty($extraMails)) {
                        $extraMails = explode(',', $extraMails);
                        foreach ($extraMails as $mail) {
                            if (!empty($mail) && filter_var($mail, \FILTER_VALIDATE_EMAIL)) {
                                $sendTo[] = $mail;
                            }
                        }
                    }
                    $data = $this->get($order_id);
                    Mailer::setCustomer($data['customer']);
                    Mailer::setOrder(array('order_id' => $order_id));
                    $template = Mailer::getTemplate('update_order_status_' . $status_id);
                    $template['content'] = str_replace('{hasComments}', '<br />' . $extra, $template['content']);
                    if ($status_id == 1) {
                        $template['content'] = str_replace('{orderView}', $order_view, $template['content']);
                    }
                    foreach ($sendTo as $to) {
                        Mail::setTo($to);
                        Mail::setSubject($template['title']);
                        Mail::setHtml($template['content']);
                        Mail::send();
                    }
                }
            }
        }
        // Fallback
        if ($status_id != 1) {
            $template = Mailer::getTemplate('update_order_status_' . $status_id);
            $content = $template['content'];
            $content = str_replace('{hasComments}', '<br />' . $extra, $content);
            $content = str_replace('{orderView}', '', $content);
        } else {
            $content = $extra;
        }
        $this->query("INSERT INTO PREFIX_orders_history\n            SET order_id        = :id,\n                status_id       = :status,\n                notify          = :notify,\n                comment         = :comment,\n                history_date    = :date", array('id' => $order_id, 'status' => $status_id, 'notify' => $notify, 'comment' => !empty($content) ? $content : '', 'date' => date('Y-m-d H:i:s')));
        Cache::removeAll();
        return true;
    }
コード例 #13
0
ファイル: product.php プロジェクト: wardvanderput/SumoStore
 public function optionStock()
 {
     $value_id = $this->request->post['value_id'];
     if (!$value_id) {
         return;
     }
     Database::query("UPDATE PREFIX_product_option_value SET quantity = " . (int) $this->request->post['quantity'] . " WHERE value_id = " . (int) $value_id);
     Cache::removeAll();
 }
コード例 #14
0
ファイル: review.php プロジェクト: wardvanderput/SumoStore
 public function deleteReview($reviewID)
 {
     $this->query("DELETE FROM PREFIX_review\n            WHERE review_id = :reviewID", array('reviewID' => $reviewID));
     Cache::removeAll();
 }
コード例 #15
0
ファイル: stores.php プロジェクト: wardvanderput/SumoStore
 public function removeStore($store_id)
 {
     if (!$store_id) {
         return;
     }
     // Remove apps that are installed on the store
     $this->query("DELETE FROM PREFIX_apps_active WHERE store_id = :id", array('id' => $store_id));
     // Fetch blogs that are added for this store
     foreach ($this->fetchAll("SELECT blog_id FROM PREFIX_blog WHERE store_id = :id", array('id' => $store_id)) as $blog) {
         $this->query("DELETE FROM PREFIX_blog_description WHERE blog_id = :id", array('id' => $blog['blog_id']));
     }
     $this->query("DELETE FROM PREFIX_blog WHERE store_id = :id", array('id' => $store_id));
     // Fetch categories that are linked to this store
     foreach ($this->fetchAll("SELECT category_id FROM PREFIX_category_to_store WHERE store_id = :id", array('id' => $store_id)) as $cat) {
         $this->query("DELETE FROM PREFIX_category_to_store WHERE category_id = :id AND store_id = :sid", array('id' => $cat['category_id'], 'sid' => $store_id));
         $check = $this->query("SELECT COUNT(*) AS total FROM PREFIX_category_to_store WHERE category_id = :id", array('id' => $cat['category_id']))->fetch();
         if (!$check['total']) {
             // Prevent "floating" category, remove all references
             $this->query("DELETE FROM PREFIX_category WHERE category_id = :id", array('id' => $cat['category_id']));
             $this->query("DELETE FROM PREFIX_category_description WHERE category_id = :id", array('id' => $cat['category_id']));
             $this->query("DELETE FROM PREFIX_category_path WHERE category_id = :id OR path_id = :cid", array('id' => $cat['category_id'], 'cid' => $cat['category_id']));
             $this->query("DELETE FROM PREFIX_coupon_category WHERE category_id = :id", array('id' => $cat['category_id']));
             $this->query("DELETE FROM PREFIX_url_alias WHERE query = :query", array('query' => 'category_id=' . $cat['category_id']));
             // Fetch all products that are linked to that category
             foreach ($this->fetchAll("SELECT product_id FROM PREFIX_product_to_category WHERE category_id = :id", array('id' => $cat['category_id'])) as $product) {
                 $this->query("DELETE FROM PREFIX_product_to_category WHERE category_id = :id", array('id' => $cat['category_id']));
                 $check2 = $this->query("SELECT COUNT(*) AS total FROM PREFIX_product_to_category WHERE product_id = :id", array('id' => $product['product_id']))->fetch();
                 if (!$check2['total']) {
                     // Prevent "floating" products, remove all references
                     $this->query("DELETE FROM PREFIX_product WHERE product_id = :product_id", $product);
                     $this->query("DELETE FROM PREFIX_product_attribute WHERE product_id = :product_id", $product);
                     $this->query("DELETE FROM PREFIX_product_description WHERE product_id = :product_id", $product);
                     $this->query("DELETE FROM PREFIX_product_discount WHERE product_id = :product_id", $product);
                     $this->query("DELETE FROM PREFIX_product_image WHERE product_id = :product_id", $product);
                     $this->query("DELETE FROM PREFIX_product_option WHERE product_id = :product_id", $product);
                     $this->query("DELETE FROM PREFIX_product_option_description WHERE product_id = :product_id", $product);
                     $this->query("DELETE FROM PREFIX_product_related WHERE product_id = :product_id", $product);
                     $this->query("DELETE FROM PREFIX_product_special WHERE product_id = :product_id", $product);
                     $this->query("DELETE FROM PREFIX_product_to_category WHERE product_id = :product_id", $product);
                     $this->query("DELETE FROM PREFIX_product_to_download WHERE product_id = :product_id", $product);
                     $this->query("DELETE FROM PREFIX_product_to_store WHERE product_id = :product_id", $product);
                     $this->query("DELETE FROM PREFIX_review WHERE product_id = :product_id", $product);
                     $this->query("DELETE FROM PREFIX_url_alias WHERE query = :query", array('query' => 'product_id=' . $product['product_id']));
                 }
             }
         }
     }
     // Fetch all customers from that store
     /*
     foreach ($this->fetchAll("SELECT customer_id FROM PREFIX_customer WHERE store_id = :id", array('id' => $store_id)) as $customer) {
         $this->query("DELETE FROM PREFIX_customer_history WHERE customer_id = :id", array('id' => $customer['customer_id']));
         $this->query("DELETE FROM PREFIX_customer_ip WHERE customer_id = :id", array('id' => $customer['customer_id']));
         $this->query("DELETE FROM PREFIX_customer_login_history WHERE customer_id = :id", array('id' => $customer['customer_id']));
         $this->query("DELETE FROM PREFIX_customer_online WHERE customer_id = :id", array('id' => $customer['customer_id']));
         $this->query("DELETE FROM PREFIX_reward WHERE customer_id = :id", array('id' => $customer['customer_id']));
         $this->query("DELETE FROM PREFIX_customer_transaction WHERE customer_id = :id", array('id' => $customer['customer_id']));
         $this->query("DELETE FROM PREFIX_address WHERE customer_id = :id", array('id' => $customer['customer_id']));
         $this->query("DELETE FROM PREFIX_review WHERE customer_id = :id", array('id' => $customer['customer_id']));
     }
     */
     // Instead of removing customer data, update customers to main store
     $this->query("UPDATE PREFIX_customer SET store_id = 0 WHERE store_id = :id", array('id' => $store_id));
     // Fetch information pages that are added for this store
     foreach ($this->fetchAll("SELECT information_id FROM PREFIX_information_to_store WHERE store_id = :id", array('id' => $store_id)) as $information) {
         $this->query("DELETE FROM PREFIX_information_to_store WHERE store_id = :id", array('id' => $store_id));
         $check = $this->query("SELECT COUNT(*) AS total FROM PREFIX_information_to_store WHERE information_id = :id", array('id' => $information['information_id']));
         if (!count($check)) {
             $this->query("DELETE FROM PREFIX_information_description WHERE information_id = :id", array('id' => $information['information_id']));
             $this->query("DELETE FROM PREFIX_information WHERE information_id = :id", array('id' => $information['id']));
         }
     }
     // Remove all aliases
     $this->query("DELETE FROM PREFIX_url_alias WHERE store_id = :id", array('id' => $store_id));
     // Remove all settings
     $this->query("DELETE FROM PREFIX_settings_stores WHERE store_id = :id", array('id' => $store_id));
     // And finally...
     $this->query("DELETE FROM PREFIX_stores WHERE store_id = :id", array('id' => $store_id));
     Cache::removeAll();
 }
コード例 #16
0
ファイル: store.php プロジェクト: wardvanderput/SumoStore
 public function update()
 {
     $this->document->setTitle(Language::getVar('SUMO_ADMIN_SHOP_SETTINGS_UPDATE'));
     $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_SETTINGS_DASHBOARD'), 'href' => $this->url->link('settings/dashboard', '', 'SSL')));
     $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_SHOP_SETTINGS'), 'href' => $this->url->link('settings/store', '', 'SSL')));
     $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_SHOP_SETTINGS_UPDATE')));
     $this->document->addScript('view/js/pages/settings_form.js');
     $this->document->addStyle('view/css/pages/settings.css');
     $this->setParent('settings/store/index');
     $store_id = isset($this->request->get['store_id']) ? $this->request->get['store_id'] : 0;
     if (!is_numeric($store_id)) {
         $this->redirect($this->url->link('settings/store', 'token=' . $this->session->data['token'], 'SSL'));
     }
     $this->data['current_store'] = $store_id;
     if ($this->request->server['REQUEST_METHOD'] == 'POST') {
         unset($this->request->post['group']);
         $this->model_settings_stores->setSettings($store_id, $this->request->post);
         Cache::removeAll();
     }
     $this->renderAndValidateForm($store_id, true);
     $this->data['action'] = $this->url->link('settings/store/update', 'token=' . $this->session->data['token'] . '&store_id=' . $store_id, 'SSL');
     $this->template = 'settings/store/general.tpl';
     $this->children = array('common/header', 'common/footer');
     $this->response->setOutput($this->render());
 }