1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
You may not change or alter any portion of this comment or credits |
4
|
|
|
of supporting developers from this source code or any supporting source code |
5
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
6
|
|
|
|
7
|
|
|
This program is distributed in the hope that it will be useful, |
8
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
9
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* oledrion |
14
|
|
|
* |
15
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
16
|
|
|
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
17
|
|
|
* @author Hervé Thouzard (http://www.herve-thouzard.com/) |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
use XoopsModules\Oledrion; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* This block shows the products that were recently sold |
24
|
|
|
* @param array $options [0] = Nombre maximum de produits à voir |
25
|
|
|
* @return array|bool |
26
|
|
|
*/ |
27
|
|
|
function b_oledrion_recentlysold_show($options) |
28
|
|
|
{ |
29
|
|
|
global $xoopsConfig, $xoTheme; |
30
|
|
|
require_once XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php'; |
31
|
|
|
$categoryId = 0; |
|
|
|
|
32
|
|
|
$start = 0; |
33
|
|
|
$limit = $options[0]; |
34
|
|
|
$shelfParameters->resetDefaultValues()->setProductsType('recentlysold')->setStart($start)->setLimit($limit); |
|
|
|
|
35
|
|
|
$products = $shelf->getProducts($shelfParameters); |
|
|
|
|
36
|
|
|
if (isset($products['lastTitle'])) { |
37
|
|
|
unset($products['lastTitle']); |
38
|
|
|
} |
39
|
|
|
if (count($products) > 0) { |
40
|
|
|
$block = []; |
41
|
|
|
$block['nostock_msg'] = Oledrion\Utility::getModuleOption('nostock_msg'); |
42
|
|
|
$block['block_products'] = $products; |
43
|
|
|
$xoTheme->addStylesheet(OLEDRION_URL . 'assets/css/oledrion.css'); |
44
|
|
|
|
45
|
|
|
return $block; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
return false; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Edition des paramètres du blocs |
53
|
|
|
* |
54
|
|
|
* @param array $options [0] = Nombre maximum de produits à voir |
55
|
|
|
* @return string |
56
|
|
|
*/ |
57
|
|
|
function b_oledrion_recentlysold_edit($options) |
58
|
|
|
{ |
59
|
|
|
require_once XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php'; |
60
|
|
|
$form = ''; |
61
|
|
|
$form .= "<table border='0'>"; |
62
|
|
|
$form .= '<tr><td>' . _MB_OLEDRION_PRODUCTS_CNT . "</td><td><input type='text' name='options[]' id='options' value='" . $options[0] . "'></td></tr>"; |
63
|
|
|
$form .= '</table>'; |
64
|
|
|
|
65
|
|
|
return $form; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Bloc à la volée |
70
|
|
|
* @param string|array $options |
71
|
|
|
* @return string |
72
|
|
|
*/ |
73
|
|
|
function b_oledrion_recentlysold_duplicatable($options) |
74
|
|
|
{ |
75
|
|
|
if (!is_array($options)) { |
76
|
|
|
$options = explode('|', $options); |
77
|
|
|
} |
78
|
|
|
$block = b_oledrion_bestsales_show($options); |
79
|
|
|
|
80
|
|
|
$tpl = new \XoopsTpl(); |
81
|
|
|
$tpl->assign('block', $block); |
82
|
|
|
$tpl->display('db:oledrion_block_recentlysold.tpl'); |
83
|
|
|
} |
84
|
|
|
|