本文整理汇总了PHP中Formatter::currency方法的典型用法代码示例。如果您正苦于以下问题:PHP Formatter::currency方法的具体用法?PHP Formatter::currency怎么用?PHP Formatter::currency使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Formatter
的用法示例。
在下文中一共展示了Formatter::currency方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
protected function getList()
{
$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_CATALOG_SPECIAL')));
$this->data = array_merge($this->data, array('delete' => $this->url->link('catalog/special/delete', 'token=' . $this->session->data['token'], 'SSL'), 'specials' => array(), 'error' => isset($this->data['error']) ? $this->data['error'] : ''));
// Initiate pagination
if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}
$data = array('start' => ($page - 1) * 25, 'limit' => 25);
$special_total = $this->model_catalog_special->getTotalSpecials();
foreach ($this->model_catalog_special->getSpecials($data) as $special) {
$this->data['specials'][] = array_merge($special, array('product_special_no' => 'SID.' . str_pad($special['product_special_id'], 5, 0, STR_PAD_LEFT), 'price' => Formatter::currency($special['price']), 'product_price' => Formatter::currency($special['product_price']), 'edit' => $this->url->link('catalog/special/update', 'token=' . $this->session->data['token'] . '&product_special_id=' . $special['product_special_id'], 'SSL')));
}
$pagination = new Pagination();
$pagination->total = $special_total;
$pagination->page = $page;
$pagination->limit = 25;
$pagination->text = '';
$pagination->url = $this->url->link('catalog/special', 'token=' . $this->session->data['token'] . '&page={page}', 'SSL');
$this->data['pagination'] = $pagination->renderAdmin();
$this->getForm();
$this->template = 'catalog/special.tpl';
$this->children = array('common/header', 'common/footer');
$this->response->setOutput($this->render());
}
示例2: updateInvoice
public function updateInvoice($invoiceID, $data)
{
// Delete invoice-lines and add 'em later again
$this->query('DELETE FROM PREFIX_invoice_line WHERE invoice_id = :invoiceID', array('invoiceID' => $invoiceID));
$this->query('DELETE FROM PREFIX_invoice_total WHERE invoice_id = :invoiceID', array('invoiceID' => $invoiceID));
$totalTax = $total = 0;
foreach ($data['amount'] as $line => $amount) {
// Recalculate tax-amount based on the tax-percentage
if ($data['tax_percentage'][$line] > 0) {
$data['tax'][$line] = round($data['amount'][$line] * $data['quantity'][$line] * ($data['tax_percentage'][$line] / 100), 4);
$totalTax += $data['tax'][$line];
} else {
$data['tax'][$line] = 0;
}
$total += $amount * $data['quantity'][$line];
$this->query('INSERT INTO PREFIX_invoice_line (invoice_id, product_id, product, quantity, amount, tax_percentage, description) VALUES (
:invoiceID,
:productID,
:product,
:quantity,
:amount,
:taxPercentage,
:description)', array('invoiceID' => $invoiceID, 'productID' => $data['product_id'][$line], 'product' => $data['product'][$line], 'quantity' => $data['quantity'][$line], 'amount' => $data['amount'][$line], 'taxPercentage' => $data['tax_percentage'][$line], 'description' => $data['description'][$line]));
}
foreach ($data['totals'] as $sortOrder => $productTotal) {
$labelInject = isset($productTotal['label_inject']) ? $productTotal['label_inject'] : '';
$this->query("INSERT INTO PREFIX_invoice_total\n SET invoice_id = :id,\n sort_order = :sortOrder,\n label = :label,\n label_inject = :labelInject,\n value = :value,\n value_hr = :valueHR", array('id' => $invoiceID, 'sortOrder' => $sortOrder, 'label' => $productTotal['label'], 'labelInject' => $labelInject, 'value' => $productTotal['value'], 'valueHR' => Formatter::currency($productTotal['value'])));
}
// Totalamount is always the last line.
$total = $productTotal['value'];
$invoicePrefix = $this->config->get('invoice_prefix');
// Customer country numeric? Change to plain text
if (preg_match("/^\\d+\$/", $data['customer_country'])) {
$countryData = $this->query("SELECT name FROM PREFIX_country WHERE country_id = :countryID", array('countryID' => $data['customer_country']))->fetch();
$data['customer_country'] = !empty($countryData) ? $countryData['name'] : '-';
}
$this->query('UPDATE PREFIX_invoice SET
invoice_no = :invoiceNO,
customer_id = :customerID,
customer_no = :customerNo,
customer_name = :customerName,
customer_address = :customerAddress,
customer_postcode = :customerPostcode,
customer_city = :customerCity,
customer_country = :customerCountry,
customer_email = :customerEmail,
payment_amount = :paymentAmount,
payment_tax_percentage = :paymentTax,
shipping_amount = :shippingAmount,
shipping_tax_percentage = :shippingTax,
discount = :discount,
total_amount = :amount,
sent_date = :sentDate,
notes = :notes,
template = :template,
term = :term,
auto = :auto,
reference = :reference
WHERE invoice_id = :invoiceID', array('invoiceNO' => $invoicePrefix . str_pad($invoiceID, 5, 0, STR_PAD_LEFT), 'customerNo' => $customerNo, 'customerID' => $data['customer_id'], 'customerName' => $data['customer_name'], 'customerAddress' => $data['customer_address'], 'customerPostcode' => $data['customer_postcode'], 'customerCity' => $data['customer_city'], 'customerCountry' => $data['customer_country'], 'customerEmail' => $data['customer_email'], 'paymentAmount' => $data['payment_amount'], 'paymentTax' => $data['payment_tax'], 'shippingAmount' => $data['shipping_amount'], 'shippingTax' => $data['shipping_tax'], 'discount' => json_encode($data['discount']), 'amount' => $total, 'sentDate' => Formatter::dateReverse($data['sent_date']), 'notes' => $data['notes'], 'template' => $data['template'], 'term' => $data['term'], 'auto' => $data['auto'], 'reference' => $data['reference'], 'invoiceID' => $invoiceID));
}
示例3: index
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: saveOrder
public function saveOrder($order_id, $data)
{
$data['store'] = array();
$storeData = $this->model_settings_stores->getStore($data['store_id']);
$data['store']['id'] = $data['store_id'];
$data['store']['url'] = $storeData['base_' . $storeData['base_default']];
$data['store']['name'] = $storeData['name'];
// Existing customer?
if (!isset($data['customer']['customer_id']) || empty($data['customer']['customer_id'])) {
$customerData = $data['customer'];
$customerData['address'][] = $data['customer']['payment_address'];
unset($customerData['customer_id']);
unset($customerData['payment_address']);
unset($customerData['shipping_address']);
$this->load->model('sale/customer');
$data['customer']['customer_id'] = $this->model_sale_customer->addCustomer($customerData);
}
$this->query("UPDATE PREFIX_orders SET order_status = :status WHERE order_id = :id", array('status' => $data['order_status_id'], 'id' => $order_id));
$this->query("DELETE FROM PREFIX_orders_download WHERE order_id = :id", array('id' => $order_id));
$this->query("DELETE FROM PREFIX_orders_data WHERE order_id = :id", array('id' => $order_id));
$this->query("DELETE FROM PREFIX_orders_lines WHERE order_id = :id", array('id' => $order_id));
$this->query("DELETE FROM PREFIX_orders_totals WHERE order_id = :id", array('id' => $order_id));
$this->query("INSERT INTO PREFIX_orders_data\n SET order_id = :id,\n store = :store,\n admin_comment = :comment,\n discount = :discount,\n reward = :reward,\n points = :points,\n customer = :customer,\n shipping = :shipping,\n payment = :payment", array('id' => $order_id, 'store' => json_encode($data['store']), 'comment' => $data['comment'], 'discount' => json_encode($data['discount']), 'customer' => json_encode($data['customer']), 'shipping' => json_encode($data['method']['shipping']), 'payment' => json_encode($data['method']['payment']), 'reward' => '', 'points' => $data['points']));
// Add product lines
foreach ($data['lines'] as $productLine) {
$this->query("INSERT INTO PREFIX_orders_lines \n SET order_id = :id,\n product_id = :productID,\n name = :name,\n `option` = '',\n download = '',\n model = :model,\n quantity = :quantity,\n price = :price,\n tax_percentage = :taxPercentage", array('id' => $order_id, 'productID' => $productLine['product_id'], 'name' => $productLine['name'], 'model' => $productLine['model'], 'quantity' => $productLine['quantity'], 'price' => $productLine['price'], 'taxPercentage' => $productLine['tax']));
// Product has download?
$productDownloads = $this->query("SELECT * \n FROM PREFIX_download d, PREFIX_download_description dd \n WHERE d.download_id = dd.download_id \n AND dd.language_id = :languageID\n AND d.download_id IN (\n SELECT download_id \n FROM PREFIX_product_to_download \n WHERE product_id = :productID)", array('languageID' => $this->config->get('language_id'), 'productID' => $productLine['product_id']))->fetchAll();
foreach ($productDownloads as $productDownload) {
// Add order download
$this->query("INSERT INTO PREFIX_orders_download SET \n order_id = :orderID,\n name = :name,\n filename = :filename,\n remaining = :remaining", array('orderID' => $productDownload['order_id'], 'name' => $productDownload['mask'], 'filename' => $productDownload['filename'], 'remaining' => $productDownload['remaining']));
}
}
// Add product totals
foreach ($data['totals'] as $sortOrder => $productTotal) {
$labelInject = isset($productTotal['label_inject']) ? $productTotal['label_inject'] : '';
$this->query("INSERT INTO PREFIX_orders_totals \n SET order_id = :id,\n sort_order = :sortOrder,\n label = :label,\n label_inject = :labelInject,\n value = :value,\n value_hr = :valueHR", array('id' => $order_id, 'sortOrder' => $sortOrder, 'label' => $productTotal['label'], 'labelInject' => $labelInject, 'value' => $productTotal['value'], 'valueHR' => Formatter::currency($productTotal['value'])));
}
}
示例5: index
//.........这里部分代码省略.........
}
if (isset($this->request->get['page'])) {
$url .= '&page=' . $this->request->get['page'];
}
if (isset($this->request->get['limit'])) {
$url .= '&limit=' . $this->request->get['limit'];
}
$this->data['breadcrumbs'][] = array('text' => $product_info['name'], 'href' => $this->url->link('product/product', $url . '&product_id=' . $this->request->get['product_id']), 'separator' => Language::getVar('SUMO_BREADCRUMBS_SEPARATOR'));
$this->document->setTitle($product_info['name']);
$this->document->setDescription(!empty($product_info['meta_description']) ? $product_info['meta_description'] : substr(htmlentities(strip_tags(html_entity_decode($product_info['description']))), 0, 150));
if (!empty($product_info['meta_keyword'])) {
$this->document->setKeywords($product_info['meta_keyword']);
}
$this->document->addLink($this->url->link('product/product', $path . '&product_id=' . $this->request->get['product_id']), 'canonical');
$this->data['heading_title'] = $product_info['name'];
$this->data['product_id'] = $this->request->get['product_id'];
$this->data['manufacturer'] = $product_info['manufacturer'];
$this->data['manufacturer_link'] = $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $product_info['manufacturer_id']);
$this->data['model'] = $product_info['model'];
$this->data['points'] = $product_info['points'];
if ($product_info['quantity'] <= 0) {
$this->data['stock'] = $product_info['stock_status'];
} elseif ($this->config->get('stock_display') || $product_info['stock_amount_visible'] == 1) {
$this->data['stock'] = $product_info['quantity'];
} else {
$this->data['stock'] = Language::getVar('SUMO_PRODUCT_IN_STOCK');
}
if ($product_info['image']) {
$this->data['popup'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('image_popup_width'), $this->config->get('image_popup_height'));
} else {
$this->data['popup'] = $this->model_tool_image->resize('no_image.jpg', 150, 150);
}
if ($product_info['image']) {
$this->data['thumb'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('image_thumb_width'), $this->config->get('image_thumb_height'));
$this->data['additional'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('image_additional_width'), $this->config->get('image_additional_height'));
} else {
$this->data['thumb'] = $this->model_tool_image->resize('no_image.jpg', 150, 150);
$this->data['additional'] = $this->model_tool_image->resize('no_image.jpg', 150, 150);
}
$this->data['images'] = array();
$results = $this->model_catalog_product->getProductImages($this->request->get['product_id']);
foreach ($results as $result) {
if (empty($result['image'])) {
$result['image'] = 'no_image.jpg';
}
$this->data['images'][] = array('popup' => $this->model_tool_image->resize($result['image'], $this->config->get('image_popup_width'), $this->config->get('image_popup_height')), 'thumb' => $this->model_tool_image->resize($result['image'], $this->config->get('image_thumb_width'), $this->config->get('image_thumb_height')), 'additional' => $this->model_tool_image->resize($result['image'], $this->config->get('image_additional_width'), $this->config->get('image_additional_height')));
}
$this->data['price'] = $this->data['price_raw'] = false;
if ($this->config->get('customer_price') && $this->customer->isLogged() || !$this->config->get('customer_price')) {
if ($this->config->get('tax_enabled')) {
$this->data['price'] = Formatter::currency($product_info['price'] + $product_info['price'] / 100 * $product_info['tax_percentage']);
} else {
$this->data['price'] = Formatter::currency($product_info['price']);
}
$this->data['price_raw'] = $product_info['price'];
}
if ((double) $product_info['special']) {
$this->data['percent_savings'] = round(($product_info['price'] - $product_info['special']) / $product_info['price'] * 100);
if ($this->config->get('tax_enabled')) {
$this->data['special'] = Formatter::currency($product_info['special'] + $product_info['special'] / 100 * $product_info['tax_percentage']);
} else {
$this->data['special'] = Formatter::currency($product_info['special']);
}
$this->data['price_raw'] = $product_info['special'];
}
$this->data['tax'] = $this->data['tax_raw'] = false;
if ($this->config->get('tax_display')) {
$price = $product_info['special'] ? $product_info['special'] : $product_info['price'];
$this->data['tax'] = Formatter::currency($price);
// + ($price / 100 * $product_info['tax_percentage']));
$this->data['tax_raw'] = $price;
}
$discounts = $this->model_catalog_product->getProductDiscounts($this->request->get['product_id']);
$this->data['discounts'] = array();
foreach ($discounts as $discount) {
$percent_savings = round(($product_info['price'] - $discount['price']) / $product_info['price'] * 100);
if ($this->config->get('tax_enabled')) {
$price = Formatter::currency(round($discount['price'] + $discount['price'] / 100 * $product_info['tax_percentage']));
} else {
$price = Formatter::currency($discount['price']);
}
$this->data['discounts'][] = array('quantity' => $discount['quantity'], 'percent_savings' => $percent_savings, 'price' => $price);
}
$this->data['options'] = $this->model_catalog_product->getProductOptions($this->request->get['product_id']);
$this->data['minimum'] = 1;
if ($product_info['minimum']) {
$this->data['minimum'] = $product_info['minimum'];
}
$this->data['review_status'] = $this->config->get('review_status');
$this->data['rating'] = !empty($product_info['rating']) ? $product_info['rating'] : 0;
$this->data['description'] = html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8');
$this->data['attributes'] = $this->model_catalog_product->getProductAttributes($this->request->get['product_id']);
$this->model_catalog_product->updateViewed($this->request->get['product_id']);
$this->template = 'product/product.tpl';
$this->children = array('common/footer', 'common/header');
$this->response->setOutput($this->render());
} else {
return $this->forward('error/not_found');
}
}
示例6: discountcheck
public function discountcheck()
{
$json = array();
if ($this->request->server['REQUEST_METHOD'] == 'POST') {
if (!empty($this->request->post['type'])) {
switch ($this->request->post['type']) {
case 'coupon':
$this->load->model('checkout/coupon');
$json['coupon'] = $this->model_checkout_coupon->check($this->request->post['code']);
if (isset($json['coupon']['discount'])) {
if ($json['coupon']['type'] == 'P') {
$json['coupon']['display'] = round($json['coupon']['discount']) . '%';
} else {
if ($this->config->get('tax_enabled')) {
$json['coupon']['display'] = Formatter::currency($json['coupon']['discount'] + $json['coupon']['discount'] / 100 * $json['coupon']['tax_percentage']);
} else {
$json['coupon']['display'] = Formatter::currency($json['coupon']['discount']);
}
}
$json['coupon']['display'] = Language::getVar('SUMO_CATALOG_COUPON_DISCOUNT', $json['coupon']['display']);
}
break;
case 'voucher':
$this->load->model('checkout/voucher');
$json['voucher'] = $this->model_checkout_voucher->check($this->request->post['code']);
if (isset($json['voucher']['amount'])) {
$json['voucher']['display'] = Language::getVar('SUMO_CATALOG_VOUCHER_DISCOUNT', array($json['voucher']['to_name'], $json['voucher']['from_name'], $json['voucher']['theme'], Formatter::currency($json['voucher']['amount']), htmlentities($json['voucher']['message'])));
}
break;
case 'reward':
if (!empty($this->request->post['amount'])) {
$json['reward']['display'] = Language::getVar('SUMO_CHECKOUT_REWARD_CALCULATION', array(intval($this->request->post['amount']), Formatter::currency($this->config->get('points_value')), Formatter::currency($this->config->get('points_value') * intval($this->request->post['amount']))));
}
break;
}
}
}
$this->response->setOutput(json_encode($json));
}
示例7: getDataProductSales
private function getDataProductSales($filters)
{
$cache = 'report.products.sales.' . json_encode($filters);
$data = Cache::find($cache);
if (is_array($data) && count($data)) {
//return $data;
}
$sql = "SELECT * FROM PREFIX_orders_lines AS ol LEFT JOIN PREFIX_orders AS o ON o.order_id = ol.order_id";
if (!empty($filters['date_start'])) {
$sql .= " AND DATE(order_date) >= '" . Formatter::dateReverse($filters['date_start']) . "'";
}
if (!empty($filters['date_end'])) {
$sql .= " AND DATE(order_date) <= '" . Formatter::dateReverse($filters['date_end']) . "'";
}
if (isset($filters['start']) && !empty($filters['limit'])) {
if ($filters['start'] < 1) {
$filters['start'] = 0;
}
}
$return = $temp = array();
$products = $this->fetchAll($sql);
$i = 0;
foreach ($products as $list) {
//$list = json_decode($list['data'], true);
$check = $this->query("SELECT viewed FROM PREFIX_product WHERE product_id = :id", array('id' => $list['product_id']))->fetch();
if (empty($check['viewed'])) {
$check['viewed'] = 0;
}
$poc = $list['name'] . $list['product_id'];
if (!isset($temp[$poc])) {
$temp[$poc] = array(0 => $list['name'], 1 => !empty($list['model']) ? $list['model'] : 'P' . $list['product_id'], 2 => $check['viewed'], 3 => 0, 4 => 0);
}
$temp[$poc][3] += $list['quantity'];
$temp[$poc][4] += $list['price'] * $list['quantity'];
}
$quantity = $total = array();
foreach ($temp as $key => $row) {
$quantity[$key] = $row[3];
$total[$key] = $row[4];
}
unset($products);
array_multisort($quantity, SORT_DESC, $total, SORT_DESC, $temp);
unset($quantity);
unset($total);
if (isset($filters['start']) && !empty($filters['limit'])) {
$return = array_slice($temp, $filters['start'], $filters['limit']);
} else {
return count($temp);
}
foreach ($return as $key => $list) {
$return[$key][4] = Formatter::currency($list[4]);
$return[$key][5] = round($list[3] / $list[2] * 100, 2) . '%';
}
Cache::set($cache, $return);
return $return;
}
示例8:
</td>
</tr>
<tr>
<td class="label">Forma de Pago:</td>
<td><?php
echo $PAYMENT_TYPE[$sell->paymentType];
?>
</td>
</tr>
<?php
if ($sell->paymentType == PAYMENT_TYPE_CREDIT) {
?>
<tr>
<td class="label">Anticipo:</td>
<td><?php
echo Formatter::currency($sell->prepayment);
?>
</td>
</tr>
<?php
}
?>
<tr>
<td class="label">Cliente:</td>
<td><?php
echo $sell->customer;
?>
</td>
</tr>
<tr>
<td class="label">NIT Cliente:</td>
示例9:
}
?>
</select>
</td>
</tr>
<tr>
<td class="label">Fecha:</td>
<td><?php
echo $purchase->date;
?>
</td>
</tr>
<tr>
<td class="label">Anticipo:</td>
<td><?php
echo Formatter::currency($purchase->prepayment);
?>
</td>
</tr>
<tr>
<td class="label">Proveedor:</td>
<td><?php
echo $purchase->provider;
?>
</td>
</tr>
<tr>
<td class="label">Observaciones:</td>
<td style="width:15em"><?php
echo $purchase->gloss;
?>
示例10: updateStatus
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>
//.........这里部分代码省略.........
示例11: getList
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());
}
示例12: getForm
//.........这里部分代码省略.........
}
}
$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
示例13: transaction
public function transaction()
{
$this->load->model('sale/customer');
if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->user->hasPermission('modify', 'sale/customer')) {
$this->model_sale_customer->addTransaction($this->request->get['customer_id'], $this->request->post['description'], $this->request->post['amount']);
$return = array('success' => Language::getVar('SUMO_SUCCESS_TRANSACTION_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['transactions'] = array();
$results = $this->model_sale_customer->getTransactions($this->request->get['customer_id']);
foreach ($results as $result) {
$this->data['transactions'][] = array_merge($result, array('amount' => Formatter::currency($result['amount']), 'date_added' => Formatter::date($result['date_added'])));
}
$this->data['transaction_balance'] = $this->currency->format($this->model_sale_customer->getTransactionTotal($this->request->get['customer_id']), $this->config->get('currency'));
}
示例14: index
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'] = '—';
}
$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());
}
示例15: info
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'] : '—', '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());
}
}