|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Dynamic\Foxy\Orders\Model; |
|
4
|
|
|
|
|
5
|
|
|
use Dynamic\Foxy\Model\Variation; |
|
6
|
|
|
use SilverStripe\CMS\Model\SiteTree; |
|
7
|
|
|
use SilverStripe\ORM\DataObject; |
|
8
|
|
|
use SilverStripe\ORM\FieldType\DBCurrency; |
|
9
|
|
|
use SilverStripe\ORM\HasManyList; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Class OrderDetail |
|
13
|
|
|
* @package Dynamic\Foxy\Orders\Model |
|
14
|
|
|
* |
|
15
|
|
|
* @property int $Quantity |
|
16
|
|
|
* @property DBCurrency $Price |
|
17
|
|
|
* @property string $ProductName |
|
18
|
|
|
* @property string $ProductCode |
|
19
|
|
|
* @property string $ProductImage |
|
20
|
|
|
* @property string $ProductCategory |
|
21
|
|
|
* @property int $ProductID |
|
22
|
|
|
* @property int $OrderID |
|
23
|
|
|
* |
|
24
|
|
|
* @method SiteTree Product |
|
25
|
|
|
* @method Order Order |
|
26
|
|
|
* |
|
27
|
|
|
* @method HasManyList OrderOptions |
|
28
|
|
|
*/ |
|
29
|
|
|
class OrderDetail extends DataObject |
|
30
|
|
|
{ |
|
31
|
|
|
/** |
|
32
|
|
|
* @var array |
|
33
|
|
|
*/ |
|
34
|
|
|
private static $db = [ |
|
|
|
|
|
|
35
|
|
|
'Quantity' => 'Int', |
|
36
|
|
|
'Price' => 'Currency', |
|
37
|
|
|
'ProductName' => 'HTMLVarchar(255)', |
|
38
|
|
|
'ProductCode' => 'Varchar(100)', |
|
39
|
|
|
'ProductImage' => 'Text', |
|
40
|
|
|
'ProductCategory' => 'Varchar(100)', |
|
41
|
|
|
]; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @var array |
|
45
|
|
|
*/ |
|
46
|
|
|
private static $has_one = [ |
|
|
|
|
|
|
47
|
|
|
'Product' => SiteTree::class, |
|
48
|
|
|
'Order' => Order::class, |
|
49
|
|
|
]; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @var array |
|
53
|
|
|
*/ |
|
54
|
|
|
private static $has_many = [ |
|
|
|
|
|
|
55
|
|
|
'OrderOptions' => OrderOption::class, |
|
56
|
|
|
'OrderVariations' => OrderVariation::class, |
|
57
|
|
|
]; |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @var array |
|
61
|
|
|
*/ |
|
62
|
|
|
private static $summary_fields = [ |
|
|
|
|
|
|
63
|
|
|
'Product.Title', |
|
64
|
|
|
'Quantity', |
|
65
|
|
|
'Price.Nice', |
|
66
|
|
|
]; |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* @var string |
|
70
|
|
|
*/ |
|
71
|
|
|
private static $table_name = 'FoxyOrderDetail'; |
|
|
|
|
|
|
72
|
|
|
} |
|
73
|
|
|
|