本文整理汇总了PHP中utf8_truncate函数的典型用法代码示例。如果您正苦于以下问题:PHP utf8_truncate函数的具体用法?PHP utf8_truncate怎么用?PHP utf8_truncate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了utf8_truncate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: truncate
private function truncate($string)
{
if (preg_match('/[^0-9]/', $string)) {
$string = utf8_truncate($string, 11, '');
} else {
$string = substr($string, 0, 15);
}
return $string;
}
示例2: GetMessage
function GetMessage($folderid, $id, $truncsize, $mimesupport = 0)
{
debugLog("IMAP-GetMessage: (fid: '{$folderid}' id: '{$id}' truncsize: {$truncsize})");
// Get flags, etc
$stat = $this->StatMessage($folderid, $id);
if ($stat) {
$this->imap_reopenFolder($folderid);
$mail = @imap_fetchheader($this->_mbox, $id, FT_UID) . @imap_body($this->_mbox, $id, FT_PEEK | FT_UID);
$mobj = new Mail_mimeDecode($mail);
$message = $mobj->decode(array('decode_headers' => true, 'decode_bodies' => true, 'include_bodies' => true, 'charset' => 'utf-8'));
$output = new SyncMail();
$body = $this->getBody($message);
$output->bodysize = strlen($body);
// truncate body, if requested
if (strlen($body) > $truncsize) {
$body = utf8_truncate($body, $truncsize);
$output->bodytruncated = 1;
} else {
$body = $body;
$output->bodytruncated = 0;
}
$body = str_replace("\n", "\r\n", str_replace("\r", "", $body));
$output->body = $body;
$output->datereceived = isset($message->headers["date"]) ? $this->cleanupDate($message->headers["date"]) : null;
$output->displayto = isset($message->headers["to"]) ? $message->headers["to"] : null;
$output->importance = isset($message->headers["x-priority"]) ? preg_replace("/\\D+/", "", $message->headers["x-priority"]) : null;
$output->messageclass = "IPM.Note";
$output->subject = isset($message->headers["subject"]) ? $message->headers["subject"] : "";
$output->read = $stat["flags"];
$output->to = isset($message->headers["to"]) ? $message->headers["to"] : null;
$output->cc = isset($message->headers["cc"]) ? $message->headers["cc"] : null;
$output->from = isset($message->headers["from"]) ? $message->headers["from"] : null;
$output->reply_to = isset($message->headers["reply-to"]) ? $message->headers["reply-to"] : null;
// Attachments are only searched in the top-level part
if (isset($message->parts)) {
$mparts = $message->parts;
for ($i = 0; $i < count($mparts); $i++) {
$part = $mparts[$i];
//recursively add parts
if ($part->ctype_primary == "multipart" && ($part->ctype_secondary == "mixed" || $part->ctype_secondary == "alternative" || $part->ctype_secondary == "related")) {
foreach ($part->parts as $spart) {
$mparts[] = $spart;
}
continue;
}
//add part as attachment if it's disposition indicates so or if it is not a text part
if (isset($part->disposition) && ($part->disposition == "attachment" || $part->disposition == "inline") || isset($part->ctype_primary) && $part->ctype_primary != "text") {
$attachment = new SyncAttachment();
if (isset($part->body)) {
$attachment->attsize = strlen($part->body);
}
if (isset($part->d_parameters['filename'])) {
$attname = $part->d_parameters['filename'];
} else {
if (isset($part->ctype_parameters['name'])) {
$attname = $part->ctype_parameters['name'];
} else {
if (isset($part->headers['content-description'])) {
$attname = $part->headers['content-description'];
} else {
$attname = "unknown attachment";
}
}
}
$attachment->displayname = $attname;
$attachment->attname = $folderid . ":" . $id . ":" . $i;
$attachment->attmethod = 1;
$attachment->attoid = isset($part->headers['content-id']) ? $part->headers['content-id'] : "";
array_push($output->attachments, $attachment);
}
}
}
// unset mimedecoder & mail
unset($mobj);
unset($mail);
return $output;
}
return false;
}
示例3: _getEmail
//.........这里部分代码省略.........
$message->bodytruncated = 0;
}
$message->body = str_replace("\n", "\r\n", w2u(str_replace("\r", "", $body)));
if (!isset($message->body) || strlen($message->body) == 0) {
$message->body = " ";
}
} else {
$rtf = mapi_message_openproperty($mapimessage, PR_RTF_COMPRESSED);
if (!$rtf) {
$message->airsyncbasenativebodytype = 1;
} else {
$rtf = preg_replace("/(\n.*)/m", "", mapi_decompressrtf($rtf));
if (strpos($rtf, "\\fromtext") != false) {
$message->airsyncbasenativebodytype = 1;
} else {
$message->airsyncbasenativebodytype = 2;
}
}
if (!isset($bodypreference[1]["TruncationSize"])) {
$bodypreference[1]["TruncationSize"] = 1024 * 1024;
}
if (isset($bodypreference[4]) && function_exists("mapi_inetmapi_imtoinet") && (!defined('ICS_IMTOINET_SEGFAULT') || ICS_IMTOINET_SEGFAULT === false)) {
$addrBook = mapi_openaddressbook($this->_session);
$mstream = mapi_inetmapi_imtoinet($this->_session, $addrBook, $mapimessage, array());
$mstreamstat = mapi_stream_stat($mstream);
}
$message->airsyncbasebody = new SyncAirSyncBaseBody();
debugLog("airsyncbasebody!");
if (isset($bodypreference[4]) && isset($mstream) && ($mimesupport == 2 || $mimesupport == 1 && strtolower(substr($messageprops[PR_MESSAGE_CLASS], 0, 14)) == 'ipm.note.smime')) {
$mstreamcontent = mapi_stream_read($mstream, MAX_EMBEDDED_SIZE);
$message->airsyncbasebody->type = 4;
if ($truncsize != false && isset($bodypreference[4]["TruncationSize"])) {
$hdrend = strpos("\r\n\r\n", $mstreamcontent);
$message->airsyncbasebody->data = utf8_truncate($mstreamcontent, $hdrend + $bodypreference[4]["TruncationSize"]);
} else {
$message->airsyncbasebody->data = $mstreamcontent;
}
if (strlen($message->airsyncbasebody->data) < $mstreamstat["cb"]) {
$message->airsyncbasebody->truncated = 1;
}
$message->airsyncbasebody->estimateddatasize = strlen($mstreamcontent);
} elseif (isset($bodypreference[3]) && $message->airsyncbasenativebodytype == 3) {
$message->airsyncbasebody->type = 3;
$rtf = mapi_openproperty($mapimessage, PR_RTF_COMPRESSED);
$message->airsyncbasebody->data = base64_encode($rtf);
$message->airsyncbasebody->estimateddatasize = strlen($rtf);
debugLog("RTF Body!");
} elseif (isset($bodypreference[2])) {
$message->airsyncbasebody->type = 2;
$html = mapi_openproperty($mapimessage, PR_HTML);
if (strpos(strtoupper($html), "<HTML>") == 0 && strpos(strtoupper($html), "<HEAD>") == 0 && strpos(strtoupper($html), "<BODY>") == 0) {
debugLog("Malformed html message, (HTML, HEAD, BODY missing");
$html = '<HTML>' . '<HEAD>' . '<META NAME="Generator" CONTENT="Z-Push">' . '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">' . '</HEAD>' . '<BODY>' . iconv(getCodepageCharset($message->internetcpid), "utf-8", $html) . '</BODY></HTML>';
$message->internetcpid = 65001;
} else {
if ($message->internetcpid != 65001) {
$html = iconv(getCodepageCharset($message->internetcpid), "utf-8", $html);
}
}
/* This should be removed 110422
if ($message->airsyncbasenativebodytype==2) {
$html = mapi_openproperty($mapimessage, PR_HTML);
} else {
$html = '<html>'.
'<head>'.
'<meta name="Generator" content="Z-Push">'.
示例4: GetMessage
function GetMessage($folderid, $id, $truncsize, $mimesupport = 0)
{
debugLog("IMAP-GetMessage: (fid: '{$folderid}' id: '{$id}' truncsize: {$truncsize})");
// Get flags, etc
$stat = $this->StatMessage($folderid, $id);
if ($stat) {
$this->imap_reopenFolder($folderid);
$mail = @imap_fetchheader($this->_mbox, $id, FT_PREFETCHTEXT | FT_UID) . @imap_body($this->_mbox, $id, FT_PEEK | FT_UID);
$mobj = new Mail_mimeDecode($mail);
$message = $mobj->decode(array('decode_headers' => true, 'decode_bodies' => true, 'include_bodies' => true, 'input' => $mail, 'crlf' => "\n", 'charset' => 'utf-8'));
$output = new SyncMail();
$body = $this->getBody($message);
// truncate body, if requested
if (strlen($body) > $truncsize) {
$body = utf8_truncate($body, $truncsize);
$output->bodytruncated = 1;
} else {
$body = $body;
$output->bodytruncated = 0;
}
$body = str_replace("\n", "\r\n", str_replace("\r", "", $body));
$output->bodysize = strlen($body);
$output->body = $body;
$output->datereceived = isset($message->headers["date"]) ? strtotime($message->headers["date"]) : null;
$output->displayto = isset($message->headers["to"]) ? $message->headers["to"] : null;
$output->importance = isset($message->headers["x-priority"]) ? preg_replace("/\\D+/", "", $message->headers["x-priority"]) : null;
$output->messageclass = "IPM.Note";
$output->subject = isset($message->headers["subject"]) ? $message->headers["subject"] : "";
$output->read = $stat["flags"];
$output->to = isset($message->headers["to"]) ? $message->headers["to"] : null;
$output->cc = isset($message->headers["cc"]) ? $message->headers["cc"] : null;
$output->from = isset($message->headers["from"]) ? $message->headers["from"] : null;
$output->reply_to = isset($message->headers["reply-to"]) ? $message->headers["reply-to"] : null;
// Attachments are only searched in the top-level part
$n = 0;
if (isset($message->parts)) {
foreach ($message->parts as $part) {
if (isset($part->disposition) && ($part->disposition == "attachment" || $part->disposition == "inline")) {
$attachment = new SyncAttachment();
if (isset($part->body)) {
$attachment->attsize = strlen($part->body);
}
if (isset($part->d_parameters['filename'])) {
$attname = $part->d_parameters['filename'];
} else {
if (isset($part->ctype_parameters['name'])) {
$attname = $part->ctype_parameters['name'];
} else {
if (isset($part->headers['content-description'])) {
$attname = $part->headers['content-description'];
} else {
$attname = "unknown attachment";
}
}
}
$attachment->displayname = $attname;
$attachment->attname = $folderid . ":" . $id . ":" . $n;
$attachment->attmethod = 1;
$attachment->attoid = isset($part->headers['content-id']) ? $part->headers['content-id'] : "";
array_push($output->attachments, $attachment);
}
$n++;
}
}
// unset mimedecoder & mail
unset($mobj);
unset($mail);
return $output;
}
return false;
}
示例5: update
public function update()
{
$this->language->load('checkout/cart');
$json = array();
if (isset($this->request->post['product_id'])) {
$this->load->model('catalog/product');
$product_info = $this->model_catalog_product->getProduct($this->request->post['product_id']);
if ($product_info) {
if (isset($this->request->post['quantity'])) {
$quantity = $this->request->post['quantity'];
} else {
$quantity = 1;
}
$product_total = 0;
$products = $this->cart->getProducts();
foreach ($products as $product_2) {
if ($product_2['product_id'] == $this->request->post['product_id']) {
$product_total += $product_2['quantity'];
}
}
if ($product_info['minimum'] > $product_total + $quantity) {
$json['error']['warning'] = sprintf($this->language->get('error_minimum'), $product_info['name'], $product_info['minimum']);
}
if (isset($this->request->post['option'])) {
$option = array_filter($this->request->post['option']);
} else {
$option = array();
}
$product_options = $this->model_catalog_product->getProductOptions($this->request->post['product_id']);
foreach ($product_options as $product_option) {
if ($product_option['required'] && (!isset($this->request->post['option'][$product_option['product_option_id']]) || !$this->request->post['option'][$product_option['product_option_id']])) {
$json['error'][$product_option['product_option_id']] = sprintf($this->language->get('error_required'), $product_option['name']);
}
}
}
if (!isset($json['error'])) {
$this->cart->add($this->request->post['product_id'], $quantity, $option);
$json['success'] = sprintf($this->language->get('text_success'), $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('checkout/cart'));
unset($this->session->data['shipping_methods']);
unset($this->session->data['shipping_method']);
unset($this->session->data['payment_methods']);
unset($this->session->data['payment_method']);
} else {
$json['redirect'] = str_replace('&', '&', $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']));
}
}
if (isset($this->request->post['remove'])) {
$this->cart->remove($this->request->post['remove']);
unset($this->session->data['shipping_methods']);
unset($this->session->data['shipping_method']);
unset($this->session->data['payment_methods']);
unset($this->session->data['payment_method']);
}
if (isset($this->request->post['voucher'])) {
if ($this->session->data['vouchers'][$this->request->post['voucher']]) {
unset($this->session->data['vouchers'][$this->request->post['voucher']]);
}
}
$this->load->model('tool/image');
$this->data['text_empty'] = $this->language->get('text_empty');
$this->data['button_checkout'] = $this->language->get('button_checkout');
$this->data['button_remove'] = $this->language->get('button_remove');
$this->data['products'] = array();
foreach ($this->cart->getProducts() as $result) {
if ($result['image']) {
$image = $this->model_tool_image->resize($result['image'], 40, 40);
} else {
$image = '';
}
$option_data = array();
foreach ($result['option'] as $option) {
if ($option['type'] != 'file') {
$option_data[] = array('name' => $option['name'], 'value' => utf8_truncate($option['option_value']));
} else {
$this->load->library('encryption');
$encryption = new Encryption($this->config->get('config_encryption'));
$file = substr($encryption->decrypt($option['option_value']), 0, strrpos($encryption->decrypt($option['option_value']), '.'));
$option_data[] = array('name' => $option['name'], 'value' => utf8_truncate($file));
}
}
if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) {
$price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = false;
}
if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) {
$total = $this->currency->format($this->tax->calculate($result['total'], $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$total = false;
}
$this->data['products'][] = array('key' => $result['key'], 'product_id' => $result['product_id'], 'thumb' => $image, 'name' => $result['name'], 'model' => $result['model'], 'option' => $option_data, 'quantity' => $result['quantity'], 'stock' => $result['stock'], 'price' => $price, 'total' => $total, 'href' => $this->url->link('product/product', 'product_id=' . $result['product_id']));
}
// Gift Voucher
$this->data['vouchers'] = array();
if (isset($this->session->data['vouchers']) && $this->session->data['vouchers']) {
foreach ($this->session->data['vouchers'] as $key => $voucher) {
$this->data['vouchers'][] = array('key' => $key, 'description' => $voucher['description'], 'amount' => $this->currency->format($voucher['amount']));
}
}
// Calculate Totals
//.........这里部分代码省略.........
示例6: index
public function index()
{
$this->language->load('product/compare');
$this->load->model('catalog/product');
$this->load->model('tool/image');
if (!isset($this->session->data['compare'])) {
$this->session->data['compare'] = array();
}
if (isset($this->request->post['remove'])) {
$key = array_search($this->request->post['remove'], $this->session->data['compare']);
if ($key !== false) {
unset($this->session->data['compare'][$key]);
}
$this->redirect($this->url->link('product/compare'));
}
$this->document->setTitle($this->language->get('heading_title'));
$this->data['breadcrumbs'] = array();
$this->data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home'), 'separator' => false);
$url = '';
if (isset($this->request->get['compare'])) {
$url .= 'compare=' . $this->request->get['compare'];
}
$this->data['breadcrumbs'][] = array('text' => $this->language->get('heading_title'), 'href' => $this->url->link('product/compare', $url), 'separator' => $this->language->get('text_separator'));
$this->data['heading_title'] = $this->language->get('heading_title');
$this->data['text_product'] = $this->language->get('text_product');
$this->data['text_name'] = $this->language->get('text_name');
$this->data['text_image'] = $this->language->get('text_image');
$this->data['text_price'] = $this->language->get('text_price');
$this->data['text_model'] = $this->language->get('text_model');
$this->data['text_manufacturer'] = $this->language->get('text_manufacturer');
$this->data['text_availability'] = $this->language->get('text_availability');
$this->data['text_rating'] = $this->language->get('text_rating');
$this->data['text_summary'] = $this->language->get('text_summary');
$this->data['text_weight'] = $this->language->get('text_weight');
$this->data['text_dimension'] = $this->language->get('text_dimension');
$this->data['text_remove'] = $this->language->get('text_remove');
$this->data['text_empty'] = $this->language->get('text_empty');
$this->data['button_cart'] = $this->language->get('button_cart');
$this->data['button_continue'] = $this->language->get('button_continue');
$this->data['action'] = $this->url->link('product/compare');
$this->data['products'] = array();
$this->data['attribute_groups'] = array();
foreach ($this->session->data['compare'] as $product_id) {
$product_info = $this->model_catalog_product->getProduct($product_id);
if ($product_info) {
if ($product_info['image']) {
$image = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_compare_width'), $this->config->get('config_image_compare_height'));
} else {
$image = false;
}
if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) {
$price = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = false;
}
if ((double) $product_info['special']) {
$special = $this->currency->format($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax')));
} else {
$special = false;
}
if ($product_info['quantity'] <= 0) {
$availability = $product_info['stock_status'];
} elseif ($this->config->get('config_stock_display')) {
$availability = $product_info['quantity'];
} else {
$availability = $this->language->get('text_instock');
}
$attribute_data = array();
$attribute_groups = $this->model_catalog_product->getProductAttributes($product_id);
foreach ($attribute_groups as $attribute_group) {
foreach ($attribute_group['attribute'] as $attribute) {
$attribute_data[$attribute['attribute_id']] = $attribute['text'];
}
}
$this->data['products'][$product_id] = array('product_id' => $product_info['product_id'], 'name' => $product_info['name'], 'thumb' => $image, 'price' => $price, 'special' => $special, 'description' => utf8_truncate(strip_tags(html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8')), 400, ' …', true), 'model' => $product_info['model'], 'manufacturer' => $product_info['manufacturer'], 'availability' => $availability, 'rating' => (int) $product_info['rating'], 'reviews' => sprintf($this->language->get('text_reviews'), (int) $product_info['reviews']), 'weight' => $this->weight->format($product_info['weight'], $product_info['weight_class_id']), 'length' => $this->length->format($product_info['length'], $product_info['length_class_id']), 'width' => $this->length->format($product_info['width'], $product_info['length_class_id']), 'height' => $this->length->format($product_info['height'], $product_info['length_class_id']), 'attribute' => $attribute_data, 'href' => $this->url->link('product/product', 'product_id=' . $product_id), 'remove' => $this->url->link('product/product', 'product_id=' . $product_id));
foreach ($attribute_groups as $attribute_group) {
$this->data['attribute_groups'][$attribute_group['attribute_group_id']]['name'] = $attribute_group['name'];
foreach ($attribute_group['attribute'] as $attribute) {
$this->data['attribute_groups'][$attribute_group['attribute_group_id']]['attribute'][$attribute['attribute_id']]['name'] = $attribute['name'];
}
}
}
}
$this->data['continue'] = $this->url->link('common/home');
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/compare.tpl')) {
$this->template = $this->config->get('config_template') . '/template/product/compare.tpl';
} else {
$this->template = 'default/template/product/compare.tpl';
}
$this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header');
$this->response->setOutput($this->render());
}
示例7: note2messagenote
/**
* Convert note to requested bodypreference format and truncate if requested
*
* @param $note string containing the plaintext message
* @param $bodypreference object
* @param &$airsyncbasebody the airsyncbasebody object to send to the client
*
* @return string plain textbody for message or false
*/
public function note2messagenote($note, $bodypreference, &$airsyncbasebody)
{
//error_log (__METHOD__);
if ($bodypreference == false) {
return $note;
} else {
if (isset($bodypreference[2])) {
debugLog("HTML Body");
$airsyncbasebody->type = 2;
$html = '<html>' . '<head>' . '<meta name="Generator" content="eGroupware/Z-Push">' . '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">' . '</head>' . '<body>' . str_replace(array("\n", "\r", "\r\n"), "<br />", $note) . '</body>' . '</html>';
if (isset($bodypreference[2]["TruncationSize"]) && strlen($html) > $bodypreference[2]["TruncationSize"]) {
$html = utf8_truncate($html, $bodypreference[2]["TruncationSize"]);
$airsyncbasebody->truncated = 1;
}
$airsyncbasebody->estimateddatasize = strlen($html);
$airsyncbasebody->data = $html;
} else {
debugLog("Plaintext Body");
$airsyncbasebody->type = 1;
$plainnote = str_replace("\n", "\r\n", str_replace("\r", "", $note));
if (isset($bodypreference[1]["TruncationSize"]) && strlen($plainnote) > $bodypreference[1]["TruncationSize"]) {
$plainnote = utf8_truncate($plainnote, $bodypreference[1]["TruncationSize"]);
$airsyncbasebody->truncated = 1;
}
$airsyncbasebody->estimateddatasize = strlen($plainnote);
$airsyncbasebody->data = $plainnote;
}
if ($airsyncbasebody->type != 3 && (!isset($airsyncbasebody->data) || strlen($airsyncbasebody->data) == 0)) {
$airsyncbasebody->data = " ";
}
}
}
示例8: index
//.........这里部分代码省略.........
$data['shipping_city'] = '';
$data['shipping_postcode'] = '';
$data['shipping_zone'] = '';
$data['shipping_zone_id'] = '';
$data['shipping_country'] = '';
$data['shipping_country_id'] = '';
$data['shipping_address_format'] = '';
$data['shipping_method'] = '';
}
$this->load->library('encryption');
$product_data = array();
foreach ($this->cart->getProducts() as $product) {
$option_data = array();
foreach ($product['option'] as $option) {
if ($option['type'] != 'file') {
$option_data[] = array('product_option_id' => $option['product_option_id'], 'product_option_value_id' => $option['product_option_value_id'], 'product_option_id' => $option['product_option_id'], 'product_option_value_id' => $option['product_option_value_id'], 'option_id' => $option['option_id'], 'option_value_id' => $option['option_value_id'], 'name' => $option['name'], 'value' => $option['option_value'], 'type' => $option['type']);
} else {
$encryption = new Encryption($this->config->get('config_encryption'));
$option_data[] = array('product_option_id' => $option['product_option_id'], 'product_option_value_id' => $option['product_option_value_id'], 'product_option_id' => $option['product_option_id'], 'product_option_value_id' => $option['product_option_value_id'], 'option_id' => $option['option_id'], 'option_value_id' => $option['option_value_id'], 'name' => $option['name'], 'value' => $encryption->decrypt($option['option_value']), 'type' => $option['type']);
}
}
$product_data[] = array('product_id' => $product['product_id'], 'name' => $product['name'], 'model' => $product['model'], 'option' => $option_data, 'download' => $product['download'], 'quantity' => $product['quantity'], 'subtract' => $product['subtract'], 'price' => $product['price'], 'total' => $product['total'], 'tax' => $this->tax->getTax($product['total'], $product['tax_class_id']));
}
// Gift Voucher
if (isset($this->session->data['vouchers']) && $this->session->data['vouchers']) {
foreach ($this->session->data['vouchers'] as $voucher) {
$product_data[] = array('product_id' => 0, 'name' => $voucher['description'], 'model' => '', 'option' => array(), 'download' => array(), 'quantity' => 1, 'subtract' => false, 'price' => $voucher['amount'], 'total' => $voucher['amount'], 'tax' => 0);
}
}
$data['products'] = $product_data;
$data['totals'] = $total_data;
$data['comment'] = $this->session->data['comment'];
$data['total'] = $total;
$data['reward'] = $this->cart->getTotalRewardPoints();
if (isset($this->request->cookie['tracking'])) {
$this->load->model('affiliate/affiliate');
$affiliate_info = $this->model_affiliate_affiliate->getAffiliateByCode($this->request->cookie['tracking']);
if ($affiliate_info) {
$data['affiliate_id'] = $affiliate_info['affiliate_id'];
$data['commission'] = $total / 100 * $affiliate_info['commission'];
} else {
$data['affiliate_id'] = 0;
$data['commission'] = 0;
}
} else {
$data['affiliate_id'] = 0;
$data['commission'] = 0;
}
$data['language_id'] = $this->config->get('config_language_id');
$data['currency_id'] = $this->currency->getId();
$data['currency_code'] = $this->currency->getCode();
$data['currency_value'] = $this->currency->getValue($this->currency->getCode());
$data['ip'] = $this->request->server['REMOTE_ADDR'];
$this->load->model('checkout/order');
$this->session->data['order_id'] = $this->model_checkout_order->create($data);
// Gift Voucher
if (isset($this->session->data['vouchers']) && is_array($this->session->data['vouchers'])) {
$this->load->model('checkout/voucher');
foreach ($this->session->data['vouchers'] as $voucher) {
$this->model_checkout_voucher->addVoucher($this->session->data['order_id'], $voucher);
}
}
$this->data['column_name'] = $this->language->get('column_name');
$this->data['column_model'] = $this->language->get('column_model');
$this->data['column_quantity'] = $this->language->get('column_quantity');
$this->data['column_price'] = $this->language->get('column_price');
$this->data['column_total'] = $this->language->get('column_total');
$this->data['products'] = array();
foreach ($this->cart->getProducts() as $product) {
$option_data = array();
foreach ($product['option'] as $option) {
if ($option['type'] != 'file') {
$option_data[] = array('name' => $option['name'], 'value' => utf8_truncate($option['option_value']));
} else {
$this->load->library('encryption');
$encryption = new Encryption($this->config->get('config_encryption'));
$file = substr($encryption->decrypt($option['option_value']), 0, strrpos($encryption->decrypt($option['option_value']), '.'));
$option_data[] = array('name' => $option['name'], 'value' => utf8_truncate($file));
}
}
$this->data['products'][] = array('product_id' => $product['product_id'], 'name' => $product['name'], 'model' => $product['model'], 'option' => $option_data, 'quantity' => $product['quantity'], 'subtract' => $product['subtract'], 'tax' => $this->tax->getTax($product['total'], $product['tax_class_id']), 'price' => $this->currency->format($product['price']), 'total' => $this->currency->format($product['total']), 'href' => $this->url->link('product/product', 'product_id=' . $product['product_id']));
}
// Gift Voucher
$this->data['vouchers'] = array();
if (isset($this->session->data['vouchers']) && $this->session->data['vouchers']) {
foreach ($this->session->data['vouchers'] as $key => $voucher) {
$this->data['vouchers'][] = array('description' => $voucher['description'], 'amount' => $this->currency->format($voucher['amount']));
}
}
$this->data['totals'] = $total_data;
$this->data['payment'] = $this->getChild('payment/' . $this->session->data['payment_method']['code']);
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/checkout/confirm.tpl')) {
$this->template = $this->config->get('config_template') . '/template/checkout/confirm.tpl';
} else {
$this->template = 'default/template/checkout/confirm.tpl';
}
$json['output'] = $this->render();
}
$this->response->setOutput(json_encode($json));
}
示例9: GetMessage
function GetMessage($folderid, $id, $truncsize, $bodypreference = false, $optionbodypreference = false, $mimesupport = 0)
{
debugLog("IMAP-GetMessage: (fid: '" . $this->_folders[$folderid] . "' id: '" . $id . "' truncsize: {$truncsize})");
// Get flags, etc
$stat = $this->StatMessage($folderid, $id);
if ($stat) {
$this->imap_reopenFolder($folderid);
if (defined("IMAP_USE_FETCHHEADER") && IMAP_USE_FETCHHEADER === false) {
$mail = @imap_fetchbody($this->_mbox, $id, "", FT_UID | FT_PEEK);
} else {
$mail = @imap_fetchheader($this->_mbox, $id, FT_UID) . @imap_body($this->_mbox, $id, FT_PEEK | FT_UID);
}
// Return in case any errors occured...
$errors = imap_errors();
if (is_array($errors)) {
foreach ($errors as $e) {
debugLog("IMAP-errors: {$e}");
$fields = explode(':', $e);
switch (strtolower(trim($fields[0]))) {
case 'security problem':
// don't care about security problems!
break;
default:
return false;
}
}
}
$mobj = new Mail_mimeDecode($mail);
$message = $mobj->decode(array('decode_headers' => true, 'decode_bodies' => true, 'rfc_822bodies' => true, 'include_bodies' => true, 'input' => $mail, 'crlf' => "\n", 'charset' => BACKEND_CHARSET));
$output = new SyncMail();
// start AS12 Stuff (bodypreference === false) case = old behaviour
if ($bodypreference === false) {
$body = $this->getBody($message);
$body = str_replace("\n", "\r\n", str_replace("\r", "", $body));
// truncate body, if requested
if (strlen($body) > $truncsize) {
$body = utf8_truncate($body, $truncsize);
$output->bodytruncated = 1;
} else {
$body = $body;
$output->bodytruncated = 0;
}
$output->bodysize = strlen($body);
$output->body = $body;
} else {
if (isset($bodypreference[1]) && !isset($bodypreference[1]["TruncationSize"])) {
$bodypreference[1]["TruncationSize"] = 1024 * 1024;
}
if (isset($bodypreference[2]) && !isset($bodypreference[2]["TruncationSize"])) {
$bodypreference[2]["TruncationSize"] = 1024 * 1024;
}
if (isset($bodypreference[3]) && !isset($bodypreference[3]["TruncationSize"])) {
$bodypreference[3]["TruncationSize"] = 1024 * 1024;
}
if (isset($bodypreference[4]) && !isset($bodypreference[4]["TruncationSize"])) {
$bodypreference[4]["TruncationSize"] = 1024 * 1024;
}
$output->airsyncbasebody = new SyncAirSyncBaseBody();
debugLog("airsyncbasebody!");
$body = "";
$this->getBodyRecursive($message, "html", $body);
if ($body != "") {
$output->airsyncbasenativebodytype = 2;
} else {
$output->airsyncbasenativebodytype = 1;
$this->getBodyRecursive($message, "plain", $body);
}
$body = str_replace("\n", "\r\n", str_replace("\r", "", $body));
if (isset($bodypreference[4]) && ($mimesupport == 2 || $mimesupport == 1 && strtolower($message->ctype_secondary) == 'signed')) {
debugLog("MIME Body");
$output->airsyncbasebody->type = 4;
$rawmessage = $mobj->decode(array('decode_headers' => false, 'decode_bodies' => true, 'rfc_822bodies' => true, 'include_bodies' => true, 'input' => $mail, 'crlf' => "\n", 'charset' => BACKEND_CHARSET));
$body = "";
foreach ($rawmessage->headers as $key => $value) {
if ($key != "content-type" && $key != "mime-version" && $key != "content-transfer-encoding" && !is_array($value)) {
$body .= $key . ":";
// Split -> Explode replace
$tokens = explode(" ", trim($value));
$line = "";
foreach ($tokens as $valu) {
if (strlen($line) + strlen($valu) + 2 > 60) {
$line .= "\n";
$body .= $line;
$line = " " . $valu;
} else {
$line .= " " . $valu;
}
}
$body .= $line . "\n";
}
}
unset($rawmessage);
$mimemsg = new Mail_mime(array('head_encoding' => 'quoted-printable', 'text_encoding' => 'quoted-printable', 'html_encoding' => 'base64', 'head_charset' => 'utf-8', 'text_charset' => 'utf-8', 'html_charset' => 'utf-8', 'eol' => "\n", 'delay_file_io' => false));
$this->getAllAttachmentsRecursive($message, $mimemsg);
if ($output->airsyncbasenativebodytype == 1) {
$this->getBodyRecursive($message, "plain", $plain);
$this->getBodyRecursive($message, "html", $html);
if ($html == "") {
$this->getBodyRecursive($message, "plain", $html);
}
//.........这里部分代码省略.........
示例10: info
//.........这里部分代码省略.........
$this->data['text_shipping_method'] = $this->language->get('text_shipping_method');
$this->data['text_shipping_address'] = $this->language->get('text_shipping_address');
$this->data['text_payment_method'] = $this->language->get('text_payment_method');
$this->data['text_payment_address'] = $this->language->get('text_payment_address');
$this->data['text_history'] = $this->language->get('text_history');
$this->data['text_comment'] = $this->language->get('text_comment');
$this->data['text_action'] = $this->language->get('text_action');
$this->data['text_selected'] = $this->language->get('text_selected');
$this->data['text_reorder'] = $this->language->get('text_reorder');
$this->data['text_return'] = $this->language->get('text_return');
$this->data['column_name'] = $this->language->get('column_name');
$this->data['column_model'] = $this->language->get('column_model');
$this->data['column_quantity'] = $this->language->get('column_quantity');
$this->data['column_price'] = $this->language->get('column_price');
$this->data['column_total'] = $this->language->get('column_total');
$this->data['column_date_added'] = $this->language->get('column_date_added');
$this->data['column_status'] = $this->language->get('column_status');
$this->data['column_comment'] = $this->language->get('column_comment');
$this->data['button_continue'] = $this->language->get('button_continue');
if (isset($this->error['warning'])) {
$this->data['error_warning'] = $this->error['warning'];
} else {
$this->data['error_warning'] = '';
}
$this->data['action'] = $this->url->link('account/order/info', 'order_id=' . $this->request->get['order_id'], 'SSL');
if ($order_info['invoice_no']) {
$this->data['invoice_no'] = $order_info['invoice_prefix'] . $order_info['invoice_no'];
} else {
$this->data['invoice_no'] = '';
}
$this->data['order_id'] = $this->request->get['order_id'];
$this->data['date_added'] = date($this->language->get('date_format_short'), strtotime($order_info['date_added']));
if ($order_info['shipping_address_format']) {
$format = $order_info['shipping_address_format'];
} else {
$format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}';
}
$find = array('{firstname}', '{lastname}', '{company}', '{address_1}', '{address_2}', '{city}', '{postcode}', '{zone}', '{zone_code}', '{country}');
$replace = array('firstname' => $order_info['shipping_firstname'], 'lastname' => $order_info['shipping_lastname'], 'company' => $order_info['shipping_company'], 'address_1' => $order_info['shipping_address_1'], 'address_2' => $order_info['shipping_address_2'], 'city' => $order_info['shipping_city'], 'postcode' => $order_info['shipping_postcode'], 'zone' => $order_info['shipping_zone'], 'zone_code' => $order_info['shipping_zone_code'], 'country' => $order_info['shipping_country']);
$this->data['shipping_address'] = str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\\s\\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format))));
$this->data['shipping_method'] = $order_info['shipping_method'];
if ($order_info['payment_address_format']) {
$format = $order_info['payment_address_format'];
} else {
$format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}';
}
$find = array('{firstname}', '{lastname}', '{company}', '{address_1}', '{address_2}', '{city}', '{postcode}', '{zone}', '{zone_code}', '{country}');
$replace = array('firstname' => $order_info['payment_firstname'], 'lastname' => $order_info['payment_lastname'], 'company' => $order_info['payment_company'], 'address_1' => $order_info['payment_address_1'], 'address_2' => $order_info['payment_address_2'], 'city' => $order_info['payment_city'], 'postcode' => $order_info['payment_postcode'], 'zone' => $order_info['payment_zone'], 'zone_code' => $order_info['payment_zone_code'], 'country' => $order_info['payment_country']);
$this->data['payment_address'] = str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\\s\\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format))));
$this->data['payment_method'] = $order_info['payment_method'];
$this->data['products'] = array();
$products = $this->model_account_order->getOrderProducts($this->request->get['order_id']);
foreach ($products as $product) {
$option_data = array();
$options = $this->model_account_order->getOrderOptions($this->request->get['order_id'], $product['order_product_id']);
foreach ($options as $option) {
if ($option['type'] != 'file') {
$option_data[] = array('name' => $option['name'], 'value' => utf8_truncate($option['value']));
} else {
$filename = substr($option['value'], 0, strrpos($option['value'], '.'));
$option_data[] = array('name' => $option['name'], 'value' => utf8_truncate($filename));
}
}
$this->data['products'][] = array('order_product_id' => $product['order_product_id'], 'name' => $product['name'], 'model' => $product['model'], 'option' => $option_data, 'quantity' => $product['quantity'], 'price' => $this->currency->format($product['price'], $order_info['currency_code'], $order_info['currency_value']), 'total' => $this->currency->format($product['total'], $order_info['currency_code'], $order_info['currency_value']), 'selected' => isset($this->request->post['selected']) && in_array($result['order_product_id'], $this->request->post['selected']));
}
$this->data['totals'] = $this->model_account_order->getOrderTotals($this->request->get['order_id']);
$this->data['comment'] = $order_info['comment'];
$this->data['histories'] = array();
$results = $this->model_account_order->getOrderHistories($this->request->get['order_id']);
foreach ($results as $result) {
$this->data['histories'][] = array('date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])), 'status' => $result['status'], 'comment' => nl2br($result['comment']));
}
$this->data['continue'] = $this->url->link('account/order', '', 'SSL');
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/account/order_info.tpl')) {
$this->template = $this->config->get('config_template') . '/template/account/order_info.tpl';
} else {
$this->template = 'default/template/account/order_info.tpl';
}
$this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header');
$this->response->setOutput($this->render());
} else {
$this->document->setTitle($this->language->get('text_order'));
$this->data['heading_title'] = $this->language->get('text_order');
$this->data['text_error'] = $this->language->get('text_error');
$this->data['button_continue'] = $this->language->get('button_continue');
$this->data['breadcrumbs'] = array();
$this->data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home'), 'separator' => false);
$this->data['breadcrumbs'][] = array('text' => $this->language->get('text_account'), 'href' => $this->url->link('account/account', '', 'SSL'), 'separator' => $this->language->get('text_separator'));
$this->data['breadcrumbs'][] = array('text' => $this->language->get('heading_title'), 'href' => $this->url->link('account/order', '', 'SSL'), 'separator' => $this->language->get('text_separator'));
$this->data['breadcrumbs'][] = array('text' => $this->language->get('text_order'), 'href' => $this->url->link('account/order/info', 'order_id=' . $order_id, 'SSL'), 'separator' => $this->language->get('text_separator'));
$this->data['continue'] = $this->url->link('account/order', '', 'SSL');
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/error/not_found.tpl')) {
$this->template = $this->config->get('config_template') . '/template/error/not_found.tpl';
} else {
$this->template = 'default/template/error/not_found.tpl';
}
$this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header');
$this->response->setOutput($this->render());
}
}
示例11: info
//.........这里部分代码省略.........
if (isset($this->error['warning'])) {
$this->data['error_warning'] = $this->error['warning'];
} else {
$this->data['error_warning'] = '';
}
$this->data['action'] = $this->url->link('account/order/info', 'order_id=' . $this->request->get['order_id'], 'SSL');
if ($order_info['invoice_no']) {
$this->data['invoice_no'] = $order_info['invoice_prefix'] . $order_info['invoice_no'];
} else {
$this->data['invoice_no'] = '';
}
$this->data['order_id'] = $this->request->get['order_id'];
$this->data['date_added'] = date($this->language->get('date_format_short'), strtotime($order_info['date_added']));
if ($order_info['shipping_address_format']) {
$format = $order_info['shipping_address_format'];
} else {
$format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}';
}
$find = array('{firstname}', '{lastname}', '{company}', '{address_1}', '{address_2}', '{city}', '{postcode}', '{zone}', '{zone_code}', '{country}');
$replace = array('firstname' => $order_info['shipping_firstname'], 'lastname' => $order_info['shipping_lastname'], 'company' => $order_info['shipping_company'], 'address_1' => $order_info['shipping_address_1'], 'address_2' => $order_info['shipping_address_2'], 'city' => $order_info['shipping_city'], 'postcode' => $order_info['shipping_postcode'], 'zone' => $order_info['shipping_zone'], 'zone_code' => $order_info['shipping_zone_code'], 'country' => $order_info['shipping_country']);
$this->data['shipping_address'] = str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\\s\\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format))));
$this->data['shipping_method'] = ShippingMethodDAO::getInstance()->getMethod(explode('.', $order_info['shipping_method'])[0])->getName();
if ($order_info['payment_address_format']) {
$format = $order_info['payment_address_format'];
} else {
$format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}';
}
$find = array('{firstname}', '{lastname}', '{company}', '{address_1}', '{address_2}', '{city}', '{postcode}', '{zone}', '{zone_code}', '{country}');
$replace = array('firstname' => $order_info['payment_firstname'], 'lastname' => $order_info['payment_lastname'], 'company' => $order_info['payment_company'], 'address_1' => $order_info['payment_address_1'], 'address_2' => $order_info['payment_address_2'], 'city' => $order_info['payment_city'], 'postcode' => $order_info['payment_postcode'], 'zone' => $order_info['payment_zone'], 'zone_code' => $order_info['payment_zone_code'], 'country' => $order_info['payment_country']);
$this->data['payment_address'] = str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\\s\\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format))));
$this->data['payment_method'] = $order_info['payment_method'];
// ----- deposit modules START -----
$this->data['text_payment_method'] = '';
$this->load->model('account/multi_pay');
$this->data['payment_method'] = $this->model_account_multi_pay->order_info($order_info);
// ----- deposit modules END -----
$this->data['products'] = array();
// $orderItems = OrderItemDAO::getInstance()->getOrderItems(
// array('filterOrderId' => $this->request->get['order_id']), null, true
// );
// $products = $this->model_account_order->getOrderProducts($this->request->get['order_id']);
foreach ($orderItems as $orderItem) {
$actions = array();
if (($orderItem->getStatusId() & 0xffff) <= 2) {
$actions[] = array('text' => $this->language->get('CANCEL'), 'href' => $this->url->link('account/orderItems/cancel', 'orderItemId=' . $orderItem->getId() . '&returnUrl=' . urlencode($this->selfUrl)));
}
$option_data = array();
$options = OrderItemDAO::getInstance()->getOptions($orderItem->getId());
foreach ($options as $option) {
if ($option['type'] != 'file') {
$option_data[] = array('name' => $option['name'], 'value' => utf8_truncate($option['value']));
} else {
$filename = substr($option['value'], 0, strrpos($option['value'], '.'));
$option_data[] = array('name' => $option['name'], 'value' => utf8_truncate($filename));
}
}
$product_image = ProductDAO::getInstance()->getImage($orderItem->getProductId());
if ($orderItem->getImagePath() == '' || $orderItem->getImagePath() == "data/event/agent-moomidae.jpg") {
$options = OrderItemDAO::getInstance()->getOptions($orderItem->getId());
$itemUrl = !empty($options[REPURCHASE_ORDER_IMAGE_URL_OPTION_ID]['value']) ? $options[REPURCHASE_ORDER_IMAGE_URL_OPTION_ID]['value'] : '';
$orderItem->setImagePath(!empty($itemUrl) ? $itemUrl : $orderItem->getImagePath());
}
if ($orderItem->getImagePath() && file_exists(DIR_IMAGE . $orderItem->getImagePath())) {
$image = $this->modelToolImage->resize($orderItem->getImagePath(), 100, 100);
} else {
$image = $this->modelToolImage->resize($product_image, 100, 100);
}
$this->data['products'][] = array('order_product_id' => $orderItem->getId(), 'actions' => $actions, 'comment' => $orderItem->getPublicComment(), 'name' => $orderItem->getName(), 'model' => $orderItem->getModel(), 'option' => $option_data, 'quantity' => $orderItem->getModel(), 'price' => $this->getCurrency()->format($orderItem->getPrice(true), $order_info['currency_code'], 1), 'total' => $this->getCurrency()->format($orderItem->getTotal(true), $order_info['currency_code'], 1), 'imagePath' => $image, 'item_status' => Status::getStatus($orderItem->getStatusId(), $this->config->get('language_id'), true), 'selected' => false);
}
$this->data['totals'] = $this->model_account_order->getOrderTotals($this->request->get['order_id']);
$this->data['comment'] = $order_info['comment'];
$this->data['histories'] = array();
$results = $this->model_account_order->getOrderHistories($this->request->get['order_id']);
foreach ($results as $result) {
$this->data['histories'][] = array('date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])), 'status' => $result['status'], 'comment' => nl2br($result['comment']));
}
$this->data['continue'] = $this->url->link('account/order', '', 'SSL');
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/account/order_info.tpl.php')) {
$this->template = $this->config->get('config_template') . '/template/account/order_info.tpl.php';
} else {
$this->template = 'default/template/account/order_info.tpl.php';
}
$this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header');
$this->getResponse()->setOutput($this->render());
} else {
$this->document->setTitle($this->language->get('text_order'));
$this->data['heading_title'] = $this->language->get('text_order');
$this->data['text_error'] = $this->language->get('text_error');
$this->data['button_continue'] = $this->language->get('button_continue');
$this->setBreadcrumbs();
$this->data['continue'] = $this->url->link('account/order', '', 'SSL');
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/error/not_found.tpl')) {
$this->template = $this->config->get('config_template') . '/template/error/not_found.tpl';
} else {
$this->template = 'default/template/error/not_found.tpl';
}
$this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header');
$this->getResponse()->setOutput($this->render());
}
}
示例12: index
//.........这里部分代码省略.........
// $result['description'] = preg_replace_callback(
// '/\{ (.*?) \}/xs',
// function ($m) {
// $ar = explode("|", $m[1]);
// return $ar[array_rand($ar, 1)];
// },
// $result['description']
// );
#kabantejay synonymizer end
$this->data['products'] = array();
if (isset($this->request->get['filter_name']) || isset($this->request->get['filter_tag'])) {
$filter = new FilterTree(['filterEnabled' => true, 'filterCategoryId' => $filter_category_id, 'filterSubCategories' => $filter_sub_category], 'AND', new FilterTree(['filterName' => $filter_name], 'OR', new FilterTree(['filterModel' => $filter_name], 'OR', new FilterTree(['filterTag' => $filter_name]))), true);
$data = array('filterEnabled' => true, 'filterName' => $filter_name, 'filterCategoryId' => $filter_category_id, 'filterSubCategories' => $filter_sub_category, 'sort' => $sort, 'order' => $order, 'start' => ($page - 1) * $limit, 'limit' => $limit);
$product_total = ProductDAO::getInstance()->getProductsCount($filter);
$results = ProductDAO::getInstance()->getProducts($filter, $sort, $order, ($page - 1) * $limit, $limit);
if ($sort == null) {
$results = $this->sortByRelevance($results, $filter_name);
}
foreach ($results as $product) {
if ($product->getImagePath()) {
$image = ImageService::getInstance()->resize($product->getImagePath(), $this->getConfig()->get('config_image_product_width'), $this->getConfig()->get('config_image_product_height'));
} else {
$image = false;
}
if ($this->getConfig()->get('config_customer_price') && $this->customer->isLogged() || !$this->getConfig()->get('config_customer_price')) {
$price = $this->getCurrency()->format($product->getPrice());
} else {
$price = false;
}
if ((double) $product->getSpecialPrice($this->getCurrentCustomer()->getCustomerGroupId())) {
$special = $this->getCurrency()->format($product->getSpecialPrice($this->getCurrentCustomer()->getCustomerGroupId()));
} else {
$special = false;
}
//
// if ($this->getConfig()->get('config_review_status')) {
// $rating = (int)$product->getRating();
// } else {
// $rating = false;
// }
$this->data['products'][] = array('product_id' => $product->getId(), 'thumb' => $image, 'name' => $product->getName(), 'description' => !is_null($product->getDescriptions()->getDescription($this->getLanguage()->getId())) ? utf8_truncate(strip_tags(html_entity_decode($product->getDescriptions()->getDescription($this->getLanguage()->getId())->getDescription(), ENT_QUOTES, 'UTF-8')), 400, ' …', true) : '', 'price' => $price, 'special' => $special, 'rating' => $product->getRating(), 'reviews' => sprintf($this->getLanguage()->get('text_reviews'), (int) $product->getReviewsCount()), 'href' => $this->getUrl()->link('product/product', $url . '&product_id=' . $product->getId()));
}
$url = '';
if (isset($this->request->get['filter_name'])) {
$url .= '&filter_name=' . $this->request->get['filter_name'];
}
if (isset($this->request->get['filter_tag'])) {
$url .= '&filter_tag=' . $this->request->get['filter_tag'];
}
if (isset($this->request->get['filter_description'])) {
$url .= '&filter_description=' . $this->request->get['filter_description'];
}
if (isset($this->request->get['filter_category_id'])) {
$url .= '&filter_category_id=' . $this->request->get['filter_category_id'];
}
if (isset($this->request->get['filter_sub_category'])) {
$url .= '&filter_sub_category=' . $this->request->get['filter_sub_category'];
}
$this->data['sorts'] = array();
// $this->data['sorts'][] = array(
// 'text' => $this->getLanguage()->get('text_default'),
// 'value' => 'p.sort_order-ASC',
// 'href' => $this->getUrl()->link('product/search', 'sort=p.sort_order&order=ASC' . $url)
// );
$this->data['sorts'][] = array('text' => $this->getLanguage()->get('RELEVANCE'), 'value' => null, 'href' => $this->getUrl()->link('product/search', '' . $url));
$this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->getUrl()->link('product/search', 'sort=pd.name&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->getUrl()->link('product/search', 'sort=pd.name&order=DESC' . $url));
$this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_price_asc'), 'value' => 'p.price-ASC', 'href' => $this->getUrl()->link('product/search', 'sort=p.price&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_price_desc'), 'value' => 'p.price-DESC', 'href' => $this->getUrl()->link('product/search', 'sort=p.price&order=DESC' . $url));
$this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->getUrl()->link('product/search', 'sort=rating&order=DESC' . $url));
$this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->getUrl()->link('product/search', 'sort=rating&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => $this->getUrl()->link('product/search', 'sort=p.model&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => $this->getUrl()->link('product/search', 'sort=p.model&order=DESC' . $url));
$this->data['limits'] = array();
$this->data['limits'][] = array('text' => $this->getConfig()->get('config_catalog_limit'), 'value' => $this->getConfig()->get('config_catalog_limit'), 'href' => $this->getUrl()->link('product/search', $url . '&limit=' . $this->getConfig()->get('config_catalog_limit')));
$this->data['limits'][] = array('text' => 25, 'value' => 25, 'href' => $this->getUrl()->link('product/search', $url . '&limit=25'));
$this->data['limits'][] = array('text' => 50, 'value' => 50, 'href' => $this->getUrl()->link('product/search', $url . '&limit=50'));
$this->data['limits'][] = array('text' => 75, 'value' => 75, 'href' => $this->getUrl()->link('product/search', $url . '&limit=75'));
$this->data['limits'][] = array('text' => 100, 'value' => 100, 'href' => $this->getUrl()->link('product/search', $url . '&limit=100'));
$pagination = new Pagination();
$pagination->total = $product_total;
$pagination->page = $page;
$pagination->limit = $limit;
$pagination->text = $this->getLanguage()->get('text_pagination');
$pagination->url = $this->getUrl()->link('product/search', $url . '&page={page}');
$this->data['pagination'] = $pagination->render();
}
$this->data['filter_name'] = $filter_name;
// $this->data['filter_description'] = $filter_description;
$this->data['filter_category_id'] = $filter_category_id;
$this->data['filter_sub_category'] = $filter_sub_category;
$this->data['sort'] = $sort;
$this->data['order'] = $order;
$this->data['limit'] = $limit;
$this->setBreadcrumbs();
$this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header');
$templateFile = '/template/product/search.tpl.php';
$templateDir = file_exists(DIR_TEMPLATE . $this->getConfig()->get('config_template') . $templateFile) ? $this->getConfig()->get('config_template') : ($templateDir = 'default');
$this->getResponse()->setOutput($this->render($templateDir . $templateFile));
}
示例13: index
public function index()
{
$this->language->load('product/special');
if (isset($this->request->get['sort'])) {
$sort = $this->request->get['sort'];
} else {
$sort = 'p.sort_order';
}
if (isset($this->request->get['order'])) {
$order = $this->request->get['order'];
} else {
$order = 'ASC';
}
if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}
if (isset($this->request->get['limit'])) {
$limit = $this->request->get['limit'];
} else {
$limit = $this->getConfig()->get('config_catalog_limit');
}
$this->document->setTitle($this->language->get('heading_title'));
$url = '';
if (isset($this->request->get['sort'])) {
$url .= '&sort=' . $this->request->get['sort'];
}
if (isset($this->request->get['order'])) {
$url .= '&order=' . $this->request->get['order'];
}
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['heading_title'] = $this->language->get('heading_title');
$this->data['compare'] = $this->getUrl()->link('product/compare');
$this->data['products'] = array();
$data = array('sort' => $sort, 'order' => $order, 'start' => ($page - 1) * $limit, 'limit' => $limit);
$customerGroupId = $this->getCurrentCustomer()->isLogged() ? $this->getCurrentCustomer()->getCustomerGroupId() : $this->getConfig()->get('config_customer_group_id');
$product_total = ProductDAO::getInstance()->getProductsCount($data);
$products = ProductDAO::getInstance()->getDiscountedProductsByCustomerGroupId($customerGroupId, $sort, $order, ($page - 1) * $limit, $limit);
foreach ($products as $product) {
#kabantejay synonymizer start
if (is_null($product->getDescriptions()) || is_null($product->getDescriptions()->getDescription($this->getLanguage()->getId()))) {
$productDescription = '';
} else {
$productDescription = preg_replace_callback('/\\{ (.*?) \\}/xs', function ($m) {
$ar = explode("|", $m[1]);
return $ar[array_rand($ar, 1)];
}, $product->getDescriptions()->getDescription($this->getLanguage()->getId())->getDescription());
}
#kabantejay synonymizer end
if ($product->getImagePath()) {
$image = ImageService::getInstance()->resize($product->getImagePath(), $this->getConfig()->get('config_image_product_width'), $this->getConfig()->get('config_image_product_height'));
} else {
$image = false;
}
if ($this->getConfig()->get('config_customer_price') && $this->customer->isLogged() || !$this->getConfig()->get('config_customer_price')) {
$price = $this->getCurrency()->format($product->getPrice());
} else {
$price = false;
}
if ((double) $product->getSpecialPrice($customerGroupId)) {
$special = $this->getCurrency()->format($product->getSpecialPrice($customerGroupId));
} else {
$special = false;
}
if ($this->getConfig()->get('config_tax')) {
$tax = $this->getCurrency()->format((double) $product->getSpecialPrice($customerGroupId) ? $product->getSpecialPrice($customerGroupId) : $product->getPrice());
} else {
$tax = false;
}
$this->data['products'][] = array('product_id' => $product->getId(), 'thumb' => $image, 'name' => $product->getName(), 'description' => utf8_truncate(strip_tags(html_entity_decode($productDescription, ENT_QUOTES, 'UTF-8')), 400, ' …', true), 'price' => $price, 'special' => $special, 'tax' => $tax, 'rating' => $product->getRating(), 'reviews' => sprintf($this->language->get('text_reviews'), (int) $product->getReviewsCount()), 'href' => $this->getUrl()->link('product/product', $url . '&product_id=' . $product->getId()));
}
$url = '';
if (isset($this->request->get['limit'])) {
$url .= '&limit=' . $this->request->get['limit'];
}
$this->data['sorts'] = array();
$this->data['sorts'][] = array('text' => $this->language->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => $this->getUrl()->link('product/special', 'sort=p.sort_order&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->getUrl()->link('product/special', 'sort=pd.name&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->getUrl()->link('product/special', 'sort=pd.name&order=DESC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_price_asc'), 'value' => 'ps.price-ASC', 'href' => $this->getUrl()->link('product/special', 'sort=ps.price&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_price_desc'), 'value' => 'special-DESC', 'href' => $this->getUrl()->link('product/special', 'sort=special&order=DESC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->getUrl()->link('product/special', 'sort=rating&order=DESC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->getUrl()->link('product/special', 'sort=rating&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => $this->getUrl()->link('product/special', 'sort=p.model&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => $this->getUrl()->link('product/special', 'sort=p.model&order=DESC' . $url));
$url = '';
if (isset($this->request->get['sort'])) {
$url .= '&sort=' . $this->request->get['sort'];
}
if (isset($this->request->get['order'])) {
$url .= '&order=' . $this->request->get['order'];
}
$this->data['limits'] = array();
$this->data['limits'][] = array('text' => $this->getConfig()->get('config_catalog_limit'), 'value' => $this->getConfig()->get('config_catalog_limit'), 'href' => $this->getUrl()->link('product/special', $url . '&limit=' . $this->getConfig()->get('config_catalog_limit')));
//.........这里部分代码省略.........
示例14: product
public function product()
{
$manufacturer = ManufacturerDAO::getInstance()->getManufacturer($this->parameters['manufacturerId']);
if ($manufacturer) {
if (!is_null($manufacturer->getDescription($this->getLanguage()->getId())) && !is_null($manufacturer->getDescription($this->getLanguage()->getId())->getSeoTitle())) {
$this->document->setTitle($manufacturer->getDescription($this->getLanguage()->getId())->getSeoTitle());
} else {
$this->document->setTitle($manufacturer->getName());
}
if (!is_null($manufacturer->getDescription($this->getLanguage()->getId())) && !is_null($manufacturer->getDescription($this->getLanguage()->getId())->getMetaDescription())) {
$this->document->setDescription($manufacturer->getDescription($this->getLanguage()->getId())->getMetaDescription());
}
if (!is_null($manufacturer->getDescription($this->getLanguage()->getId())) && !is_null($manufacturer->getDescription($this->getLanguage()->getId())->getMetaKeyword())) {
$this->document->setKeywords($manufacturer->getDescription($this->getLanguage()->getId())->getMetaKeyword());
}
if (!is_null($manufacturer->getDescription($this->getLanguage()->getId())) && !is_null($manufacturer->getDescription($this->getLanguage()->getId())->getSeoH1())) {
$this->data['seo_h1'] = $manufacturer->getDescription($this->getLanguage()->getId())->getSeoH1();
}
$this->data = array_merge($this->data, $this->parameters);
$this->data['heading_title'] = $manufacturer->getName();
$this->data['compare'] = $this->getUrl()->link('product/compare');
$url = '';
if (isset($this->request->get['sort'])) {
$url .= '&sort=' . $this->request->get['sort'];
}
if (isset($this->request->get['order'])) {
$url .= '&order=' . $this->request->get['order'];
}
if (isset($this->request->get['page'])) {
$url .= '&page=' . $this->request->get['page'];
}
if (isset($this->request->get['limit'])) {
$url .= '&limit=' . $this->request->get['limit'];
}
#kabantejay synonymizer start
$this->data['description'] = preg_replace_callback('/\\{ (.*?) \\}/xs', function ($m) {
$ar = explode("|", $m[1]);
return $ar[array_rand($ar, 1)];
}, html_entity_decode(!is_null($manufacturer->getDescription($this->getLanguage()->getId())) ? $manufacturer->getDescription($this->getLanguage()->getId())->getDescription() : "", ENT_QUOTES, 'UTF-8'));
#kabantejay synonymizer end
$this->data['products'] = array();
$data = array('filterManufacturerId' => $this->parameters['manufacturerId'], 'sort' => $this->parameters['sort'], 'order' => $this->parameters['order'], 'start' => ($this->parameters['page'] - 1) * $this->parameters['limit'], 'limit' => $this->parameters['limit']);
$product_total = ProductDAO::getInstance()->getProductsCount($data);
$products = ProductDAO::getInstance()->getProducts($data, $this->parameters['sort'], $this->parameters['order'], ($this->parameters['page'] - 1) * $this->parameters['limit'], $this->parameters['limit']);
foreach ($products as $product) {
if ($product->getImagePath()) {
$image = ImageService::getInstance()->resize($product->getImagePath(), $this->getConfig()->get('config_image_product_width'), $this->getConfig()->get('config_image_product_height'));
} else {
$image = false;
}
if ($this->getConfig()->get('config_customer_price') && $this->customer->isLogged() || !$this->getConfig()->get('config_customer_price')) {
// $price = $this->currency->format($this->tax->calculate($product->getPrice(), $product->getTaxClassId(), $this->getConfig()->get('config_tax')));
$price = $this->getCurrentCurrency()->format($product->getPrice());
} else {
$price = false;
}
if ((double) $product->getSpecialPrice($this->getCurrentCustomer()->getCustomerGroupId())) {
// $special = $this->currency->format($this->tax->calculate($product->getSpecials(), $product->getTaxClassId(), $this->getConfig()->get('config_tax')));
$special = $this->getCurrentCurrency()->format($product->getSpecialPrice($this->getCurrentCustomer()->getCustomerGroupId()));
} else {
$special = false;
}
// if ($this->getConfig()->get('config_tax')) {
// $tax = $this->currency->format((float)$product->getSpecial() ? $product->getSpecial() : $product->getPrice());
// } else {
// $tax = false;
// }
// #kabantejay synonymizer start
if (is_null($product->getDescriptions())) {
$description = '';
} else {
$description = preg_replace_callback('/\\{ (.*?) \\}/xs', function ($m) {
$ar = explode("|", $m[1]);
return $ar[array_rand($ar, 1)];
}, $product->getDescriptions()->getDescription($this->getLanguage()->getId()));
}
// #kabantejay synonymizer end
$this->data['products'][] = array('product_id' => $product->getId(), 'thumb' => $image, 'name' => $product->getName(), 'description' => utf8_truncate(strip_tags(html_entity_decode($description, ENT_QUOTES, 'UTF-8')), 400, ' …', true), 'price' => $price, 'special' => $special, 'rating' => $this->getConfig()->get('config_review_status') ? $product->getRating() : false, 'reviews' => sprintf($this->getLanguage()->get('text_reviews'), $product->getReviewsCount()), 'href' => $this->getUrl()->link('product/product', $url . '&manufacturer_id=' . $product->getManufacturer()->getId() . '&product_id=' . $product->getId()));
}
$url = '';
if (isset($this->request->get['limit'])) {
$url .= '&limit=' . $this->request->get['limit'];
}
$this->data['sorts'] = array();
$this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=p.sort_order&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=pd.name&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=pd.name&order=DESC' . $url));
$this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_price_asc'), 'value' => 'p.price-ASC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=p.price&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_price_desc'), 'value' => 'p.price-DESC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=p.price&order=DESC' . $url));
$this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=rating&order=DESC' . $url));
$this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=rating&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=p.model&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->getLanguage()->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => $this->getUrl()->link('product/manufacturer/product', 'manufacturer_id=' . $this->request->get['manufacturer_id'] . '&sort=p.model&order=DESC' . $url));
$url = '';
if (isset($this->request->get['sort'])) {
$url .= '&sort=' . $this->request->get['sort'];
}
if (isset($this->request->get['order'])) {
$url .= '&order=' . $this->request->get['order'];
}
//.........这里部分代码省略.........
示例15: index
//.........这里部分代码省略.........
#kabantejay synonymizer start
if (!isset($result['manufacturer'])) {
$brand = '';
} else {
$brand = $result['manufacturer'];
}
if (!isset($razdel)) {
$razdel = '';
}
if (!isset($result['name'])) {
$syncat = '';
} else {
$syncat = $category_info['name'];
}
if (!isset($result['model'])) {
$synmod = '';
} else {
$synmod = $result['model'];
}
if ($special == false) {
$synprice = $price;
} else {
$synprice = $special;
}
$syntext = array(array("%H1%", $result['name']), array("%BRAND%", $brand), array("%RAZDEL%", $razdel), array("%CATEGORY%", $syncat), array("%MODEL%", $synmod), array("%PRICE%", $synprice));
for ($it = 0; $it < 6; $it++) {
$result['description'] = str_replace($syntext[$it][0], $syntext[$it][1], $result['description']);
}
$result['description'] = preg_replace_callback('/\\{ (.*?) \\}/xs', function ($m) {
$ar = explode("|", $m[1]);
return $ar[array_rand($ar, 1)];
}, $result['description']);
#kabantejay synonymizer end
$this->data['products'][] = array('product_id' => $result['product_id'], 'thumb' => $image, 'name' => $result['name'], 'description' => utf8_truncate(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 400, ' …', true), 'price' => $price, 'isSaler' => $this->data['isSaler'], 'special' => $special, 'tax' => $tax, 'rating' => $result['rating'], 'reviews' => sprintf($this->language->get('text_reviews'), (int) $result['reviews']), 'href' => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id']), 'hot' => $date_added + 86400 * $this->config->get('config_product_hotness_age') > time());
}
$url = '';
if (isset($this->request->get['limit'])) {
$url .= '&limit=' . $this->request->get['limit'];
}
$this->data['sorts'] = array();
$this->data['sorts'][] = array('text' => $this->language->get('text_default'), 'value' => 'p.sort_order-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.sort_order&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_name_asc'), 'value' => 'pd.name-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_name_desc'), 'value' => 'pd.name-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=pd.name&order=DESC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_price_asc'), 'value' => 'p.price-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_price_desc'), 'value' => 'p.price-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.price&order=DESC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_rating_desc'), 'value' => 'rating-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=DESC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_rating_asc'), 'value' => 'rating-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=rating&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_model_asc'), 'value' => 'p.model-ASC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=ASC' . $url));
$this->data['sorts'][] = array('text' => $this->language->get('text_model_desc'), 'value' => 'p.model-DESC', 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '&sort=p.model&order=DESC' . $url));
$url = '';
if (isset($this->request->get['sort'])) {
$url .= '&sort=' . $this->request->get['sort'];
}
if (isset($this->request->get['order'])) {
$url .= '&order=' . $this->request->get['order'];
}
$this->data['limits'] = array();
$this->data['limits'][] = array('text' => $this->config->get('config_catalog_limit'), 'value' => $this->config->get('config_catalog_limit'), 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&limit=' . $this->config->get('config_catalog_limit')));
$this->data['limits'][] = array('text' => 25, 'value' => 25, 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&limit=25'));
$this->data['limits'][] = array('text' => 50, 'value' => 50, 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&limit=50'));
$this->data['limits'][] = array('text' => 75, 'value' => 75, 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&limit=75'));
$this->data['limits'][] = array('text' => 100, 'value' => 100, 'href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url . '&limit=100'));
$url = '';
if (isset($this->request->get['sort'])) {
$url .= '&sort=' . $this->request->get['sort'];
}