1 | <?php |
||
20 | abstract class Base |
||
21 | extends \Aimeos\Controller\Frontend\Base |
||
22 | implements \Aimeos\Controller\Frontend\Common\Decorator\Iface, \Aimeos\Controller\Frontend\Order\Iface |
||
23 | { |
||
24 | private $controller; |
||
25 | |||
26 | |||
27 | /** |
||
28 | * Initializes the controller decorator. |
||
29 | * |
||
30 | * @param \Aimeos\Controller\Frontend\Iface $controller Controller object |
||
31 | * @param \Aimeos\MShop\Context\Item\Iface $context Context object with required objects |
||
32 | */ |
||
33 | public function __construct( \Aimeos\Controller\Frontend\Iface $controller, \Aimeos\MShop\Context\Item\Iface $context ) |
||
46 | |||
47 | |||
48 | /** |
||
49 | * Passes unknown methods to wrapped objects. |
||
50 | * |
||
51 | * @param string $name Name of the method |
||
52 | * @param array $param List of method parameter |
||
53 | * @return mixed Returns the value of the called method |
||
54 | * @throws \Aimeos\Controller\Frontend\Exception If method call failed |
||
55 | */ |
||
56 | public function __call( $name, array $param ) |
||
60 | |||
61 | |||
62 | /** |
||
63 | * Creates and adds a new order for the given order base ID |
||
64 | * |
||
65 | * @param string $baseId Unique ID of the saved basket |
||
66 | * @param string $type Arbitrary order type (max. eight chars) |
||
67 | * @return \Aimeos\MShop\Order\Item\Iface Created order object |
||
68 | */ |
||
69 | public function addItem( $baseId, $type ) |
||
73 | |||
74 | |||
75 | /** |
||
76 | * Returns the filter for searching items |
||
77 | * |
||
78 | * @return \Aimeos\MW\Criteria\Iface Filter object |
||
79 | */ |
||
80 | public function createFilter() |
||
84 | |||
85 | |||
86 | /** |
||
87 | * Returns the order item for the given ID |
||
88 | * |
||
89 | * @param string $id Unique order ID |
||
90 | * @param boolean $default Use default criteria to limit orders |
||
91 | * @return \Aimeos\MShop\Order\Item\Iface Order object |
||
92 | */ |
||
93 | public function getItem( $id, $default = true ) |
||
97 | |||
98 | |||
99 | /** |
||
100 | * Saves the modified order item |
||
101 | * |
||
102 | * @param \Aimeos\MShop\Order\Item\Iface $item Order object |
||
103 | * @return \Aimeos\MShop\Order\Item\Iface Saved order item |
||
104 | */ |
||
105 | public function saveItem( \Aimeos\MShop\Order\Item\Iface $item ) |
||
109 | |||
110 | |||
111 | /** |
||
112 | * Returns the order items based on the given filter that belong to the current user |
||
113 | * |
||
114 | * @param \Aimeos\MW\Criteria\Iface Filter object |
||
115 | * @param integer &$total|null Variable that will contain the total number of available items |
||
116 | * @return \Aimeos\MShop\Order\Item\Iface[] Associative list of IDs as keys and order objects as values |
||
117 | */ |
||
118 | public function searchItems( \Aimeos\MW\Criteria\Iface $filter, &$total = null ) |
||
122 | |||
123 | |||
124 | /** |
||
125 | * Blocks the resources listed in the order. |
||
126 | * |
||
127 | * Every order contains resources like products or redeemed coupon codes |
||
128 | * that must be blocked so they can't be used by another customer in a |
||
129 | * later order. This method reduces the the stock level of products, the |
||
130 | * counts of coupon codes and others. |
||
131 | * |
||
132 | * It's save to call this method multiple times for one order. In this case, |
||
133 | * the actions will be executed only once. All subsequent calls will do |
||
134 | * nothing as long as the resources haven't been unblocked in the meantime. |
||
135 | * |
||
136 | * You can also block and unblock resources several times. Please keep in |
||
137 | * mind that unblocked resources may be reused by other orders in the |
||
138 | * meantime. This can lead to an oversell of products! |
||
139 | * |
||
140 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
||
141 | * @return void |
||
142 | */ |
||
143 | public function block( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
||
147 | |||
148 | |||
149 | /** |
||
150 | * Frees the resources listed in the order. |
||
151 | * |
||
152 | * If customers created orders but didn't pay for them, the blocked resources |
||
153 | * like products and redeemed coupon codes must be unblocked so they can be |
||
154 | * ordered again or used by other customers. This method increased the stock |
||
155 | * level of products, the counts of coupon codes and others. |
||
156 | * |
||
157 | * It's save to call this method multiple times for one order. In this case, |
||
158 | * the actions will be executed only once. All subsequent calls will do |
||
159 | * nothing as long as the resources haven't been blocked in the meantime. |
||
160 | * |
||
161 | * You can also unblock and block resources several times. Please keep in |
||
162 | * mind that unblocked resources may be reused by other orders in the |
||
163 | * meantime. This can lead to an oversell of products! |
||
164 | * |
||
165 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
||
166 | * @return void |
||
167 | */ |
||
168 | public function unblock( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
||
172 | |||
173 | |||
174 | /** |
||
175 | * Blocks or frees the resources listed in the order if necessary. |
||
176 | * |
||
177 | * After payment status updates, the resources like products or coupon |
||
178 | * codes listed in the order must be blocked or unblocked. This method |
||
179 | * cares about executing the appropriate action depending on the payment |
||
180 | * status. |
||
181 | * |
||
182 | * It's save to call this method multiple times for one order. In this case, |
||
183 | * the actions will be executed only once. All subsequent calls will do |
||
184 | * nothing as long as the payment status hasn't changed in the meantime. |
||
185 | * |
||
186 | * @param \Aimeos\MShop\Order\Item\Iface $orderItem Order item object |
||
187 | * @return void |
||
188 | */ |
||
189 | public function update( \Aimeos\MShop\Order\Item\Iface $orderItem ) |
||
193 | |||
194 | |||
195 | /** |
||
196 | * Returns the frontend controller |
||
197 | * |
||
198 | * @return \Aimeos\Controller\Frontend\Order\Iface Frontend controller object |
||
199 | */ |
||
200 | protected function getController() |
||
204 | } |
||
205 |