コード例 #1
0
ファイル: user.php プロジェクト: wardvanderput/SumoStore
 protected function getList()
 {
     $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_SETTINGS_DASHBOARD'), 'href' => $this->url->link('settings/dashboard')));
     $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_USERS_OVERVIEW')));
     // Initiate pagination
     if (isset($this->request->get['page'])) {
         $page = $this->request->get['page'];
     } else {
         $page = 1;
     }
     $data = array('start' => ($page - 1) * 25, 'limit' => 25);
     $user_total = $this->model_user_user->getTotalUsers();
     foreach ($this->model_user_user->getUsers($data) as $result) {
         $this->data['users'][] = array_merge($result, array('status' => $result['status'] ? Language::getVar('SUMO_NOUN_ENABLED') : Language::getVar('SUMO_NOUN_DISABLED'), 'date_added' => Formatter::date($result['date_added']), 'date_last_seen' => $result['date_last_seen'] != '0000-00-00 00:00:00' ? Formatter::date($result['date_last_seen']) : '—', 'edit' => $this->url->link('user/user/update', 'token=' . $this->session->data['token'] . '&user_id=' . $result['user_id'], 'SSL')));
     }
     $pagination = new Pagination();
     $pagination->total = $user_total;
     $pagination->page = $page;
     $pagination->limit = 25;
     $pagination->text = '';
     $pagination->url = $this->url->link('sale/return', 'token=' . $this->session->data['token'] . '&page={page}', 'SSL');
     $this->data = array_merge($this->data, array('pagination' => $pagination->renderAdmin(), 'insert' => $this->url->link('user/user/insert', 'token=' . $this->session->data['token'], 'SSL'), 'delete' => $this->url->link('user/user/delete', 'token=' . $this->session->data['token'], 'SSL'), 'u_users' => $this->url->link('user/user', 'token=' . $this->session->data['token'], 'SSL'), 'u_permissions' => $this->url->link('user/user_permission', 'token=' . $this->session->data['token'], 'SSL')));
     $this->template = 'user/user_list.tpl';
     $this->children = array('common/header', 'common/footer');
     $this->response->setOutput($this->render());
 }
コード例 #2
0
ファイル: download.php プロジェクト: wardvanderput/SumoStore
 public function index()
 {
     if (!$this->customer->isLogged()) {
         $this->session->data['redirect'] = $this->url->link('account/download', '', 'SSL');
         $this->redirect($this->url->link('account/login', '', 'SSL'));
     }
     $this->document->setTitle(Language::getVar('SUMO_DOWNLOAD_TITLE'));
     $this->data['breadcrumbs'] = array();
     $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_NOUN_HOME'), 'href' => $this->url->link('common/home'), 'separator' => false);
     $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_ACCOUNT_TITLE'), 'href' => $this->url->link('account/account', '', 'SSL'));
     $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_DOWNLOAD_TITLE'), 'href' => $this->url->link('account/download', '', 'SSL'));
     $this->load->model('account/download');
     $totalDownloads = $this->model_account_download->getTotalDownloads();
     if ($totalDownloads) {
         if (isset($this->request->get['page'])) {
             $page = $this->request->get['page'];
         } else {
             $page = 1;
         }
         $this->data['downloads'] = array();
         $results = $this->model_account_download->getDownloads(($page - 1) * $this->config->get('catalog_limit'), $this->config->get('catalog_limit'));
         foreach ($results as $result) {
             if (file_exists(DIR_DOWNLOAD . $result['filename'])) {
                 $size = filesize(DIR_DOWNLOAD . $result['filename']);
                 $i = 0;
                 $suffix = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
                 while ($size / 1024 > 1) {
                     $size = $size / 1024;
                     $i++;
                 }
                 $this->data['downloads'][] = array('order_id' => str_pad($result['order_id'], 6, 0, STR_PAD_LEFT), 'date' => Formatter::date($result['order_date']), 'name' => $result['name'], 'remaining' => $result['remaining'], 'size' => round(substr($size, 0, strpos($size, '.') + 4), 2) . $suffix[$i], 'download' => $this->url->link('account/download/download', 'order_download_id=' . $result['order_download_id'], 'SSL'));
             }
         }
         $pagination = new Pagination();
         $pagination->total = $totalDownloads;
         $pagination->page = $page;
         $pagination->limit = $this->config->get('config_catalog_limit');
         $pagination->url = $this->url->link('account/download', 'page={page}', 'SSL');
         $this->data['pagination'] = $pagination->render();
         $this->data['continue'] = $this->url->link('account/account', '', 'SSL');
     } else {
         $this->data['downloads'] = $this->data['pagination'] = false;
     }
     $this->data['settings'] = $this->config->get('details_account_' . $this->config->get('template'));
     if (!is_array($this->data['settings']) || !count($this->data['settings'])) {
         $this->data['settings']['left'][] = $this->getChild('app/widgetsimplesidebar/', array('type' => 'accountTree', 'data' => array()));
     }
     $this->template = 'account/download.tpl';
     $this->children = array('common/footer', 'common/header');
     $this->response->setOutput($this->render());
 }
コード例 #3
0
 public function index()
 {
     if (!$this->customer->isLogged()) {
         $this->session->data['redirect'] = $this->url->link('account/transaction', '', 'SSL');
         $this->redirect($this->url->link('account/login', '', 'SSL'));
     }
     $this->document->setTitle(Language::getVar('SUMO_ACCOUNT_TRANSACTION_TITLE'));
     $this->data['breadcrumbs'] = array();
     $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_NOUN_HOME'), 'href' => $this->url->link('common/home'), 'separator' => false);
     $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_ACCOUNT_TITLE'), 'href' => $this->url->link('account/account', '', 'SSL'));
     $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_ACCOUNT_TRANSACTION_TITLE'), 'href' => $this->url->link('account/transaction', '', 'SSL'));
     $this->load->model('account/transaction');
     //$this->data['column_amount'] = sprintf(Language::getVar('SUMO_ACCOUNT_TRANSACTION_AMOUNT'), $this->config->get('config_currency'));
     if (isset($this->request->get['page'])) {
         $page = $this->request->get['page'];
     } else {
         $page = 1;
     }
     $this->data['transactions'] = array();
     $data = array('sort' => 'date_added', 'order' => 'DESC', 'start' => ($page - 1) * 10, 'limit' => 10);
     $transaction_total = $this->model_account_transaction->getTotalTransactions($data);
     foreach ($this->model_account_transaction->getTransactions($data) as $result) {
         $this->data['transactions'][] = array('transaction_id' => str_pad($result['customer_transaction_id'], 9, 0, STR_PAD_LEFT), 'amount' => Formatter::currency($result['amount']), 'description' => $result['description'], 'date_added' => Formatter::date($result['date_added']));
     }
     $pagination = new Pagination();
     $pagination->total = $transaction_total;
     $pagination->page = $page;
     $pagination->limit = 10;
     $pagination->url = $this->url->link('account/transaction', 'page={page}', 'SSL');
     $this->data['pagination'] = $pagination->render();
     $this->data['total'] = $this->currency->format($this->customer->getBalance());
     $this->data['settings'] = $this->config->get('details_account_' . $this->config->get('template'));
     if (!is_array($this->data['settings']) || !count($this->data['settings'])) {
         $this->data['settings']['left'][] = $this->getChild('app/widgetsimplesidebar/', array('type' => 'accountTree', 'data' => array()));
     }
     $this->template = 'account/transaction.tpl';
     $this->children = array('common/footer', 'common/header');
     $this->response->setOutput($this->render());
 }
コード例 #4
0
ファイル: reward.php プロジェクト: wardvanderput/SumoStore
 public function index()
 {
     if (!$this->customer->isLogged()) {
         $this->session->data['redirect'] = $this->url->link('account/reward', '', 'SSL');
         $this->redirect($this->url->link('account/login', '', 'SSL'));
     }
     $this->document->setTitle(Language::getVar('SUMO_ACCOUNT_REWARD_TITLE'));
     $this->data['breadcrumbs'] = array();
     $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_NOUN_HOME'), 'href' => $this->url->link('common/home'), 'separator' => false);
     $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_ACCOUNT_TITLE'), 'href' => $this->url->link('account/account', '', 'SSL'));
     $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_ACCOUNT_REWARD_TITLE'), 'href' => $this->url->link('account/reward', '', 'SSL'));
     $this->load->model('account/reward');
     if (isset($this->request->get['page'])) {
         $page = $this->request->get['page'];
     } else {
         $page = 1;
     }
     $this->data['rewards'] = array();
     $data = array('sort' => 'date_added', 'order' => 'DESC', 'start' => ($page - 1) * 10, 'limit' => 10);
     $reward_total = $this->model_account_reward->getTotalRewards($data);
     foreach ($this->model_account_reward->getRewards($data) as $result) {
         $this->data['rewards'][] = array('order_id' => $result['order_id'], 'points' => $result['points'], 'description' => $result['description'], 'date_added' => Formatter::date($result['date_added']), 'order' => $this->url->link('account/order/info', 'order_id=' . $result['order_id'], 'SSL'));
     }
     $pagination = new Pagination();
     $pagination->total = $reward_total;
     $pagination->page = $page;
     $pagination->limit = 10;
     $pagination->url = $this->url->link('account/reward', 'page={page}', 'SSL');
     $this->data['pagination'] = $pagination->render();
     $this->data['total'] = (int) $this->customer->getRewardPoints();
     $this->data['settings'] = $this->config->get('details_account_' . $this->config->get('template'));
     if (!is_array($this->data['settings']) || !count($this->data['settings'])) {
         $this->data['settings']['left'][] = $this->getChild('app/widgetsimplesidebar/', array('type' => 'accountTree', 'data' => array()));
     }
     $this->template = 'account/reward.tpl';
     $this->children = array('common/footer', 'common/header');
     $this->response->setOutput($this->render());
 }
コード例 #5
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;
    }
コード例 #6
0
 /**
  * @covers Formatter::date
  */
 public function testDateDefault()
 {
     $actual = $this->formatter->date(null, "2015-05-01");
     $excepted = "2015-05-01";
     $this->assertEquals($excepted, $actual);
 }
コード例 #7
0
ファイル: coupon.php プロジェクト: wardvanderput/SumoStore
 public function history()
 {
     $this->load->model('sale/coupon');
     $this->data['histories'] = array();
     $results = $this->model_sale_coupon->getCouponHistories($this->request->get['coupon_id'], 0, 10);
     foreach ($results as $result) {
         $this->data['histories'][] = array_merge($result, array('date_added' => Formatter::date($result['date_added'])));
     }
 }
コード例 #8
0
ファイル: generate.php プロジェクト: wardvanderput/SumoStore
 private function getDataCoupons($filters)
 {
     $cache = 'report.coupons.' . json_encode($filters);
     $data = Cache::find($cache);
     if (is_array($data) && count($data)) {
         return $data;
     }
     $sql = "SELECT ch.coupon_id, ch.amount, ch.date_added, c.name, c.code, c.type, c.discount FROM PREFIX_coupon_history AS ch LEFT JOIN PREFIX_coupon AS c ON c.coupon_id = ch.coupon_id WHERE 1 = 1";
     if (!empty($filters['date_start'])) {
         $sql .= " AND DATE(ch.date_added) >= '" . Formatter::dateReverse($filters['date_start']) . "'";
     }
     if (!empty($filters['date_end'])) {
         $sql .= " AND DATE(ch.date_added) <= '" . Formatter::dateReverse($filters['date_end']) . "'";
     }
     if (isset($filters['start']) && !empty($filters['limit'])) {
         $sql .= " LIMIT " . (int) $filters['start'] . "," . (int) $filter['limit'];
     } else {
         return $sql;
     }
     if (empty($filters['group'])) {
         $filters['group'] = 'week';
     }
     $coupons = $this->fetchAll($sql);
     $return = array();
     foreach ($coupons as $list) {
         $put = '';
         $return_time = strtotime($list['date_added']);
         switch ($filters['group']) {
             case 'day':
                 $put .= date('Y-m-d', $return_time);
                 $start_time = $end_time = $return_time;
                 break;
             case 'month':
                 $put .= date('Y-m', $return_time);
                 $start_time = strtotime('first day of this month', $return_time);
                 $end_time = strtotime('last day of this month', $return_time);
                 break;
             case 'year':
                 $put .= date('Y', $return_time);
                 $start_time = strtotime(date('Y-01-01', $return_time));
                 $end_time = strtotime(date('Y-12-31', $return_time));
                 break;
             default:
                 $put .= date('Y', $return_time);
                 $put .= 'W';
                 $put .= str_pad(date('W', $return_time), 2, '0', STR_PAD_LEFT);
                 $tmp = strtotime($put);
                 $start_time = strtotime('monday this week', $tmp);
                 $end_time = strtotime('sunday this week', $tmp);
                 break;
         }
         if (!isset($return[$put])) {
             $return[$put] = array(1 => Formatter::date($start_time), 2 => Formatter::date($end_time), 3 => $list['name'], 4 => $list['code'], 5 => 0, 6 => 0, 7 => 0);
         }
         $return[$put][5] += 1;
         $return[$put][6] += $list['amount'];
         if (strtolower($list['type']) == 'p') {
             $return[$put][7] += $list['amount'] / 100 * $list['discount'];
         } else {
             $return[$put][7] += $list['discount'];
         }
     }
     foreach ($return as $key => $list) {
         $return[$key][6] = Formatter::currency($return[$key][6]) . '<br /><span class="alert-danger">- ' . Formatter::currency($return[$key][7]) . '</span>';
         unset($return[$key][7]);
     }
     return $return;
 }
コード例 #9
0
ファイル: special.php プロジェクト: wardvanderput/SumoStore
 protected function getForm()
 {
     if (isset($this->request->get['product_special_id'])) {
         $productSpecialData = $this->model_catalog_special->getSpecial($this->request->get['product_special_id']);
         $formAction = $this->url->link('catalog/special/update', 'token=' . $this->session->data['token'] . '&product_special_id=' . $this->request->get['product_special_id'], 'SSL');
     } else {
         $formAction = $this->url->link('catalog/special/insert', 'token=' . $this->session->data['token'], 'SSL');
     }
     $fields = array('product' => '', 'product_id' => 0, 'discount' => '', 'discount_suffix' => '', 'date_start' => Formatter::date(time()), 'date_end' => Formatter::date(strtotime('+1 month')));
     // Find value for field in A: Post-array or B: Existing specialdata array
     foreach ($fields as $key => $defaultVal) {
         if (isset($this->request->post[$key])) {
             $fields[$key] = $this->request->post[$key];
         } elseif (isset($productSpecialData[$key])) {
             if ($key == 'date_start' || $key == 'date_end') {
                 $fields[$key] = Formatter::date($productSpecialData[$key]);
             } else {
                 $fields[$key] = $productSpecialData[$key];
             }
         }
     }
     $this->data = array_merge($this->data, $fields, array('cancel' => $this->url->link('catalog/special', 'token=' . $this->session->data['token'], 'SSL'), 'action' => $formAction, 'token' => $this->request->get['token']));
     $this->document->addScript('view/js/jquery/jquery.autocomplete.js');
     $this->document->addScript('view/js/pages/special.js');
 }
コード例 #10
0
ファイル: home.php プロジェクト: wardvanderput/SumoStore
 public function index()
 {
     $this->document->setTitle(Language::getVar('SUMO_ADMIN_NOUN_DASHBOARD'));
     $this->document->addStyle('view/css/pages/dashboard.css');
     $this->document->addScript('view/js/pages/dashboard.js');
     $this->document->addScript('view/js/jquery/jquery.flot.js');
     $this->document->addScript('view/js/jquery/jquery.flot.pie.js');
     $this->document->addScript('view/js/jquery/jquery.flot.resize.js');
     $this->data['token'] = $this->session->data['token'];
     $this->load->model('sale/orders');
     $this->data['total_sale'] = Formatter::currency($this->model_sale_orders->getTotalSales());
     $this->data['total_sale_year'] = Formatter::currency($this->model_sale_orders->getTotalSalesByYear(date('Y')));
     $this->data['total_order'] = $this->model_sale_orders->getOrdersTotal();
     $this->load->model('sale/customer');
     $this->data['total_customer'] = $this->model_sale_customer->getTotalCustomers();
     $this->data['total_customer_approval'] = $this->model_sale_customer->getTotalCustomersAwaitingApproval();
     $this->load->model('catalog/review');
     $this->data['total_review'] = $this->model_catalog_review->getTotalReviews();
     $this->data['total_review_approval'] = $this->model_catalog_review->getTotalReviewsAwaitingApproval();
     $this->data['orders'] = array();
     $data = array('sort' => 'o.date_added', 'order' => 'DESC', 'start' => 0, 'limit' => 10);
     $results = $this->model_sale_orders->getOrders($data);
     foreach ($results as $result) {
         if (!empty($result['middlename'])) {
             $name = $result['customer']['firstname'] . ' ' . $result['customer']['middlename'] . ' ' . $result['customer']['lastname'];
         } else {
             $name = $result['customer']['firstname'] . ' ' . $result['customer']['lastname'];
         }
         $this->data['orders'][] = array('order_id' => $result['order_id'], 'customer' => $name, 'status' => $result['status'], 'date_added' => Formatter::date($result['order_date']), 'total' => Formatter::currency($result['total']), 'info' => $this->url->link('sale/orders/info', 'token=' . $this->session->data['token'] . '&order_id=' . $result['order_id'], 'SSL'));
     }
     // Get last ten customers
     $data = array('sort' => 'date_added', 'order' => 'DESC', 'start' => 0, 'limit' => 10);
     $results = $this->model_sale_customer->getCustomers($data);
     foreach ($results as $result) {
         if (!empty($result['middlename'])) {
             $name = $result['firstname'] . ' ' . $result['middlename'] . ' ' . $result['lastname'];
         } else {
             $name = $result['firstname'] . ' ' . $result['lastname'];
         }
         // Get address
         if ($result['address_id'] > 0) {
             $addressInfo = $this->model_sale_customer->getAddress($result['address_id']);
             $result['city'] = $addressInfo['city'];
         } else {
             $result['city'] = '&mdash;';
         }
         $this->data['visitors'][] = array('customer_id' => $result['customer_id'], 'customer' => $name, 'city' => $result['city'], 'info' => $this->url->link('sale/customer/edit', 'token=' . $this->session->data['token'] . '&customer_id=' . $result['customer_id'], 'SSL'));
     }
     // Get countries for customers
     /*
     $this->load->model('sale/customer');
     $countries = $this->model_sale_customer->getCustomersPerCountry();
     $colors = array("#93e529", "#ffffff", "#f97f32", "#40a5c3");
     
     foreach ($countries as $i => $country) {
         $this->data['countries'][] = array(
             'label'     => $country['country_name'],
             'data'      => $country['customers'],
             'color'     => $colors[$i]
         );
     }
     */
     $this->load->model('user/user');
     $this->data = array_merge($this->data, array('todo' => $this->model_user_user->getTodos(), 'uri_orders' => $this->url->link('sale/orders', 'token=' . $this->session->data['token']), 'uri_customers' => $this->url->link('sale/customers', 'token=' . $this->session->data['token'])));
     /*
     $this->data['visitors'] = array();
     $this->load->model('report/online');
     
     $results = Database::fetchAll("SELECT customer_id FROM PREFIX_customer ORDER BY date_added DESC LIMIT 0,5");
     foreach ($results as $list) {
         if ($list['customer_id'] >= 1) {
             $tmp = Database::query("SELECT city, firstname, lastname FROM PREFIX_address WHERE customer_id = :id LIMIT 1", array('id' => $list['customer_id']))->fetch();
             $list['city'] = $tmp['city'];
             $list['customer'] = $tmp['firstname'] . ' ' . $tmp['lastname'];
         }
         else {
             $list['city'] = '';
             $list['customer'] = Language::getVar('SUMO_NOUN_GUEST');
         }
         $this->data['visitors'][] = $list;
     }
     
     if ($this->config->get('currency_auto')) {
         $this->load->model('localisation/currency');
     
         $this->model_localisation_currency->updateCurrencies();
     }
     */
     $this->assembleCharts();
     $this->template = 'common/home.tpl';
     $this->children = array('common/header', 'common/footer');
     $this->response->setOutput($this->render());
 }
コード例 #11
0
	<th style="width:2em">#</th>
	<th style="width:8em">Fecha</th>
	<th style="width:30em">Aceptado por</th>
	<th style="width:8em">Monto <?php 
    echo SB_CURRENCY;
    ?>
</th>
</tr>
</thead>
<tbody>
<?php 
    $totalPaid = 0;
    foreach ($payments as $payment) {
        echo "<tr>";
        echo "<td class='number'>{$payment->line}</td>";
        echo "<td class='date'>" . Formatter::date($payment->date) . "</td>";
        echo "<td>{$payment->createdBy}</td>";
        echo "<td class='number'>" . Formatter::number($payment->amount) . "</td>";
        echo "</tr>";
        $totalPaid += $payment->amount;
    }
    $outstanding = $total - $totalPaid;
    ?>
</tbody>
<tfoot>
<tr>
	<td colspan="3" style="text-align:right">Total: </td>
	<td class="number total"><?php 
    echo Formatter::number($totalPaid);
    ?>
</td>
コード例 #12
0
ファイル: product.php プロジェクト: wardvanderput/SumoStore
 public function copyProduct($product_id)
 {
     $query = $this->query("SELECT DISTINCT *\n            FROM PREFIX_product p\n            LEFT JOIN PREFIX_product_description pd\n                ON (p.product_id = pd.product_id)\n            WHERE p.product_id = :pid\n                AND pd.language_id = :lang", array('pid' => $product_id, 'lang' => $this->config->get('language_id')))->fetch();
     if (count($query)) {
         $data = array();
         $data = $query;
         /*$data['sku'] = '';
           $data['upc'] = '';*/
         $data['viewed'] = '0';
         $data['keyword'] = '';
         $data['status'] = '0';
         $data['date_available'] = Formatter::date($data['date_available']);
         $productImages = array();
         // Don't forget about the default image...
         $productImages[0] = $data['image'];
         foreach ($this->getProductImages($product_id) as $productImage) {
             $productImages[] = $productImage['image'];
         }
         $data = array_merge($data, array('product_price' => $data['price'], 'product_points' => $data['points'], 'product_weight' => $data['weight']));
         $data = array_merge($data, array('attribute' => $this->getProductAttributes($product_id)));
         $data = array_merge($data, array('product_description' => $this->getProductDescriptions($product_id)));
         $data = array_merge($data, array('product_discount' => $this->getProductDiscounts($product_id)));
         $data = array_merge($data, array('product_image' => $productImages));
         $data = array_merge($data, array('product_option' => $this->getProductOptions($product_id)));
         $data = array_merge($data, array('product_related' => $this->getProductRelated($product_id)));
         $data = array_merge($data, array('product_special' => $this->getProductSpecials($product_id)));
         $data = array_merge($data, array('product_category' => $this->getProductCategories($product_id)));
         $data = array_merge($data, array('product_download' => $this->getProductDownloads($product_id)));
         $data = array_merge($data, array('product_store' => $this->getProductStores($product_id)));
         $new_id = $this->addProduct();
         $data['model'] = 'P' . $new_id;
         $this->editProduct($new_id, $data);
         $this->query("\n                UPDATE PREFIX_product\n                SET image = '" . $data['image'] . "',\n                    status = " . $data['status'] . "\n                WHERE product_id = " . $new_id);
     }
     Cache::removeAll();
 }
コード例 #13
0
ファイル: return.php プロジェクト: wardvanderput/SumoStore
 public function history()
 {
     $this->load->model('sale/return');
     if ($this->request->server['REQUEST_METHOD'] == 'POST') {
         $this->model_sale_return->addReturnHistory($this->request->get['return_id'], $this->request->post);
     }
     $this->data['histories'] = array();
     $results = $this->model_sale_return->getReturnHistories($this->request->get['return_id'], 0, 10);
     foreach ($results as $result) {
         $this->data['histories'][] = array('notify' => $result['notify'] ? Language::getVar('SUMO_NOUN_YES') : Language::getVar('SUMO_NOUN_NO'), 'status' => $result['status'], 'comment' => nl2br($result['comment']), 'date_added' => Formatter::date($result['date_added']));
     }
 }
コード例 #14
0
ファイル: customer.php プロジェクト: wardvanderput/SumoStore
 public function reward()
 {
     $this->load->model('sale/customer');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->user->hasPermission('modify', 'sale/customer')) {
         $this->model_sale_customer->addReward($this->request->get['customer_id'], $this->request->post['description'], $this->request->post['points']);
         $return = array('success' => Language::getVar('SUMO_SUCCESS_REWARD_ADDED'));
         $this->response->setOutput(json_encode($return));
     }
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && !$this->user->hasPermission('modify', 'sale/customer')) {
         $return = array('error' => Language::getVar('SUMO_ERROR_NO_PERMISSION'));
         $this->response->setOutput(json_encode($return));
     }
     $this->data['rewards'] = array();
     $results = $this->model_sale_customer->getRewards($this->request->get['customer_id']);
     foreach ($results as $result) {
         $this->data['rewards'][] = array_merge($result, array('date_added' => Formatter::date($result['date_added'])));
     }
     $this->data['points_balance'] = $this->model_sale_customer->getRewardTotal($this->request->get['customer_id']);
 }
コード例 #15
0
ファイル: invoice.php プロジェクト: wardvanderput/SumoStore
 private function getList()
 {
     $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_SALES_DASHBOARD'), 'href' => $this->url->link('sale/dashboard')));
     $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_SALES_INVOICES')));
     // Find invoices
     $allowedFilters = array('concept', 'sent', 'partially_paid', 'paid', 'credit', 'expired');
     if (isset($this->request->get['filter']) && in_array($this->request->get['filter'], $allowedFilters)) {
         $status = mb_strtoupper($this->request->get['filter']);
     } else {
         $status = array('CONCEPT', 'SENT', 'PARTIALLY_PAID', 'PAID', 'CREDIT');
     }
     $limit = 20;
     $page_total_ex = $page_total_in = 0;
     $page = isset($this->request->get['page']) ? $this->request->get['page'] : 1;
     $filter = array('status' => $status, 'limit' => $limit, 'start' => ($page - 1) * $limit);
     foreach ($this->model_sale_invoice->getInvoices($filter) as $invoice) {
         // Customer is corporate or private?
         if (!empty($invoice['customer_company_name'])) {
             $customer = $invoice['customer_company_name'];
         } else {
             $customer = $invoice['customer_name'];
         }
         // Sent to the view
         $this->data['invoices'][] = array('invoice_id' => $invoice['invoice_id'], 'invoice_no' => $invoice['invoice_no'], 'customer' => $customer, 'date' => Formatter::date($invoice['invoice_date']), 'amount' => Formatter::currency($invoice['total_amount']), 'status' => $invoice['status'], 'send' => $this->url->link('sale/invoice/send', 'token=' . $this->session->data['token'] . '&invoice_id=' . $invoice['invoice_id'], 'SSL'), 'view' => $this->url->link('sale/invoice/view', 'token=' . $this->session->data['token'] . '&invoice_id=' . $invoice['invoice_id'], 'SSL'), 'download' => $this->url->link('sale/invoice/download', 'token=' . $this->session->data['token'] . '&invoice_id=' . $invoice['invoice_id'], 'SSL'), 'update' => $this->url->link('sale/invoice/update', 'token=' . $this->session->data['token'] . '&invoice_id=' . $invoice['invoice_id'], 'SSL'));
         $page_total_ex += $invoice['amount'] - $invoice['tax'];
         $page_total_in += $invoice['amount'];
     }
     // In need of pagination?
     $invoiceTotal = $this->model_sale_invoice->getTotalInvoices($filter);
     if ($invoiceTotal > $limit) {
         $pagination = new Pagination();
         $pagination->total = $product_total;
         $pagination->limit = $limit;
         $pagination->page = $page;
         $pagination->url = $this->url->link('sale/invoice', 'token=' . $this->session->data['token'] . '&page={page}' . (!is_array($status) ? '&status=' . $status : ''));
         $this->data['pagination'] = $pagination->renderAdmin();
     } else {
         $this->data['pagination'] = false;
     }
     $this->data = array_merge($this->data, array('page_total_ex' => Formatter::currency($page_total_ex), 'page_total_in' => Formatter::currency($page_total_in), 'status' => !is_array($status) ? Language::getVar('SUMO_NOUN_' . mb_strtoupper($status)) : Language::getVar('SUMO_NOUN_DEFAULT'), 'delete' => $this->url->link('sale/invoice/delete', 'token=' . $this->session->data['token'], 'SSL'), 'insert' => $this->url->link('sale/invoice/insert', 'token=' . $this->session->data['token'], 'SSL'), 'filter' => $this->url->link('sale/invoice', 'token=' . $this->session->data['token'] . '&filter=', 'SSL'), 'overview' => $this->url->link('sale/invoice', 'token=' . $this->session->data['token'], 'SSL')));
     $this->template = 'sale/invoice_list.tpl';
     $this->children = array('common/header', 'common/footer');
     $this->response->setOutput($this->render());
 }
コード例 #16
0
echo SB_CURRENCY;
?>
</th>
		<th style="width:8em">Saldo <?php 
echo SB_CURRENCY;
?>
</th>
		<th colspan="2">&nbsp;</th>
	</tr>
</thead>
<tbody>
	<?php 
foreach ($selles as $sell) {
    echo "<tr>";
    echo "<td class='number'>{$sell->id}</td>";
    echo "<td class='date'>" . Formatter::date($sell->date) . "</td>";
    echo "<td>{$sell->provider}</td>";
    echo "<td>{$PURCHASE_STATUS[$sell->status]}</td>";
    echo "<td class='number'>" . Formatter::number($sell->amount) . "</td>";
    echo "<td class='number'>" . Formatter::number($sell->amount - Sell::getAmountPaid($sell->id)) . "</td>";
    echo "<td class='ui-state-default'><a href='index.php?pages=sell_detail&sell={$sell->id}' title='Ver'>" . ICON_ZOOMIN . "</a></td>";
    echo "<td class='ui-state-default'><a href='index.php?pages=sell_edit&sell={$sell->id}' title='Editar'>" . ICON_PENCIL . "</a></td>";
    echo "</tr>";
}
?>
</tbody>
</table>

<script type="text/javascript">
jQuery(document).ready(function(){
	jQuery('.default tbody tr:odd').addClass('alternate');
コード例 #17
0
ファイル: generate.php プロジェクト: wardvanderput/SumoStore
 private function generateData($type)
 {
     $this->data['table_head'] = $this->data['statuses'] = array();
     $this->data['disable_dates'] = false;
     $title = '';
     switch ($type) {
         case 'customer':
             $title = Language::getVar('SUMO_ADMIN_REPORT_CUSTOMER');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_ORDER_DATE');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_CUSTOMER_SINGULAR');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_ORDERS');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_PRODUCTS');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_TAX_AMOUNT');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_TOTAL');
             $this->load->model('localisation/order_status');
             foreach ($this->model_localisation_order_status->getOrderStatuses() as $list) {
                 $this->data['statuses'][] = array('status_id' => $list['order_status_id'], 'name' => $list['name']);
             }
             break;
         case 'sales':
             $title = Language::getVar('SUMO_ADMIN_REPORT_SALES');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_DATE_START');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_DATE_END');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_ORDERS');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_PRODUCTS');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_TAX_AMOUNT');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_TOTAL');
             $this->load->model('localisation/order_status');
             foreach ($this->model_localisation_order_status->getOrderStatuses() as $list) {
                 $this->data['statuses'][] = array('status_id' => $list['order_status_id'], 'name' => $list['name']);
             }
             break;
         case 'returns':
             $title = Language::getVar('SUMO_ADMIN_REPORT_RETURNS');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_DATE_START');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_DATE_END');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_RETURNS');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_STATUS');
             $this->load->model('localisation/return_status');
             foreach ($this->model_localisation_return_status->getReturnStatuses() as $list) {
                 $this->data['statuses'][] = array('status_id' => $list['return_status_id'], 'name' => $list['name']);
             }
             break;
         case 'coupons':
             $title = Language::getVar('SUMO_ADMIN_REPORT_COUPONS');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_DATE_START');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_DATE_END');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_NAME');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_COUPON_CODE');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_ORDERS');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_TOTAL');
             break;
         case 'products_viewed':
             $title = Language::getVar('SUMO_ADMIN_REPORT_PRODUCTS_VIEWED');
             $this->data['disable_dates'] = true;
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_NAME');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_MODEL');
             $this->data['table_head'][] = Language::getvar('SUMO_NOUN_VIEWS');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_PERCENTAGE');
             $this->data['statuses'][] = array('status_id' => 1, 'name' => Language::getVar('SUMO_NOUN_PRODUCT_ACTIVE'));
             $this->data['statuses'][] = array('status_id' => 2, 'name' => Language::getVar('SUMO_NOUN_PRODUCT_INACTIVE'));
             break;
         case 'products_sales':
             $title = Language::getVar('SUMO_ADMIN_REPORT_PRODUCTS_SALES');
             $this->data['disable_group'] = true;
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_NAME');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_MODEL');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_VIEWS');
             $this->data['table_head'][] = Language::getvar('SUMO_NOUN_ORDERS');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_TOTAL');
             $this->data['table_head'][] = Language::getVar('SUMO_NOUN_PERCENTAGE');
             break;
     }
     $this->document->setTitle($title);
     $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_REPORT_DASHBOARD'), 'href' => $this->url->link('report/dashboard')));
     $this->document->addBreadcrumbs(array('text' => $title));
     // Load required models
     $this->load->model('report/generate');
     // Setup filters and vars
     $this->data['groups'] = array(array('text' => Language::getVar('SUMO_NOUN_YEAR'), 'value' => 'year'), array('text' => Language::getVar('SUMO_NOUN_MONTH'), 'value' => 'month'), array('text' => Language::getVar('SUMO_NOUN_WEEK'), 'value' => 'week'), array('text' => Language::getVar('SUMO_NOUN_DAY'), 'value' => 'day'));
     $filter = array();
     $filter['date_start'] = Formatter::date(strtotime('first day of this month'));
     $filter['date_end'] = Formatter::date(strtotime('last day of this month'));
     $filter['group'] = 'week';
     $filter['status_id'] = 0;
     $filter['page'] = 0;
     $url = '';
     foreach ($filter as $key => $value) {
         if (!empty($this->request->get[$key]) && $key != 'page') {
             $filter[$key] = $this->request->get[$key];
             $url .= '&' . $key . '=' . $this->request->get[$key];
         }
     }
     foreach ($filter as $key => $value) {
         $this->data[$key] = $value;
     }
     $total = $this->model_report_generate->getTotal($type, $filter);
     $filter['page'] = !empty($this->request->get['page']) ? (int) $this->request->get['page'] : 1;
     $filter['start'] = ($filter['page'] - 1) * 25;
     $filter['limit'] = 25;
     // Generate pagination before applying the page to the url string
     $pagination = new Pagination();
     $pagination->total = $total;
     $pagination->page = $filter['page'];
     $pagination->limit = 25;
     $pagination->text = '';
     $pagination->url = $this->url->link('report/generate/' . str_replace('_', '', $type), 'token=' . $this->session->data['token'] . $url . '&page={page}', 'SSL');
     $this->data['pagination'] = $pagination->renderAdmin();
     $this->data['reset'] = $this->url->link('report/generate/' . str_replace('_', '', $type), 'token=' . $this->session->data['token'], 'SSL');
     $this->data['items'] = array();
     foreach ($this->model_report_generate->getData($type, $filter) as $time => $list) {
         $this->data['items'][$time] = $list;
     }
     $this->template = 'report/generate.tpl';
     $this->children = array('common/header', 'common/footer');
     $this->response->setOutput($this->render());
 }
コード例 #18
0
ファイル: product.php プロジェクト: wardvanderput/SumoStore
 protected function getForm()
 {
     $this->setParent('catalog/product/insert');
     $this->data['token'] = $this->session->data['token'];
     if (isset($this->error['warning'])) {
         $this->data['error_warning'] = $this->error['warning'];
     } else {
         $this->data['error_warning'] = '';
     }
     if (isset($this->error['name'])) {
         $this->data['error_name'] = $this->error['name'];
     } else {
         $this->data['error_name'] = array();
     }
     if (isset($this->error['meta_description'])) {
         $this->data['error_meta_description'] = $this->error['meta_description'];
     } else {
         $this->data['error_meta_description'] = array();
     }
     if (isset($this->error['description'])) {
         $this->data['error_description'] = $this->error['description'];
     } else {
         $this->data['error_description'] = array();
     }
     if (isset($this->error['model'])) {
         $this->data['error_model'] = $this->error['model'];
     } else {
         $this->data['error_model'] = '';
     }
     if (isset($this->error['date_available'])) {
         $this->data['error_date_available'] = $this->error['date_available'];
     } else {
         $this->data['error_date_available'] = '';
     }
     if (!isset($this->request->get['product_id'])) {
         $this->data['action'] = $this->url->link('catalog/product/insert', 'token=' . $this->session->data['token'], 'SSL');
         $this->data['id'] = 'XX';
     } else {
         $this->data['action'] = $this->url->link('catalog/product/update', 'token=' . $this->session->data['token'] . '&product_id=' . $this->request->get['product_id'], 'SSL');
         $this->data['id'] = $this->request->get['product_id'];
     }
     $this->data['cancel'] = $this->url->link('catalog/product', 'token=' . $this->session->data['token'] . '&' . $this->getFilterURL(), 'SSL');
     if (isset($this->request->get['product_id']) && $this->request->server['REQUEST_METHOD'] != 'POST') {
         $product_info = $this->model_catalog_product->getProduct($this->request->get['product_id']);
     }
     $this->data['token'] = $this->session->data['token'];
     $this->load->model('localisation/language');
     $this->data['languages'] = $this->model_localisation_language->getLanguages();
     if (isset($this->request->post['product_description'])) {
         $this->data['product_description'] = $this->request->post['product_description'];
     } elseif (isset($this->request->get['product_id'])) {
         $this->data['product_description'] = $this->model_catalog_product->getProductDescriptions($this->request->get['product_id']);
     } else {
         foreach ($this->data['languages'] as $language) {
             $this->data['product_description'][$language['language_id']] = array('title' => '', 'keyword' => '', 'meta_description' => '', 'meta_keyword' => '');
         }
     }
     if (isset($this->request->post['model'])) {
         $this->data['model'] = $this->request->post['model_2'];
     } elseif (!empty($product_info)) {
         $this->data['model'] = $product_info['model_2'];
     } else {
         $this->data['model'] = '';
     }
     $extra_info_types = array('sku', 'upc', 'ean', 'jan', 'isbn', 'mpn');
     $this->data['extra_info'] = array();
     foreach ($extra_info_types as $type) {
         if (isset($this->request->post[$type])) {
             $this->data['extra_info'][] = array('type' => $type, 'value' => $this->request->post[$type], 'visible' => $this->request->post[$type . '_visible']);
         } else {
             if (!empty($product_info[$type])) {
                 $this->data['extra_info'][] = array('type' => $type, 'value' => $product_info[$type], 'visible' => $product_info[$type . '_visible']);
             }
         }
     }
     if (isset($this->request->post['location'])) {
         $this->data['location'] = $this->request->post['location'];
     } elseif (!empty($product_info)) {
         $this->data['location'] = $product_info['location'];
     } else {
         $this->data['location'] = '';
     }
     $this->load->model('settings/stores');
     $stores = array();
     /*$stores[] = array(
           'url' => HTTP_CATALOG,
           'name' => $this->config->get('config_name'),
           'store_id' => 0
       );*/
     foreach ($this->model_settings_stores->getStores() as $list) {
         $stores[$list['store_id']] = $list;
     }
     $this->data['stores'] = $stores;
     if (isset($this->request->post['product_store'])) {
         $this->data['product_store'] = $this->request->post['product_store'];
     } elseif (isset($this->request->get['product_id'])) {
         $this->data['product_store'] = $this->model_catalog_product->getProductStores($this->request->get['product_id']);
     } else {
         $this->data['product_store'] = 0;
     }
     if (isset($this->request->post['image'])) {
         $this->data['image'] = $this->request->post['image'];
     } elseif (!empty($product_info)) {
         $this->data['image'] = $product_info['image'];
     } else {
         $this->data['image'] = '';
     }
     $this->load->model('tool/image');
     if (isset($this->request->post['image']) && file_exists(DIR_IMAGE . $this->request->post['image'])) {
         $this->data['thumb'] = $this->model_tool_image->resize($this->request->post['image'], 150, 150);
     } elseif (!empty($product_info) && $product_info['image'] && file_exists(DIR_IMAGE . $product_info['image'])) {
         $this->data['thumb'] = $this->model_tool_image->resize($product_info['image'], 150, 150);
     } else {
         $this->data['thumb'] = $this->model_tool_image->resize('no_image.jpg', 150, 150);
     }
     $this->data['thumb_extra'] = $this->model_tool_image->resize('no_image.jpg', 125, 125);
     if (isset($this->request->post['shipping'])) {
         $this->data['shipping'] = $this->request->post['shipping'];
     } elseif (!empty($product_info)) {
         $this->data['shipping'] = $product_info['shipping'];
     } else {
         $this->data['shipping'] = 1;
     }
     if (isset($this->request->post['model_supplier'])) {
         $this->data['model_supplier'] = $this->request->post['model_supplier'];
     } elseif (!empty($product_info)) {
         $this->data['model_supplier'] = $product_info['model_supplier'];
     } else {
         $this->data['model_supplier'] = '';
     }
     if (isset($this->request->post['product_price'])) {
         $this->data['price'] = $this->request->post['product_price'];
     } elseif (!empty($product_info)) {
         $this->data['price'] = $product_info['price'];
     } else {
         $this->data['price'] = '0.0000';
     }
     // Get tax rates
     $this->load->model('settings/general');
     $tax_percentages = $this->model_settings_general->getSetting('tax_percentage');
     if (is_array($tax_percentages)) {
         foreach ($tax_percentages as $tp) {
             if (is_array($tp)) {
                 // Extra tax percentages
                 foreach ($tp as $tpExtra) {
                     $this->data['tax_percentages'][] = $tpExtra;
                 }
             } else {
                 // Default tax percentage
                 $this->data['tax_percentages'][] = $tp;
                 $this->data['tax_percentage'] = $tp;
             }
         }
     } else {
         $this->data['tax_percentages'] = array();
     }
     if (isset($this->request->post['tax_percentage'])) {
         $this->data['tax_percentage'] = $this->request->post['tax_percentage'];
     } elseif (!empty($product_info)) {
         $this->data['tax_percentage'] = $product_info['tax_percentage'];
     } elseif (!isset($this->data['tax_percentage'])) {
         $this->data['tax_percentage'] = 0;
     }
     if (isset($this->request->post['date_available'])) {
         $this->data['date_available'] = $this->request->post['date_available'];
     } elseif (!empty($product_info) && $product_info['date_available'] != '0000-00-00') {
         $this->data['date_available'] = Formatter::date($product_info['date_available']);
     } else {
         $this->data['date_available'] = Formatter::date(time() - 86400);
     }
     if (isset($this->request->post['product_quantity'])) {
         $this->data['quantity'] = $this->request->post['product_quantity'];
     } elseif (!empty($product_info)) {
         $this->data['quantity'] = $product_info['quantity'];
     } else {
         $this->data['quantity'] = 1;
     }
     $this->data['stock_linked_products'] = $this->model_catalog_product->getLinkedProducts();
     $this->data['stock_product_name'] = '';
     if (isset($this->request->post['stock_id'])) {
         $this->data['stock_id'] = $this->request->post['stock_id'];
         $this->data['stock_product'] = $this->request->post['stock_product'];
         $this->data['stock_product_name'] = $this->request->post['stock_product_name'];
     } elseif (!empty($product_info)) {
         $this->data['stock_id'] = $product_info['stock_id'];
         if ($product_info['stock_id'] != $this->data['id']) {
             $this->data['stock_product'] = true;
             $stock_product_data = $this->model_catalog_product->getProduct($product_info['stock_id']);
             $this->data['stock_product_name'] = $stock_product_data['name'];
         } else {
             $this->data['stock_product'] = false;
         }
     } else {
         $this->data['stock_id'] = 0;
         $this->data['stock_product'] = false;
     }
     $this->load->model('localisation/stock_status');
     $this->data['stock_statuses'] = $this->model_localisation_stock_status->getStockStatuses();
     if (isset($this->request->post['stock_status_id'])) {
         $this->data['stock_status_id'] = $this->request->post['stock_status_id'];
     } elseif (!empty($product_info)) {
         $this->data['stock_status_id'] = $product_info['stock_status_id'];
     } else {
         $this->data['stock_status_id'] = $this->config->get('stock_status_id');
     }
     if (isset($this->request->post['stock_visible'])) {
         $this->data['stock_visible'] = $this->request->post['stock_visible'];
     } elseif (!empty($product_info)) {
         $this->data['stock_visible'] = $product_info['stock_visible'];
     } else {
         $this->data['stock_visible'] = 2;
     }
     if (isset($this->request->post['minimum'])) {
         $this->data['minimum'] = $this->request->post['minimum'];
     } elseif (!empty($product_info)) {
         $this->data['minimum'] = $product_info['minimum'];
     } else {
         $this->data['minimum'] = 1;
     }
     if (isset($this->request->post['subtract'])) {
         $this->data['subtract'] = $this->request->post['subtract'];
     } elseif (!empty($product_info)) {
         $this->data['subtract'] = $product_info['subtract'];
     } else {
         $this->data['subtract'] = 1;
     }
     if (isset($this->request->post['sort_order'])) {
         $this->data['sort_order'] = $this->request->post['sort_order'];
     } elseif (!empty($product_info)) {
         $this->data['sort_order'] = $product_info['sort_order'];
     } else {
         $this->data['sort_order'] = 1;
     }
     if (isset($this->request->post['status'])) {
         $this->data['status'] = $this->request->post['status'];
     } elseif (!empty($product_info)) {
         $this->data['status'] = $product_info['status'];
     } else {
         $this->data['status'] = 1;
     }
     if (isset($this->request->post['product_weight'])) {
         $this->data['weight'] = $this->request->post['product_weight'];
     } elseif (!empty($product_info)) {
         $this->data['weight'] = $product_info['weight'];
     } else {
         $this->data['weight'] = '';
     }
     $this->load->model('localisation/weight_class');
     $this->data['weight_classes'] = $this->model_localisation_weight_class->getWeightClasses();
     if (isset($this->request->post['weight_class_id'])) {
         $this->data['weight_class_id'] = $this->request->post['weight_class_id'];
     } elseif (!empty($product_info)) {
         $this->data['weight_class_id'] = $product_info['weight_class_id'];
     } else {
         $this->data['weight_class_id'] = $this->config->get('config_weight_class_id');
     }
     if (isset($this->request->post['length'])) {
         $this->data['length'] = $this->request->post['length'];
     } elseif (!empty($product_info)) {
         $this->data['length'] = $product_info['length'];
     } else {
         $this->data['length'] = '';
     }
     if (isset($this->request->post['width'])) {
         $this->data['width'] = $this->request->post['width'];
     } elseif (!empty($product_info)) {
         $this->data['width'] = $product_info['width'];
     } else {
         $this->data['width'] = '';
     }
     if (isset($this->request->post['height'])) {
         $this->data['height'] = $this->request->post['height'];
     } elseif (!empty($product_info)) {
         $this->data['height'] = $product_info['height'];
     } else {
         $this->data['height'] = '';
     }
     if (isset($this->request->post['cost_price'])) {
         $this->data['cost_price'] = $this->request->post['cost_price'];
     } elseif (!empty($product_info)) {
         $this->data['cost_price'] = $product_info['cost_price'];
     } else {
         $this->data['cost_price'] = '0.0000';
     }
     $this->load->model('localisation/length_class');
     $this->data['length_classes'] = $this->model_localisation_length_class->getLengthClasses();
     if (isset($this->request->post['length_class_id'])) {
         $this->data['length_class_id'] = $this->request->post['length_class_id'];
     } elseif (!empty($product_info)) {
         $this->data['length_class_id'] = $product_info['length_class_id'];
     } else {
         $this->data['length_class_id'] = $this->config->get('config_length_class_id');
     }
     $this->load->model('catalog/manufacturer');
     $this->data['manufacturers'] = array();
     $this->data['manufacturers'][0] = array('manufacturer_id' => 0, 'name' => Language::getVar('SUMO_NOUN_NONE'));
     foreach ($this->model_catalog_manufacturer->getManufacturers() as $man) {
         $this->data['manufacturers'][] = $man;
     }
     if (isset($this->request->post['manufacturer_id'])) {
         $this->data['manufacturer_id'] = $this->request->post['manufacturer_id'];
     } elseif (!empty($product_info)) {
         $this->data['manufacturer_id'] = $product_info['manufacturer_id'];
     } else {
         $this->data['manufacturer_id'] = 0;
     }
     if (isset($this->request->post['manufacturer'])) {
         $this->data['manufacturer'] = $this->request->post['manufacturer'];
     } elseif (!empty($product_info)) {
         $manufacturer_info = $this->model_catalog_manufacturer->getManufacturer($product_info['manufacturer_id']);
         if ($manufacturer_info) {
             $this->data['manufacturer'] = $manufacturer_info['name'];
         } else {
             $this->data['manufacturer'] = '';
         }
     } else {
         $this->data['manufacturer'] = '';
     }
     // Categories
     $this->load->model('catalog/category');
     if (isset($this->request->post['product_category'])) {
         $category = $this->request->post['product_category'];
     } elseif (isset($this->request->get['product_id'])) {
         $category = $this->model_catalog_product->getProductCategories($this->request->get['product_id']);
     } else {
         $category = array();
     }
     $this->data['product_category'] = $category;
     $categories = $this->model_catalog_category->getCategories();
     $tmp_cats = array();
     foreach ($categories as $store => $storeCats) {
         foreach ($storeCats as $category_info) {
             if (!isset($category_info['name'])) {
                 foreach ($category_info as $cat) {
                     $tmp_cats2[$cat['category_id']] = $cat['name'];
                     $this->data['product_categories'][] = array('store_id' => $store, 'category_id' => $cat['category_id'], 'name' => $tmp_cats2[$cat['parent_id']] . ' &gt; ' . $cat['name'], 'store_name' => $stores[$store]['name'], 'selected' => in_array($cat['category_id'], $category) ? true : false);
                 }
                 continue;
             }
             $this->data['product_categories'][] = array('store_id' => $store, 'category_id' => $category_info['category_id'], 'name' => $category_info['name'], 'store_name' => $stores[$store]['name'], 'selected' => in_array($category_info['category_id'], $category) ? true : false);
             $tmp_cats[$category_info['category_id']] = $category_info['name'];
             $tmp_cats2[$category_info['category_id']] = $category_info['name'];
         }
     }
     // Attributes
     $this->load->model('catalog/attribute');
     $posted = false;
     if (isset($this->request->post['attribute'])) {
         $posted = true;
         $product_attributes = $this->request->post['attribute'];
     } elseif (isset($this->request->get['product_id'])) {
         $product_attributes = $this->model_catalog_product->getProductAttributes($this->request->get['product_id']);
     } else {
         $product_attributes = array();
     }
     $this->data['attribute_sets'] = array();
     foreach ($this->model_catalog_attribute->getAttributeGroups() as $group) {
         $attributes = $this->model_catalog_attribute->getAttributes(array('filter_attribute_group_id' => $group['attribute_group_id']));
         // Check certain attributes?
         foreach ($attributes as $key => $attribute) {
             if (in_array($attribute['attribute_id'], $product_attributes)) {
                 $attributes[$key]['checked'] = true;
             } else {
                 $attributes[$key]['checked'] = false;
             }
         }
         $this->data['attribute_sets'][] = array('name' => $group['name'], 'attributes' => $attributes);
     }
     // Options
     if (isset($this->request->post['product_option'])) {
         $product_options = $this->request->post['product_option'];
     } elseif (isset($this->request->get['product_id'])) {
         $product_options = $this->model_catalog_product->getProductOptions($this->request->get['product_id']);
     } else {
         $product_options = array();
     }
     // Set option prices
     foreach ($product_options as $i => $option) {
         if (isset($option['product_option_value'])) {
             foreach ($option['product_option_value'] as $j => $option_value) {
                 $product_options[$i]['product_option_value'][$j]['price'] = round(floatval($product_options[$i]['product_option_value'][$j]['price']) * (1 + $product_info['tax_percentage'] / 100), 4);
             }
         }
     }
     $this->data['product_options'] = $product_options;
     $this->load->model('sale/customer_group');
     $this->load->model('sale/volume');
     //$this->data['volumes'] = $this->model_sale_volume->getVolumes();
     $this->data['customer_groups'] = $this->model_sale_customer_group->getCustomerGroups();
     if (isset($this->request->post['product_discount'])) {
         $product_discounts = $this->request->post['product_discount'];
     } elseif (isset($this->request->get['product_id'])) {
         $product_discounts = $this->model_catalog_product->getProductDiscounts($this->request->get['product_id']);
     } else {
         $product_discounts = array();
     }
     foreach ($product_discounts as $i => $discount) {
         $product_discounts[$i]['price_in'] = Formatter::currency($discount['price'] + $discount['price'] / 100 * $this->data['tax_percentage']);
     }
     $this->data['product_discounts'] = $product_discounts;
     if (isset($this->request->post['product_special'])) {
         $product_specials = $this->request->post['product_special'];
     } elseif (isset($this->request->get['product_id'])) {
         $product_specials = $this->model_catalog_product->getProductSpecials($this->request->get['product_id']);
     } else {
         $product_specials = array();
     }
     foreach ($product_specials as $i => $special) {
         $product_specials[$i]['price_in'] = Formatter::currency($special['price'] + $special['price'] / 100 * $this->data['tax_percentage']);
     }
     $this->data['product_specials'] = $product_specials;
     // Images
     if (isset($this->request->post['product_image'])) {
         $product_images = $this->request->post['product_image'];
     } elseif (isset($this->request->get['product_id'])) {
         $product_images = $this->model_catalog_product->getProductImages($this->request->get['product_id']);
     } else {
         $product_images = array();
     }
     $this->data['product_images'] = array();
     foreach ($product_images as $product_image) {
         if ($product_image['image'] && file_exists(DIR_IMAGE . $product_image['image'])) {
             $image = $product_image['image'];
         } else {
             $image = 'no_image.jpg';
         }
         $this->data['product_images'][] = array('image' => $image, 'thumb' => $this->model_tool_image->resize($image, 125, 125), 'sort_order' => $product_image['sort_order']);
     }
     $this->data['no_image'] = $this->model_tool_image->resize('no_image.jpg', 125, 125);
     // Downloads
     $this->load->model('catalog/download');
     if (isset($this->request->post['product_download'])) {
         $product_downloads = $this->request->post['product_download'];
     } elseif (isset($this->request->get['product_id'])) {
         $product_downloads = $this->model_catalog_product->getProductDownloads($this->request->get['product_id']);
     } else {
         $product_downloads = array();
     }
     $this->data['product_downloads'] = array();
     foreach ($product_downloads as $download_id) {
         $this->data['product_downloads'][] = $this->model_catalog_download->getDownload($download_id);
     }
     if (isset($this->request->post['product_related'])) {
         $products = $this->request->post['product_related'];
     } elseif (isset($this->request->get['product_id'])) {
         $products = $this->model_catalog_product->getProductRelated($this->request->get['product_id']);
     } else {
         $products = array();
     }
     $this->data['product_related'] = array();
     foreach ($products as $id) {
         if (isset($this->request->get['product_id'])) {
             if ($this->request->get['product_id'] == $id) {
                 continue;
             }
         }
         $related_product = $this->model_catalog_product->getProduct($id);
         $related_product['image'] = $this->model_tool_image->resize($related_product['image'], 50, 50);
         $this->data['product_related'][] = $related_product;
     }
     if (isset($this->request->post['product_points'])) {
         $this->data['points'] = $this->request->post['product_points'];
     } elseif (!empty($product_info)) {
         $this->data['points'] = $product_info['points'];
     } else {
         $this->data['points'] = '';
     }
     if (isset($this->request->post['product_reward'])) {
         $this->data['product_reward'] = $this->request->post['product_reward'];
     } elseif (isset($this->request->get['product_id'])) {
         $this->data['product_reward'] = $this->model_catalog_product->getProductRewards($this->request->get['product_id']);
     } else {
         $this->data['product_reward'] = array();
     }
     if (!empty($this->error)) {
         $this->data['error'] = implode('<br />', $this->error);
     } else {
         $this->data['error'] = '';
     }
     $this->data['tax_settings'] = $this->url->link('settings/store/general', 'token=' . $this->session->data['token'], 'SSL');
     $this->document->addStyle('view/css/pages/product.css');
     $this->document->addStyle('view/css/pages/uploader.css');
     $this->document->addScript('view/js/pages/product_form.js');
     $this->document->addScript('view/js/pages/uploader.js');
     $this->document->addScript('view/js/jquery/jquery.ajaxupload.js');
     $this->document->addScript('view/js/jquery/jquery.autocomplete.js');
     $this->template = 'catalog/product_form.tpl';
     $this->children = array('common/header', 'common/footer');
     $this->response->setOutput($this->render());
 }
コード例 #19
0
echo SB_CURRENCY;
?>
</th>
		<th style="width:8em">Saldo <?php 
echo SB_CURRENCY;
?>
</th>
		<th colspan="2">&nbsp;</th>
	</tr>
</thead>
<tbody>
	<?php 
foreach ($purchases as $purchase) {
    echo "<tr>";
    echo "<td>{$purchase->code}</td>";
    echo "<td class='date'>" . Formatter::date($purchase->date) . "</td>";
    echo "<td>{$purchase->provider}</td>";
    echo "<td>{$PURCHASE_STATUS[$purchase->status]}</td>";
    echo "<td>" . Formatter::text($purchase->gloss) . "</td>";
    echo "<td class='number'>" . Formatter::number($purchase->amount) . "</td>";
    echo "<td class='number'>" . Formatter::number($purchase->amount - Purchase::getAmountPaid($purchase->id)) . "</td>";
    echo "<td class='ui-state-default'><a href='index.php?pages=purchase_detail&purchase={$purchase->id}' title='Ver'>" . ICON_ZOOMIN . "</a></td>";
    echo "<td class='ui-state-default'><a href='index.php?pages=purchase_edit&purchase={$purchase->id}' title='Editar'>" . ICON_PENCIL . "</a></td>";
    echo "</tr>";
}
?>
</tbody>
</table>

<script type="text/javascript">
jQuery(document).ready(function(){
コード例 #20
0
ファイル: return.php プロジェクト: wardvanderput/SumoStore
 public function insert()
 {
     $this->load->model('account/return');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $this->model_account_return->addReturn($this->request->post);
         $this->redirect($this->url->link('account/return/success', '', 'SSL'));
     }
     $this->document->setTitle(Language::getVar('SUMO_ACCOUNT_RETURN_NEW'));
     $this->data['breadcrumbs'] = array();
     $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_NOUN_HOME'), 'href' => $this->url->link('common/home'), 'separator' => false);
     $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_ACCOUNT_TITLE'), 'href' => $this->url->link('account/account', '', 'SSL'));
     $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_ACCOUNT_RETURN_TITLE'), 'href' => $this->url->link('account/return/', '', 'SSL'));
     $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_ACCOUNT_RETURN_NEW'), 'href' => $this->url->link('account/return/insert', '', 'SSL'));
     // Load required models
     $this->load->model('catalog/product');
     $this->load->model('localisation/return_reason');
     $this->load->model('account/order');
     $this->load->model('localisation/return_reason');
     if (isset($this->request->get['order_id'])) {
         $orderInfo = $this->model_account_order->getOrder($this->request->get['order_id']);
         $orderID = $this->request->get['order_id'];
         $productID = isset($this->request->get['product_id']) ? $this->request->get['product_id'] : 0;
     } else {
         $orderID = $productID = 0;
     }
     $fields = array('order_id' => $orderID, 'date_ordered' => isset($orderInfo['order_date']) ? Formatter::date($orderInfo['order_date']) : '', 'firstname' => $this->customer->getFirstName(), 'lastname' => $this->customer->getLastName(), 'email' => $this->customer->getEmail(), 'telephone' => $this->customer->getTelephone(), 'product' => '', 'product_id' => $productID, 'model' => '', 'quantity' => 1, 'opened' => 0, 'return_reason_id' => '', 'comment' => '', 'agree' => 0);
     foreach ($fields as $field => $defaultVal) {
         if (isset($this->request->post[$field])) {
             $fields[$field] = $this->request->post[$field];
         } elseif (isset($orderInfo[$field])) {
             $fields[$field] = $orderInfo[$field];
         } elseif (isset($orderInfo['customer'][$field])) {
             $fields[$field] = $orderInfo['customer'][$field];
         }
     }
     // Get orders for customer
     $orders = $this->model_account_order->getOrders();
     $rawOrders = array();
     foreach ($orders as $order) {
         // Get products for order
         $products = array();
         foreach ($this->model_account_order->getOrderProducts($order['order_id']) as $product) {
             $products[$product['product_id']] = array('product' => $product['name'], 'model' => $product['model'], 'quantity' => $product['quantity']);
             if ($order['order_id'] == $fields['order_id']) {
                 // List products
                 $this->data['products'][] = array('product_id' => $product['product_id'], 'product' => $product['name']);
             }
         }
         $this->data['orders'][]['order_id'] = $order['order_id'];
         $rawOrders[$order['order_id']] = array('products' => $products, 'order_date' => Formatter::date($order['order_date']));
     }
     $this->data = array_merge($this->data, $fields, array('error' => !empty($this->error) ? implode('<br />', $this->error) : '', 'action' => $this->url->link('account/return/insert', '', 'SSL'), 'return_reasons' => $this->model_localisation_return_reason->getReturnReasons(), 'raw_orders' => json_encode($rawOrders), 'text_agree' => '', 'cancel' => $this->url->link('account/return', '', 'SSL'), 'products' => isset($this->data['products']) ? $this->data['products'] : array()));
     if ($this->config->get('config_return_id')) {
         $this->load->model('catalog/information');
         $informationInfo = $this->model_catalog_information->getInformation($this->config->get('config_return_id'));
         if ($informationInfo) {
             $this->data['text_agree'] = sprintf(Language::getVar('SUMO_ACCOUNT_RETURN_AGREE'), $this->url->link('information/information/info', 'information_id=' . $this->config->get('config_return_id'), 'SSL'), $informationInfo['title'], $informationInfo['title']);
         } else {
             $this->data['text_agree'] = Language::getVar('SUMO_ACCOUNT_RETURN_AGREE');
         }
     }
     $this->data['settings'] = $this->config->get('details_account_' . $this->config->get('template'));
     if (!is_array($this->data['settings']) || !count($this->data['settings'])) {
         $this->data['settings']['left'][] = $this->getChild('app/widgetsimplesidebar/', array('type' => 'accountTree', 'data' => array()));
     }
     $this->template = 'account/return/form.tpl';
     $this->children = array('common/footer', 'common/header');
     $this->response->setOutput($this->render());
 }
コード例 #21
0
ファイル: review.php プロジェクト: wardvanderput/SumoStore
 protected function getForm()
 {
     $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_CATALOG_DASHBOARD'), 'href' => $this->url->link('catalog/dashboard')));
     $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_REVIEW'), 'href' => $this->url->link('catalog/review')));
     if (!isset($this->request->get['review_id'])) {
         $reviewID = 0;
         $action = $this->url->link('catalog/review/insert', 'token=' . $this->session->data['token'], 'SSL');
         $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_REVIEW_ADD')));
     } else {
         $reviewID = $this->request->get['review_id'];
         $reviewInfo = $this->model_catalog_review->getReview($reviewID);
         $action = $this->url->link('catalog/review/update', 'token=' . $this->session->data['token'] . '&review_id=' . $reviewID, 'SSL');
         $this->document->addBreadcrumbs(array('text' => Language::getVar('SUMO_ADMIN_REVIEW_UPDATE')));
     }
     $fields = array('product_id' => 0, 'product' => '', 'author' => '', 'text' => '', 'rating' => '', 'status' => '', 'date_added' => Formatter::date(time()));
     foreach ($fields as $field => $defaultValue) {
         if (isset($this->request->post[$field])) {
             $fields[$field] = $this->request->post[$field];
         } elseif (isset($reviewInfo[$field])) {
             if ($field == 'date_added') {
                 $fields[$field] = Formatter::date($reviewInfo[$field]);
             } else {
                 $fields[$field] = $reviewInfo[$field];
             }
         }
     }
     $this->data = array_merge($this->data, $fields, array('action' => $action, 'error' => implode('<br />', $this->error), 'cancel' => $this->url->link('catalog/review', 'token=' . $this->session->data['token'], 'SSL'), 'token' => $this->session->data['token']));
     $this->document->addScript('view/js/jquery/jquery.autocomplete.js');
     $this->document->addScript('view/js/pages/review_form.js');
     $this->template = 'catalog/review_form.tpl';
     $this->children = array('common/header', 'common/footer');
     $this->response->setOutput($this->render());
 }
コード例 #22
0
ファイル: order.php プロジェクト: wardvanderput/SumoStore
 public function info()
 {
     if (!$this->customer->isLogged()) {
         $this->session->data['redirect'] = $this->url->link('account/order/info', 'order_id=' . $orderID, 'SSL');
         $this->redirect($this->url->link('account/login', '', 'SSL'));
     }
     $orderID = 0;
     if (isset($this->request->get['order_id'])) {
         $orderID = $this->request->get['order_id'];
     }
     $this->load->model('account/order');
     $orderInfo = $this->model_account_order->getOrder($orderID);
     if ($orderInfo) {
         $this->document->setTitle(Language::getVar('SUMO_NOUN_ORDER'));
         $this->data['breadcrumbs'] = array();
         $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_NOUN_HOME'), 'href' => $this->url->link('common/home'), 'separator' => false);
         $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_ACCOUNT_TITLE'), 'href' => $this->url->link('account/account', '', 'SSL'));
         $url = '';
         if (isset($this->request->get['page'])) {
             $url .= '&page=' . $this->request->get['page'];
         }
         $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_ACCOUNT_ORDER_TITLE'), 'href' => $this->url->link('account/order', $url, 'SSL'));
         $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_NOUN_ORDER'), 'href' => $this->url->link('account/order/info', 'order_id=' . $this->request->get['order_id'] . $url, 'SSL'));
         // ** NOTICE **
         // This data is also fetched in model/checkout/order.php :: updateStatus
         // to create the order 'table'. If anything is changed here,
         // check there as well to be consistent.
         // Grab order totals
         foreach ($this->model_account_order->getOrderTotals($orderID) as $total) {
             if (!empty($total['label_inject'])) {
                 $label = sprintf(Language::getVar($total['label'] . '_INJ'), $total['label_inject']);
             } else {
                 $label = Language::getVar($total['label']);
             }
             $this->data['totals'][] = array_merge($total, array('label' => $label));
         }
         // Grab order products
         foreach ($this->model_account_order->getOrderProducts($orderID) as $product) {
             $price = $product['price'] * (1 + $product['tax_percentage'] / 100);
             $this->data['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')));
         }
         // Grab history
         foreach ($this->model_account_order->getOrderHistories($orderID) as $history) {
             $this->data['histories'][] = array_merge($history, array('date_added' => Formatter::date($history['history_date'])));
         }
         /**
          * 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);
         }
         // Remove remaining vars and excessive line breaks
         $shippingAddress = preg_replace("/\\{([a-z0-9_\\-]+)\\}/", '', $shippingAddress);
         $shippingAddress = preg_replace("/[\r\n]+/", "\n", $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
         $paymentAddress = preg_replace("/\\{([a-z0-9_\\-]+)\\}/", '', $paymentAddress);
         $paymentAddress = preg_replace("/[\r\n]+/", "\n", $paymentAddress);
         $this->data = array_merge($this->data, array('order_date' => Formatter::date($orderInfo['order_date']), 'invoice_no' => isset($orderInfo['invoice_no']) ? $orderInfo['invoice_no'] : '&mdash;', 'order_id' => str_pad($orderInfo['order_id'], 6, 0, STR_PAD_LEFT), 'payment_method' => $orderInfo['payment']['name'], 'payment_address' => $paymentAddress, 'shipping_method' => $orderInfo['shipping']['name'], 'shipping_address' => $shippingAddress, 'continue' => $this->url->link('account/order', '', 'SSL')));
         $this->data['settings'] = $this->config->get('details_account_' . $this->config->get('template'));
         if (!is_array($this->data['settings']) || !count($this->data['settings'])) {
             $this->data['settings']['left'][] = $this->getChild('app/widgetsimplesidebar/', array('type' => 'accountTree', 'data' => array()));
         }
         $this->template = 'account/order/view.tpl';
         $this->children = array('common/footer', 'common/header');
         $this->response->setOutput($this->render());
     } else {
         $this->document->setTitle(Language::getVar('SUMO_NOUN_ORDER'));
         $this->data['breadcrumbs'] = array();
         $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_NOUN_HOME'), 'href' => $this->url->link('common/home'), 'separator' => false);
         $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_ACCOUNT_TITLE'), 'href' => $this->url->link('account/account', '', 'SSL'));
         $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_ACCOUNT_ORDER_TITLE'), 'href' => $this->url->link('account/order', '', 'SSL'));
         $this->data['breadcrumbs'][] = array('text' => Language::getVar('SUMO_NOUN_ORDER'), 'href' => $this->url->link('account/order/info', 'order_id=' . $orderID, 'SSL'));
         $this->data['continue'] = $this->url->link('account/order', '', 'SSL');
         $this->data['settings'] = $this->config->get('details_account_' . $this->config->get('template'));
         if (!is_array($this->data['settings']) || !count($this->data['settings'])) {
             $this->data['settings']['left'][] = $this->getChild('app/widgetsimplesidebar/', array('type' => 'accountTree', 'data' => array()));
         }
         $this->template = 'account/order/view.tpl';
         $this->children = array('common/footer', 'common/header');
         $this->response->setOutput($this->render());
     }
 }