本文整理汇总了PHP中Journal2Utils::resizeImage方法的典型用法代码示例。如果您正苦于以下问题:PHP Journal2Utils::resizeImage方法的具体用法?PHP Journal2Utils::resizeImage怎么用?PHP Journal2Utils::resizeImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Journal2Utils
的用法示例。
在下文中一共展示了Journal2Utils::resizeImage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: refine_images
public function refine_images()
{
if (!in_array($this->journal2->settings->get('refine_category'), array('grid', 'carousel'))) {
return;
}
if (!isset($this->request->get['route']) || $this->request->get['route'] !== 'product/category') {
return;
}
$path = isset($this->request->get['path']) ? $this->request->get['path'] : false;
if ($path) {
$this->load->model('catalog/category');
$parts = explode('_', (string) $path);
$category_id = (int) array_pop($parts);
$categories = $this->model_catalog_category->getCategories($category_id);
$image_width = $this->journal2->settings->get('refine_image_width', 175);
$image_height = $this->journal2->settings->get('refine_image_height', 175);
$image_type = $this->journal2->settings->get('refine_image_type', 'fit');
$data = array();
foreach ($categories as $category) {
$filters = array('filter_category_id' => $category['category_id'], 'filter_sub_category' => true);
if ($this->config->get('config_product_count')) {
$product_total = ' (' . $this->model_catalog_product->getTotalProducts($filters) . ')';
} else {
$product_total = '';
}
$data[] = array('name' => $category['name'] . $product_total, 'href' => $this->url->link('product/category', 'path=' . $path . '_' . $category['category_id']), 'thumb' => Journal2Utils::resizeImage($this->model_tool_image, $category, $image_width, $image_height, $image_type));
}
$this->journal2->settings->set('refine_category_images', $data);
}
}
示例2: index
public function index($setting)
{
if (!defined('JOURNAL_INSTALLED')) {
return;
}
Journal2::startTimer(get_class($this));
/* get module data from db */
$module_data = $this->model_journal2_module->getModule($setting['module_id']);
if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
return;
}
if (Journal2Utils::getProperty($module_data, 'module_data.disable_mobile') && (Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet())) {
return;
}
$cache_property = "module_journal_fullscreen_slider_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}";
$cache = $this->journal2->cache->get($cache_property);
if ($cache === null || self::$CACHEABLE !== true) {
$module = mt_rand();
$this->data['module'] = $module;
$this->data['transition'] = Journal2Utils::getProperty($module_data, 'module_data.transition', 'fade');
$this->data['transition_speed'] = Journal2Utils::getProperty($module_data, 'module_data.transition_speed', '700');
$this->data['transition_delay'] = Journal2Utils::getProperty($module_data, 'module_data.transition_delay', '3000');
if (Journal2Utils::getProperty($module_data, 'module_data.transparent_overlay', '')) {
$this->data['transparent_overlay'] = Journal2Utils::resizeImage($this->model_tool_image, Journal2Utils::getProperty($module_data, 'module_data.transparent_overlay', ''));
} else {
$this->data['transparent_overlay'] = '';
}
$this->data['images'] = array();
$images = Journal2Utils::getProperty($module_data, 'module_data.images', array());
$images = Journal2Utils::sortArray($images);
foreach ($images as $image) {
if (!$image['status']) {
continue;
}
$image = Journal2Utils::getProperty($image, 'image');
if (is_array($image)) {
$image = Journal2Utils::getProperty($image, $this->config->get('config_language_id'));
}
$this->data['images'][] = array('image' => Journal2Utils::resizeImage($this->model_tool_image, $image), 'title' => '');
}
$this->template = $this->config->get('config_template') . '/template/journal2/module/fullscreen_slider.tpl';
if (self::$CACHEABLE === true) {
$html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
$this->journal2->cache->set($cache_property, $html);
}
} else {
$this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
$this->data['cache'] = $cache;
}
$this->document->addStyle('catalog/view/theme/journal2/lib/supersized/css/supersized.css');
$this->document->addScript('catalog/view/theme/journal2/lib/supersized/js/jquery.easing.min.js');
$this->document->addScript('catalog/view/theme/journal2/lib/supersized/js/supersized.3.2.7.min.js');
$output = $this->render();
Journal2::stopTimer(get_class($this));
return $output;
}
示例3: index
public function index()
{
$this->load->model('journal2/search');
$this->load->model('catalog/product');
$this->load->model('tool/image');
$json = array('results' => array());
if (isset($this->request->get['search'])) {
$results = $this->model_journal2_search->search($this->request->get['search'], $this->journal2->settings->get('autosuggest_limit', 0), $this->journal2->settings->get('search_autocomplete_include_description', '1') === '1');
$image_width = $this->journal2->settings->get('autosuggest_product_image_width', 50);
$image_height = $this->journal2->settings->get('autosuggest_product_image_height', 50);
$image_type = $this->journal2->settings->get('autosuggest_product_image_type', 'fit');
foreach ($results as $result) {
$result = $this->model_catalog_product->getProduct($result['product_id']);
if (self::$SHOW_IMAGES) {
$image = Journal2Utils::resizeImage($this->model_tool_image, $result['image'], $image_width, $image_height, $image_type);
} else {
$image = null;
}
if (self::$SHOW_PRICE && ($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 = null;
}
if (self::$SHOW_PRICE && (double) $result['special']) {
$special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$special = null;
}
$json['results'][] = array('name' => html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8'), 'url' => htmlspecialchars_decode($this->url->link('product/product', '&product_id=' . $result['product_id'])), 'image' => $image, 'price' => $price, 'special' => $special);
}
if ($json['results']) {
$json['view_more_text'] = $this->journal2->settings->get('autosuggest_view_more_text', 'View More');
if (VERSION === '1.5.4' || VERSION === '1.5.4.1') {
$json['view_more_url'] = $this->url->link('product/search', '&filter_name=' . urlencode(html_entity_decode($this->request->get['search'], ENT_QUOTES, 'UTF-8')));
} else {
$json['view_more_url'] = $this->url->link('product/search', '&search=' . urlencode(html_entity_decode($this->request->get['search'], ENT_QUOTES, 'UTF-8')));
}
} else {
$this->language->load('product/search');
$json['view_more_text'] = $this->language->get('text_empty');
$json['view_more_url'] = '';
}
}
$this->response->setOutput(json_encode($json));
}
示例4: index
public function index($setting)
{
if (!defined('JOURNAL_INSTALLED')) {
return;
}
Journal2::startTimer(get_class($this));
$module_data = $this->model_journal2_module->getModule($setting['module_id']);
if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
return;
}
$module_data = $module_data['module_data'];
if (Journal2Utils::getProperty($module_data, 'hideonmobile') && Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet() && $this->journal2->settings->get('responsive_design')) {
return;
}
/* hide on desktop */
if (Journal2Utils::getProperty($module_data, 'disable_desktop') && !Journal2Cache::$mobile_detect->isMobile()) {
return;
}
/* css for top / bottom positions */
if (in_array($setting['position'], array('top', 'bottom'))) {
$padding = $this->journal2->settings->get('module_margins', 20) . 'px';
/* outer */
$css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'background'));
$css[] = 'padding-top: ' . Journal2Utils::getProperty($module_data, 'margin_top', 0) . 'px';
$css[] = 'padding-bottom: ' . Journal2Utils::getProperty($module_data, 'margin_bottom', 0) . 'px';
$this->journal2->settings->set('module_journal2_simple_slider_' . $setting['module_id'], implode('; ', $css));
}
$cache_property = "module_journal_simple_slider_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}";
$cache = $this->journal2->cache->get($cache_property);
if ($cache === null || self::$CACHEABLE !== true) {
$module = mt_rand();
/* slider position */
$height = Journal2Utils::getProperty($module_data, 'height', 400);
$width = null;
switch ($setting['position']) {
case 'column_left':
case 'column_right':
$width = 220;
$this->data['width'] = "max-width: {$width}px";
break;
case 'content_top':
case 'content_bottom':
if (Journal2Cache::$mobile_detect->isMobile() && !Journal2Cache::$mobile_detect->isTablet() && $this->journal2->settings->get('responsive_design')) {
$width = $this->journal2->settings->get('site_width', 1024);
} else {
if ($this->journal2->settings->get('extended_layout')) {
$width = $this->journal2->settings->get('site_width', 1024) - 240 * $this->journal2->settings->get('config_columns_count');
} else {
$width = $this->journal2->settings->get('site_width', 1024) - 40 - 240 * $this->journal2->settings->get('config_columns_count');
}
$height *= $width / $this->journal2->settings->get('site_width', 1024);
}
$this->data['width'] = "max-width: {$width}px";
break;
case 'top':
case 'bottom':
$width = $this->journal2->settings->get('site_width', 1024);
$this->data['width'] = "max-width: {$width}px";
break;
case 'multi_module':
$width = $setting['width'];
$height = $setting['height'];
$this->data['width'] = "max-width: {$width}px";
break;
}
/* global style data */
$this->data['global_style'] = array();
$slides = Journal2Utils::getProperty($module_data, 'slides', array());
$slides = Journal2Utils::sortArray($slides);
$_slides = array();
$this->data['js_options'] = array('slideSpeed' => (int) Journal2Utils::getProperty($module_data, 'transition_speed', 800), 'stopOnHover' => (bool) Journal2Utils::getProperty($module_data, 'pause_on_hover', 1), 'lazyLoad' => (bool) Journal2Utils::getProperty($module_data, 'preload_images', 1), 'touchDrag' => (bool) Journal2Utils::getProperty($module_data, 'touch_drag', 0), 'navigation' => (bool) Journal2Utils::getProperty($module_data, 'arrows', 1), 'pagination' => (bool) Journal2Utils::getProperty($module_data, 'bullets', 1));
if (Journal2Utils::getProperty($module_data, 'transition', 'fade') !== 'slide') {
$this->data['js_options']['transitionStyle'] = Journal2Utils::getProperty($module_data, 'transition', 'fade');
}
$this->data['nav_on_hover'] = Journal2Utils::getProperty($module_data, 'show_on_hover', 1) ? 'nav-on-hover' : '';
if (Journal2Utils::getProperty($module_data, 'autoplay')) {
$this->data['js_options']['autoPlay'] = (int) Journal2Utils::getProperty($module_data, 'transition_delay', 3000);
} else {
$this->data['js_options']['autoPlay'] = false;
}
$this->data['image_width'] = $width;
$this->data['image_height'] = $height;
foreach ($slides as $slide) {
if (isset($slide['status']) && !$slide['status']) {
continue;
}
$image = Journal2Utils::getProperty($slide, 'image');
if (is_array($image)) {
$image = Journal2Utils::getProperty($image, $this->config->get('config_language_id'));
}
$_slides[] = array('image' => Journal2Utils::resizeImage($this->model_tool_image, $image, $width, $height, 'crop'), 'name' => Journal2Utils::getProperty($slide, 'slide_name'), 'link' => $this->model_journal2_menu->getLink(Journal2Utils::getProperty($slide, 'link')), 'target' => Journal2Utils::getProperty($slide, 'link_new_window') ? 'target="_blank"' : '');
}
$this->data['slides'] = $_slides;
if (count($_slides) <= 1) {
$this->data['js_options']['autoPlay'] = false;
}
$this->data['module'] = $module;
$this->data['preload_images'] = Journal2Utils::getProperty($module_data, 'preload_images', '1');
$this->data['height'] = $height;
$this->template = $this->config->get('config_template') . '/template/journal2/module/slider_simple.tpl';
//.........这里部分代码省略.........
示例5: generateMenuItem
private function generateMenuItem(&$menu, $menu_item, $image_width, $image_height, $image_resize_type)
{
$items_limit = Journal2Utils::getProperty($menu_item, 'items_limit', 0);
switch (Journal2Utils::getProperty($menu_item, 'type')) {
/* categories menu */
case 'categories':
switch (Journal2Utils::getProperty($menu_item, 'categories.render_as', 'megamenu')) {
case 'megamenu':
$menu['show'] = Journal2Utils::getProperty($menu_item, 'categories.show');
switch ($menu['show']) {
case 'links':
$menu['show_class'] = 'menu-no-image';
break;
case 'image':
$menu['show_class'] = 'menu-no-links';
break;
default:
$menu['show_class'] = '';
}
$menu['classes'] .= ' menu-image-' . Journal2Utils::getProperty($menu_item, 'categories.image_position', 'right');
$menu['type'] = 'mega-menu-categories';
$links_type = Journal2Utils::getProperty($menu_item, 'categories.links_type', 'categories');
switch (Journal2Utils::getProperty($menu_item, 'categories.type')) {
/* existing categories */
case 'existing':
$parent_category = $this->model_catalog_category->getCategory(Journal2Utils::getProperty($menu_item, 'categories.top.id'));
if (!$parent_category) {
continue;
}
$menu['name'] = $parent_category['name'];
$menu['href'] = $this->url->link('product/category', 'path=' . $parent_category['category_id']);
switch ($links_type) {
case 'categories':
$subcategories = $this->model_catalog_category->getCategories(Journal2Utils::getProperty($menu_item, 'categories.top.id'));
foreach ($subcategories as $subcategory) {
$submenu = array();
$sub_categories = $this->model_catalog_category->getCategories($subcategory['category_id']);
foreach ($sub_categories as $sub_category) {
$submenu[] = array('name' => $sub_category['name'], 'href' => $this->url->link('product/category', 'path=' . $parent_category['category_id'] . '_' . $subcategory['category_id'] . '_' . $sub_category['category_id']), 'image' => Journal2Utils::resizeImage($this->model_tool_image, $sub_category, $image_width, $image_height, $image_resize_type), 'image_width' => $image_width ? $image_width : 100, 'image_height' => $image_height ? $image_height : 100, 'dummy' => Journal2Utils::resizeImage($this->model_tool_image, 'data/journal2/transparent.png', $image_width, $image_height, 'fit'));
}
$menu['items'][] = array('name' => $subcategory['name'], 'href' => $this->url->link('product/category', 'path=' . $parent_category['category_id'] . '_' . $subcategory['category_id']), 'items' => $submenu, 'image' => Journal2Utils::resizeImage($this->model_tool_image, $subcategory, $image_width, $image_height, $image_resize_type), 'image_width' => $image_width ? $image_width : 100, 'image_height' => $image_height ? $image_height : 100, 'dummy' => Journal2Utils::resizeImage($this->model_tool_image, 'data/journal2/transparent.jpg', $image_width, $image_height, 'fit'), 'image-class' => count($submenu) ? '' : 'full-img');
}
break;
case 'products':
$subcategories = $this->model_catalog_category->getCategories(Journal2Utils::getProperty($menu_item, 'categories.top.id'));
foreach ($subcategories as $subcategory) {
$submenu = array();
$sub_categories = $this->model_journal2_product->getProductsByCategory($subcategory['category_id'], $items_limit ? $items_limit : 5);
foreach ($sub_categories as $sub_category) {
$submenu[] = array('name' => $sub_category['name'], 'href' => $this->url->link('product/product', 'path=' . $parent_category['category_id'] . '_' . $subcategory['category_id'] . '&product_id=' . $sub_category['product_id']), 'image' => Journal2Utils::resizeImage($this->model_tool_image, $sub_category, $image_width, $image_height, $image_resize_type), 'image_width' => $image_width ? $image_width : $this->config->get('config_image_product_width'), 'image_height' => $image_height ? $image_height : $this->config->get('config_image_product_height'), 'dummy' => Journal2Utils::resizeImage($this->model_tool_image, 'data/journal2/transparent.jpg', $image_width, $image_height, 'fit'));
}
$menu['items'][] = array('name' => $subcategory['name'], 'href' => $this->url->link('product/category', 'path=' . $parent_category['category_id'] . '_' . $subcategory['category_id']), 'items' => $submenu, 'image' => Journal2Utils::resizeImage($this->model_tool_image, $subcategory, $image_width, $image_height, $image_resize_type), 'image_width' => $image_width ? $image_width : $this->config->get('config_image_product_width'), 'image_height' => $image_height ? $image_height : $this->config->get('config_image_product_height'), 'dummy' => Journal2Utils::resizeImage($this->model_tool_image, 'data/journal2/transparent.jpg', $image_width, $image_height, 'fit'), 'image-class' => count($submenu) ? '' : 'full-img');
}
break;
}
break;
/* custom categories */
/* custom categories */
case 'custom':
switch ($links_type) {
case 'categories':
$menu['name'] = Journal2Utils::getProperty($menu_item, 'name.value.' . $this->config->get('config_language_id'), 'Not Translated');
$menu['href'] = 'javascript:;';
foreach (Journal2Utils::getProperty($menu_item, 'categories.items', array()) as $category) {
$parent_category = $this->model_catalog_category->getCategory(Journal2Utils::getProperty($category, 'data.id'));
if (!$parent_category) {
continue;
}
$sub_categories = $this->model_catalog_category->getCategories(Journal2Utils::getProperty($category, 'data.id'));
$submenu = array();
foreach ($sub_categories as $sub_category) {
$submenu[] = array('name' => $sub_category['name'], 'href' => $this->url->link('product/category', 'path=' . $parent_category['category_id'] . '_' . $sub_category['category_id']), 'image' => Journal2Utils::resizeImage($this->model_tool_image, $sub_category, $image_width, $image_height, $image_resize_type), 'image_width' => $image_width ? $image_width : 100, 'image_height' => $image_height ? $image_height : 100, 'dummy' => Journal2Utils::resizeImage($this->model_tool_image, 'data/journal2/transparent.jpg', $image_width, $image_height, 'fit'));
}
$menu['items'][] = array('name' => $parent_category['name'], 'href' => $this->url->link('product/category', 'path=' . $parent_category['category_id']), 'image' => Journal2Utils::resizeImage($this->model_tool_image, $parent_category, $image_width, $image_height, $image_resize_type), 'image_width' => $image_width ? $image_width : 100, 'image_height' => $image_height ? $image_height : 100, 'dummy' => Journal2Utils::resizeImage($this->model_tool_image, 'data/journal2/transparent.jpg', $image_width, $image_height, 'fit'), 'items' => $submenu, 'image-class' => count($submenu) ? '' : 'full-img');
}
break;
case 'products':
$menu['name'] = Journal2Utils::getProperty($menu_item, 'name.value.' . $this->config->get('config_language_id'), 'Not Translated');
$menu['href'] = 'javascript:;';
foreach (Journal2Utils::getProperty($menu_item, 'categories.items', array()) as $category) {
$parent_category = $this->model_catalog_category->getCategory(Journal2Utils::getProperty($category, 'data.id'));
if (!$parent_category) {
continue;
}
$sub_categories = $this->model_journal2_product->getProductsByCategory(Journal2Utils::getProperty($category, 'data.id'), $items_limit);
$submenu = array();
foreach ($sub_categories as $sub_category) {
$submenu[] = array('name' => $sub_category['name'], 'href' => $this->url->link('product/product', 'path=' . $parent_category['category_id'] . '&product_id=' . $sub_category['product_id']), 'image' => Journal2Utils::resizeImage($this->model_tool_image, $sub_category, $image_width, $image_height, $image_resize_type), 'image_width' => $image_width ? $image_width : $this->config->get('config_image_product_width'), 'image_height' => $image_height ? $image_height : $this->config->get('config_image_product_height'), 'dummy' => Journal2Utils::resizeImage($this->model_tool_image, 'data/journal2/transparent.jpg', $image_width, $image_height, 'fit'));
}
$menu['items'][] = array('name' => $parent_category['name'], 'href' => $this->url->link('product/category', 'path=' . $parent_category['category_id']), 'image' => Journal2Utils::resizeImage($this->model_tool_image, $parent_category, $image_width, $image_height, $image_resize_type), 'image_width' => $image_width ? $image_width : $this->config->get('config_image_product_width'), 'image_height' => $image_height ? $image_height : $this->config->get('config_image_product_height'), 'dummy' => Journal2Utils::resizeImage($this->model_tool_image, 'data/journal2/transparent.jpg', $image_width, $image_height, 'fit'), 'items' => $submenu, 'image-class' => count($submenu) ? '' : 'full-img');
}
break;
}
break;
}
break;
case 'dropdown':
$menu['type'] = 'drop-down';
switch (Journal2Utils::getProperty($menu_item, 'categories.type')) {
/* existing categories */
//.........这里部分代码省略.........
示例6: feed
public function feed()
{
if (!$this->journal2->settings->get('config_blog_settings.feed', 1)) {
$this->response->redirect('index.php?route=error/not_found');
exit;
}
$output = '<?xml version="1.0" encoding="UTF-8" ?>';
$output .= '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">';
$output .= '<channel>';
$output .= '<atom:link href="' . $this->url->link('journal2/blog') . '" rel="self" type="application/rss+xml" />';
$output .= '<title>' . $this->blog_title . '</title>';
$output .= '<link>' . $this->url->link('journal2/blog') . '</link>';
$output .= '<description>' . $this->blog_meta_description . '</description>';
$data = array('sort' => 'newest', 'start' => 0, 'limit' => PHP_INT_MAX);
if (isset($this->request->get['journal_blog_feed_category_id'])) {
$data['category_id'] = $this->request->get['journal_blog_feed_category_id'];
}
foreach ($this->model_journal2_blog->getPosts($data) as $post) {
$output .= '<item>';
$output .= '<title>' . htmlspecialchars($post['name']) . '</title>';
$output .= '<author>' . $this->model_journal2_blog->getAuthorName($post) . '</author>';
$output .= '<pubDate>' . date(DATE_RSS, strtotime($post['date'])) . '</pubDate>';
$output .= '<link>' . $this->url->link('journal2/blog/post', 'journal_blog_post_id=' . $post['post_id']) . '</link>';
$output .= '<guid>' . $this->url->link('journal2/blog/post', 'journal_blog_post_id=' . $post['post_id']) . '</guid>';
$description = '';
if ($post['image']) {
$image = Journal2Utils::resizeImage($this->model_tool_image, $post, $this->journal2->settings->get('feed_image_width', 250), $this->journal2->settings->get('feed_image_height', 250), 'crop');
$description .= '<p><img src="' . $image . '" /></p>';
}
$description .= utf8_substr(strip_tags(html_entity_decode($post['description'], ENT_QUOTES, 'UTF-8')), 0, $this->journal2->settings->get('config_blog_settings.description_char_limit', 150)) . '... ';
$description .= '<a href="' . $this->url->link('journal2/blog/post', 'journal_blog_post_id=' . $post['post_id']) . '">' . $this->journal2->settings->get('blog_button_read_more', 'Read More') . '</a>';
$output .= '<description>' . htmlspecialchars($description) . '</description>';
$output .= '</item>';
}
$output .= '</channel>';
$output .= '</rss>';
$this->response->addHeader('Content-Type: application/rss+xml');
$this->response->setOutput($output);
}
示例7: index2
//.........这里部分代码省略.........
$data['popup'] = '';
}
if ($product_info['image']) {
$data['thumb_fixed'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_additional_width'), $this->config->get('config_image_additional_height'));
$data['thumb'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_thumb_width'), $this->config->get('config_image_thumb_height'));
} else {
$data['thumb'] = '';
}
$data['images'] = array();
$results = $this->model_catalog_product->getProductImages($this->request->get['pid']);
foreach ($results as $result) {
$data['images'][] = array('popup' => $this->model_tool_image->resize($result['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height')), 'thumb' => $this->model_tool_image->resize($result['image'], $this->config->get('config_image_additional_width'), $this->config->get('config_image_additional_height')));
}
if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) {
$data['price'] = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
} else {
$data['price'] = false;
}
if ((double) $product_info['special']) {
$data['special'] = $this->currency->format($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax')));
} else {
$data['special'] = false;
}
if ($this->config->get('config_tax')) {
$data['tax'] = $this->currency->format((double) $product_info['special'] ? $product_info['special'] : $product_info['price']);
} else {
$data['tax'] = false;
}
$discounts = $this->model_catalog_product->getProductDiscounts($this->request->get['pid']);
$data['discounts'] = array();
foreach ($discounts as $discount) {
$data['discounts'][] = array('quantity' => $discount['quantity'], 'price' => $this->currency->format($this->tax->calculate($discount['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))));
}
$data['options'] = array();
foreach ($this->model_catalog_product->getProductOptions($this->request->get['pid']) as $option) {
$product_option_value_data = array();
foreach ($option['product_option_value'] as $option_value) {
if (!$option_value['subtract'] || $option_value['quantity'] > 0) {
if (($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) && (double) $option_value['price']) {
$price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax') ? 'P' : false));
} else {
$price = false;
}
$product_option_value_data[] = array('product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => Journal2Utils::resizeImage($this->model_tool_image, $option_value['image'], $this->journal2->settings->get('product_page_options_push_image_width', 30), $this->journal2->settings->get('product_page_options_push_image_height', 30), 'crop'), 'price' => $price, 'price_prefix' => $option_value['price_prefix']);
}
}
$data['options'][] = array('product_option_id' => $option['product_option_id'], 'product_option_value' => $product_option_value_data, 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'value' => $option['value'], 'required' => $option['required']);
}
if ($product_info['minimum']) {
$data['minimum'] = $product_info['minimum'];
} else {
$data['minimum'] = 1;
}
$data['review_status'] = $this->config->get('config_review_status');
if ($this->config->get('config_review_guest') || $this->customer->isLogged()) {
$data['review_guest'] = true;
} else {
$data['review_guest'] = false;
}
if ($this->customer->isLogged()) {
$data['customer_name'] = $this->customer->getFirstName() . ' ' . $this->customer->getLastName();
} else {
$data['customer_name'] = '';
}
$data['reviews'] = sprintf($this->language->get('text_reviews'), (int) $product_info['reviews']);
$data['rating'] = (int) $product_info['rating'];
$data['description'] = html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8');
$data['attribute_groups'] = $this->model_catalog_product->getProductAttributes($this->request->get['pid']);
$data['tags'] = array();
if ($product_info['tag']) {
$tags = explode(',', $product_info['tag']);
foreach ($tags as $tag) {
$data['tags'][] = array('tag' => trim($tag), 'href' => $this->url->link('product/search', 'tag=' . trim($tag)));
}
}
$data['text_payment_recurring'] = $this->language->get('text_payment_recurring');
$data['recurrings'] = $this->model_catalog_product->getProfiles($this->request->get['pid']);
$this->model_catalog_product->updateViewed($this->request->get['pid']);
$this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/journal2/quickview/quickview.tpl', $data));
} else {
$this->document->setTitle($this->language->get('text_error'));
$data['heading_title'] = $this->language->get('text_error');
$data['text_error'] = $this->language->get('text_error');
$data['button_continue'] = $this->language->get('button_continue');
$data['continue'] = $this->url->link('common/home');
$data['breadcrumbs'][] = array('text' => $this->language->get('text_error'), 'href' => $this->url->link('journal2/quickview', '&pid=' . $product_id));
$this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found');
$data['column_left'] = $this->load->controller('common/column_left');
$data['column_right'] = $this->load->controller('common/column_right');
$data['content_top'] = $this->load->controller('common/content_top');
$data['content_bottom'] = $this->load->controller('common/content_bottom');
$data['footer'] = $this->load->controller('common/footer');
$data['header'] = $this->load->controller('common/header');
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/error/not_found.tpl')) {
$this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/error/not_found.tpl', $data));
} else {
$this->response->setOutput($this->load->view('default/template/error/not_found.tpl', $data));
}
}
}
示例8: index
//.........这里部分代码省略.........
if ($this->config->get('config_template') === 'journal2' && $this->journal2->settings->get('show_countdown_product_page', 'on') == 'on') {
$this->load->model('journal2/product');
$date_end = $this->model_journal2_product->getSpecialCountdown($this->request->get['product_id']);
if ($date_end === '0000-00-00') {
$date_end = false;
}
$this->data['date_end'] = $date_end;
}
$this->data['special'] = $this->currency->format($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax')));
} else {
$this->data['special'] = false;
}
if ($this->config->get('config_tax')) {
$this->data['tax'] = $this->currency->format((double) $product_info['special'] ? $product_info['special'] : $product_info['price']);
} else {
$this->data['tax'] = false;
}
$discounts = $this->model_catalog_product->getProductDiscounts($this->request->get['product_id']);
$this->data['discounts'] = array();
foreach ($discounts as $discount) {
$this->data['discounts'][] = array('quantity' => $discount['quantity'], 'price' => $this->currency->format($this->tax->calculate($discount['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))));
}
$this->data['options'] = array();
foreach ($this->model_catalog_product->getProductOptions($this->request->get['product_id']) as $option) {
if ($option['type'] == 'select' || $option['type'] == 'radio' || $option['type'] == 'checkbox' || $option['type'] == 'image') {
$option_value_data = array();
foreach ($option['option_value'] as $option_value) {
if (!$option_value['subtract'] || $option_value['quantity'] > 0) {
if (($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) && (double) $option_value['price']) {
$price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = false;
}
$option_value_data[] = array('product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => strpos($this->config->get('config_template'), 'journal2') === 0 ? Journal2Utils::resizeImage($this->model_tool_image, $option_value['image'], $this->journal2->settings->get('product_page_options_push_image_width', 30), $this->journal2->settings->get('product_page_options_push_image_height', 30), 'crop') : $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => $price, 'price_prefix' => $option_value['price_prefix']);
}
}
$this->data['options'][] = array('product_option_id' => $option['product_option_id'], 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'option_value' => $option_value_data, 'required' => $option['required']);
} elseif ($option['type'] == 'text' || $option['type'] == 'textarea' || $option['type'] == 'file' || $option['type'] == 'date' || $option['type'] == 'datetime' || $option['type'] == 'time') {
$this->data['options'][] = array('product_option_id' => $option['product_option_id'], 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'option_value' => $option['option_value'], 'required' => $option['required']);
}
}
if ($product_info['minimum']) {
$this->data['minimum'] = $product_info['minimum'];
} else {
$this->data['minimum'] = 1;
}
$this->data['review_status'] = $this->config->get('config_review_status');
$this->data['reviews'] = sprintf($this->language->get('text_reviews'), (int) $product_info['reviews']);
$this->data['rating'] = (int) $product_info['rating'];
$this->data['description'] = html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8');
$this->data['attribute_groups'] = $this->model_catalog_product->getProductAttributes($this->request->get['product_id']);
$this->data['products'] = array();
$results = $this->model_catalog_product->getProductRelated($this->request->get['product_id']);
foreach ($results as $result) {
if ($result['image']) {
$image = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_related_width'), $this->config->get('config_image_related_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($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = false;
}
if ((double) $result['special']) {
$special = $this->currency->format($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax')));
示例9: generateManufacturerSections
private function generateManufacturerSections($sections_data)
{
$section_index = 0;
foreach ($sections_data as $section) {
if (!$section['status']) {
continue;
}
$manufacturers = array();
$section_manufacturers = array();
$section_name = Journal2Utils::getProperty($section, 'section_title.value.' . $this->config->get('config_language_id'), 'Not Translated');
switch (Journal2Utils::getProperty($section, 'section_type')) {
case 'all':
$manufacturers = $this->model_catalog_manufacturer->getManufacturers(array('start' => 0, 'limit' => Journal2Utils::getProperty($section, 'items_limit', 5)));
break;
case 'custom':
foreach (Journal2Utils::getProperty($section, 'manufacturers', array()) as $manufacturer) {
$manufacturers[] = array('manufacturer_id' => Journal2Utils::getProperty($manufacturer, 'data.id', -1));
}
}
foreach ($manufacturers as $manufacturer) {
$this->has_items = true;
$manufacturer_info = $this->model_catalog_manufacturer->getManufacturer($manufacturer['manufacturer_id']);
if (!$manufacturer_info) {
continue;
}
$manufacturer_sections = isset($this->data['items'][$manufacturer_info['manufacturer_id']]) ? $this->data['items'][$manufacturer_info['manufacturer_id']]['section_class'] : array();
$manufacturer_sections[$section_index] = 'section-' . $section_index;
$manufacturer_data = array('section_class' => $manufacturer_sections, 'name' => $manufacturer_info['name'], 'href' => $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $manufacturer_info['manufacturer_id']), 'thumb' => Journal2Utils::resizeImage($this->model_tool_image, $manufacturer_info['image'] ? $manufacturer_info['image'] : 'data/journal2/no_image_large.jpg', $this->data['image_width'], $this->data['image_height'], $this->data['image_resize_type']));
$section_manufacturers[] = $manufacturer_data;
}
$this->data['sections'][] = array('section_class' => $section_index, 'section_name' => $section_name, 'items' => $section_manufacturers, 'is_link' => Journal2Utils::getProperty($section, 'section_type') === 'link', 'url' => $this->model_journal2_menu->getLink(Journal2Utils::getProperty($section, 'link')), 'target' => Journal2Utils::getProperty($section, 'new_window') ? 'target="_blank"' : '');
if (Journal2Utils::getProperty($section, 'default_section')) {
$this->data['default_section'] = $section_index;
}
$section_index++;
}
}
示例10: index
//.........这里部分代码省略.........
if (Journal2Utils::getProperty($module_data, 'text_font.value.color.value.color')) {
$css[] = 'color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'text_font.value.color.value.color'));
}
$this->data['quote_css'] = implode('; ', $css);
/* author options */
$css = array();
if (Journal2Utils::getProperty($module_data, 'author_font.value.font_type') === 'google') {
$font_name = Journal2Utils::getProperty($module_data, 'author_font.value.font_name');
$font_subset = Journal2Utils::getProperty($module_data, 'author_font.value.font_subset');
$font_weight = Journal2Utils::getProperty($module_data, 'author_font.value.font_weight');
$this->journal2->google_fonts->add($font_name, $font_subset, $font_weight);
$this->google_fonts[] = array('name' => $font_name, 'subset' => $font_subset, 'weight' => $font_weight);
$weight = filter_var(Journal2Utils::getProperty($module_data, 'author_font.value.font_weight'), FILTER_SANITIZE_NUMBER_INT);
$css[] = 'font-weight: ' . ($weight ? $weight : 400);
$css[] = "font-family: '" . Journal2Utils::getProperty($module_data, 'author_font.value.font_name') . "'";
}
if (Journal2Utils::getProperty($module_data, 'author_font.value.font_type') === 'system') {
$css[] = 'font-weight: ' . Journal2Utils::getProperty($module_data, 'author_font.value.font_weight');
$css[] = 'font-family: ' . Journal2Utils::getProperty($module_data, 'author_font.value.font_family');
}
$css[] = 'text-align: ' . Journal2Utils::getProperty($module_data, 'author_align', 'center');
if (Journal2Utils::getProperty($module_data, 'author_font.value.font_type') !== 'none') {
$css[] = 'font-size: ' . Journal2Utils::getProperty($module_data, 'author_font.value.font_size');
$css[] = 'font-style: ' . Journal2Utils::getProperty($module_data, 'author_font.value.font_style');
$css[] = 'text-transform: ' . Journal2Utils::getProperty($module_data, 'author_font.value.text_transform');
}
if (Journal2Utils::getProperty($module_data, 'author_font.value.color.value.color')) {
$css[] = 'color: ' . Journal2Utils::getColor(Journal2Utils::getProperty($module_data, 'author_font.value.color.value.color'));
}
$this->data['author_css'] = implode('; ', $css);
/* rotator options */
$css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'text_background'));
$this->data['rotator_css'] = implode('; ', $css);
/* image options */
$css = array();
$css = array_merge($css, Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($module_data, 'image_border')));
switch (Journal2Utils::getProperty($module_data, 'image_align')) {
case 'left':
$this->data['image_align'] = 'left';
$css[] = 'float: left';
break;
case 'center':
$this->data['image_align'] = 'center';
$css[] = 'float: none';
$css[] = 'margin:0 auto';
$css[] = 'margin-bottom:10px';
break;
case 'right':
$this->data['image_align'] = 'right';
$css[] = 'float: right';
break;
}
$this->data['image_css'] = implode('; ', $css);
/* sections */
$this->data['random_sections'] = Journal2Utils::getProperty($module_data, 'random_sections', '0');
$this->data['sections'] = array();
$sections = Journal2Utils::getProperty($module_data, 'sections', array());
$sections = Journal2Utils::sortArray($sections);
$image_width = Journal2Utils::getProperty($module_data, 'image_width', 150);
$image_height = Journal2Utils::getProperty($module_data, 'image_height', 150);
foreach ($sections as $section) {
if (!$section['status']) {
continue;
}
$image = Journal2Utils::getProperty($section, 'image');
if (is_array($image)) {
$image = Journal2Utils::getProperty($image, $this->config->get('config_language_id'));
}
if (!file_exists(DIR_IMAGE . $image)) {
$image = false;
}
$this->data['sections'][] = array('author' => Journal2Utils::getProperty($section, 'author'), 'image' => $image ? Journal2Utils::resizeImage($this->model_tool_image, $image, $image_width, $image_height, 'crop') : false, 'image_width' => $image_width, 'image_height' => $image_height, 'text' => Journal2Utils::getProperty($section, 'text.value.' . $this->config->get('config_language_id')), 'icon' => Journal2Utils::getIconOptions2(Journal2Utils::getProperty($section, 'icon')));
}
/* bullets */
$this->data['bullets'] = Journal2Utils::getProperty($module_data, 'bullets') && count($this->data['sections']) > 1 ? true : false;
/* pause on hover */
$this->data['pause_on_hover'] = Journal2Utils::getProperty($module_data, 'pause_on_hover', '1');
$this->template = $this->config->get('config_template') . '/template/journal2/module/text_rotator.tpl';
if (self::$CACHEABLE === true) {
$html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
$this->journal2->cache->set($cache_property, $html);
$this->journal2->cache->set($cache_property . '_fonts', json_encode($this->google_fonts));
}
} else {
if ($fonts = $this->journal2->cache->get($cache_property . '_fonts')) {
$fonts = json_decode($fonts, true);
if (is_array($fonts)) {
foreach ($fonts as $font) {
$this->journal2->google_fonts->add($font['name'], $font['subset'], $font['weight']);
}
}
}
$this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
$this->data['cache'] = $cache;
}
$this->document->addScript('catalog/view/theme/journal2/lib/quovolver/jquery.quovolver.js');
$output = $this->render();
Journal2::stopTimer(get_class($this));
return $output;
}
示例11: index
public function index()
{
$this->load->model('tool/image');
/* blog manager compatibility */
$route = isset($this->request->get['route']) ? $this->request->get['route'] : null;
if ($route !== null && in_array($route, array('blog/article', 'blog/category'))) {
return;
}
/* end of blog manager compatibility */
$this->s_url = Journal2Cache::getCurrentUrl();
switch ($this->journal2->page->getType()) {
case 'product':
$this->load->model('catalog/product');
$product_info = $this->model_catalog_product->getProduct($this->journal2->page->getId());
if ($product_info) {
$this->s_title = $product_info['name'];
$this->s_description = trim(utf8_substr(strip_tags(html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8')), 0, 300));
$this->s_image = Journal2Utils::staticAsset('image/' . $product_info['image']);
$this->s_rating = (int) $product_info['rating'];
$this->journal2->settings->set('product_google_snippet', 'itemscope itemtype="http://schema.org/Product"');
$this->journal2->settings->set('product_price_currency', $this->currency->getCode());
$this->journal2->settings->set('product_num_reviews', $product_info['reviews']);
$this->journal2->settings->set('product_in_stock', $product_info['quantity'] > 0 ? 'yes' : 'no');
/* review ratings */
$this->language->load('product/product');
$this->load->model('catalog/review');
$this->data['text_on'] = $this->language->get('text_on');
$this->data['text_no_reviews'] = $this->language->get('text_no_reviews');
if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}
$this->data['reviews'] = array();
$review_total = $this->model_catalog_review->getTotalReviewsByProductId($this->request->get['product_id']);
$results = $this->model_catalog_review->getReviewsByProductId($this->request->get['product_id'], ($page - 1) * 5, 5);
foreach ($results as $result) {
$this->data['reviews'][] = array('author' => $result['author'], 'text' => $result['text'], 'rating' => (int) $result['rating'], 'reviews' => sprintf($this->language->get('text_reviews'), (int) $review_total), 'date_added' => date($this->language->get('date_format_short'), strtotime($result['date_added'])));
}
$pagination = new Pagination();
$pagination->total = $review_total;
$pagination->page = $page;
$pagination->limit = 5;
$pagination->text = $this->language->get('text_pagination');
$pagination->url = $this->url->link('product/product/review', 'product_id=' . $this->request->get['product_id'] . '&page={page}');
$this->data['pagination'] = $pagination->render();
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/review.tpl')) {
$this->template = $this->config->get('config_template') . '/template/product/review.tpl';
} else {
$this->template = 'default/template/product/review.tpl';
}
$this->journal2->settings->set('product_reviews', $this->render());
}
break;
case 'category':
$this->load->model('catalog/category');
$parts = explode('_', $this->journal2->page->getId());
$category_id = (int) array_pop($parts);
$category_info = $this->model_catalog_category->getCategory($category_id);
if ($category_info) {
$this->s_title = $category_info['name'];
$this->s_description = trim(utf8_substr(strip_tags(html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8')), 0, 300));
$this->s_image = Journal2Utils::staticAsset('image/' . $category_info['image']);
}
break;
default:
$this->s_title = $this->config->get('config_name');
$meta_description = $this->config->get('config_meta_description');
if (is_array($meta_description)) {
$lang_id = $this->config->get('config_language_id');
if (isset($meta_description[$lang_id])) {
$this->s_description = $meta_description[$lang_id] . '...';
}
} else {
$this->s_description = $meta_description . '...';
}
$this->s_image = Journal2Utils::resizeImage($this->model_tool_image, $this->config->get('config_logo'), self::IMG_WIDTH, self::IMG_HEIGHT, 'fit');
break;
}
$this->journal2->settings->set('fb_meta_title', $this->s_title);
$this->journal2->settings->set('fb_meta_description', $this->s_description);
$this->journal2->settings->set('fb_meta_url', $this->s_url);
$this->journal2->settings->set('fb_meta_image', $this->s_image);
}
示例12: index
public function index($setting)
{
if (!defined('JOURNAL_INSTALLED')) {
return;
}
Journal2::startTimer(get_class($this));
/* get module data from db */
$module_data = $this->model_journal2_module->getModule($setting['module_id']);
if (!$module_data || !isset($module_data['module_data']) || !$module_data['module_data']) {
return;
}
$module_data = $module_data['module_data'];
/* device detection */
$this->data['disable_on_classes'] = array();
if ($this->journal2->settings->get('responsive_design')) {
$device = Journal2Utils::getDevice();
if (Journal2Utils::getProperty($module_data, 'enable_on_phone', '1') == '0') {
if ($device === 'phone') {
return;
} else {
$this->data['disable_on_classes'][] = 'hide-on-phone';
}
}
if (Journal2Utils::getProperty($module_data, 'enable_on_tablet', '1') == '0') {
if ($device === 'tablet') {
return;
} else {
$this->data['disable_on_classes'][] = 'hide-on-tablet';
}
}
if (Journal2Utils::getProperty($module_data, 'enable_on_desktop', '1') == '0') {
if ($device === 'desktop') {
return;
} else {
$this->data['disable_on_classes'][] = 'hide-on-desktop';
}
}
}
/* css for top / bottom positions */
if (in_array($setting['position'], array('top', 'bottom'))) {
$padding = $this->journal2->settings->get('module_margins', 20) . 'px';
/* outer */
$css = Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'background'));
$css[] = 'padding-top: ' . Journal2Utils::getProperty($module_data, 'margin_top', 0) . 'px';
$css[] = 'padding-bottom: ' . Journal2Utils::getProperty($module_data, 'margin_bottom', 0) . 'px';
$this->journal2->settings->set('module_journal2_static_banners_' . $setting['module_id'], implode('; ', $css));
$this->journal2->settings->set('module_journal2_static_banners_' . $setting['module_id'] . '_classes', implode(' ', $this->data['disable_on_classes']));
/* inner css */
$css = array();
if (Journal2Utils::getProperty($module_data, 'fullwidth')) {
$css[] = 'max-width: 100%';
$css[] = 'padding-left: ' . $padding;
$css[] = 'padding-right: ' . $padding;
} else {
$css[] = 'max-width: ' . $this->journal2->settings->get('site_width', 1024) . 'px';
$css = array_merge($css, Journal2Utils::getBackgroundCssProperties(Journal2Utils::getProperty($module_data, 'module_background')));
if (Journal2Utils::getProperty($module_data, 'module_padding')) {
$this->data['gutter_on_class'] = 'gutter-on';
$css[] = 'padding: 20px';
}
}
$this->data['css'] = implode('; ', $css);
}
$cache_property = "module_journal_static_banners_{$setting['module_id']}_{$setting['layout_id']}_{$setting['position']}";
$cache = $this->journal2->cache->get($cache_property);
if ($cache === null || self::$CACHEABLE !== true) {
$module = mt_rand();
/* set global module properties */
$this->data['module'] = $module;
$this->data['title'] = Journal2Utils::getProperty($module_data, 'module_title.value.' . $this->config->get('config_language_id'), '');
/* icon */
$this->data['icon'] = Journal2Utils::getIconOptions2(Journal2Utils::getProperty($module_data, 'icon'));
/* bgcolor*/
$this->data['bgcolor'] = Journal2Utils::getProperty($module_data, 'bgcolor.value.color');
/* image border */
$this->data['image_border'] = implode('; ', Journal2Utils::getBorderCssProperties(Journal2Utils::getProperty($module_data, 'image_border')));
/* sort sections */
$sections = Journal2Utils::getProperty($module_data, 'sections', array());
$sections = Journal2Utils::sortArray($sections);
/* generate sections */
$this->data['sections'] = array();
foreach ($sections as $section) {
if (!$section['status']) {
continue;
}
$image = Journal2Utils::getProperty($section, 'image');
if (is_array($image)) {
$image = Journal2Utils::getProperty($image, $this->config->get('config_language_id'));
}
if (!$image || !file_exists(DIR_IMAGE . $image)) {
$image = Front::$IS_OC2 ? 'no_image.png' : 'no_image.jpg';
}
list($width, $height) = getimagesize(DIR_IMAGE . $image);
$this->data['sections'][] = array('type' => 'image', 'link' => $this->model_journal2_menu->getLink(Journal2Utils::getProperty($section, 'link')), 'target' => Journal2Utils::getProperty($section, 'link_new_window') ? 'target="_blank"' : '', 'image' => Journal2Utils::resizeImage($this->model_tool_image, $image), 'image_title' => Journal2Utils::getProperty($section, 'image_title.value.' . $this->config->get('config_language_id'), ''), 'image_width' => $width, 'image_height' => $height);
}
/* carousel mode */
$this->data['carousel'] = Journal2Utils::getProperty($module_data, 'carousel', '0');
if (Journal2Utils::getProperty($module_data, 'autoplay')) {
$this->data['autoplay'] = (int) Journal2Utils::getProperty($module_data, 'transition_delay', 3000);
} else {
//.........这里部分代码省略.........
示例13: index
//.........这里部分代码省略.........
$this->data['tax'] = $this->currency->format((double) $product_info['special'] ? $product_info['special'] : $product_info['price']);
} else {
$this->data['tax'] = false;
}
//if($this->customer->isLogged()) {
$product_description_doc = $this->model_catalog_product->getProductDescriptionDocument($this->request->get['product_id'], $this->customer->getCustomerGroupId() ? $this->customer->getCustomerGroupId() : 5);
//echo "<pre>"; print_r($product_description_doc); die('opencart/vqmod/xml/product_description_pdf.xml:774');
foreach ($product_description_doc as $file_name) {
$customer_id = (int) $this->session->data['customer_id'];
$document_id = (int) $file_name['product_description_download_pdf_id'];
$sec_id = $customer_id + 17;
$this->data['product_doc'][] = array('href' => $this->url->link('product/product/download', '&id=' . $document_id . '&sec=' . $sec_id), 'name' => $file_name['document_name'], 'type' => $file_name['document_type'], 'description' => $file_name['document_description']);
}
//echo "<pre>"; print_r($this->data['product_doc']); die('opencart/vqmod/xml/product_description_pdf.xml:783');
//}
$discounts = $this->model_catalog_product->getProductDiscounts($this->request->get['product_id']);
$this->data['discounts'] = array();
foreach ($discounts as $discount) {
$this->data['discounts'][] = array('quantity' => $discount['quantity'], 'price' => $this->currency->format($this->tax->calculate($discount['price'], $product_info['tax_class_id'], $this->config->get('config_tax'))));
}
$this->data['options'] = array();
/* print_r( $this->model_catalog_product->getProductOptions($this->request->get['product_id']) );
die();*/
foreach ($this->model_catalog_product->getProductOptions($this->request->get['product_id']) as $option) {
if ($option['type'] == 'select' || $option['type'] == 'radio' || $option['type'] == 'checkbox' || $option['type'] == 'image') {
$option_value_data = array();
foreach ($option['option_value'] as $option_value) {
if (!$option_value['subtract'] || $option_value['quantity'] >= 0) {
if (($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) && (double) $option_value['price']) {
$price = $this->currency->format($this->tax->calculate($option_value['price'], $product_info['tax_class_id'], TRUE));
} else {
$price = false;
}
$option_value_data[] = array('product_option_value_id' => $option_value['product_option_value_id'], 'option_value_id' => $option_value['option_value_id'], 'name' => $option_value['name'], 'image' => strpos($this->config->get('config_template'), 'journal2') === 0 ? Journal2Utils::resizeImage($this->model_tool_image, $option_value['image'], $this->journal2->settings->get('product_page_options_push_image_width', 30), $this->journal2->settings->get('product_page_options_push_image_height', 30), 'crop') : $this->model_tool_image->resize($option_value['image'], 50, 50), 'price' => $price, 'price_prefix' => $option_value['price_prefix']);
}
}
$this->data['options'][] = array('product_option_id' => $option['product_option_id'], 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'option_value' => $option_value_data, 'required' => $option['required']);
} elseif ($option['type'] == 'text' || $option['type'] == 'textarea' || $option['type'] == 'file' || $option['type'] == 'date' || $option['type'] == 'datetime' || $option['type'] == 'time') {
$this->data['options'][] = array('product_option_id' => $option['product_option_id'], 'option_id' => $option['option_id'], 'name' => $option['name'], 'type' => $option['type'], 'option_value' => $option['option_value'], 'required' => $option['required']);
}
}
if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) {
$this->language->load('module/cart');
if ($product_info['price'] == 'MORE_OPTION_NEEDED' && sizeof($this->data['options']) == 0) {
$this->data['price'] = $this->language->get('text_no_price_specified_for_b2b');
} else {
if ($product_info['price'] == 'MORE_OPTION_NEEDED' && sizeof($this->data['options']) > 0) {
$this->data['price'] = $this->language->get('text_select_option_to_show_price');
} else {
if ((double) $product_info['price'] == 0) {
$this->data['price'] = $this->language->get('text_price_ask');
} else {
$this->data['price'] = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
}
}
}
} else {
$this->data['price'] = false;
}
$this->data['error_option_combo'] = $this->language->get('error_option_combo');
$option_combo_setting = $this->model_catalog_product->getProductOptionComboSetting($this->request->get['product_id']);
if (isset($option_combo_setting['status']) && $option_combo_setting['status']) {
$this->data['text_col_quantity'] = $this->language->get('text_col_quantity');
$this->data['text_col_points'] = $this->language->get('text_col_points');
$this->data['text_col_total_points'] = $this->language->get('text_col_total_points');
$this->data['text_col_price'] = $this->language->get('text_col_price');
示例14: processFooter
private function processFooter()
{
/* copyright text */
$copyright = $this->journal2->settings->get('config_copyright', array());
$copyright_text = Journal2Utils::getProperty($copyright, 'value.' . $this->config->get('config_language_id'));
$this->journal2->settings->set('config_copyright', $copyright_text);
/* payment methods */
$payments = $this->journal2->settings->get('config_payments.payments', array());
$payments = Journal2Utils::sortArray($payments);
$payment_methods = array();
$width = '';
$height = '';
foreach ($payments as $payment) {
$image = Journal2Utils::getProperty($payment, 'image');
if (!$image || !file_exists(DIR_IMAGE . $image)) {
$image = Front::$IS_OC2 ? 'no_image.png' : 'no_image.jpg';
}
list($width, $height) = getimagesize(DIR_IMAGE . $image);
$payment_methods[] = array('image' => Journal2Utils::resizeImage($this->model_tool_image, $image), 'name' => Journal2Utils::getProperty($payment, 'name.value.' . $this->config->get('config_language_id')), 'url' => Journal2Utils::getProperty($payment, 'link.value.text'), 'target' => Journal2Utils::getProperty($payment, 'new_window') ? ' target="_blank"' : '', 'width' => $width, 'height' => $height);
}
$this->journal2->settings->set('config_payments', $payment_methods);
if ($payment_methods) {
$this->journal2->settings->set('config_payments_dummy', $this->model_tool_image->resize('data/journal2/transparent.png', $width, $height));
}
/* custom classes */
$classes = array();
if (!$copyright_text) {
$classes[] = 'no-copyright';
}
if (!$payment_methods) {
$classes[] = 'no-payments';
}
$this->journal2->settings->set('config_footer_classes', implode(' ', $classes));
}
示例15: index
//.........这里部分代码省略.........
} else {
$products = array();
}
}
break;
case 'people-also-bought':
$products = $this->model_journal2_product->getPeopleAlsoBought($product_id);
break;
case 'most-viewed':
$products = $this->model_journal2_product->getMostViewed($limit);
$this->has_random_products = true;
break;
case 'recently-viewed':
$products = $this->model_journal2_product->getRecentlyViewed($limit);
$this->has_random_products = true;
break;
}
break;
case 'category':
$category_info = $this->model_catalog_category->getCategory(Journal2Utils::getProperty($module_data, 'category.data.id'));
if (!$category_info) {
continue;
}
$products = $this->model_journal2_product->getProductsByCategory($category_info['category_id'], $limit);
break;
case 'manufacturer':
$manufacturer = $this->model_catalog_manufacturer->getManufacturer(Journal2Utils::getProperty($module_data, 'manufacturer.data.id'));
if (!$manufacturer) {
continue;
}
$products = $this->model_journal2_product->getProductsByManufacturer($manufacturer['manufacturer_id'], $limit);
break;
case 'custom':
foreach (Journal2Utils::sortArray(Journal2Utils::getProperty($module_data, 'products', array())) as $product) {
$result = $this->model_catalog_product->getProduct((int) Journal2Utils::getProperty($product, 'data.id'));
if (!$result) {
continue;
}
$products[] = $result;
}
break;
case 'random':
$this->has_random_products = true;
$random_type = Journal2Utils::getProperty($module_data, 'random_from', 'all');
$category_id = $random_type === 'category' ? Journal2Utils::getProperty($module_data, 'random_from_category.id', -1) : -1;
$random_products = $this->model_journal2_product->getRandomProducts($limit, $category_id);
foreach ($random_products as $product) {
$result = $this->model_catalog_product->getProduct($product['product_id']);
if (!$result) {
continue;
}
$products[] = $result;
}
break;
}
if (!count($products)) {
return;
}
$products_data = array();
foreach ($products as $product) {
$image = Journal2Utils::resizeImage($this->model_tool_image, $product['image'] ? $product['image'] : 'data/journal2/no_image_large.jpg', $this->data['image_width'], $this->data['image_height'], $this->data['image_resize_type']);
if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) {
$price = $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')));
} else {
$price = false;
}
if ((double) $product['special']) {
$special = $this->currency->format($this->tax->calculate($product['special'], $product['tax_class_id'], $this->config->get('config_tax')));
} else {
$special = false;
}
if ($this->config->get('config_tax')) {
$tax = $this->currency->format((double) $product['special'] ? $product['special'] : $product['price']);
} else {
$tax = false;
}
if ($this->config->get('config_review_status')) {
$rating = $product['rating'];
} else {
$rating = false;
}
$product_sections = isset($this->data['items'][$product['product_id']]) ? $this->data['items'][$product['product_id']]['section_class'] : array();
$results = $this->model_catalog_product->getProductImages($product['product_id']);
$products_data[] = array('product_id' => $product['product_id'], 'section_class' => $product_sections, 'thumb' => $image, 'name' => $product['name'], 'price' => $price, 'special' => $special, 'rating' => $rating, 'description' => utf8_substr(strip_tags(html_entity_decode($product['description'], ENT_QUOTES, 'UTF-8')), 0, 100) . '..', 'tax' => $tax, 'reviews' => sprintf($this->language->get('text_reviews'), (int) $product['reviews']), 'href' => $this->url->link('product/product', 'product_id=' . $product['product_id']), 'labels' => $this->model_journal2_product->getLabels($product['product_id']));
}
$this->data['heading_title'] = Journal2Utils::getProperty($module_data, 'section_title.value.' . $this->config->get('config_language_id'));
$this->data['products'] = $products_data;
$this->template = $this->config->get('config_template') . "/template/journal2/module/side_products.tpl";
if (self::$CACHEABLE === true && !$this->has_random_products) {
$html = Minify_HTML::minify($this->render(), array('xhtml' => false, 'jsMinifier' => 'j2_js_minify'));
$this->journal2->cache->set($cache_property, $html);
}
} else {
$this->template = $this->config->get('config_template') . '/template/journal2/cache/cache.tpl';
$this->data['cache'] = $cache;
}
$output = $this->render();
Journal2::stopTimer(get_class($this));
return $output;
}