-
Notifications
You must be signed in to change notification settings - Fork 0
/
manufacturer.php
99 lines (89 loc) · 3.79 KB
/
manufacturer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
/**
* ****************************************************************************
* myshop - MODULE FOR XOOPS
* Copyright (c) Hervé Thouzard of Instant Zero (http://www.instant-zero.com)
*
* You may not change or alter any portion of this comment or credits
* of supporting developers from this source code or any supporting source code
* which is considered copyrighted (c) material of the original comment or credit authors.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* @copyright Hervé Thouzard of Instant Zero (http://www.instant-zero.com)
* @license http://www.fsf.org/copyleft/gpl.html GNU public license
* @package myshop
* @author Hervé Thouzard of Instant Zero (http://www.instant-zero.com)
*
* Version : $Id:
* ****************************************************************************
*/
/**
* manufacturer
*/
require 'header.php';
$GLOBALS['current_category'] = -1;
$xoopsOption['template_main'] = 'myshop_manufacturer.html';
require_once XOOPS_ROOT_PATH.'/header.php';
require_once XOOPS_ROOT_PATH.'/class/pagenav.php';
// Test
if(isset($_GET['manu_id'])) {
$manu_id = intval($_GET['manu_id']);
} else {
myshop_utils::redirect(_MYSHOP_ERROR7, 'index.php', 5);
}
$start = isset($_GET['start']) ? intval($_GET['start']) : 0;
$manufacturer = null;
$manufacturer = $h_myshop_manufacturer->get($manu_id);
if(!is_object($manufacturer)) {
myshop_utils::redirect(_MYSHOP_ERROR7, 'index.php', 5);
}
$xoopsTpl->assign('mod_pref', $mod_pref);
$xoopsTpl->assign('manufacturer', $manufacturer->toArray());
$limit = myshop_utils::getModuleOption('perpage');
// VAT
$vatArray = array();
$vatArray = $h_myshop_vat->getAllVats();
// Search all manufacturer products
$itemsCount = $h_myshop_manufacturer->getManufacturerProductsCount($manu_id);
if($itemsCount > $limit) {
$pagenav = new XoopsPageNav( $itemsCount, $limit, $start, 'start', 'manu_id='.$manu_id);
$xoopsTpl->assign('pagenav', $pagenav->renderNav());
}
$products = array();
$products = $h_myshop_manufacturer->getManufacturerProducts($manu_id, $start, $limit);
if(count($products) > 0) {
$tmp = $categories = array();
foreach($products as $product) {
$tmp[] = $product->getVar('product_cid');
}
$tmp = array_unique($tmp);
sort($tmp);
if(count($tmp) > 0) {
$categories = $h_myshop_cat->getCategoriesFromIds($tmp);
}
$cpt = 1;
foreach($products as $product) {
$productForTemplate = array();
$productForTemplate = $product->toArray();
$productForTemplate['count'] = $cpt;
$productForTemplate['product_category'] = isset($categories[$product->getVar('product_cid')]) ? $categories[$product->getVar('product_cid')]->toArray() : null;
$xoopsTpl->append('products', $productForTemplate);
$cpt++;
}
}
myshop_utils::setCSS();
if (file_exists( MYSHOP_PATH.'language/'.$xoopsConfig['language'].'/modinfo.php')) {
require_once MYSHOP_PATH.'language/'.$xoopsConfig['language'].'/modinfo.php';
} else {
require_once MYSHOP_PATH.'language/english/modinfo.php';
}
$xoopsTpl->assign('global_advert', myshop_utils::getModuleOption('advertisement'));
$breadcrumb = array(MYSHOP_URL.'whoswho.php' => _MYSHOP_MANUFACTURERS,
MYSHOP_URL.basename(__FILE__) => $manufacturer->getVar('manu_name').' '.$manufacturer->getVar('manu_commercialname'));
$xoopsTpl->assign('breadcrumb', myshop_utils::breadcrumb($breadcrumb));
$title = $manufacturer->getVar('manu_name').' '.$manufacturer->getVar('manu_commercialname').' - '.myshop_utils::getModuleName();
myshop_utils::setMetas($title, $title, myshop_utils::createMetaKeywords($manufacturer->getVar('manu_name').' '.$manufacturer->getVar('manu_commercialname').' '.$manufacturer->getVar('manu_bio')) );
require_once XOOPS_ROOT_PATH.'/footer.php';
?>