1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace XoopsModules\Oledrion; |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
You may not change or alter any portion of this comment or credits |
7
|
|
|
of supporting developers from this source code or any supporting source code |
8
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
9
|
|
|
|
10
|
|
|
This program is distributed in the hope that it will be useful, |
11
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
12
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* oledrion |
17
|
|
|
* |
18
|
|
|
* @copyright {@link https://xoops.org/ XOOPS Project} |
19
|
|
|
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
20
|
|
|
* @author Hervé Thouzard (http://www.herve-thouzard.com/) |
21
|
|
|
*/ |
22
|
|
|
|
23
|
|
|
use XoopsModules\Oledrion; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Gestion des caddy |
27
|
|
|
*/ |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Class Caddy |
31
|
|
|
*/ |
32
|
|
|
class Caddy extends OledrionObject |
33
|
|
|
{ |
34
|
|
|
/** |
35
|
|
|
* constructor |
36
|
|
|
* |
37
|
|
|
* normally, this is called from child classes only |
38
|
|
|
*/ |
39
|
|
|
public function __construct() |
40
|
|
|
{ |
41
|
|
|
$this->initVar('caddy_id', XOBJ_DTYPE_INT, null, false); |
42
|
|
|
$this->initVar('caddy_product_id', XOBJ_DTYPE_INT, null, false); |
43
|
|
|
$this->initVar('caddy_qte', XOBJ_DTYPE_INT, null, false); |
44
|
|
|
$this->initVar('caddy_price', XOBJ_DTYPE_TXTBOX, null, false); // Prix TTC |
45
|
|
|
$this->initVar('caddy_cmd_id', XOBJ_DTYPE_INT, null, false); |
46
|
|
|
$this->initVar('caddy_shipping', XOBJ_DTYPE_TXTBOX, null, false); |
47
|
|
|
$this->initVar('caddy_pass', XOBJ_DTYPE_TXTBOX, null, false); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Retourne les éléments du produits formatés pour affichage |
52
|
|
|
* |
53
|
|
|
* @param string $format Le format à utiliser |
54
|
|
|
* @return array Les informations formatées |
55
|
|
|
*/ |
56
|
|
|
public function toArray($format = 's') |
57
|
|
|
{ |
58
|
|
|
$ret = []; |
|
|
|
|
59
|
|
|
$ret = parent::toArray($format); |
60
|
|
|
$oledrionCurrency = Oledrion\Currency::getInstance(); |
61
|
|
|
$ret['caddy_price_fordisplay'] = $oledrionCurrency->amountForDisplay($this->getVar('caddy_price')); |
62
|
|
|
$ret['caddy_shipping_fordisplay'] = $oledrionCurrency->amountForDisplay($this->getVar('caddy_shipping')); |
63
|
|
|
|
64
|
|
|
return $ret; |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|