@@ -19,509 +19,509 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/checkout/confirm/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the checkout confirm section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2014.03 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/checkout/confirm/standard/subparts'; |
|
| 59 | - |
|
| 60 | - /** client/html/checkout/confirm/intro/name |
|
| 61 | - * Name of the intro part used by the checkout confirm client implementation |
|
| 62 | - * |
|
| 63 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Confirm\Intro\Myname". |
|
| 64 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 65 | - * |
|
| 66 | - * @param string Last part of the client class name |
|
| 67 | - * @since 2014.07 |
|
| 68 | - * @category Developer |
|
| 69 | - */ |
|
| 70 | - |
|
| 71 | - /** client/html/checkout/confirm/basic/name |
|
| 72 | - * Name of the basic part used by the checkout confirm client implementation |
|
| 73 | - * |
|
| 74 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Confirm\Basic\Myname". |
|
| 75 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 76 | - * |
|
| 77 | - * @param string Last part of the client class name |
|
| 78 | - * @since 2014.03 |
|
| 79 | - * @category Developer |
|
| 80 | - */ |
|
| 81 | - |
|
| 82 | - /** client/html/checkout/confirm/retry/name |
|
| 83 | - * Name of the retry part used by the checkout confirm client implementation |
|
| 84 | - * |
|
| 85 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Confirm\Retry\Myname". |
|
| 86 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 87 | - * |
|
| 88 | - * @param string Last part of the client class name |
|
| 89 | - * @since 2014.07 |
|
| 90 | - * @category Developer |
|
| 91 | - */ |
|
| 92 | - |
|
| 93 | - /** client/html/checkout/confirm/order/name |
|
| 94 | - * Name of the order part used by the checkout confirm client implementation |
|
| 95 | - * |
|
| 96 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Confirm\Order\Myname". |
|
| 97 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 98 | - * |
|
| 99 | - * @param string Last part of the client class name |
|
| 100 | - * @since 2015.02 |
|
| 101 | - * @category Developer |
|
| 102 | - */ |
|
| 103 | - private $subPartNames = array( 'intro', 'basic', 'retry', 'order' ); |
|
| 104 | - private $cache; |
|
| 105 | - |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * Returns the HTML code for insertion into the body. |
|
| 109 | - * |
|
| 110 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | - * @return string HTML code |
|
| 114 | - */ |
|
| 115 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | - { |
|
| 117 | - $context = $this->getContext(); |
|
| 118 | - $view = $this->getView(); |
|
| 119 | - |
|
| 120 | - try |
|
| 121 | - { |
|
| 122 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 123 | - |
|
| 124 | - $html = ''; |
|
| 125 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 126 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 127 | - } |
|
| 128 | - $view->confirmBody = $html; |
|
| 129 | - } |
|
| 130 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 131 | - { |
|
| 132 | - $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 133 | - $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
|
| 134 | - } |
|
| 135 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 136 | - { |
|
| 137 | - $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 138 | - $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
|
| 139 | - } |
|
| 140 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 141 | - { |
|
| 142 | - $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 143 | - $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
|
| 144 | - } |
|
| 145 | - catch( \Exception $e ) |
|
| 146 | - { |
|
| 147 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 148 | - |
|
| 149 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 150 | - $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - /** client/html/checkout/confirm/standard/template-body |
|
| 154 | - * Relative path to the HTML body template of the checkout confirm client. |
|
| 155 | - * |
|
| 156 | - * The template file contains the HTML code and processing instructions |
|
| 157 | - * to generate the result shown in the body of the frontend. The |
|
| 158 | - * configuration string is the path to the template file relative |
|
| 159 | - * to the templates directory (usually in client/html/templates). |
|
| 160 | - * |
|
| 161 | - * You can overwrite the template file configuration in extensions and |
|
| 162 | - * provide alternative templates. These alternative templates should be |
|
| 163 | - * named like the default one but with the string "standard" replaced by |
|
| 164 | - * an unique name. You may use the name of your project for this. If |
|
| 165 | - * you've implemented an alternative client class as well, "standard" |
|
| 166 | - * should be replaced by the name of the new class. |
|
| 167 | - * |
|
| 168 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 169 | - * @since 2014.03 |
|
| 170 | - * @category Developer |
|
| 171 | - * @see client/html/checkout/confirm/standard/template-header |
|
| 172 | - */ |
|
| 173 | - $tplconf = 'client/html/checkout/confirm/standard/template-body'; |
|
| 174 | - $default = 'checkout/confirm/body-default.php'; |
|
| 175 | - |
|
| 176 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 177 | - } |
|
| 178 | - |
|
| 179 | - |
|
| 180 | - /** |
|
| 181 | - * Returns the HTML string for insertion into the header. |
|
| 182 | - * |
|
| 183 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 184 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 185 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 186 | - * @return string|null String including HTML tags for the header on error |
|
| 187 | - */ |
|
| 188 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 189 | - { |
|
| 190 | - try |
|
| 191 | - { |
|
| 192 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 193 | - |
|
| 194 | - $html = ''; |
|
| 195 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 196 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 197 | - } |
|
| 198 | - $view->confirmHeader = $html; |
|
| 199 | - |
|
| 200 | - /** client/html/checkout/confirm/standard/template-header |
|
| 201 | - * Relative path to the HTML header template of the checkout confirm client. |
|
| 202 | - * |
|
| 203 | - * The template file contains the HTML code and processing instructions |
|
| 204 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 205 | - * of the rendered page in the frontend. The configuration string is the |
|
| 206 | - * path to the template file relative to the templates directory (usually |
|
| 207 | - * in client/html/templates). |
|
| 208 | - * |
|
| 209 | - * You can overwrite the template file configuration in extensions and |
|
| 210 | - * provide alternative templates. These alternative templates should be |
|
| 211 | - * named like the default one but with the string "standard" replaced by |
|
| 212 | - * an unique name. You may use the name of your project for this. If |
|
| 213 | - * you've implemented an alternative client class as well, "standard" |
|
| 214 | - * should be replaced by the name of the new class. |
|
| 215 | - * |
|
| 216 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 217 | - * @since 2014.03 |
|
| 218 | - * @category Developer |
|
| 219 | - * @see client/html/checkout/confirm/standard/template-body |
|
| 220 | - */ |
|
| 221 | - $tplconf = 'client/html/checkout/confirm/standard/template-header'; |
|
| 222 | - $default = 'checkout/confirm/header-default.php'; |
|
| 223 | - |
|
| 224 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 225 | - } |
|
| 226 | - catch( \Exception $e ) |
|
| 227 | - { |
|
| 228 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 229 | - } |
|
| 230 | - } |
|
| 231 | - |
|
| 232 | - |
|
| 233 | - /** |
|
| 234 | - * Returns the sub-client given by its name. |
|
| 235 | - * |
|
| 236 | - * @param string $type Name of the client type |
|
| 237 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 238 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 239 | - */ |
|
| 240 | - public function getSubClient( $type, $name = null ) |
|
| 241 | - { |
|
| 242 | - /** client/html/checkout/confirm/decorators/excludes |
|
| 243 | - * Excludes decorators added by the "common" option from the checkout confirm html client |
|
| 244 | - * |
|
| 245 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 246 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 247 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 248 | - * modify what is returned to the caller. |
|
| 249 | - * |
|
| 250 | - * This option allows you to remove a decorator added via |
|
| 251 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 252 | - * around the html client. |
|
| 253 | - * |
|
| 254 | - * client/html/checkout/confirm/decorators/excludes = array( 'decorator1' ) |
|
| 255 | - * |
|
| 256 | - * This would remove the decorator named "decorator1" from the list of |
|
| 257 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 258 | - * "client/html/common/decorators/default" to the html client. |
|
| 259 | - * |
|
| 260 | - * @param array List of decorator names |
|
| 261 | - * @since 2014.05 |
|
| 262 | - * @category Developer |
|
| 263 | - * @see client/html/common/decorators/default |
|
| 264 | - * @see client/html/checkout/confirm/decorators/global |
|
| 265 | - * @see client/html/checkout/confirm/decorators/local |
|
| 266 | - */ |
|
| 267 | - |
|
| 268 | - /** client/html/checkout/confirm/decorators/global |
|
| 269 | - * Adds a list of globally available decorators only to the checkout confirm html client |
|
| 270 | - * |
|
| 271 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 272 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 273 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 274 | - * modify what is returned to the caller. |
|
| 275 | - * |
|
| 276 | - * This option allows you to wrap global decorators |
|
| 277 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 278 | - * |
|
| 279 | - * client/html/checkout/confirm/decorators/global = array( 'decorator1' ) |
|
| 280 | - * |
|
| 281 | - * This would add the decorator named "decorator1" defined by |
|
| 282 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 283 | - * |
|
| 284 | - * @param array List of decorator names |
|
| 285 | - * @since 2014.05 |
|
| 286 | - * @category Developer |
|
| 287 | - * @see client/html/common/decorators/default |
|
| 288 | - * @see client/html/checkout/confirm/decorators/excludes |
|
| 289 | - * @see client/html/checkout/confirm/decorators/local |
|
| 290 | - */ |
|
| 291 | - |
|
| 292 | - /** client/html/checkout/confirm/decorators/local |
|
| 293 | - * Adds a list of local decorators only to the checkout confirm html client |
|
| 294 | - * |
|
| 295 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 296 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 297 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 298 | - * modify what is returned to the caller. |
|
| 299 | - * |
|
| 300 | - * This option allows you to wrap local decorators |
|
| 301 | - * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 302 | - * |
|
| 303 | - * client/html/checkout/confirm/decorators/local = array( 'decorator2' ) |
|
| 304 | - * |
|
| 305 | - * This would add the decorator named "decorator2" defined by |
|
| 306 | - * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 307 | - * |
|
| 308 | - * @param array List of decorator names |
|
| 309 | - * @since 2014.05 |
|
| 310 | - * @category Developer |
|
| 311 | - * @see client/html/common/decorators/default |
|
| 312 | - * @see client/html/checkout/confirm/decorators/excludes |
|
| 313 | - * @see client/html/checkout/confirm/decorators/global |
|
| 314 | - */ |
|
| 315 | - |
|
| 316 | - return $this->createSubClient( 'checkout/confirm/' . $type, $name ); |
|
| 317 | - } |
|
| 318 | - |
|
| 319 | - |
|
| 320 | - /** |
|
| 321 | - * Processes the input, e.g. store given values. |
|
| 322 | - * A view must be available and this method doesn't generate any output |
|
| 323 | - * besides setting view variables. |
|
| 324 | - */ |
|
| 325 | - public function process() |
|
| 326 | - { |
|
| 327 | - $view = $this->getView(); |
|
| 328 | - $context = $this->getContext(); |
|
| 329 | - $session = $context->getSession(); |
|
| 330 | - $orderid = $session->get( 'aimeos/orderid' ); |
|
| 331 | - |
|
| 332 | - try |
|
| 333 | - { |
|
| 334 | - if( ( $orderItem = $this->updatePayment( $view, $orderid ) ) === null ) |
|
| 335 | - { |
|
| 336 | - $orderManager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
| 337 | - $orderItem = $orderManager->getItem( $orderid ); |
|
| 338 | - } |
|
| 339 | - |
|
| 340 | - $view->confirmOrderItem = $orderItem; |
|
| 341 | - |
|
| 342 | - |
|
| 343 | - parent::process(); |
|
| 344 | - |
|
| 345 | - |
|
| 346 | - if( $orderItem->getPaymentStatus() > \Aimeos\MShop\Order\Item\Base::PAY_REFUSED ) |
|
| 347 | - { |
|
| 348 | - foreach( $session->get( 'aimeos/basket/cache', array() ) as $key => $value ) { |
|
| 349 | - $session->set( $key, null ); |
|
| 350 | - } |
|
| 351 | - |
|
| 352 | - \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' )->clear(); |
|
| 353 | - } |
|
| 354 | - |
|
| 355 | - // Update stock, coupons, etc. |
|
| 356 | - \Aimeos\Controller\Frontend\Factory::createController( $context, 'order' )->update( $orderItem ); |
|
| 357 | - } |
|
| 358 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 359 | - { |
|
| 360 | - $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 361 | - $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
|
| 362 | - } |
|
| 363 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 364 | - { |
|
| 365 | - $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 366 | - $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
|
| 367 | - } |
|
| 368 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 369 | - { |
|
| 370 | - $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 371 | - $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
|
| 372 | - } |
|
| 373 | - catch( \Exception $e ) |
|
| 374 | - { |
|
| 375 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 376 | - |
|
| 377 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 378 | - $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
|
| 379 | - } |
|
| 380 | - } |
|
| 381 | - |
|
| 382 | - |
|
| 383 | - /** |
|
| 384 | - * Returns the payment service providere for the given code |
|
| 385 | - * |
|
| 386 | - * @param string $code Unique service code |
|
| 387 | - * @throws \Aimeos\Client\Html\Exception If no payment service item could be found |
|
| 388 | - * @return \Aimeos\MShop\Service\Provider\Iface Service provider object |
|
| 389 | - */ |
|
| 390 | - protected function getServiceProvider( $code ) |
|
| 391 | - { |
|
| 392 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 393 | - |
|
| 394 | - $search = $serviceManager->createSearch(); |
|
| 395 | - $expr = array( |
|
| 396 | - $search->compare( '==', 'service.code', $code ), |
|
| 397 | - $search->compare( '==', 'service.type.code', 'payment' ), |
|
| 398 | - ); |
|
| 399 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 400 | - |
|
| 401 | - $result = $serviceManager->searchItems( $search ); |
|
| 402 | - |
|
| 403 | - if( ( $serviceItem = reset( $result ) ) === false ) |
|
| 404 | - { |
|
| 405 | - $msg = sprintf( 'No service for code "%1$s" found', $code ); |
|
| 406 | - throw new \Aimeos\Client\Html\Exception( $msg ); |
|
| 407 | - } |
|
| 408 | - |
|
| 409 | - return $serviceManager->getProvider( $serviceItem ); |
|
| 410 | - } |
|
| 411 | - |
|
| 412 | - |
|
| 413 | - /** |
|
| 414 | - * Returns the list of sub-client names configured for the client. |
|
| 415 | - * |
|
| 416 | - * @return array List of HTML client names |
|
| 417 | - */ |
|
| 418 | - protected function getSubClientNames() |
|
| 419 | - { |
|
| 420 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 421 | - } |
|
| 422 | - |
|
| 423 | - |
|
| 424 | - /** |
|
| 425 | - * Returns the URL to the confirm page. |
|
| 426 | - * |
|
| 427 | - * @param \Aimeos\MW\View\Iface $view View object |
|
| 428 | - * @param array $params Parameters that should be part of the URL |
|
| 429 | - * @param array $config Default URL configuration |
|
| 430 | - * @return string URL string |
|
| 431 | - */ |
|
| 432 | - protected function getUrlConfirm( \Aimeos\MW\View\Iface $view, array $params, array $config ) |
|
| 433 | - { |
|
| 434 | - $target = $view->config( 'client/html/checkout/confirm/url/target' ); |
|
| 435 | - $cntl = $view->config( 'client/html/checkout/confirm/url/controller', 'checkout' ); |
|
| 436 | - $action = $view->config( 'client/html/checkout/confirm/url/action', 'confirm' ); |
|
| 437 | - $config = $view->config( 'client/html/checkout/confirm/url/config', $config ); |
|
| 438 | - |
|
| 439 | - return $view->url( $target, $cntl, $action, $params, array(), $config ); |
|
| 440 | - } |
|
| 441 | - |
|
| 442 | - |
|
| 443 | - /** |
|
| 444 | - * Returns the URL to the update page. |
|
| 445 | - * |
|
| 446 | - * @param \Aimeos\MW\View\Iface $view View object |
|
| 447 | - * @param array $params Parameters that should be part of the URL |
|
| 448 | - * @param array $config Default URL configuration |
|
| 449 | - * @return string URL string |
|
| 450 | - */ |
|
| 451 | - protected function getUrlUpdate( \Aimeos\MW\View\Iface $view, array $params, array $config ) |
|
| 452 | - { |
|
| 453 | - $target = $view->config( 'client/html/checkout/update/url/target' ); |
|
| 454 | - $cntl = $view->config( 'client/html/checkout/update/url/controller', 'checkout' ); |
|
| 455 | - $action = $view->config( 'client/html/checkout/update/url/action', 'update' ); |
|
| 456 | - $config = $view->config( 'client/html/checkout/update/url/config', $config ); |
|
| 457 | - |
|
| 458 | - return $view->url( $target, $cntl, $action, $params, array(), $config ); |
|
| 459 | - } |
|
| 460 | - |
|
| 461 | - |
|
| 462 | - /** |
|
| 463 | - * Sets the necessary parameter values in the view. |
|
| 464 | - * |
|
| 465 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 466 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 467 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 468 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 469 | - */ |
|
| 470 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 471 | - { |
|
| 472 | - if( !isset( $this->cache ) ) |
|
| 473 | - { |
|
| 474 | - if( !isset( $view->confirmOrderItem ) ) |
|
| 475 | - { |
|
| 476 | - $context = $this->getContext(); |
|
| 477 | - $orderid = $context->getSession()->get( 'aimeos/orderid' ); |
|
| 478 | - $orderManager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
| 479 | - |
|
| 480 | - $view->confirmOrderItem = $orderManager->getItem( $orderid ); |
|
| 481 | - } |
|
| 482 | - |
|
| 483 | - $this->cache = $view; |
|
| 484 | - } |
|
| 485 | - |
|
| 486 | - return $this->cache; |
|
| 487 | - } |
|
| 488 | - |
|
| 489 | - |
|
| 490 | - /** |
|
| 491 | - * Updates the payment status for the given order ID and returns the order item |
|
| 492 | - * |
|
| 493 | - * @param \Aimeos\MW\View\Iface $view View object of the HTML client |
|
| 494 | - * @param string $orderid ID of the order whose payment status should be updated |
|
| 495 | - * @return void|\Aimeos\MShop\Order\Item\Iface Order item that has been updated |
|
| 496 | - */ |
|
| 497 | - protected function updatePayment( \Aimeos\MW\View\Iface $view, $orderid ) |
|
| 498 | - { |
|
| 499 | - if( ( $code = $view->param( 'code' ) ) === null ) { |
|
| 500 | - return; |
|
| 501 | - } |
|
| 502 | - |
|
| 503 | - $provider = $this->getServiceProvider( $code ); |
|
| 504 | - |
|
| 505 | - $config = array( 'absoluteUri' => true, 'namespace' => false ); |
|
| 506 | - $params = array( 'code' => $code, 'orderid' => $orderid ); |
|
| 507 | - $urls = array( |
|
| 508 | - 'payment.url-success' => $this->getUrlConfirm( $view, $params, $config ), |
|
| 509 | - 'payment.url-update' => $this->getUrlUpdate( $view, $params, $config ), |
|
| 510 | - 'client.ipaddress' => $view->request()->getClientAddress(), |
|
| 511 | - ); |
|
| 512 | - $urls['payment.url-self'] = $urls['payment.url-success']; |
|
| 513 | - $provider->injectGlobalConfigBE( $urls ); |
|
| 514 | - |
|
| 515 | - $reqParams = $view->param(); |
|
| 516 | - $reqParams['orderid'] = $orderid; |
|
| 517 | - |
|
| 518 | - if( ( $orderItem = $provider->updateSync( $reqParams, $view->request()->getBody() ) ) !== null |
|
| 519 | - && $orderItem->getPaymentStatus() === \Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED |
|
| 520 | - && $provider->isImplemented( \Aimeos\MShop\Service\Provider\Payment\Base::FEAT_QUERY ) |
|
| 521 | - ) { |
|
| 522 | - $provider->query( $orderItem ); |
|
| 523 | - } |
|
| 524 | - |
|
| 525 | - return $orderItem; |
|
| 526 | - } |
|
| 25 | + /** client/html/checkout/confirm/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the checkout confirm section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2014.03 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/checkout/confirm/standard/subparts'; |
|
| 59 | + |
|
| 60 | + /** client/html/checkout/confirm/intro/name |
|
| 61 | + * Name of the intro part used by the checkout confirm client implementation |
|
| 62 | + * |
|
| 63 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Confirm\Intro\Myname". |
|
| 64 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 65 | + * |
|
| 66 | + * @param string Last part of the client class name |
|
| 67 | + * @since 2014.07 |
|
| 68 | + * @category Developer |
|
| 69 | + */ |
|
| 70 | + |
|
| 71 | + /** client/html/checkout/confirm/basic/name |
|
| 72 | + * Name of the basic part used by the checkout confirm client implementation |
|
| 73 | + * |
|
| 74 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Confirm\Basic\Myname". |
|
| 75 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 76 | + * |
|
| 77 | + * @param string Last part of the client class name |
|
| 78 | + * @since 2014.03 |
|
| 79 | + * @category Developer |
|
| 80 | + */ |
|
| 81 | + |
|
| 82 | + /** client/html/checkout/confirm/retry/name |
|
| 83 | + * Name of the retry part used by the checkout confirm client implementation |
|
| 84 | + * |
|
| 85 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Confirm\Retry\Myname". |
|
| 86 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 87 | + * |
|
| 88 | + * @param string Last part of the client class name |
|
| 89 | + * @since 2014.07 |
|
| 90 | + * @category Developer |
|
| 91 | + */ |
|
| 92 | + |
|
| 93 | + /** client/html/checkout/confirm/order/name |
|
| 94 | + * Name of the order part used by the checkout confirm client implementation |
|
| 95 | + * |
|
| 96 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Confirm\Order\Myname". |
|
| 97 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 98 | + * |
|
| 99 | + * @param string Last part of the client class name |
|
| 100 | + * @since 2015.02 |
|
| 101 | + * @category Developer |
|
| 102 | + */ |
|
| 103 | + private $subPartNames = array( 'intro', 'basic', 'retry', 'order' ); |
|
| 104 | + private $cache; |
|
| 105 | + |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * Returns the HTML code for insertion into the body. |
|
| 109 | + * |
|
| 110 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | + * @return string HTML code |
|
| 114 | + */ |
|
| 115 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | + { |
|
| 117 | + $context = $this->getContext(); |
|
| 118 | + $view = $this->getView(); |
|
| 119 | + |
|
| 120 | + try |
|
| 121 | + { |
|
| 122 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 123 | + |
|
| 124 | + $html = ''; |
|
| 125 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 126 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 127 | + } |
|
| 128 | + $view->confirmBody = $html; |
|
| 129 | + } |
|
| 130 | + catch( \Aimeos\Client\Html\Exception $e ) |
|
| 131 | + { |
|
| 132 | + $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 133 | + $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
|
| 134 | + } |
|
| 135 | + catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 136 | + { |
|
| 137 | + $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 138 | + $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
|
| 139 | + } |
|
| 140 | + catch( \Aimeos\MShop\Exception $e ) |
|
| 141 | + { |
|
| 142 | + $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 143 | + $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
|
| 144 | + } |
|
| 145 | + catch( \Exception $e ) |
|
| 146 | + { |
|
| 147 | + $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 148 | + |
|
| 149 | + $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 150 | + $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + /** client/html/checkout/confirm/standard/template-body |
|
| 154 | + * Relative path to the HTML body template of the checkout confirm client. |
|
| 155 | + * |
|
| 156 | + * The template file contains the HTML code and processing instructions |
|
| 157 | + * to generate the result shown in the body of the frontend. The |
|
| 158 | + * configuration string is the path to the template file relative |
|
| 159 | + * to the templates directory (usually in client/html/templates). |
|
| 160 | + * |
|
| 161 | + * You can overwrite the template file configuration in extensions and |
|
| 162 | + * provide alternative templates. These alternative templates should be |
|
| 163 | + * named like the default one but with the string "standard" replaced by |
|
| 164 | + * an unique name. You may use the name of your project for this. If |
|
| 165 | + * you've implemented an alternative client class as well, "standard" |
|
| 166 | + * should be replaced by the name of the new class. |
|
| 167 | + * |
|
| 168 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 169 | + * @since 2014.03 |
|
| 170 | + * @category Developer |
|
| 171 | + * @see client/html/checkout/confirm/standard/template-header |
|
| 172 | + */ |
|
| 173 | + $tplconf = 'client/html/checkout/confirm/standard/template-body'; |
|
| 174 | + $default = 'checkout/confirm/body-default.php'; |
|
| 175 | + |
|
| 176 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 177 | + } |
|
| 178 | + |
|
| 179 | + |
|
| 180 | + /** |
|
| 181 | + * Returns the HTML string for insertion into the header. |
|
| 182 | + * |
|
| 183 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 184 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 185 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 186 | + * @return string|null String including HTML tags for the header on error |
|
| 187 | + */ |
|
| 188 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 189 | + { |
|
| 190 | + try |
|
| 191 | + { |
|
| 192 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 193 | + |
|
| 194 | + $html = ''; |
|
| 195 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 196 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 197 | + } |
|
| 198 | + $view->confirmHeader = $html; |
|
| 199 | + |
|
| 200 | + /** client/html/checkout/confirm/standard/template-header |
|
| 201 | + * Relative path to the HTML header template of the checkout confirm client. |
|
| 202 | + * |
|
| 203 | + * The template file contains the HTML code and processing instructions |
|
| 204 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 205 | + * of the rendered page in the frontend. The configuration string is the |
|
| 206 | + * path to the template file relative to the templates directory (usually |
|
| 207 | + * in client/html/templates). |
|
| 208 | + * |
|
| 209 | + * You can overwrite the template file configuration in extensions and |
|
| 210 | + * provide alternative templates. These alternative templates should be |
|
| 211 | + * named like the default one but with the string "standard" replaced by |
|
| 212 | + * an unique name. You may use the name of your project for this. If |
|
| 213 | + * you've implemented an alternative client class as well, "standard" |
|
| 214 | + * should be replaced by the name of the new class. |
|
| 215 | + * |
|
| 216 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 217 | + * @since 2014.03 |
|
| 218 | + * @category Developer |
|
| 219 | + * @see client/html/checkout/confirm/standard/template-body |
|
| 220 | + */ |
|
| 221 | + $tplconf = 'client/html/checkout/confirm/standard/template-header'; |
|
| 222 | + $default = 'checkout/confirm/header-default.php'; |
|
| 223 | + |
|
| 224 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 225 | + } |
|
| 226 | + catch( \Exception $e ) |
|
| 227 | + { |
|
| 228 | + $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 229 | + } |
|
| 230 | + } |
|
| 231 | + |
|
| 232 | + |
|
| 233 | + /** |
|
| 234 | + * Returns the sub-client given by its name. |
|
| 235 | + * |
|
| 236 | + * @param string $type Name of the client type |
|
| 237 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 238 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 239 | + */ |
|
| 240 | + public function getSubClient( $type, $name = null ) |
|
| 241 | + { |
|
| 242 | + /** client/html/checkout/confirm/decorators/excludes |
|
| 243 | + * Excludes decorators added by the "common" option from the checkout confirm html client |
|
| 244 | + * |
|
| 245 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 246 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 247 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 248 | + * modify what is returned to the caller. |
|
| 249 | + * |
|
| 250 | + * This option allows you to remove a decorator added via |
|
| 251 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 252 | + * around the html client. |
|
| 253 | + * |
|
| 254 | + * client/html/checkout/confirm/decorators/excludes = array( 'decorator1' ) |
|
| 255 | + * |
|
| 256 | + * This would remove the decorator named "decorator1" from the list of |
|
| 257 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 258 | + * "client/html/common/decorators/default" to the html client. |
|
| 259 | + * |
|
| 260 | + * @param array List of decorator names |
|
| 261 | + * @since 2014.05 |
|
| 262 | + * @category Developer |
|
| 263 | + * @see client/html/common/decorators/default |
|
| 264 | + * @see client/html/checkout/confirm/decorators/global |
|
| 265 | + * @see client/html/checkout/confirm/decorators/local |
|
| 266 | + */ |
|
| 267 | + |
|
| 268 | + /** client/html/checkout/confirm/decorators/global |
|
| 269 | + * Adds a list of globally available decorators only to the checkout confirm html client |
|
| 270 | + * |
|
| 271 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 272 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 273 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 274 | + * modify what is returned to the caller. |
|
| 275 | + * |
|
| 276 | + * This option allows you to wrap global decorators |
|
| 277 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 278 | + * |
|
| 279 | + * client/html/checkout/confirm/decorators/global = array( 'decorator1' ) |
|
| 280 | + * |
|
| 281 | + * This would add the decorator named "decorator1" defined by |
|
| 282 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 283 | + * |
|
| 284 | + * @param array List of decorator names |
|
| 285 | + * @since 2014.05 |
|
| 286 | + * @category Developer |
|
| 287 | + * @see client/html/common/decorators/default |
|
| 288 | + * @see client/html/checkout/confirm/decorators/excludes |
|
| 289 | + * @see client/html/checkout/confirm/decorators/local |
|
| 290 | + */ |
|
| 291 | + |
|
| 292 | + /** client/html/checkout/confirm/decorators/local |
|
| 293 | + * Adds a list of local decorators only to the checkout confirm html client |
|
| 294 | + * |
|
| 295 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 296 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 297 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 298 | + * modify what is returned to the caller. |
|
| 299 | + * |
|
| 300 | + * This option allows you to wrap local decorators |
|
| 301 | + * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 302 | + * |
|
| 303 | + * client/html/checkout/confirm/decorators/local = array( 'decorator2' ) |
|
| 304 | + * |
|
| 305 | + * This would add the decorator named "decorator2" defined by |
|
| 306 | + * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 307 | + * |
|
| 308 | + * @param array List of decorator names |
|
| 309 | + * @since 2014.05 |
|
| 310 | + * @category Developer |
|
| 311 | + * @see client/html/common/decorators/default |
|
| 312 | + * @see client/html/checkout/confirm/decorators/excludes |
|
| 313 | + * @see client/html/checkout/confirm/decorators/global |
|
| 314 | + */ |
|
| 315 | + |
|
| 316 | + return $this->createSubClient( 'checkout/confirm/' . $type, $name ); |
|
| 317 | + } |
|
| 318 | + |
|
| 319 | + |
|
| 320 | + /** |
|
| 321 | + * Processes the input, e.g. store given values. |
|
| 322 | + * A view must be available and this method doesn't generate any output |
|
| 323 | + * besides setting view variables. |
|
| 324 | + */ |
|
| 325 | + public function process() |
|
| 326 | + { |
|
| 327 | + $view = $this->getView(); |
|
| 328 | + $context = $this->getContext(); |
|
| 329 | + $session = $context->getSession(); |
|
| 330 | + $orderid = $session->get( 'aimeos/orderid' ); |
|
| 331 | + |
|
| 332 | + try |
|
| 333 | + { |
|
| 334 | + if( ( $orderItem = $this->updatePayment( $view, $orderid ) ) === null ) |
|
| 335 | + { |
|
| 336 | + $orderManager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
| 337 | + $orderItem = $orderManager->getItem( $orderid ); |
|
| 338 | + } |
|
| 339 | + |
|
| 340 | + $view->confirmOrderItem = $orderItem; |
|
| 341 | + |
|
| 342 | + |
|
| 343 | + parent::process(); |
|
| 344 | + |
|
| 345 | + |
|
| 346 | + if( $orderItem->getPaymentStatus() > \Aimeos\MShop\Order\Item\Base::PAY_REFUSED ) |
|
| 347 | + { |
|
| 348 | + foreach( $session->get( 'aimeos/basket/cache', array() ) as $key => $value ) { |
|
| 349 | + $session->set( $key, null ); |
|
| 350 | + } |
|
| 351 | + |
|
| 352 | + \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' )->clear(); |
|
| 353 | + } |
|
| 354 | + |
|
| 355 | + // Update stock, coupons, etc. |
|
| 356 | + \Aimeos\Controller\Frontend\Factory::createController( $context, 'order' )->update( $orderItem ); |
|
| 357 | + } |
|
| 358 | + catch( \Aimeos\Client\Html\Exception $e ) |
|
| 359 | + { |
|
| 360 | + $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 361 | + $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
|
| 362 | + } |
|
| 363 | + catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 364 | + { |
|
| 365 | + $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 366 | + $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
|
| 367 | + } |
|
| 368 | + catch( \Aimeos\MShop\Exception $e ) |
|
| 369 | + { |
|
| 370 | + $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 371 | + $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
|
| 372 | + } |
|
| 373 | + catch( \Exception $e ) |
|
| 374 | + { |
|
| 375 | + $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 376 | + |
|
| 377 | + $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 378 | + $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
|
| 379 | + } |
|
| 380 | + } |
|
| 381 | + |
|
| 382 | + |
|
| 383 | + /** |
|
| 384 | + * Returns the payment service providere for the given code |
|
| 385 | + * |
|
| 386 | + * @param string $code Unique service code |
|
| 387 | + * @throws \Aimeos\Client\Html\Exception If no payment service item could be found |
|
| 388 | + * @return \Aimeos\MShop\Service\Provider\Iface Service provider object |
|
| 389 | + */ |
|
| 390 | + protected function getServiceProvider( $code ) |
|
| 391 | + { |
|
| 392 | + $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 393 | + |
|
| 394 | + $search = $serviceManager->createSearch(); |
|
| 395 | + $expr = array( |
|
| 396 | + $search->compare( '==', 'service.code', $code ), |
|
| 397 | + $search->compare( '==', 'service.type.code', 'payment' ), |
|
| 398 | + ); |
|
| 399 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 400 | + |
|
| 401 | + $result = $serviceManager->searchItems( $search ); |
|
| 402 | + |
|
| 403 | + if( ( $serviceItem = reset( $result ) ) === false ) |
|
| 404 | + { |
|
| 405 | + $msg = sprintf( 'No service for code "%1$s" found', $code ); |
|
| 406 | + throw new \Aimeos\Client\Html\Exception( $msg ); |
|
| 407 | + } |
|
| 408 | + |
|
| 409 | + return $serviceManager->getProvider( $serviceItem ); |
|
| 410 | + } |
|
| 411 | + |
|
| 412 | + |
|
| 413 | + /** |
|
| 414 | + * Returns the list of sub-client names configured for the client. |
|
| 415 | + * |
|
| 416 | + * @return array List of HTML client names |
|
| 417 | + */ |
|
| 418 | + protected function getSubClientNames() |
|
| 419 | + { |
|
| 420 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 421 | + } |
|
| 422 | + |
|
| 423 | + |
|
| 424 | + /** |
|
| 425 | + * Returns the URL to the confirm page. |
|
| 426 | + * |
|
| 427 | + * @param \Aimeos\MW\View\Iface $view View object |
|
| 428 | + * @param array $params Parameters that should be part of the URL |
|
| 429 | + * @param array $config Default URL configuration |
|
| 430 | + * @return string URL string |
|
| 431 | + */ |
|
| 432 | + protected function getUrlConfirm( \Aimeos\MW\View\Iface $view, array $params, array $config ) |
|
| 433 | + { |
|
| 434 | + $target = $view->config( 'client/html/checkout/confirm/url/target' ); |
|
| 435 | + $cntl = $view->config( 'client/html/checkout/confirm/url/controller', 'checkout' ); |
|
| 436 | + $action = $view->config( 'client/html/checkout/confirm/url/action', 'confirm' ); |
|
| 437 | + $config = $view->config( 'client/html/checkout/confirm/url/config', $config ); |
|
| 438 | + |
|
| 439 | + return $view->url( $target, $cntl, $action, $params, array(), $config ); |
|
| 440 | + } |
|
| 441 | + |
|
| 442 | + |
|
| 443 | + /** |
|
| 444 | + * Returns the URL to the update page. |
|
| 445 | + * |
|
| 446 | + * @param \Aimeos\MW\View\Iface $view View object |
|
| 447 | + * @param array $params Parameters that should be part of the URL |
|
| 448 | + * @param array $config Default URL configuration |
|
| 449 | + * @return string URL string |
|
| 450 | + */ |
|
| 451 | + protected function getUrlUpdate( \Aimeos\MW\View\Iface $view, array $params, array $config ) |
|
| 452 | + { |
|
| 453 | + $target = $view->config( 'client/html/checkout/update/url/target' ); |
|
| 454 | + $cntl = $view->config( 'client/html/checkout/update/url/controller', 'checkout' ); |
|
| 455 | + $action = $view->config( 'client/html/checkout/update/url/action', 'update' ); |
|
| 456 | + $config = $view->config( 'client/html/checkout/update/url/config', $config ); |
|
| 457 | + |
|
| 458 | + return $view->url( $target, $cntl, $action, $params, array(), $config ); |
|
| 459 | + } |
|
| 460 | + |
|
| 461 | + |
|
| 462 | + /** |
|
| 463 | + * Sets the necessary parameter values in the view. |
|
| 464 | + * |
|
| 465 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 466 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 467 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 468 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 469 | + */ |
|
| 470 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 471 | + { |
|
| 472 | + if( !isset( $this->cache ) ) |
|
| 473 | + { |
|
| 474 | + if( !isset( $view->confirmOrderItem ) ) |
|
| 475 | + { |
|
| 476 | + $context = $this->getContext(); |
|
| 477 | + $orderid = $context->getSession()->get( 'aimeos/orderid' ); |
|
| 478 | + $orderManager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
| 479 | + |
|
| 480 | + $view->confirmOrderItem = $orderManager->getItem( $orderid ); |
|
| 481 | + } |
|
| 482 | + |
|
| 483 | + $this->cache = $view; |
|
| 484 | + } |
|
| 485 | + |
|
| 486 | + return $this->cache; |
|
| 487 | + } |
|
| 488 | + |
|
| 489 | + |
|
| 490 | + /** |
|
| 491 | + * Updates the payment status for the given order ID and returns the order item |
|
| 492 | + * |
|
| 493 | + * @param \Aimeos\MW\View\Iface $view View object of the HTML client |
|
| 494 | + * @param string $orderid ID of the order whose payment status should be updated |
|
| 495 | + * @return void|\Aimeos\MShop\Order\Item\Iface Order item that has been updated |
|
| 496 | + */ |
|
| 497 | + protected function updatePayment( \Aimeos\MW\View\Iface $view, $orderid ) |
|
| 498 | + { |
|
| 499 | + if( ( $code = $view->param( 'code' ) ) === null ) { |
|
| 500 | + return; |
|
| 501 | + } |
|
| 502 | + |
|
| 503 | + $provider = $this->getServiceProvider( $code ); |
|
| 504 | + |
|
| 505 | + $config = array( 'absoluteUri' => true, 'namespace' => false ); |
|
| 506 | + $params = array( 'code' => $code, 'orderid' => $orderid ); |
|
| 507 | + $urls = array( |
|
| 508 | + 'payment.url-success' => $this->getUrlConfirm( $view, $params, $config ), |
|
| 509 | + 'payment.url-update' => $this->getUrlUpdate( $view, $params, $config ), |
|
| 510 | + 'client.ipaddress' => $view->request()->getClientAddress(), |
|
| 511 | + ); |
|
| 512 | + $urls['payment.url-self'] = $urls['payment.url-success']; |
|
| 513 | + $provider->injectGlobalConfigBE( $urls ); |
|
| 514 | + |
|
| 515 | + $reqParams = $view->param(); |
|
| 516 | + $reqParams['orderid'] = $orderid; |
|
| 517 | + |
|
| 518 | + if( ( $orderItem = $provider->updateSync( $reqParams, $view->request()->getBody() ) ) !== null |
|
| 519 | + && $orderItem->getPaymentStatus() === \Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED |
|
| 520 | + && $provider->isImplemented( \Aimeos\MShop\Service\Provider\Payment\Base::FEAT_QUERY ) |
|
| 521 | + ) { |
|
| 522 | + $provider->query( $orderItem ); |
|
| 523 | + } |
|
| 524 | + |
|
| 525 | + return $orderItem; |
|
| 526 | + } |
|
| 527 | 527 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * @since 2015.02 |
| 101 | 101 | * @category Developer |
| 102 | 102 | */ |
| 103 | - private $subPartNames = array( 'intro', 'basic', 'retry', 'order' ); |
|
| 103 | + private $subPartNames = array('intro', 'basic', 'retry', 'order'); |
|
| 104 | 104 | private $cache; |
| 105 | 105 | |
| 106 | 106 | |
@@ -112,42 +112,42 @@ discard block |
||
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | 113 | * @return string HTML code |
| 114 | 114 | */ |
| 115 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 115 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 116 | 116 | { |
| 117 | 117 | $context = $this->getContext(); |
| 118 | 118 | $view = $this->getView(); |
| 119 | 119 | |
| 120 | 120 | try |
| 121 | 121 | { |
| 122 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 122 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 123 | 123 | |
| 124 | 124 | $html = ''; |
| 125 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 126 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 125 | + foreach ($this->getSubClients() as $subclient) { |
|
| 126 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 127 | 127 | } |
| 128 | 128 | $view->confirmBody = $html; |
| 129 | 129 | } |
| 130 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 130 | + catch (\Aimeos\Client\Html\Exception $e) |
|
| 131 | 131 | { |
| 132 | - $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 133 | - $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
|
| 132 | + $error = array($this->getContext()->getI18n()->dt('client', $e->getMessage())); |
|
| 133 | + $view->confirmErrorList = $view->get('confirmErrorList', array()) + $error; |
|
| 134 | 134 | } |
| 135 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 135 | + catch (\Aimeos\Controller\Frontend\Exception $e) |
|
| 136 | 136 | { |
| 137 | - $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 138 | - $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
|
| 137 | + $error = array($this->getContext()->getI18n()->dt('controller/frontend', $e->getMessage())); |
|
| 138 | + $view->confirmErrorList = $view->get('confirmErrorList', array()) + $error; |
|
| 139 | 139 | } |
| 140 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 140 | + catch (\Aimeos\MShop\Exception $e) |
|
| 141 | 141 | { |
| 142 | - $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 143 | - $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
|
| 142 | + $error = array($this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
| 143 | + $view->confirmErrorList = $view->get('confirmErrorList', array()) + $error; |
|
| 144 | 144 | } |
| 145 | - catch( \Exception $e ) |
|
| 145 | + catch (\Exception $e) |
|
| 146 | 146 | { |
| 147 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 147 | + $context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 148 | 148 | |
| 149 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 150 | - $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
|
| 149 | + $error = array($context->getI18n()->dt('client', 'A non-recoverable error occured')); |
|
| 150 | + $view->confirmErrorList = $view->get('confirmErrorList', array()) + $error; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** client/html/checkout/confirm/standard/template-body |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $tplconf = 'client/html/checkout/confirm/standard/template-body'; |
| 174 | 174 | $default = 'checkout/confirm/body-default.php'; |
| 175 | 175 | |
| 176 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 176 | + return $view->render($view->config($tplconf, $default)); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | |
@@ -185,15 +185,15 @@ discard block |
||
| 185 | 185 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 186 | 186 | * @return string|null String including HTML tags for the header on error |
| 187 | 187 | */ |
| 188 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 188 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 189 | 189 | { |
| 190 | 190 | try |
| 191 | 191 | { |
| 192 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 192 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 193 | 193 | |
| 194 | 194 | $html = ''; |
| 195 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 196 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 195 | + foreach ($this->getSubClients() as $subclient) { |
|
| 196 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 197 | 197 | } |
| 198 | 198 | $view->confirmHeader = $html; |
| 199 | 199 | |
@@ -221,11 +221,11 @@ discard block |
||
| 221 | 221 | $tplconf = 'client/html/checkout/confirm/standard/template-header'; |
| 222 | 222 | $default = 'checkout/confirm/header-default.php'; |
| 223 | 223 | |
| 224 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 224 | + return $view->render($view->config($tplconf, $default)); |
|
| 225 | 225 | } |
| 226 | - catch( \Exception $e ) |
|
| 226 | + catch (\Exception $e) |
|
| 227 | 227 | { |
| 228 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 228 | + $this->getContext()->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | * @param string|null $name Name of the sub-client (Default if null) |
| 238 | 238 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 239 | 239 | */ |
| 240 | - public function getSubClient( $type, $name = null ) |
|
| 240 | + public function getSubClient($type, $name = null) |
|
| 241 | 241 | { |
| 242 | 242 | /** client/html/checkout/confirm/decorators/excludes |
| 243 | 243 | * Excludes decorators added by the "common" option from the checkout confirm html client |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | * @see client/html/checkout/confirm/decorators/global |
| 314 | 314 | */ |
| 315 | 315 | |
| 316 | - return $this->createSubClient( 'checkout/confirm/' . $type, $name ); |
|
| 316 | + return $this->createSubClient('checkout/confirm/'.$type, $name); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | |
@@ -327,14 +327,14 @@ discard block |
||
| 327 | 327 | $view = $this->getView(); |
| 328 | 328 | $context = $this->getContext(); |
| 329 | 329 | $session = $context->getSession(); |
| 330 | - $orderid = $session->get( 'aimeos/orderid' ); |
|
| 330 | + $orderid = $session->get('aimeos/orderid'); |
|
| 331 | 331 | |
| 332 | 332 | try |
| 333 | 333 | { |
| 334 | - if( ( $orderItem = $this->updatePayment( $view, $orderid ) ) === null ) |
|
| 334 | + if (($orderItem = $this->updatePayment($view, $orderid)) === null) |
|
| 335 | 335 | { |
| 336 | - $orderManager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
| 337 | - $orderItem = $orderManager->getItem( $orderid ); |
|
| 336 | + $orderManager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
| 337 | + $orderItem = $orderManager->getItem($orderid); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | $view->confirmOrderItem = $orderItem; |
@@ -343,39 +343,39 @@ discard block |
||
| 343 | 343 | parent::process(); |
| 344 | 344 | |
| 345 | 345 | |
| 346 | - if( $orderItem->getPaymentStatus() > \Aimeos\MShop\Order\Item\Base::PAY_REFUSED ) |
|
| 346 | + if ($orderItem->getPaymentStatus() > \Aimeos\MShop\Order\Item\Base::PAY_REFUSED) |
|
| 347 | 347 | { |
| 348 | - foreach( $session->get( 'aimeos/basket/cache', array() ) as $key => $value ) { |
|
| 349 | - $session->set( $key, null ); |
|
| 348 | + foreach ($session->get('aimeos/basket/cache', array()) as $key => $value) { |
|
| 349 | + $session->set($key, null); |
|
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' )->clear(); |
|
| 352 | + \Aimeos\Controller\Frontend\Factory::createController($context, 'basket')->clear(); |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | // Update stock, coupons, etc. |
| 356 | - \Aimeos\Controller\Frontend\Factory::createController( $context, 'order' )->update( $orderItem ); |
|
| 356 | + \Aimeos\Controller\Frontend\Factory::createController($context, 'order')->update($orderItem); |
|
| 357 | 357 | } |
| 358 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 358 | + catch (\Aimeos\Client\Html\Exception $e) |
|
| 359 | 359 | { |
| 360 | - $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 361 | - $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
|
| 360 | + $error = array($context->getI18n()->dt('client', $e->getMessage())); |
|
| 361 | + $view->confirmErrorList = $view->get('confirmErrorList', array()) + $error; |
|
| 362 | 362 | } |
| 363 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 363 | + catch (\Aimeos\Controller\Frontend\Exception $e) |
|
| 364 | 364 | { |
| 365 | - $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 366 | - $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
|
| 365 | + $error = array($context->getI18n()->dt('controller/frontend', $e->getMessage())); |
|
| 366 | + $view->confirmErrorList = $view->get('confirmErrorList', array()) + $error; |
|
| 367 | 367 | } |
| 368 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 368 | + catch (\Aimeos\MShop\Exception $e) |
|
| 369 | 369 | { |
| 370 | - $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 371 | - $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
|
| 370 | + $error = array($context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 371 | + $view->confirmErrorList = $view->get('confirmErrorList', array()) + $error; |
|
| 372 | 372 | } |
| 373 | - catch( \Exception $e ) |
|
| 373 | + catch (\Exception $e) |
|
| 374 | 374 | { |
| 375 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 375 | + $context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 376 | 376 | |
| 377 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 378 | - $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
|
| 377 | + $error = array($context->getI18n()->dt('client', 'A non-recoverable error occured')); |
|
| 378 | + $view->confirmErrorList = $view->get('confirmErrorList', array()) + $error; |
|
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | |
@@ -387,26 +387,26 @@ discard block |
||
| 387 | 387 | * @throws \Aimeos\Client\Html\Exception If no payment service item could be found |
| 388 | 388 | * @return \Aimeos\MShop\Service\Provider\Iface Service provider object |
| 389 | 389 | */ |
| 390 | - protected function getServiceProvider( $code ) |
|
| 390 | + protected function getServiceProvider($code) |
|
| 391 | 391 | { |
| 392 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 392 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 393 | 393 | |
| 394 | 394 | $search = $serviceManager->createSearch(); |
| 395 | 395 | $expr = array( |
| 396 | - $search->compare( '==', 'service.code', $code ), |
|
| 397 | - $search->compare( '==', 'service.type.code', 'payment' ), |
|
| 396 | + $search->compare('==', 'service.code', $code), |
|
| 397 | + $search->compare('==', 'service.type.code', 'payment'), |
|
| 398 | 398 | ); |
| 399 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 399 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 400 | 400 | |
| 401 | - $result = $serviceManager->searchItems( $search ); |
|
| 401 | + $result = $serviceManager->searchItems($search); |
|
| 402 | 402 | |
| 403 | - if( ( $serviceItem = reset( $result ) ) === false ) |
|
| 403 | + if (($serviceItem = reset($result)) === false) |
|
| 404 | 404 | { |
| 405 | - $msg = sprintf( 'No service for code "%1$s" found', $code ); |
|
| 406 | - throw new \Aimeos\Client\Html\Exception( $msg ); |
|
| 405 | + $msg = sprintf('No service for code "%1$s" found', $code); |
|
| 406 | + throw new \Aimeos\Client\Html\Exception($msg); |
|
| 407 | 407 | } |
| 408 | 408 | |
| 409 | - return $serviceManager->getProvider( $serviceItem ); |
|
| 409 | + return $serviceManager->getProvider($serviceItem); |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | */ |
| 418 | 418 | protected function getSubClientNames() |
| 419 | 419 | { |
| 420 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 420 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | |
@@ -429,14 +429,14 @@ discard block |
||
| 429 | 429 | * @param array $config Default URL configuration |
| 430 | 430 | * @return string URL string |
| 431 | 431 | */ |
| 432 | - protected function getUrlConfirm( \Aimeos\MW\View\Iface $view, array $params, array $config ) |
|
| 432 | + protected function getUrlConfirm(\Aimeos\MW\View\Iface $view, array $params, array $config) |
|
| 433 | 433 | { |
| 434 | - $target = $view->config( 'client/html/checkout/confirm/url/target' ); |
|
| 435 | - $cntl = $view->config( 'client/html/checkout/confirm/url/controller', 'checkout' ); |
|
| 436 | - $action = $view->config( 'client/html/checkout/confirm/url/action', 'confirm' ); |
|
| 437 | - $config = $view->config( 'client/html/checkout/confirm/url/config', $config ); |
|
| 434 | + $target = $view->config('client/html/checkout/confirm/url/target'); |
|
| 435 | + $cntl = $view->config('client/html/checkout/confirm/url/controller', 'checkout'); |
|
| 436 | + $action = $view->config('client/html/checkout/confirm/url/action', 'confirm'); |
|
| 437 | + $config = $view->config('client/html/checkout/confirm/url/config', $config); |
|
| 438 | 438 | |
| 439 | - return $view->url( $target, $cntl, $action, $params, array(), $config ); |
|
| 439 | + return $view->url($target, $cntl, $action, $params, array(), $config); |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | |
@@ -448,14 +448,14 @@ discard block |
||
| 448 | 448 | * @param array $config Default URL configuration |
| 449 | 449 | * @return string URL string |
| 450 | 450 | */ |
| 451 | - protected function getUrlUpdate( \Aimeos\MW\View\Iface $view, array $params, array $config ) |
|
| 451 | + protected function getUrlUpdate(\Aimeos\MW\View\Iface $view, array $params, array $config) |
|
| 452 | 452 | { |
| 453 | - $target = $view->config( 'client/html/checkout/update/url/target' ); |
|
| 454 | - $cntl = $view->config( 'client/html/checkout/update/url/controller', 'checkout' ); |
|
| 455 | - $action = $view->config( 'client/html/checkout/update/url/action', 'update' ); |
|
| 456 | - $config = $view->config( 'client/html/checkout/update/url/config', $config ); |
|
| 453 | + $target = $view->config('client/html/checkout/update/url/target'); |
|
| 454 | + $cntl = $view->config('client/html/checkout/update/url/controller', 'checkout'); |
|
| 455 | + $action = $view->config('client/html/checkout/update/url/action', 'update'); |
|
| 456 | + $config = $view->config('client/html/checkout/update/url/config', $config); |
|
| 457 | 457 | |
| 458 | - return $view->url( $target, $cntl, $action, $params, array(), $config ); |
|
| 458 | + return $view->url($target, $cntl, $action, $params, array(), $config); |
|
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | |
@@ -467,17 +467,17 @@ discard block |
||
| 467 | 467 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 468 | 468 | * @return \Aimeos\MW\View\Iface Modified view object |
| 469 | 469 | */ |
| 470 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 470 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 471 | 471 | { |
| 472 | - if( !isset( $this->cache ) ) |
|
| 472 | + if (!isset($this->cache)) |
|
| 473 | 473 | { |
| 474 | - if( !isset( $view->confirmOrderItem ) ) |
|
| 474 | + if (!isset($view->confirmOrderItem)) |
|
| 475 | 475 | { |
| 476 | 476 | $context = $this->getContext(); |
| 477 | - $orderid = $context->getSession()->get( 'aimeos/orderid' ); |
|
| 478 | - $orderManager = \Aimeos\MShop\Factory::createManager( $context, 'order' ); |
|
| 477 | + $orderid = $context->getSession()->get('aimeos/orderid'); |
|
| 478 | + $orderManager = \Aimeos\MShop\Factory::createManager($context, 'order'); |
|
| 479 | 479 | |
| 480 | - $view->confirmOrderItem = $orderManager->getItem( $orderid ); |
|
| 480 | + $view->confirmOrderItem = $orderManager->getItem($orderid); |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | $this->cache = $view; |
@@ -494,32 +494,32 @@ discard block |
||
| 494 | 494 | * @param string $orderid ID of the order whose payment status should be updated |
| 495 | 495 | * @return void|\Aimeos\MShop\Order\Item\Iface Order item that has been updated |
| 496 | 496 | */ |
| 497 | - protected function updatePayment( \Aimeos\MW\View\Iface $view, $orderid ) |
|
| 497 | + protected function updatePayment(\Aimeos\MW\View\Iface $view, $orderid) |
|
| 498 | 498 | { |
| 499 | - if( ( $code = $view->param( 'code' ) ) === null ) { |
|
| 499 | + if (($code = $view->param('code')) === null) { |
|
| 500 | 500 | return; |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | - $provider = $this->getServiceProvider( $code ); |
|
| 503 | + $provider = $this->getServiceProvider($code); |
|
| 504 | 504 | |
| 505 | - $config = array( 'absoluteUri' => true, 'namespace' => false ); |
|
| 506 | - $params = array( 'code' => $code, 'orderid' => $orderid ); |
|
| 505 | + $config = array('absoluteUri' => true, 'namespace' => false); |
|
| 506 | + $params = array('code' => $code, 'orderid' => $orderid); |
|
| 507 | 507 | $urls = array( |
| 508 | - 'payment.url-success' => $this->getUrlConfirm( $view, $params, $config ), |
|
| 509 | - 'payment.url-update' => $this->getUrlUpdate( $view, $params, $config ), |
|
| 508 | + 'payment.url-success' => $this->getUrlConfirm($view, $params, $config), |
|
| 509 | + 'payment.url-update' => $this->getUrlUpdate($view, $params, $config), |
|
| 510 | 510 | 'client.ipaddress' => $view->request()->getClientAddress(), |
| 511 | 511 | ); |
| 512 | 512 | $urls['payment.url-self'] = $urls['payment.url-success']; |
| 513 | - $provider->injectGlobalConfigBE( $urls ); |
|
| 513 | + $provider->injectGlobalConfigBE($urls); |
|
| 514 | 514 | |
| 515 | 515 | $reqParams = $view->param(); |
| 516 | 516 | $reqParams['orderid'] = $orderid; |
| 517 | 517 | |
| 518 | - if( ( $orderItem = $provider->updateSync( $reqParams, $view->request()->getBody() ) ) !== null |
|
| 518 | + if (($orderItem = $provider->updateSync($reqParams, $view->request()->getBody())) !== null |
|
| 519 | 519 | && $orderItem->getPaymentStatus() === \Aimeos\MShop\Order\Item\Base::PAY_UNFINISHED |
| 520 | - && $provider->isImplemented( \Aimeos\MShop\Service\Provider\Payment\Base::FEAT_QUERY ) |
|
| 520 | + && $provider->isImplemented(\Aimeos\MShop\Service\Provider\Payment\Base::FEAT_QUERY) |
|
| 521 | 521 | ) { |
| 522 | - $provider->query( $orderItem ); |
|
| 522 | + $provider->query($orderItem); |
|
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | return $orderItem; |
@@ -126,23 +126,19 @@ discard block |
||
| 126 | 126 | $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
| 127 | 127 | } |
| 128 | 128 | $view->confirmBody = $html; |
| 129 | - } |
|
| 130 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 129 | + } catch( \Aimeos\Client\Html\Exception $e ) |
|
| 131 | 130 | { |
| 132 | 131 | $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) ); |
| 133 | 132 | $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
| 134 | - } |
|
| 135 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 133 | + } catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 136 | 134 | { |
| 137 | 135 | $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
| 138 | 136 | $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
| 139 | - } |
|
| 140 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 137 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 141 | 138 | { |
| 142 | 139 | $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 143 | 140 | $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
| 144 | - } |
|
| 145 | - catch( \Exception $e ) |
|
| 141 | + } catch( \Exception $e ) |
|
| 146 | 142 | { |
| 147 | 143 | $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 148 | 144 | |
@@ -222,8 +218,7 @@ discard block |
||
| 222 | 218 | $default = 'checkout/confirm/header-default.php'; |
| 223 | 219 | |
| 224 | 220 | return $view->render( $view->config( $tplconf, $default ) ); |
| 225 | - } |
|
| 226 | - catch( \Exception $e ) |
|
| 221 | + } catch( \Exception $e ) |
|
| 227 | 222 | { |
| 228 | 223 | $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 229 | 224 | } |
@@ -354,23 +349,19 @@ discard block |
||
| 354 | 349 | |
| 355 | 350 | // Update stock, coupons, etc. |
| 356 | 351 | \Aimeos\Controller\Frontend\Factory::createController( $context, 'order' )->update( $orderItem ); |
| 357 | - } |
|
| 358 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 352 | + } catch( \Aimeos\Client\Html\Exception $e ) |
|
| 359 | 353 | { |
| 360 | 354 | $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
| 361 | 355 | $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
| 362 | - } |
|
| 363 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 356 | + } catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 364 | 357 | { |
| 365 | 358 | $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
| 366 | 359 | $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
| 367 | - } |
|
| 368 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 360 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 369 | 361 | { |
| 370 | 362 | $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 371 | 363 | $view->confirmErrorList = $view->get( 'confirmErrorList', array() ) + $error; |
| 372 | - } |
|
| 373 | - catch( \Exception $e ) |
|
| 364 | + } catch( \Exception $e ) |
|
| 374 | 365 | { |
| 375 | 366 | $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 376 | 367 | |
@@ -19,231 +19,231 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/checkout/confirm/basic/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the checkout confirm basic section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2014.03 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/checkout/confirm/basic/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * Returns the HTML code for insertion into the body. |
|
| 64 | - * |
|
| 65 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 66 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 67 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 68 | - * @return string HTML code |
|
| 69 | - */ |
|
| 70 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | - { |
|
| 72 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | - |
|
| 74 | - $html = ''; |
|
| 75 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | - } |
|
| 78 | - $view->basicBody = $html; |
|
| 79 | - |
|
| 80 | - /** client/html/checkout/confirm/basic/standard/template-body |
|
| 81 | - * Relative path to the HTML body template of the checkout confirm basic client. |
|
| 82 | - * |
|
| 83 | - * The template file contains the HTML code and processing instructions |
|
| 84 | - * to generate the result shown in the body of the frontend. The |
|
| 85 | - * configuration string is the path to the template file relative |
|
| 86 | - * to the templates directory (usually in client/html/templates). |
|
| 87 | - * |
|
| 88 | - * You can overwrite the template file configuration in extensions and |
|
| 89 | - * provide alternative templates. These alternative templates should be |
|
| 90 | - * named like the default one but with the string "standard" replaced by |
|
| 91 | - * an unique name. You may use the name of your project for this. If |
|
| 92 | - * you've implemented an alternative client class as well, "standard" |
|
| 93 | - * should be replaced by the name of the new class. |
|
| 94 | - * |
|
| 95 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | - * @since 2014.03 |
|
| 97 | - * @category Developer |
|
| 98 | - * @see client/html/checkout/confirm/basic/standard/template-header |
|
| 99 | - */ |
|
| 100 | - $tplconf = 'client/html/checkout/confirm/basic/standard/template-body'; |
|
| 101 | - $default = 'checkout/confirm/basic-body-default.php'; |
|
| 102 | - |
|
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * Returns the HTML string for insertion into the header. |
|
| 109 | - * |
|
| 110 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 114 | - */ |
|
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | - { |
|
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | - |
|
| 119 | - $html = ''; |
|
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | - } |
|
| 123 | - $view->basicHeader = $html; |
|
| 124 | - |
|
| 125 | - /** client/html/checkout/confirm/basic/standard/template-header |
|
| 126 | - * Relative path to the HTML header template of the checkout confirm basic client. |
|
| 127 | - * |
|
| 128 | - * The template file contains the HTML code and processing instructions |
|
| 129 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | - * of the rendered page in the frontend. The configuration string is the |
|
| 131 | - * path to the template file relative to the templates directory (usually |
|
| 132 | - * in client/html/templates). |
|
| 133 | - * |
|
| 134 | - * You can overwrite the template file configuration in extensions and |
|
| 135 | - * provide alternative templates. These alternative templates should be |
|
| 136 | - * named like the default one but with the string "standard" replaced by |
|
| 137 | - * an unique name. You may use the name of your project for this. If |
|
| 138 | - * you've implemented an alternative client class as well, "standard" |
|
| 139 | - * should be replaced by the name of the new class. |
|
| 140 | - * |
|
| 141 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | - * @since 2014.03 |
|
| 143 | - * @category Developer |
|
| 144 | - * @see client/html/checkout/confirm/basic/standard/template-body |
|
| 145 | - */ |
|
| 146 | - $tplconf = 'client/html/checkout/confirm/basic/standard/template-header'; |
|
| 147 | - $default = 'checkout/confirm/basic-header-default.php'; |
|
| 148 | - |
|
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - |
|
| 153 | - /** |
|
| 154 | - * Returns the sub-client given by its name. |
|
| 155 | - * |
|
| 156 | - * @param string $type Name of the client type |
|
| 157 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | - */ |
|
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 161 | - { |
|
| 162 | - /** client/html/checkout/confirm/basic/decorators/excludes |
|
| 163 | - * Excludes decorators added by the "common" option from the checkout confirm basic html client |
|
| 164 | - * |
|
| 165 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | - * modify what is returned to the caller. |
|
| 169 | - * |
|
| 170 | - * This option allows you to remove a decorator added via |
|
| 171 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | - * around the html client. |
|
| 173 | - * |
|
| 174 | - * client/html/checkout/confirm/basic/decorators/excludes = array( 'decorator1' ) |
|
| 175 | - * |
|
| 176 | - * This would remove the decorator named "decorator1" from the list of |
|
| 177 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | - * "client/html/common/decorators/default" to the html client. |
|
| 179 | - * |
|
| 180 | - * @param array List of decorator names |
|
| 181 | - * @since 2015.08 |
|
| 182 | - * @category Developer |
|
| 183 | - * @see client/html/common/decorators/default |
|
| 184 | - * @see client/html/checkout/confirm/basic/decorators/global |
|
| 185 | - * @see client/html/checkout/confirm/basic/decorators/local |
|
| 186 | - */ |
|
| 187 | - |
|
| 188 | - /** client/html/checkout/confirm/basic/decorators/global |
|
| 189 | - * Adds a list of globally available decorators only to the checkout confirm basic html client |
|
| 190 | - * |
|
| 191 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | - * modify what is returned to the caller. |
|
| 195 | - * |
|
| 196 | - * This option allows you to wrap global decorators |
|
| 197 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | - * |
|
| 199 | - * client/html/checkout/confirm/basic/decorators/global = array( 'decorator1' ) |
|
| 200 | - * |
|
| 201 | - * This would add the decorator named "decorator1" defined by |
|
| 202 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | - * |
|
| 204 | - * @param array List of decorator names |
|
| 205 | - * @since 2015.08 |
|
| 206 | - * @category Developer |
|
| 207 | - * @see client/html/common/decorators/default |
|
| 208 | - * @see client/html/checkout/confirm/basic/decorators/excludes |
|
| 209 | - * @see client/html/checkout/confirm/basic/decorators/local |
|
| 210 | - */ |
|
| 211 | - |
|
| 212 | - /** client/html/checkout/confirm/basic/decorators/local |
|
| 213 | - * Adds a list of local decorators only to the checkout confirm basic html client |
|
| 214 | - * |
|
| 215 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | - * modify what is returned to the caller. |
|
| 219 | - * |
|
| 220 | - * This option allows you to wrap local decorators |
|
| 221 | - * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 222 | - * |
|
| 223 | - * client/html/checkout/confirm/basic/decorators/local = array( 'decorator2' ) |
|
| 224 | - * |
|
| 225 | - * This would add the decorator named "decorator2" defined by |
|
| 226 | - * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 227 | - * |
|
| 228 | - * @param array List of decorator names |
|
| 229 | - * @since 2015.08 |
|
| 230 | - * @category Developer |
|
| 231 | - * @see client/html/common/decorators/default |
|
| 232 | - * @see client/html/checkout/confirm/basic/decorators/excludes |
|
| 233 | - * @see client/html/checkout/confirm/basic/decorators/global |
|
| 234 | - */ |
|
| 235 | - |
|
| 236 | - return $this->createSubClient( 'checkout/confirm/basic/' . $type, $name ); |
|
| 237 | - } |
|
| 238 | - |
|
| 239 | - |
|
| 240 | - /** |
|
| 241 | - * Returns the list of sub-client names configured for the client. |
|
| 242 | - * |
|
| 243 | - * @return array List of HTML client names |
|
| 244 | - */ |
|
| 245 | - protected function getSubClientNames() |
|
| 246 | - { |
|
| 247 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | - } |
|
| 25 | + /** client/html/checkout/confirm/basic/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the checkout confirm basic section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2014.03 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/checkout/confirm/basic/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | + |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * Returns the HTML code for insertion into the body. |
|
| 64 | + * |
|
| 65 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 66 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 67 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 68 | + * @return string HTML code |
|
| 69 | + */ |
|
| 70 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | + { |
|
| 72 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | + |
|
| 74 | + $html = ''; |
|
| 75 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | + } |
|
| 78 | + $view->basicBody = $html; |
|
| 79 | + |
|
| 80 | + /** client/html/checkout/confirm/basic/standard/template-body |
|
| 81 | + * Relative path to the HTML body template of the checkout confirm basic client. |
|
| 82 | + * |
|
| 83 | + * The template file contains the HTML code and processing instructions |
|
| 84 | + * to generate the result shown in the body of the frontend. The |
|
| 85 | + * configuration string is the path to the template file relative |
|
| 86 | + * to the templates directory (usually in client/html/templates). |
|
| 87 | + * |
|
| 88 | + * You can overwrite the template file configuration in extensions and |
|
| 89 | + * provide alternative templates. These alternative templates should be |
|
| 90 | + * named like the default one but with the string "standard" replaced by |
|
| 91 | + * an unique name. You may use the name of your project for this. If |
|
| 92 | + * you've implemented an alternative client class as well, "standard" |
|
| 93 | + * should be replaced by the name of the new class. |
|
| 94 | + * |
|
| 95 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | + * @since 2014.03 |
|
| 97 | + * @category Developer |
|
| 98 | + * @see client/html/checkout/confirm/basic/standard/template-header |
|
| 99 | + */ |
|
| 100 | + $tplconf = 'client/html/checkout/confirm/basic/standard/template-body'; |
|
| 101 | + $default = 'checkout/confirm/basic-body-default.php'; |
|
| 102 | + |
|
| 103 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * Returns the HTML string for insertion into the header. |
|
| 109 | + * |
|
| 110 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | + * @return string|null String including HTML tags for the header on error |
|
| 114 | + */ |
|
| 115 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | + { |
|
| 117 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | + |
|
| 119 | + $html = ''; |
|
| 120 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | + } |
|
| 123 | + $view->basicHeader = $html; |
|
| 124 | + |
|
| 125 | + /** client/html/checkout/confirm/basic/standard/template-header |
|
| 126 | + * Relative path to the HTML header template of the checkout confirm basic client. |
|
| 127 | + * |
|
| 128 | + * The template file contains the HTML code and processing instructions |
|
| 129 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | + * of the rendered page in the frontend. The configuration string is the |
|
| 131 | + * path to the template file relative to the templates directory (usually |
|
| 132 | + * in client/html/templates). |
|
| 133 | + * |
|
| 134 | + * You can overwrite the template file configuration in extensions and |
|
| 135 | + * provide alternative templates. These alternative templates should be |
|
| 136 | + * named like the default one but with the string "standard" replaced by |
|
| 137 | + * an unique name. You may use the name of your project for this. If |
|
| 138 | + * you've implemented an alternative client class as well, "standard" |
|
| 139 | + * should be replaced by the name of the new class. |
|
| 140 | + * |
|
| 141 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | + * @since 2014.03 |
|
| 143 | + * @category Developer |
|
| 144 | + * @see client/html/checkout/confirm/basic/standard/template-body |
|
| 145 | + */ |
|
| 146 | + $tplconf = 'client/html/checkout/confirm/basic/standard/template-header'; |
|
| 147 | + $default = 'checkout/confirm/basic-header-default.php'; |
|
| 148 | + |
|
| 149 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + |
|
| 153 | + /** |
|
| 154 | + * Returns the sub-client given by its name. |
|
| 155 | + * |
|
| 156 | + * @param string $type Name of the client type |
|
| 157 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | + */ |
|
| 160 | + public function getSubClient( $type, $name = null ) |
|
| 161 | + { |
|
| 162 | + /** client/html/checkout/confirm/basic/decorators/excludes |
|
| 163 | + * Excludes decorators added by the "common" option from the checkout confirm basic html client |
|
| 164 | + * |
|
| 165 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | + * modify what is returned to the caller. |
|
| 169 | + * |
|
| 170 | + * This option allows you to remove a decorator added via |
|
| 171 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | + * around the html client. |
|
| 173 | + * |
|
| 174 | + * client/html/checkout/confirm/basic/decorators/excludes = array( 'decorator1' ) |
|
| 175 | + * |
|
| 176 | + * This would remove the decorator named "decorator1" from the list of |
|
| 177 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | + * "client/html/common/decorators/default" to the html client. |
|
| 179 | + * |
|
| 180 | + * @param array List of decorator names |
|
| 181 | + * @since 2015.08 |
|
| 182 | + * @category Developer |
|
| 183 | + * @see client/html/common/decorators/default |
|
| 184 | + * @see client/html/checkout/confirm/basic/decorators/global |
|
| 185 | + * @see client/html/checkout/confirm/basic/decorators/local |
|
| 186 | + */ |
|
| 187 | + |
|
| 188 | + /** client/html/checkout/confirm/basic/decorators/global |
|
| 189 | + * Adds a list of globally available decorators only to the checkout confirm basic html client |
|
| 190 | + * |
|
| 191 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | + * modify what is returned to the caller. |
|
| 195 | + * |
|
| 196 | + * This option allows you to wrap global decorators |
|
| 197 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | + * |
|
| 199 | + * client/html/checkout/confirm/basic/decorators/global = array( 'decorator1' ) |
|
| 200 | + * |
|
| 201 | + * This would add the decorator named "decorator1" defined by |
|
| 202 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | + * |
|
| 204 | + * @param array List of decorator names |
|
| 205 | + * @since 2015.08 |
|
| 206 | + * @category Developer |
|
| 207 | + * @see client/html/common/decorators/default |
|
| 208 | + * @see client/html/checkout/confirm/basic/decorators/excludes |
|
| 209 | + * @see client/html/checkout/confirm/basic/decorators/local |
|
| 210 | + */ |
|
| 211 | + |
|
| 212 | + /** client/html/checkout/confirm/basic/decorators/local |
|
| 213 | + * Adds a list of local decorators only to the checkout confirm basic html client |
|
| 214 | + * |
|
| 215 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | + * modify what is returned to the caller. |
|
| 219 | + * |
|
| 220 | + * This option allows you to wrap local decorators |
|
| 221 | + * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 222 | + * |
|
| 223 | + * client/html/checkout/confirm/basic/decorators/local = array( 'decorator2' ) |
|
| 224 | + * |
|
| 225 | + * This would add the decorator named "decorator2" defined by |
|
| 226 | + * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 227 | + * |
|
| 228 | + * @param array List of decorator names |
|
| 229 | + * @since 2015.08 |
|
| 230 | + * @category Developer |
|
| 231 | + * @see client/html/common/decorators/default |
|
| 232 | + * @see client/html/checkout/confirm/basic/decorators/excludes |
|
| 233 | + * @see client/html/checkout/confirm/basic/decorators/global |
|
| 234 | + */ |
|
| 235 | + |
|
| 236 | + return $this->createSubClient( 'checkout/confirm/basic/' . $type, $name ); |
|
| 237 | + } |
|
| 238 | + |
|
| 239 | + |
|
| 240 | + /** |
|
| 241 | + * Returns the list of sub-client names configured for the client. |
|
| 242 | + * |
|
| 243 | + * @return array List of HTML client names |
|
| 244 | + */ |
|
| 245 | + protected function getSubClientNames() |
|
| 246 | + { |
|
| 247 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 248 | + } |
|
| 249 | 249 | } |
| 250 | 250 | \ No newline at end of file |
@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 68 | 68 | * @return string HTML code |
| 69 | 69 | */ |
| 70 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 70 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 71 | 71 | { |
| 72 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 72 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 73 | 73 | |
| 74 | 74 | $html = ''; |
| 75 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 75 | + foreach ($this->getSubClients() as $subclient) { |
|
| 76 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 77 | 77 | } |
| 78 | 78 | $view->basicBody = $html; |
| 79 | 79 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $tplconf = 'client/html/checkout/confirm/basic/standard/template-body'; |
| 101 | 101 | $default = 'checkout/confirm/basic-body-default.php'; |
| 102 | 102 | |
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 103 | + return $view->render($view->config($tplconf, $default)); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
@@ -112,13 +112,13 @@ discard block |
||
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | 113 | * @return string|null String including HTML tags for the header on error |
| 114 | 114 | */ |
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 115 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 116 | 116 | { |
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 117 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 118 | 118 | |
| 119 | 119 | $html = ''; |
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 120 | + foreach ($this->getSubClients() as $subclient) { |
|
| 121 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 122 | 122 | } |
| 123 | 123 | $view->basicHeader = $html; |
| 124 | 124 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $tplconf = 'client/html/checkout/confirm/basic/standard/template-header'; |
| 147 | 147 | $default = 'checkout/confirm/basic-header-default.php'; |
| 148 | 148 | |
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 149 | + return $view->render($view->config($tplconf, $default)); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @param string|null $name Name of the sub-client (Default if null) |
| 158 | 158 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 159 | 159 | */ |
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 160 | + public function getSubClient($type, $name = null) |
|
| 161 | 161 | { |
| 162 | 162 | /** client/html/checkout/confirm/basic/decorators/excludes |
| 163 | 163 | * Excludes decorators added by the "common" option from the checkout confirm basic html client |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @see client/html/checkout/confirm/basic/decorators/global |
| 234 | 234 | */ |
| 235 | 235 | |
| 236 | - return $this->createSubClient( 'checkout/confirm/basic/' . $type, $name ); |
|
| 236 | + return $this->createSubClient('checkout/confirm/basic/'.$type, $name); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | |
@@ -244,6 +244,6 @@ discard block |
||
| 244 | 244 | */ |
| 245 | 245 | protected function getSubClientNames() |
| 246 | 246 | { |
| 247 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 247 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 248 | 248 | } |
| 249 | 249 | } |
| 250 | 250 | \ No newline at end of file |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -19,251 +19,251 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/checkout/confirm/intro/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the checkout confirm intro section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2014.03 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/checkout/confirm/intro/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 25 | + /** client/html/checkout/confirm/intro/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the checkout confirm intro section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2014.03 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/checkout/confirm/intro/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | 60 | |
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Returns the HTML code for insertion into the body. |
|
| 64 | - * |
|
| 65 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 66 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 67 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 68 | - * @return string HTML code |
|
| 69 | - */ |
|
| 70 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | - { |
|
| 72 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 62 | + /** |
|
| 63 | + * Returns the HTML code for insertion into the body. |
|
| 64 | + * |
|
| 65 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 66 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 67 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 68 | + * @return string HTML code |
|
| 69 | + */ |
|
| 70 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | + { |
|
| 72 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | 73 | |
| 74 | - $html = ''; |
|
| 75 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | - } |
|
| 78 | - $view->introBody = $html; |
|
| 74 | + $html = ''; |
|
| 75 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | + } |
|
| 78 | + $view->introBody = $html; |
|
| 79 | 79 | |
| 80 | - /** client/html/checkout/confirm/intro/standard/template-body |
|
| 81 | - * Relative path to the HTML body template of the checkout confirm intro client. |
|
| 82 | - * |
|
| 83 | - * The template file contains the HTML code and processing instructions |
|
| 84 | - * to generate the result shown in the body of the frontend. The |
|
| 85 | - * configuration string is the path to the template file relative |
|
| 86 | - * to the templates directory (usually in client/html/templates). |
|
| 87 | - * |
|
| 88 | - * You can overwrite the template file configuration in extensions and |
|
| 89 | - * provide alternative templates. These alternative templates should be |
|
| 90 | - * named like the default one but with the string "standard" replaced by |
|
| 91 | - * an unique name. You may use the name of your project for this. If |
|
| 92 | - * you've implemented an alternative client class as well, "standard" |
|
| 93 | - * should be replaced by the name of the new class. |
|
| 94 | - * |
|
| 95 | - * The introduction part of the checkout confirm html client allows to use |
|
| 96 | - * a different template for each payment status value. You can create a |
|
| 97 | - * template for each payment status and store it in the "checkout/confirm/<status number>/" |
|
| 98 | - * directory below the "templates" directory (usually in client/html/templates). |
|
| 99 | - * If no specific layout template is found, the common template in the |
|
| 100 | - * "checkout/confirm/" directory is used. |
|
| 101 | - * |
|
| 102 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 103 | - * @since 2014.03 |
|
| 104 | - * @since 2014.07 - one template for each payment status |
|
| 105 | - * @category Developer |
|
| 106 | - * @see client/html/checkout/confirm/intro/standard/template-header |
|
| 107 | - */ |
|
| 108 | - $tplconf = 'client/html/checkout/confirm/intro/standard/template-body'; |
|
| 80 | + /** client/html/checkout/confirm/intro/standard/template-body |
|
| 81 | + * Relative path to the HTML body template of the checkout confirm intro client. |
|
| 82 | + * |
|
| 83 | + * The template file contains the HTML code and processing instructions |
|
| 84 | + * to generate the result shown in the body of the frontend. The |
|
| 85 | + * configuration string is the path to the template file relative |
|
| 86 | + * to the templates directory (usually in client/html/templates). |
|
| 87 | + * |
|
| 88 | + * You can overwrite the template file configuration in extensions and |
|
| 89 | + * provide alternative templates. These alternative templates should be |
|
| 90 | + * named like the default one but with the string "standard" replaced by |
|
| 91 | + * an unique name. You may use the name of your project for this. If |
|
| 92 | + * you've implemented an alternative client class as well, "standard" |
|
| 93 | + * should be replaced by the name of the new class. |
|
| 94 | + * |
|
| 95 | + * The introduction part of the checkout confirm html client allows to use |
|
| 96 | + * a different template for each payment status value. You can create a |
|
| 97 | + * template for each payment status and store it in the "checkout/confirm/<status number>/" |
|
| 98 | + * directory below the "templates" directory (usually in client/html/templates). |
|
| 99 | + * If no specific layout template is found, the common template in the |
|
| 100 | + * "checkout/confirm/" directory is used. |
|
| 101 | + * |
|
| 102 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 103 | + * @since 2014.03 |
|
| 104 | + * @since 2014.07 - one template for each payment status |
|
| 105 | + * @category Developer |
|
| 106 | + * @see client/html/checkout/confirm/intro/standard/template-header |
|
| 107 | + */ |
|
| 108 | + $tplconf = 'client/html/checkout/confirm/intro/standard/template-body'; |
|
| 109 | 109 | |
| 110 | - $status = $view->confirmOrderItem->getPaymentStatus(); |
|
| 111 | - $default = array( 'checkout/confirm/' . $status . '/intro-body-default.php', 'checkout/confirm/intro-body-default.php' ); |
|
| 110 | + $status = $view->confirmOrderItem->getPaymentStatus(); |
|
| 111 | + $default = array( 'checkout/confirm/' . $status . '/intro-body-default.php', 'checkout/confirm/intro-body-default.php' ); |
|
| 112 | 112 | |
| 113 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 114 | - } |
|
| 113 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | 116 | |
| 117 | - /** |
|
| 118 | - * Returns the HTML string for insertion into the header. |
|
| 119 | - * |
|
| 120 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 121 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 122 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 123 | - * @return string|null String including HTML tags for the header on error |
|
| 124 | - */ |
|
| 125 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 126 | - { |
|
| 127 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 117 | + /** |
|
| 118 | + * Returns the HTML string for insertion into the header. |
|
| 119 | + * |
|
| 120 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 121 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 122 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 123 | + * @return string|null String including HTML tags for the header on error |
|
| 124 | + */ |
|
| 125 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 126 | + { |
|
| 127 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 128 | 128 | |
| 129 | - $html = ''; |
|
| 130 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 131 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 132 | - } |
|
| 133 | - $view->introHeader = $html; |
|
| 129 | + $html = ''; |
|
| 130 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 131 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 132 | + } |
|
| 133 | + $view->introHeader = $html; |
|
| 134 | 134 | |
| 135 | - /** client/html/checkout/confirm/intro/standard/template-header |
|
| 136 | - * Relative path to the HTML header template of the checkout confirm intro client. |
|
| 137 | - * |
|
| 138 | - * The template file contains the HTML code and processing instructions |
|
| 139 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 140 | - * of the rendered page in the frontend. The configuration string is the |
|
| 141 | - * path to the template file relative to the templates directory (usually |
|
| 142 | - * in client/html/templates). |
|
| 143 | - * |
|
| 144 | - * You can overwrite the template file configuration in extensions and |
|
| 145 | - * provide alternative templates. These alternative templates should be |
|
| 146 | - * named like the default one but with the string "standard" replaced by |
|
| 147 | - * an unique name. You may use the name of your project for this. If |
|
| 148 | - * you've implemented an alternative client class as well, "standard" |
|
| 149 | - * should be replaced by the name of the new class. |
|
| 150 | - * |
|
| 151 | - * The introduction part of the checkout confirm html client allows to use |
|
| 152 | - * a different template for each payment status value. You can create a |
|
| 153 | - * template for each payment status and store it in the "checkout/confirm/<status number>/" |
|
| 154 | - * directory below the "templates" directory (usually in client/html/templates). |
|
| 155 | - * If no specific layout template is found, the common template in the |
|
| 156 | - * "checkout/confirm/" directory is used. |
|
| 157 | - * |
|
| 158 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 159 | - * @since 2014.03 |
|
| 160 | - * @since 2014.07 - one template for each payment status |
|
| 161 | - * @category Developer |
|
| 162 | - * @see client/html/checkout/confirm/intro/standard/template-body |
|
| 163 | - */ |
|
| 164 | - $tplconf = 'client/html/checkout/confirm/intro/standard/template-header'; |
|
| 135 | + /** client/html/checkout/confirm/intro/standard/template-header |
|
| 136 | + * Relative path to the HTML header template of the checkout confirm intro client. |
|
| 137 | + * |
|
| 138 | + * The template file contains the HTML code and processing instructions |
|
| 139 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 140 | + * of the rendered page in the frontend. The configuration string is the |
|
| 141 | + * path to the template file relative to the templates directory (usually |
|
| 142 | + * in client/html/templates). |
|
| 143 | + * |
|
| 144 | + * You can overwrite the template file configuration in extensions and |
|
| 145 | + * provide alternative templates. These alternative templates should be |
|
| 146 | + * named like the default one but with the string "standard" replaced by |
|
| 147 | + * an unique name. You may use the name of your project for this. If |
|
| 148 | + * you've implemented an alternative client class as well, "standard" |
|
| 149 | + * should be replaced by the name of the new class. |
|
| 150 | + * |
|
| 151 | + * The introduction part of the checkout confirm html client allows to use |
|
| 152 | + * a different template for each payment status value. You can create a |
|
| 153 | + * template for each payment status and store it in the "checkout/confirm/<status number>/" |
|
| 154 | + * directory below the "templates" directory (usually in client/html/templates). |
|
| 155 | + * If no specific layout template is found, the common template in the |
|
| 156 | + * "checkout/confirm/" directory is used. |
|
| 157 | + * |
|
| 158 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 159 | + * @since 2014.03 |
|
| 160 | + * @since 2014.07 - one template for each payment status |
|
| 161 | + * @category Developer |
|
| 162 | + * @see client/html/checkout/confirm/intro/standard/template-body |
|
| 163 | + */ |
|
| 164 | + $tplconf = 'client/html/checkout/confirm/intro/standard/template-header'; |
|
| 165 | 165 | |
| 166 | - $status = $view->confirmOrderItem->getPaymentStatus(); |
|
| 167 | - $default = array( 'checkout/confirm/' . $status . '/intro-header-default.php', 'checkout/confirm/intro-header-default.php' ); |
|
| 166 | + $status = $view->confirmOrderItem->getPaymentStatus(); |
|
| 167 | + $default = array( 'checkout/confirm/' . $status . '/intro-header-default.php', 'checkout/confirm/intro-header-default.php' ); |
|
| 168 | 168 | |
| 169 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 170 | - } |
|
| 169 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 170 | + } |
|
| 171 | 171 | |
| 172 | 172 | |
| 173 | - /** |
|
| 174 | - * Returns the sub-client given by its name. |
|
| 175 | - * |
|
| 176 | - * @param string $type Name of the client type |
|
| 177 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 178 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 179 | - */ |
|
| 180 | - public function getSubClient( $type, $name = null ) |
|
| 181 | - { |
|
| 182 | - /** client/html/checkout/confirm/intro/decorators/excludes |
|
| 183 | - * Excludes decorators added by the "common" option from the checkout confirm intro html client |
|
| 184 | - * |
|
| 185 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 186 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 187 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 188 | - * modify what is returned to the caller. |
|
| 189 | - * |
|
| 190 | - * This option allows you to remove a decorator added via |
|
| 191 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 192 | - * around the html client. |
|
| 193 | - * |
|
| 194 | - * client/html/checkout/confirm/intro/decorators/excludes = array( 'decorator1' ) |
|
| 195 | - * |
|
| 196 | - * This would remove the decorator named "decorator1" from the list of |
|
| 197 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 198 | - * "client/html/common/decorators/default" to the html client. |
|
| 199 | - * |
|
| 200 | - * @param array List of decorator names |
|
| 201 | - * @since 2015.08 |
|
| 202 | - * @category Developer |
|
| 203 | - * @see client/html/common/decorators/default |
|
| 204 | - * @see client/html/checkout/confirm/intro/decorators/global |
|
| 205 | - * @see client/html/checkout/confirm/intro/decorators/local |
|
| 206 | - */ |
|
| 173 | + /** |
|
| 174 | + * Returns the sub-client given by its name. |
|
| 175 | + * |
|
| 176 | + * @param string $type Name of the client type |
|
| 177 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 178 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 179 | + */ |
|
| 180 | + public function getSubClient( $type, $name = null ) |
|
| 181 | + { |
|
| 182 | + /** client/html/checkout/confirm/intro/decorators/excludes |
|
| 183 | + * Excludes decorators added by the "common" option from the checkout confirm intro html client |
|
| 184 | + * |
|
| 185 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 186 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 187 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 188 | + * modify what is returned to the caller. |
|
| 189 | + * |
|
| 190 | + * This option allows you to remove a decorator added via |
|
| 191 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 192 | + * around the html client. |
|
| 193 | + * |
|
| 194 | + * client/html/checkout/confirm/intro/decorators/excludes = array( 'decorator1' ) |
|
| 195 | + * |
|
| 196 | + * This would remove the decorator named "decorator1" from the list of |
|
| 197 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 198 | + * "client/html/common/decorators/default" to the html client. |
|
| 199 | + * |
|
| 200 | + * @param array List of decorator names |
|
| 201 | + * @since 2015.08 |
|
| 202 | + * @category Developer |
|
| 203 | + * @see client/html/common/decorators/default |
|
| 204 | + * @see client/html/checkout/confirm/intro/decorators/global |
|
| 205 | + * @see client/html/checkout/confirm/intro/decorators/local |
|
| 206 | + */ |
|
| 207 | 207 | |
| 208 | - /** client/html/checkout/confirm/intro/decorators/global |
|
| 209 | - * Adds a list of globally available decorators only to the checkout confirm intro html client |
|
| 210 | - * |
|
| 211 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 212 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 213 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 214 | - * modify what is returned to the caller. |
|
| 215 | - * |
|
| 216 | - * This option allows you to wrap global decorators |
|
| 217 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 218 | - * |
|
| 219 | - * client/html/checkout/confirm/intro/decorators/global = array( 'decorator1' ) |
|
| 220 | - * |
|
| 221 | - * This would add the decorator named "decorator1" defined by |
|
| 222 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 223 | - * |
|
| 224 | - * @param array List of decorator names |
|
| 225 | - * @since 2015.08 |
|
| 226 | - * @category Developer |
|
| 227 | - * @see client/html/common/decorators/default |
|
| 228 | - * @see client/html/checkout/confirm/intro/decorators/excludes |
|
| 229 | - * @see client/html/checkout/confirm/intro/decorators/local |
|
| 230 | - */ |
|
| 208 | + /** client/html/checkout/confirm/intro/decorators/global |
|
| 209 | + * Adds a list of globally available decorators only to the checkout confirm intro html client |
|
| 210 | + * |
|
| 211 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 212 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 213 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 214 | + * modify what is returned to the caller. |
|
| 215 | + * |
|
| 216 | + * This option allows you to wrap global decorators |
|
| 217 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 218 | + * |
|
| 219 | + * client/html/checkout/confirm/intro/decorators/global = array( 'decorator1' ) |
|
| 220 | + * |
|
| 221 | + * This would add the decorator named "decorator1" defined by |
|
| 222 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 223 | + * |
|
| 224 | + * @param array List of decorator names |
|
| 225 | + * @since 2015.08 |
|
| 226 | + * @category Developer |
|
| 227 | + * @see client/html/common/decorators/default |
|
| 228 | + * @see client/html/checkout/confirm/intro/decorators/excludes |
|
| 229 | + * @see client/html/checkout/confirm/intro/decorators/local |
|
| 230 | + */ |
|
| 231 | 231 | |
| 232 | - /** client/html/checkout/confirm/intro/decorators/local |
|
| 233 | - * Adds a list of local decorators only to the checkout confirm intro html client |
|
| 234 | - * |
|
| 235 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 236 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 237 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 238 | - * modify what is returned to the caller. |
|
| 239 | - * |
|
| 240 | - * This option allows you to wrap local decorators |
|
| 241 | - * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 242 | - * |
|
| 243 | - * client/html/checkout/confirm/intro/decorators/local = array( 'decorator2' ) |
|
| 244 | - * |
|
| 245 | - * This would add the decorator named "decorator2" defined by |
|
| 246 | - * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 247 | - * |
|
| 248 | - * @param array List of decorator names |
|
| 249 | - * @since 2015.08 |
|
| 250 | - * @category Developer |
|
| 251 | - * @see client/html/common/decorators/default |
|
| 252 | - * @see client/html/checkout/confirm/intro/decorators/excludes |
|
| 253 | - * @see client/html/checkout/confirm/intro/decorators/global |
|
| 254 | - */ |
|
| 232 | + /** client/html/checkout/confirm/intro/decorators/local |
|
| 233 | + * Adds a list of local decorators only to the checkout confirm intro html client |
|
| 234 | + * |
|
| 235 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 236 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 237 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 238 | + * modify what is returned to the caller. |
|
| 239 | + * |
|
| 240 | + * This option allows you to wrap local decorators |
|
| 241 | + * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 242 | + * |
|
| 243 | + * client/html/checkout/confirm/intro/decorators/local = array( 'decorator2' ) |
|
| 244 | + * |
|
| 245 | + * This would add the decorator named "decorator2" defined by |
|
| 246 | + * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 247 | + * |
|
| 248 | + * @param array List of decorator names |
|
| 249 | + * @since 2015.08 |
|
| 250 | + * @category Developer |
|
| 251 | + * @see client/html/common/decorators/default |
|
| 252 | + * @see client/html/checkout/confirm/intro/decorators/excludes |
|
| 253 | + * @see client/html/checkout/confirm/intro/decorators/global |
|
| 254 | + */ |
|
| 255 | 255 | |
| 256 | - return $this->createSubClient( 'checkout/confirm/intro/' . $type, $name ); |
|
| 257 | - } |
|
| 256 | + return $this->createSubClient( 'checkout/confirm/intro/' . $type, $name ); |
|
| 257 | + } |
|
| 258 | 258 | |
| 259 | 259 | |
| 260 | - /** |
|
| 261 | - * Returns the list of sub-client names configured for the client. |
|
| 262 | - * |
|
| 263 | - * @return array List of HTML client names |
|
| 264 | - */ |
|
| 265 | - protected function getSubClientNames() |
|
| 266 | - { |
|
| 267 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 268 | - } |
|
| 260 | + /** |
|
| 261 | + * Returns the list of sub-client names configured for the client. |
|
| 262 | + * |
|
| 263 | + * @return array List of HTML client names |
|
| 264 | + */ |
|
| 265 | + protected function getSubClientNames() |
|
| 266 | + { |
|
| 267 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 268 | + } |
|
| 269 | 269 | } |
| 270 | 270 | \ No newline at end of file |
@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 68 | 68 | * @return string HTML code |
| 69 | 69 | */ |
| 70 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 70 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 71 | 71 | { |
| 72 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 72 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 73 | 73 | |
| 74 | 74 | $html = ''; |
| 75 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 75 | + foreach ($this->getSubClients() as $subclient) { |
|
| 76 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 77 | 77 | } |
| 78 | 78 | $view->introBody = $html; |
| 79 | 79 | |
@@ -108,9 +108,9 @@ discard block |
||
| 108 | 108 | $tplconf = 'client/html/checkout/confirm/intro/standard/template-body'; |
| 109 | 109 | |
| 110 | 110 | $status = $view->confirmOrderItem->getPaymentStatus(); |
| 111 | - $default = array( 'checkout/confirm/' . $status . '/intro-body-default.php', 'checkout/confirm/intro-body-default.php' ); |
|
| 111 | + $default = array('checkout/confirm/'.$status.'/intro-body-default.php', 'checkout/confirm/intro-body-default.php'); |
|
| 112 | 112 | |
| 113 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 113 | + return $view->render($view->config($tplconf, $default)); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | |
@@ -122,13 +122,13 @@ discard block |
||
| 122 | 122 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 123 | 123 | * @return string|null String including HTML tags for the header on error |
| 124 | 124 | */ |
| 125 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 125 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 126 | 126 | { |
| 127 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 127 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 128 | 128 | |
| 129 | 129 | $html = ''; |
| 130 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 131 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 130 | + foreach ($this->getSubClients() as $subclient) { |
|
| 131 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 132 | 132 | } |
| 133 | 133 | $view->introHeader = $html; |
| 134 | 134 | |
@@ -164,9 +164,9 @@ discard block |
||
| 164 | 164 | $tplconf = 'client/html/checkout/confirm/intro/standard/template-header'; |
| 165 | 165 | |
| 166 | 166 | $status = $view->confirmOrderItem->getPaymentStatus(); |
| 167 | - $default = array( 'checkout/confirm/' . $status . '/intro-header-default.php', 'checkout/confirm/intro-header-default.php' ); |
|
| 167 | + $default = array('checkout/confirm/'.$status.'/intro-header-default.php', 'checkout/confirm/intro-header-default.php'); |
|
| 168 | 168 | |
| 169 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 169 | + return $view->render($view->config($tplconf, $default)); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | * @param string|null $name Name of the sub-client (Default if null) |
| 178 | 178 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 179 | 179 | */ |
| 180 | - public function getSubClient( $type, $name = null ) |
|
| 180 | + public function getSubClient($type, $name = null) |
|
| 181 | 181 | { |
| 182 | 182 | /** client/html/checkout/confirm/intro/decorators/excludes |
| 183 | 183 | * Excludes decorators added by the "common" option from the checkout confirm intro html client |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | * @see client/html/checkout/confirm/intro/decorators/global |
| 254 | 254 | */ |
| 255 | 255 | |
| 256 | - return $this->createSubClient( 'checkout/confirm/intro/' . $type, $name ); |
|
| 256 | + return $this->createSubClient('checkout/confirm/intro/'.$type, $name); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | |
@@ -264,6 +264,6 @@ discard block |
||
| 264 | 264 | */ |
| 265 | 265 | protected function getSubClientNames() |
| 266 | 266 | { |
| 267 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 267 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | \ No newline at end of file |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | |
| 14 | 14 | // Strings for translation |
| 15 | -sprintf( 'process' ); |
|
| 15 | +sprintf('process'); |
|
| 16 | 16 | |
| 17 | 17 | |
| 18 | 18 | /** |
@@ -70,19 +70,19 @@ discard block |
||
| 70 | 70 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 71 | 71 | * @return string HTML code |
| 72 | 72 | */ |
| 73 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 73 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 74 | 74 | { |
| 75 | 75 | $view = $this->getView(); |
| 76 | 76 | |
| 77 | - if( !in_array( $view->get( 'standardStepActive' ), array( 'order', 'process' ) ) ) { |
|
| 77 | + if (!in_array($view->get('standardStepActive'), array('order', 'process'))) { |
|
| 78 | 78 | return ''; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 81 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 82 | 82 | |
| 83 | 83 | $html = ''; |
| 84 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 85 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 84 | + foreach ($this->getSubClients() as $subclient) { |
|
| 85 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 86 | 86 | } |
| 87 | 87 | $view->processBody = $html; |
| 88 | 88 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | $tplconf = 'client/html/checkout/standard/process/standard/template-body'; |
| 110 | 110 | $default = 'checkout/standard/process-body-default.php'; |
| 111 | 111 | |
| 112 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 112 | + return $view->render($view->config($tplconf, $default)); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | |
@@ -121,19 +121,19 @@ discard block |
||
| 121 | 121 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 122 | 122 | * @return string|null String including HTML tags for the header on error |
| 123 | 123 | */ |
| 124 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 124 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 125 | 125 | { |
| 126 | 126 | $view = $this->getView(); |
| 127 | 127 | |
| 128 | - if( !in_array( $view->param( 'standardStepActive' ), array( 'order', 'process' ) ) ) { |
|
| 128 | + if (!in_array($view->param('standardStepActive'), array('order', 'process'))) { |
|
| 129 | 129 | return ''; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 132 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 133 | 133 | |
| 134 | 134 | $html = ''; |
| 135 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 136 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 135 | + foreach ($this->getSubClients() as $subclient) { |
|
| 136 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 137 | 137 | } |
| 138 | 138 | $view->processHeader = $html; |
| 139 | 139 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | $tplconf = 'client/html/checkout/standard/process/standard/template-header'; |
| 162 | 162 | $default = 'checkout/standard/process-header-default.php'; |
| 163 | 163 | |
| 164 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 164 | + return $view->render($view->config($tplconf, $default)); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | * @param string|null $name Name of the sub-client (Default if null) |
| 173 | 173 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 174 | 174 | */ |
| 175 | - public function getSubClient( $type, $name = null ) |
|
| 175 | + public function getSubClient($type, $name = null) |
|
| 176 | 176 | { |
| 177 | 177 | /** client/html/checkout/standard/process/decorators/excludes |
| 178 | 178 | * Excludes decorators added by the "common" option from the checkout standard process html client |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | * @see client/html/checkout/standard/process/decorators/global |
| 249 | 249 | */ |
| 250 | 250 | |
| 251 | - return $this->createSubClient( 'checkout/standard/process/' . $type, $name ); |
|
| 251 | + return $this->createSubClient('checkout/standard/process/'.$type, $name); |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | |
@@ -260,41 +260,41 @@ discard block |
||
| 260 | 260 | public function process() |
| 261 | 261 | { |
| 262 | 262 | $view = $this->getView(); |
| 263 | - $errors = $view->get( 'standardErrorList', array() ); |
|
| 263 | + $errors = $view->get('standardErrorList', array()); |
|
| 264 | 264 | |
| 265 | - if( !in_array( $view->param( 'c_step' ), array( 'order', 'process' ) ) || !empty( $errors ) ) { |
|
| 265 | + if (!in_array($view->param('c_step'), array('order', 'process')) || !empty($errors)) { |
|
| 266 | 266 | return; |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | $context = $this->getContext(); |
| 270 | 270 | $session = $context->getSession(); |
| 271 | - $orderid = $session->get( 'aimeos/orderid' ); |
|
| 272 | - $config = array( 'absoluteUri' => true, 'namespace' => false ); |
|
| 271 | + $orderid = $session->get('aimeos/orderid'); |
|
| 272 | + $config = array('absoluteUri' => true, 'namespace' => false); |
|
| 273 | 273 | |
| 274 | 274 | try |
| 275 | 275 | { |
| 276 | - $orderItem = \Aimeos\MShop\Factory::createManager( $context, 'order' )->getItem( $orderid ); |
|
| 276 | + $orderItem = \Aimeos\MShop\Factory::createManager($context, 'order')->getItem($orderid); |
|
| 277 | 277 | |
| 278 | - if( ( $code = $this->getOrderServiceCode( $orderItem->getBaseId() ) ) !== null ) |
|
| 278 | + if (($code = $this->getOrderServiceCode($orderItem->getBaseId())) !== null) |
|
| 279 | 279 | { |
| 280 | - $serviceItem = $this->getServiceItem( $code ); |
|
| 280 | + $serviceItem = $this->getServiceItem($code); |
|
| 281 | 281 | |
| 282 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
| 283 | - $provider = $serviceManager->getProvider( $serviceItem ); |
|
| 282 | + $serviceManager = \Aimeos\MShop\Factory::createManager($context, 'service'); |
|
| 283 | + $provider = $serviceManager->getProvider($serviceItem); |
|
| 284 | 284 | |
| 285 | - $params = array( 'code' => $serviceItem->getCode(), 'orderid' => $orderid ); |
|
| 285 | + $params = array('code' => $serviceItem->getCode(), 'orderid' => $orderid); |
|
| 286 | 286 | $urls = array( |
| 287 | - 'payment.url-self' => $this->getUrlSelf( $view, $params + array( 'c_step' => 'process' ), array() ), |
|
| 288 | - 'payment.url-success' => $this->getUrlConfirm( $view, $params, $config ), |
|
| 289 | - 'payment.url-update' => $this->getUrlUpdate( $view, $params, $config ), |
|
| 287 | + 'payment.url-self' => $this->getUrlSelf($view, $params + array('c_step' => 'process'), array()), |
|
| 288 | + 'payment.url-success' => $this->getUrlConfirm($view, $params, $config), |
|
| 289 | + 'payment.url-update' => $this->getUrlUpdate($view, $params, $config), |
|
| 290 | 290 | 'client.ipaddress' => $view->request()->getClientAddress(), |
| 291 | 291 | ); |
| 292 | - $provider->injectGlobalConfigBE( $urls ); |
|
| 292 | + $provider->injectGlobalConfigBE($urls); |
|
| 293 | 293 | |
| 294 | - if( ( $form = $provider->process( $orderItem, $view->param() ) ) === null ) |
|
| 294 | + if (($form = $provider->process($orderItem, $view->param())) === null) |
|
| 295 | 295 | { |
| 296 | - $msg = sprintf( 'Invalid process response from service provider with code "%1$s"', $serviceItem->getCode() ); |
|
| 297 | - throw new \Aimeos\Client\Html\Exception( $msg ); |
|
| 296 | + $msg = sprintf('Invalid process response from service provider with code "%1$s"', $serviceItem->getCode()); |
|
| 297 | + throw new \Aimeos\Client\Html\Exception($msg); |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | $view->standardUrlNext = $form->getUrl(); |
@@ -304,34 +304,34 @@ discard block |
||
| 304 | 304 | } |
| 305 | 305 | else |
| 306 | 306 | { |
| 307 | - $view->standardUrlNext = $this->getUrlConfirm( $view, array(), array() ); |
|
| 307 | + $view->standardUrlNext = $this->getUrlConfirm($view, array(), array()); |
|
| 308 | 308 | $view->standardMethod = 'GET'; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | |
| 312 | 312 | parent::process(); |
| 313 | 313 | } |
| 314 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 314 | + catch (\Aimeos\Client\Html\Exception $e) |
|
| 315 | 315 | { |
| 316 | - $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 317 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 316 | + $error = array($context->getI18n()->dt('client', $e->getMessage())); |
|
| 317 | + $view->standardErrorList = $view->get('standardErrorList', array()) + $error; |
|
| 318 | 318 | } |
| 319 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 319 | + catch (\Aimeos\Controller\Frontend\Exception $e) |
|
| 320 | 320 | { |
| 321 | - $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 322 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 321 | + $error = array($context->getI18n()->dt('controller/frontend', $e->getMessage())); |
|
| 322 | + $view->standardErrorList = $view->get('standardErrorList', array()) + $error; |
|
| 323 | 323 | } |
| 324 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 324 | + catch (\Aimeos\MShop\Exception $e) |
|
| 325 | 325 | { |
| 326 | - $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 327 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 326 | + $error = array($context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 327 | + $view->standardErrorList = $view->get('standardErrorList', array()) + $error; |
|
| 328 | 328 | } |
| 329 | - catch( \Exception $e ) |
|
| 329 | + catch (\Exception $e) |
|
| 330 | 330 | { |
| 331 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 331 | + $context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 332 | 332 | |
| 333 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 334 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 333 | + $error = array($context->getI18n()->dt('client', 'A non-recoverable error occured')); |
|
| 334 | + $view->standardErrorList = $view->get('standardErrorList', array()) + $error; |
|
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | 337 | |
@@ -342,20 +342,20 @@ discard block |
||
| 342 | 342 | * @param string $baseid ID of the order base item |
| 343 | 343 | * @return string|null Code of the service item or null if not found |
| 344 | 344 | */ |
| 345 | - protected function getOrderServiceCode( $baseid ) |
|
| 345 | + protected function getOrderServiceCode($baseid) |
|
| 346 | 346 | { |
| 347 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/service' ); |
|
| 347 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/service'); |
|
| 348 | 348 | |
| 349 | 349 | $search = $manager->createSearch(); |
| 350 | 350 | $expr = array( |
| 351 | - $search->compare( '==', 'order.base.service.baseid', $baseid ), |
|
| 352 | - $search->compare( '==', 'order.base.service.type', \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT ), |
|
| 351 | + $search->compare('==', 'order.base.service.baseid', $baseid), |
|
| 352 | + $search->compare('==', 'order.base.service.type', \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT), |
|
| 353 | 353 | ); |
| 354 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 354 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 355 | 355 | |
| 356 | - $result = $manager->searchItems( $search ); |
|
| 356 | + $result = $manager->searchItems($search); |
|
| 357 | 357 | |
| 358 | - if( ( $item = reset( $result ) ) !== false ) { |
|
| 358 | + if (($item = reset($result)) !== false) { |
|
| 359 | 359 | return $item->getCode(); |
| 360 | 360 | } |
| 361 | 361 | } |
@@ -368,23 +368,23 @@ discard block |
||
| 368 | 368 | * @throws \Aimeos\Client\Html\Exception If no service item for this code is found |
| 369 | 369 | * @return \Aimeos\MShop\Service\Item\Iface Service item object |
| 370 | 370 | */ |
| 371 | - protected function getServiceItem( $code ) |
|
| 371 | + protected function getServiceItem($code) |
|
| 372 | 372 | { |
| 373 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 373 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 374 | 374 | |
| 375 | 375 | $search = $serviceManager->createSearch(); |
| 376 | 376 | $expr = array( |
| 377 | - $search->compare( '==', 'service.code', $code ), |
|
| 378 | - $search->compare( '==', 'service.type.code', 'payment' ), |
|
| 377 | + $search->compare('==', 'service.code', $code), |
|
| 378 | + $search->compare('==', 'service.type.code', 'payment'), |
|
| 379 | 379 | ); |
| 380 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 380 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 381 | 381 | |
| 382 | - $result = $serviceManager->searchItems( $search ); |
|
| 382 | + $result = $serviceManager->searchItems($search); |
|
| 383 | 383 | |
| 384 | - if( ( $serviceItem = reset( $result ) ) === false ) |
|
| 384 | + if (($serviceItem = reset($result)) === false) |
|
| 385 | 385 | { |
| 386 | - $msg = sprintf( 'No service for code "%1$s" found', $code ); |
|
| 387 | - throw new \Aimeos\Client\Html\Exception( $msg ); |
|
| 386 | + $msg = sprintf('No service for code "%1$s" found', $code); |
|
| 387 | + throw new \Aimeos\Client\Html\Exception($msg); |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | return $serviceItem; |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | */ |
| 399 | 399 | protected function getSubClientNames() |
| 400 | 400 | { |
| 401 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 401 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | * @param array $config Default URL configuration |
| 411 | 411 | * @return string URL string |
| 412 | 412 | */ |
| 413 | - protected function getUrlConfirm( \Aimeos\MW\View\Iface $view, array $params, array $config ) |
|
| 413 | + protected function getUrlConfirm(\Aimeos\MW\View\Iface $view, array $params, array $config) |
|
| 414 | 414 | { |
| 415 | 415 | /** client/html/checkout/confirm/url/target |
| 416 | 416 | * Destination of the URL where the controller specified in the URL is known |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | * @see client/html/checkout/confirm/url/action |
| 427 | 427 | * @see client/html/checkout/confirm/url/config |
| 428 | 428 | */ |
| 429 | - $target = $view->config( 'client/html/checkout/confirm/url/target' ); |
|
| 429 | + $target = $view->config('client/html/checkout/confirm/url/target'); |
|
| 430 | 430 | |
| 431 | 431 | /** client/html/checkout/confirm/url/controller |
| 432 | 432 | * Name of the controller whose action should be called |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | * @see client/html/checkout/confirm/url/action |
| 443 | 443 | * @see client/html/checkout/confirm/url/config |
| 444 | 444 | */ |
| 445 | - $cntl = $view->config( 'client/html/checkout/confirm/url/controller', 'checkout' ); |
|
| 445 | + $cntl = $view->config('client/html/checkout/confirm/url/controller', 'checkout'); |
|
| 446 | 446 | |
| 447 | 447 | /** client/html/checkout/confirm/url/action |
| 448 | 448 | * Name of the action that should create the output |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | * @see client/html/checkout/confirm/url/controller |
| 459 | 459 | * @see client/html/checkout/confirm/url/config |
| 460 | 460 | */ |
| 461 | - $action = $view->config( 'client/html/checkout/confirm/url/action', 'confirm' ); |
|
| 461 | + $action = $view->config('client/html/checkout/confirm/url/action', 'confirm'); |
|
| 462 | 462 | |
| 463 | 463 | /** client/html/checkout/confirm/url/config |
| 464 | 464 | * Associative list of configuration options used for generating the URL |
@@ -481,9 +481,9 @@ discard block |
||
| 481 | 481 | * @see client/html/checkout/confirm/url/action |
| 482 | 482 | * @see client/html/url/config |
| 483 | 483 | */ |
| 484 | - $config = $view->config( 'client/html/checkout/confirm/url/config', $config ); |
|
| 484 | + $config = $view->config('client/html/checkout/confirm/url/config', $config); |
|
| 485 | 485 | |
| 486 | - return $view->url( $target, $cntl, $action, $params, array(), $config ); |
|
| 486 | + return $view->url($target, $cntl, $action, $params, array(), $config); |
|
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | * @param array $config Default URL configuration |
| 496 | 496 | * @return string URL string |
| 497 | 497 | */ |
| 498 | - protected function getUrlSelf( \Aimeos\MW\View\Iface $view, array $params, array $config ) |
|
| 498 | + protected function getUrlSelf(\Aimeos\MW\View\Iface $view, array $params, array $config) |
|
| 499 | 499 | { |
| 500 | 500 | /** client/html/checkout/standard/url/target |
| 501 | 501 | * Destination of the URL where the controller specified in the URL is known |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | * @see client/html/checkout/standard/url/action |
| 512 | 512 | * @see client/html/checkout/standard/url/config |
| 513 | 513 | */ |
| 514 | - $target = $view->config( 'client/html/checkout/standard/url/target' ); |
|
| 514 | + $target = $view->config('client/html/checkout/standard/url/target'); |
|
| 515 | 515 | |
| 516 | 516 | /** client/html/checkout/standard/url/controller |
| 517 | 517 | * Name of the controller whose action should be called |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | * @see client/html/checkout/standard/url/action |
| 528 | 528 | * @see client/html/checkout/standard/url/config |
| 529 | 529 | */ |
| 530 | - $cntl = $view->config( 'client/html/checkout/standard/url/controller', 'checkout' ); |
|
| 530 | + $cntl = $view->config('client/html/checkout/standard/url/controller', 'checkout'); |
|
| 531 | 531 | |
| 532 | 532 | /** client/html/checkout/standard/url/action |
| 533 | 533 | * Name of the action that should create the output |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | * @see client/html/checkout/standard/url/controller |
| 544 | 544 | * @see client/html/checkout/standard/url/config |
| 545 | 545 | */ |
| 546 | - $action = $view->config( 'client/html/checkout/standard/url/action', 'standard' ); |
|
| 546 | + $action = $view->config('client/html/checkout/standard/url/action', 'standard'); |
|
| 547 | 547 | |
| 548 | 548 | /** client/html/checkout/standard/url/config |
| 549 | 549 | * Associative list of configuration options used for generating the URL |
@@ -566,9 +566,9 @@ discard block |
||
| 566 | 566 | * @see client/html/checkout/standard/url/action |
| 567 | 567 | * @see client/html/url/config |
| 568 | 568 | */ |
| 569 | - $config = $view->config( 'client/html/checkout/standard/url/config', $config ); |
|
| 569 | + $config = $view->config('client/html/checkout/standard/url/config', $config); |
|
| 570 | 570 | |
| 571 | - return $view->url( $target, $cntl, $action, $params, array(), $config ); |
|
| 571 | + return $view->url($target, $cntl, $action, $params, array(), $config); |
|
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | * @param array $config Default URL configuration |
| 581 | 581 | * @return string URL string |
| 582 | 582 | */ |
| 583 | - protected function getUrlUpdate( \Aimeos\MW\View\Iface $view, array $params, array $config ) |
|
| 583 | + protected function getUrlUpdate(\Aimeos\MW\View\Iface $view, array $params, array $config) |
|
| 584 | 584 | { |
| 585 | 585 | /** client/html/checkout/update/url/target |
| 586 | 586 | * Destination of the URL where the controller specified in the URL is known |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | * @see client/html/checkout/update/url/action |
| 597 | 597 | * @see client/html/checkout/update/url/config |
| 598 | 598 | */ |
| 599 | - $target = $view->config( 'client/html/checkout/update/url/target' ); |
|
| 599 | + $target = $view->config('client/html/checkout/update/url/target'); |
|
| 600 | 600 | |
| 601 | 601 | /** client/html/checkout/update/url/controller |
| 602 | 602 | * Name of the controller whose action should be called |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | * @see client/html/checkout/update/url/action |
| 613 | 613 | * @see client/html/checkout/update/url/config |
| 614 | 614 | */ |
| 615 | - $cntl = $view->config( 'client/html/checkout/update/url/controller', 'checkout' ); |
|
| 615 | + $cntl = $view->config('client/html/checkout/update/url/controller', 'checkout'); |
|
| 616 | 616 | |
| 617 | 617 | /** client/html/checkout/update/url/action |
| 618 | 618 | * Name of the action that should create the output |
@@ -628,7 +628,7 @@ discard block |
||
| 628 | 628 | * @see client/html/checkout/update/url/controller |
| 629 | 629 | * @see client/html/checkout/update/url/config |
| 630 | 630 | */ |
| 631 | - $action = $view->config( 'client/html/checkout/update/url/action', 'update' ); |
|
| 631 | + $action = $view->config('client/html/checkout/update/url/action', 'update'); |
|
| 632 | 632 | |
| 633 | 633 | /** client/html/checkout/update/url/config |
| 634 | 634 | * Associative list of configuration options used for generating the URL |
@@ -651,9 +651,9 @@ discard block |
||
| 651 | 651 | * @see client/html/checkout/update/url/action |
| 652 | 652 | * @see client/html/url/config |
| 653 | 653 | */ |
| 654 | - $config = $view->config( 'client/html/checkout/update/url/config', $config ); |
|
| 654 | + $config = $view->config('client/html/checkout/update/url/config', $config); |
|
| 655 | 655 | |
| 656 | - return $view->url( $target, $cntl, $action, $params, array(), $config ); |
|
| 656 | + return $view->url($target, $cntl, $action, $params, array(), $config); |
|
| 657 | 657 | } |
| 658 | 658 | |
| 659 | 659 | |
@@ -665,11 +665,11 @@ discard block |
||
| 665 | 665 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 666 | 666 | * @return \Aimeos\MW\View\Iface Modified view object |
| 667 | 667 | */ |
| 668 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 668 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 669 | 669 | { |
| 670 | - if( !isset( $this->cache ) ) |
|
| 670 | + if (!isset($this->cache)) |
|
| 671 | 671 | { |
| 672 | - $view->standardUrlPayment = $this->getUrlSelf( $view, array( 'c_step' => 'payment' ), array() ); |
|
| 672 | + $view->standardUrlPayment = $this->getUrlSelf($view, array('c_step' => 'payment'), array()); |
|
| 673 | 673 | |
| 674 | 674 | $this->cache = $view; |
| 675 | 675 | } |
@@ -301,8 +301,7 @@ discard block |
||
| 301 | 301 | $view->standardMethod = $form->getMethod(); |
| 302 | 302 | $view->standardProcessParams = $form->getValues(); |
| 303 | 303 | $view->standardUrlExternal = $form->getExternal(); |
| 304 | - } |
|
| 305 | - else |
|
| 304 | + } else |
|
| 306 | 305 | { |
| 307 | 306 | $view->standardUrlNext = $this->getUrlConfirm( $view, array(), array() ); |
| 308 | 307 | $view->standardMethod = 'GET'; |
@@ -310,23 +309,19 @@ discard block |
||
| 310 | 309 | |
| 311 | 310 | |
| 312 | 311 | parent::process(); |
| 313 | - } |
|
| 314 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 312 | + } catch( \Aimeos\Client\Html\Exception $e ) |
|
| 315 | 313 | { |
| 316 | 314 | $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
| 317 | 315 | $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
| 318 | - } |
|
| 319 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 316 | + } catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 320 | 317 | { |
| 321 | 318 | $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
| 322 | 319 | $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
| 323 | - } |
|
| 324 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 320 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 325 | 321 | { |
| 326 | 322 | $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 327 | 323 | $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
| 328 | - } |
|
| 329 | - catch( \Exception $e ) |
|
| 324 | + } catch( \Exception $e ) |
|
| 330 | 325 | { |
| 331 | 326 | $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 332 | 327 | |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -22,659 +22,659 @@ |
||
| 22 | 22 | * @subpackage Html |
| 23 | 23 | */ |
| 24 | 24 | class Standard |
| 25 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 26 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 25 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 26 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 27 | 27 | { |
| 28 | - /** client/html/checkout/standard/process/standard/subparts |
|
| 29 | - * List of HTML sub-clients rendered within the checkout standard process section |
|
| 30 | - * |
|
| 31 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 32 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 33 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 34 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 35 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 36 | - * the output that is placed inside the container of its parent. |
|
| 37 | - * |
|
| 38 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 39 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 40 | - * determines the order of the output of these sub-clients inside the parent |
|
| 41 | - * container. If the configured list of clients is |
|
| 42 | - * |
|
| 43 | - * array( "subclient1", "subclient2" ) |
|
| 44 | - * |
|
| 45 | - * you can easily change the order of the output by reordering the subparts: |
|
| 46 | - * |
|
| 47 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 48 | - * |
|
| 49 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 50 | - * |
|
| 51 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 52 | - * |
|
| 53 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 54 | - * should support adding, removing or reordering content by a fluid like |
|
| 55 | - * design. |
|
| 56 | - * |
|
| 57 | - * @param array List of sub-client names |
|
| 58 | - * @since 2014.03 |
|
| 59 | - * @category Developer |
|
| 60 | - */ |
|
| 61 | - private $subPartPath = 'client/html/checkout/standard/process/standard/subparts'; |
|
| 62 | - private $subPartNames = array(); |
|
| 63 | - private $cache; |
|
| 64 | - |
|
| 65 | - |
|
| 66 | - /** |
|
| 67 | - * Returns the HTML code for insertion into the body. |
|
| 68 | - * |
|
| 69 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 70 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 71 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 72 | - * @return string HTML code |
|
| 73 | - */ |
|
| 74 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 75 | - { |
|
| 76 | - $view = $this->getView(); |
|
| 77 | - |
|
| 78 | - if( !in_array( $view->get( 'standardStepActive' ), array( 'order', 'process' ) ) ) { |
|
| 79 | - return ''; |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 83 | - |
|
| 84 | - $html = ''; |
|
| 85 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 86 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 87 | - } |
|
| 88 | - $view->processBody = $html; |
|
| 89 | - |
|
| 90 | - /** client/html/checkout/standard/process/standard/template-body |
|
| 91 | - * Relative path to the HTML body template of the checkout standard process client. |
|
| 92 | - * |
|
| 93 | - * The template file contains the HTML code and processing instructions |
|
| 94 | - * to generate the result shown in the body of the frontend. The |
|
| 95 | - * configuration string is the path to the template file relative |
|
| 96 | - * to the templates directory (usually in client/html/templates). |
|
| 97 | - * |
|
| 98 | - * You can overwrite the template file configuration in extensions and |
|
| 99 | - * provide alternative templates. These alternative templates should be |
|
| 100 | - * named like the default one but with the string "standard" replaced by |
|
| 101 | - * an unique name. You may use the name of your project for this. If |
|
| 102 | - * you've implemented an alternative client class as well, "standard" |
|
| 103 | - * should be replaced by the name of the new class. |
|
| 104 | - * |
|
| 105 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 106 | - * @since 2014.03 |
|
| 107 | - * @category Developer |
|
| 108 | - * @see client/html/checkout/standard/process/standard/template-header |
|
| 109 | - */ |
|
| 110 | - $tplconf = 'client/html/checkout/standard/process/standard/template-body'; |
|
| 111 | - $default = 'checkout/standard/process-body-default.php'; |
|
| 112 | - |
|
| 113 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - |
|
| 117 | - /** |
|
| 118 | - * Returns the HTML string for insertion into the header. |
|
| 119 | - * |
|
| 120 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 121 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 122 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 123 | - * @return string|null String including HTML tags for the header on error |
|
| 124 | - */ |
|
| 125 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 126 | - { |
|
| 127 | - $view = $this->getView(); |
|
| 128 | - |
|
| 129 | - if( !in_array( $view->param( 'standardStepActive' ), array( 'order', 'process' ) ) ) { |
|
| 130 | - return ''; |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 134 | - |
|
| 135 | - $html = ''; |
|
| 136 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 137 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 138 | - } |
|
| 139 | - $view->processHeader = $html; |
|
| 140 | - |
|
| 141 | - /** client/html/checkout/standard/process/standard/template-header |
|
| 142 | - * Relative path to the HTML header template of the checkout standard process client. |
|
| 143 | - * |
|
| 144 | - * The template file contains the HTML code and processing instructions |
|
| 145 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 146 | - * of the rendered page in the frontend. The configuration string is the |
|
| 147 | - * path to the template file relative to the templates directory (usually |
|
| 148 | - * in client/html/templates). |
|
| 149 | - * |
|
| 150 | - * You can overwrite the template file configuration in extensions and |
|
| 151 | - * provide alternative templates. These alternative templates should be |
|
| 152 | - * named like the default one but with the string "standard" replaced by |
|
| 153 | - * an unique name. You may use the name of your project for this. If |
|
| 154 | - * you've implemented an alternative client class as well, "standard" |
|
| 155 | - * should be replaced by the name of the new class. |
|
| 156 | - * |
|
| 157 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 158 | - * @since 2014.03 |
|
| 159 | - * @category Developer |
|
| 160 | - * @see client/html/checkout/standard/process/standard/template-body |
|
| 161 | - */ |
|
| 162 | - $tplconf = 'client/html/checkout/standard/process/standard/template-header'; |
|
| 163 | - $default = 'checkout/standard/process-header-default.php'; |
|
| 164 | - |
|
| 165 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - |
|
| 169 | - /** |
|
| 170 | - * Returns the sub-client given by its name. |
|
| 171 | - * |
|
| 172 | - * @param string $type Name of the client type |
|
| 173 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 174 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 175 | - */ |
|
| 176 | - public function getSubClient( $type, $name = null ) |
|
| 177 | - { |
|
| 178 | - /** client/html/checkout/standard/process/decorators/excludes |
|
| 179 | - * Excludes decorators added by the "common" option from the checkout standard process html client |
|
| 180 | - * |
|
| 181 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 182 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 183 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 184 | - * modify what is returned to the caller. |
|
| 185 | - * |
|
| 186 | - * This option allows you to remove a decorator added via |
|
| 187 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 188 | - * around the html client. |
|
| 189 | - * |
|
| 190 | - * client/html/checkout/standard/process/decorators/excludes = array( 'decorator1' ) |
|
| 191 | - * |
|
| 192 | - * This would remove the decorator named "decorator1" from the list of |
|
| 193 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 194 | - * "client/html/common/decorators/default" to the html client. |
|
| 195 | - * |
|
| 196 | - * @param array List of decorator names |
|
| 197 | - * @since 2015.08 |
|
| 198 | - * @category Developer |
|
| 199 | - * @see client/html/common/decorators/default |
|
| 200 | - * @see client/html/checkout/standard/process/decorators/global |
|
| 201 | - * @see client/html/checkout/standard/process/decorators/local |
|
| 202 | - */ |
|
| 203 | - |
|
| 204 | - /** client/html/checkout/standard/process/decorators/global |
|
| 205 | - * Adds a list of globally available decorators only to the checkout standard process html client |
|
| 206 | - * |
|
| 207 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 208 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 209 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 210 | - * modify what is returned to the caller. |
|
| 211 | - * |
|
| 212 | - * This option allows you to wrap global decorators |
|
| 213 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 214 | - * |
|
| 215 | - * client/html/checkout/standard/process/decorators/global = array( 'decorator1' ) |
|
| 216 | - * |
|
| 217 | - * This would add the decorator named "decorator1" defined by |
|
| 218 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 219 | - * |
|
| 220 | - * @param array List of decorator names |
|
| 221 | - * @since 2015.08 |
|
| 222 | - * @category Developer |
|
| 223 | - * @see client/html/common/decorators/default |
|
| 224 | - * @see client/html/checkout/standard/process/decorators/excludes |
|
| 225 | - * @see client/html/checkout/standard/process/decorators/local |
|
| 226 | - */ |
|
| 227 | - |
|
| 228 | - /** client/html/checkout/standard/process/decorators/local |
|
| 229 | - * Adds a list of local decorators only to the checkout standard process html client |
|
| 230 | - * |
|
| 231 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 232 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 233 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 234 | - * modify what is returned to the caller. |
|
| 235 | - * |
|
| 236 | - * This option allows you to wrap local decorators |
|
| 237 | - * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 238 | - * |
|
| 239 | - * client/html/checkout/standard/process/decorators/local = array( 'decorator2' ) |
|
| 240 | - * |
|
| 241 | - * This would add the decorator named "decorator2" defined by |
|
| 242 | - * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 243 | - * |
|
| 244 | - * @param array List of decorator names |
|
| 245 | - * @since 2015.08 |
|
| 246 | - * @category Developer |
|
| 247 | - * @see client/html/common/decorators/default |
|
| 248 | - * @see client/html/checkout/standard/process/decorators/excludes |
|
| 249 | - * @see client/html/checkout/standard/process/decorators/global |
|
| 250 | - */ |
|
| 251 | - |
|
| 252 | - return $this->createSubClient( 'checkout/standard/process/' . $type, $name ); |
|
| 253 | - } |
|
| 254 | - |
|
| 255 | - |
|
| 256 | - /** |
|
| 257 | - * Processes the input, e.g. store given order. |
|
| 258 | - * A view must be available and this method doesn't generate any output |
|
| 259 | - * besides setting view variables. |
|
| 260 | - */ |
|
| 261 | - public function process() |
|
| 262 | - { |
|
| 263 | - $view = $this->getView(); |
|
| 264 | - $errors = $view->get( 'standardErrorList', array() ); |
|
| 265 | - |
|
| 266 | - if( !in_array( $view->param( 'c_step' ), array( 'order', 'process' ) ) || !empty( $errors ) ) { |
|
| 267 | - return; |
|
| 268 | - } |
|
| 269 | - |
|
| 270 | - $context = $this->getContext(); |
|
| 271 | - $session = $context->getSession(); |
|
| 272 | - $orderid = $session->get( 'aimeos/orderid' ); |
|
| 273 | - $config = array( 'absoluteUri' => true, 'namespace' => false ); |
|
| 274 | - |
|
| 275 | - try |
|
| 276 | - { |
|
| 277 | - $orderItem = \Aimeos\MShop\Factory::createManager( $context, 'order' )->getItem( $orderid ); |
|
| 278 | - |
|
| 279 | - if( ( $code = $this->getOrderServiceCode( $orderItem->getBaseId() ) ) !== null ) |
|
| 280 | - { |
|
| 281 | - $serviceItem = $this->getServiceItem( $code ); |
|
| 282 | - |
|
| 283 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
| 284 | - $provider = $serviceManager->getProvider( $serviceItem ); |
|
| 285 | - |
|
| 286 | - $params = array( 'code' => $serviceItem->getCode(), 'orderid' => $orderid ); |
|
| 287 | - $urls = array( |
|
| 288 | - 'payment.url-self' => $this->getUrlSelf( $view, $params + array( 'c_step' => 'process' ), array() ), |
|
| 289 | - 'payment.url-success' => $this->getUrlConfirm( $view, $params, $config ), |
|
| 290 | - 'payment.url-update' => $this->getUrlUpdate( $view, $params, $config ), |
|
| 291 | - 'client.ipaddress' => $view->request()->getClientAddress(), |
|
| 292 | - ); |
|
| 293 | - $provider->injectGlobalConfigBE( $urls ); |
|
| 294 | - |
|
| 295 | - if( ( $form = $provider->process( $orderItem, $view->param() ) ) === null ) |
|
| 296 | - { |
|
| 297 | - $msg = sprintf( 'Invalid process response from service provider with code "%1$s"', $serviceItem->getCode() ); |
|
| 298 | - throw new \Aimeos\Client\Html\Exception( $msg ); |
|
| 299 | - } |
|
| 300 | - |
|
| 301 | - $view->standardUrlNext = $form->getUrl(); |
|
| 302 | - $view->standardMethod = $form->getMethod(); |
|
| 303 | - $view->standardProcessParams = $form->getValues(); |
|
| 304 | - $view->standardUrlExternal = $form->getExternal(); |
|
| 305 | - } |
|
| 306 | - else |
|
| 307 | - { |
|
| 308 | - $view->standardUrlNext = $this->getUrlConfirm( $view, array(), array() ); |
|
| 309 | - $view->standardMethod = 'GET'; |
|
| 310 | - } |
|
| 311 | - |
|
| 312 | - |
|
| 313 | - parent::process(); |
|
| 314 | - } |
|
| 315 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 316 | - { |
|
| 317 | - $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 318 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 319 | - } |
|
| 320 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 321 | - { |
|
| 322 | - $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 323 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 324 | - } |
|
| 325 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 326 | - { |
|
| 327 | - $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 328 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 329 | - } |
|
| 330 | - catch( \Exception $e ) |
|
| 331 | - { |
|
| 332 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 333 | - |
|
| 334 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 335 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 336 | - } |
|
| 337 | - } |
|
| 338 | - |
|
| 339 | - |
|
| 340 | - /** |
|
| 341 | - * Returns the payment service code from the order with the given base ID. |
|
| 342 | - * |
|
| 343 | - * @param string $baseid ID of the order base item |
|
| 344 | - * @return string|null Code of the service item or null if not found |
|
| 345 | - */ |
|
| 346 | - protected function getOrderServiceCode( $baseid ) |
|
| 347 | - { |
|
| 348 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/service' ); |
|
| 349 | - |
|
| 350 | - $search = $manager->createSearch(); |
|
| 351 | - $expr = array( |
|
| 352 | - $search->compare( '==', 'order.base.service.baseid', $baseid ), |
|
| 353 | - $search->compare( '==', 'order.base.service.type', \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT ), |
|
| 354 | - ); |
|
| 355 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 356 | - |
|
| 357 | - $result = $manager->searchItems( $search ); |
|
| 358 | - |
|
| 359 | - if( ( $item = reset( $result ) ) !== false ) { |
|
| 360 | - return $item->getCode(); |
|
| 361 | - } |
|
| 362 | - } |
|
| 363 | - |
|
| 364 | - |
|
| 365 | - /** |
|
| 366 | - * Returns the payment service item for the given code. |
|
| 367 | - * |
|
| 368 | - * @param string $code Unique service code |
|
| 369 | - * @throws \Aimeos\Client\Html\Exception If no service item for this code is found |
|
| 370 | - * @return \Aimeos\MShop\Service\Item\Iface Service item object |
|
| 371 | - */ |
|
| 372 | - protected function getServiceItem( $code ) |
|
| 373 | - { |
|
| 374 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 375 | - |
|
| 376 | - $search = $serviceManager->createSearch(); |
|
| 377 | - $expr = array( |
|
| 378 | - $search->compare( '==', 'service.code', $code ), |
|
| 379 | - $search->compare( '==', 'service.type.code', 'payment' ), |
|
| 380 | - ); |
|
| 381 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 382 | - |
|
| 383 | - $result = $serviceManager->searchItems( $search ); |
|
| 384 | - |
|
| 385 | - if( ( $serviceItem = reset( $result ) ) === false ) |
|
| 386 | - { |
|
| 387 | - $msg = sprintf( 'No service for code "%1$s" found', $code ); |
|
| 388 | - throw new \Aimeos\Client\Html\Exception( $msg ); |
|
| 389 | - } |
|
| 390 | - |
|
| 391 | - return $serviceItem; |
|
| 392 | - } |
|
| 393 | - |
|
| 394 | - |
|
| 395 | - /** |
|
| 396 | - * Returns the list of sub-client names configured for the client. |
|
| 397 | - * |
|
| 398 | - * @return array List of HTML client names |
|
| 399 | - */ |
|
| 400 | - protected function getSubClientNames() |
|
| 401 | - { |
|
| 402 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 403 | - } |
|
| 404 | - |
|
| 405 | - |
|
| 406 | - /** |
|
| 407 | - * Returns the URL to the confirm page. |
|
| 408 | - * |
|
| 409 | - * @param \Aimeos\MW\View\Iface $view View object |
|
| 410 | - * @param array $params Parameters that should be part of the URL |
|
| 411 | - * @param array $config Default URL configuration |
|
| 412 | - * @return string URL string |
|
| 413 | - */ |
|
| 414 | - protected function getUrlConfirm( \Aimeos\MW\View\Iface $view, array $params, array $config ) |
|
| 415 | - { |
|
| 416 | - /** client/html/checkout/confirm/url/target |
|
| 417 | - * Destination of the URL where the controller specified in the URL is known |
|
| 418 | - * |
|
| 419 | - * The destination can be a page ID like in a content management system or the |
|
| 420 | - * module of a software development framework. This "target" must contain or know |
|
| 421 | - * the controller that should be called by the generated URL. |
|
| 422 | - * |
|
| 423 | - * @param string Destination of the URL |
|
| 424 | - * @since 2014.03 |
|
| 425 | - * @category Developer |
|
| 426 | - * @see client/html/checkout/confirm/url/controller |
|
| 427 | - * @see client/html/checkout/confirm/url/action |
|
| 428 | - * @see client/html/checkout/confirm/url/config |
|
| 429 | - */ |
|
| 430 | - $target = $view->config( 'client/html/checkout/confirm/url/target' ); |
|
| 431 | - |
|
| 432 | - /** client/html/checkout/confirm/url/controller |
|
| 433 | - * Name of the controller whose action should be called |
|
| 434 | - * |
|
| 435 | - * In Model-View-Controller (MVC) applications, the controller contains the methods |
|
| 436 | - * that create parts of the output displayed in the generated HTML page. Controller |
|
| 437 | - * names are usually alpha-numeric. |
|
| 438 | - * |
|
| 439 | - * @param string Name of the controller |
|
| 440 | - * @since 2014.03 |
|
| 441 | - * @category Developer |
|
| 442 | - * @see client/html/checkout/confirm/url/target |
|
| 443 | - * @see client/html/checkout/confirm/url/action |
|
| 444 | - * @see client/html/checkout/confirm/url/config |
|
| 445 | - */ |
|
| 446 | - $cntl = $view->config( 'client/html/checkout/confirm/url/controller', 'checkout' ); |
|
| 447 | - |
|
| 448 | - /** client/html/checkout/confirm/url/action |
|
| 449 | - * Name of the action that should create the output |
|
| 450 | - * |
|
| 451 | - * In Model-View-Controller (MVC) applications, actions are the methods of a |
|
| 452 | - * controller that create parts of the output displayed in the generated HTML page. |
|
| 453 | - * Action names are usually alpha-numeric. |
|
| 454 | - * |
|
| 455 | - * @param string Name of the action |
|
| 456 | - * @since 2014.03 |
|
| 457 | - * @category Developer |
|
| 458 | - * @see client/html/checkout/confirm/url/target |
|
| 459 | - * @see client/html/checkout/confirm/url/controller |
|
| 460 | - * @see client/html/checkout/confirm/url/config |
|
| 461 | - */ |
|
| 462 | - $action = $view->config( 'client/html/checkout/confirm/url/action', 'confirm' ); |
|
| 463 | - |
|
| 464 | - /** client/html/checkout/confirm/url/config |
|
| 465 | - * Associative list of configuration options used for generating the URL |
|
| 466 | - * |
|
| 467 | - * You can specify additional options as key/value pairs used when generating |
|
| 468 | - * the URLs, like |
|
| 469 | - * |
|
| 470 | - * client/html/<clientname>/url/config = array( 'absoluteUri' => true ) |
|
| 471 | - * |
|
| 472 | - * The available key/value pairs depend on the application that embeds the e-commerce |
|
| 473 | - * framework. This is because the infrastructure of the application is used for |
|
| 474 | - * generating the URLs. The full list of available config options is referenced |
|
| 475 | - * in the "see also" section of this page. |
|
| 476 | - * |
|
| 477 | - * @param string Associative list of configuration options |
|
| 478 | - * @since 2014.03 |
|
| 479 | - * @category Developer |
|
| 480 | - * @see client/html/checkout/confirm/url/target |
|
| 481 | - * @see client/html/checkout/confirm/url/controller |
|
| 482 | - * @see client/html/checkout/confirm/url/action |
|
| 483 | - * @see client/html/url/config |
|
| 484 | - */ |
|
| 485 | - $config = $view->config( 'client/html/checkout/confirm/url/config', $config ); |
|
| 486 | - |
|
| 487 | - return $view->url( $target, $cntl, $action, $params, array(), $config ); |
|
| 488 | - } |
|
| 489 | - |
|
| 490 | - |
|
| 491 | - /** |
|
| 492 | - * Returns the URL to the current page. |
|
| 493 | - * |
|
| 494 | - * @param \Aimeos\MW\View\Iface $view View object |
|
| 495 | - * @param array $params Parameters that should be part of the URL |
|
| 496 | - * @param array $config Default URL configuration |
|
| 497 | - * @return string URL string |
|
| 498 | - */ |
|
| 499 | - protected function getUrlSelf( \Aimeos\MW\View\Iface $view, array $params, array $config ) |
|
| 500 | - { |
|
| 501 | - /** client/html/checkout/standard/url/target |
|
| 502 | - * Destination of the URL where the controller specified in the URL is known |
|
| 503 | - * |
|
| 504 | - * The destination can be a page ID like in a content management system or the |
|
| 505 | - * module of a software development framework. This "target" must contain or know |
|
| 506 | - * the controller that should be called by the generated URL. |
|
| 507 | - * |
|
| 508 | - * @param string Destination of the URL |
|
| 509 | - * @since 2014.03 |
|
| 510 | - * @category Developer |
|
| 511 | - * @see client/html/checkout/standard/url/controller |
|
| 512 | - * @see client/html/checkout/standard/url/action |
|
| 513 | - * @see client/html/checkout/standard/url/config |
|
| 514 | - */ |
|
| 515 | - $target = $view->config( 'client/html/checkout/standard/url/target' ); |
|
| 516 | - |
|
| 517 | - /** client/html/checkout/standard/url/controller |
|
| 518 | - * Name of the controller whose action should be called |
|
| 519 | - * |
|
| 520 | - * In Model-View-Controller (MVC) applications, the controller contains the methods |
|
| 521 | - * that create parts of the output displayed in the generated HTML page. Controller |
|
| 522 | - * names are usually alpha-numeric. |
|
| 523 | - * |
|
| 524 | - * @param string Name of the controller |
|
| 525 | - * @since 2014.03 |
|
| 526 | - * @category Developer |
|
| 527 | - * @see client/html/checkout/standard/url/target |
|
| 528 | - * @see client/html/checkout/standard/url/action |
|
| 529 | - * @see client/html/checkout/standard/url/config |
|
| 530 | - */ |
|
| 531 | - $cntl = $view->config( 'client/html/checkout/standard/url/controller', 'checkout' ); |
|
| 532 | - |
|
| 533 | - /** client/html/checkout/standard/url/action |
|
| 534 | - * Name of the action that should create the output |
|
| 535 | - * |
|
| 536 | - * In Model-View-Controller (MVC) applications, actions are the methods of a |
|
| 537 | - * controller that create parts of the output displayed in the generated HTML page. |
|
| 538 | - * Action names are usually alpha-numeric. |
|
| 539 | - * |
|
| 540 | - * @param string Name of the action |
|
| 541 | - * @since 2014.03 |
|
| 542 | - * @category Developer |
|
| 543 | - * @see client/html/checkout/standard/url/target |
|
| 544 | - * @see client/html/checkout/standard/url/controller |
|
| 545 | - * @see client/html/checkout/standard/url/config |
|
| 546 | - */ |
|
| 547 | - $action = $view->config( 'client/html/checkout/standard/url/action', 'standard' ); |
|
| 548 | - |
|
| 549 | - /** client/html/checkout/standard/url/config |
|
| 550 | - * Associative list of configuration options used for generating the URL |
|
| 551 | - * |
|
| 552 | - * You can specify additional options as key/value pairs used when generating |
|
| 553 | - * the URLs, like |
|
| 554 | - * |
|
| 555 | - * client/html/<clientname>/url/config = array( 'absoluteUri' => true ) |
|
| 556 | - * |
|
| 557 | - * The available key/value pairs depend on the application that embeds the e-commerce |
|
| 558 | - * framework. This is because the infrastructure of the application is used for |
|
| 559 | - * generating the URLs. The full list of available config options is referenced |
|
| 560 | - * in the "see also" section of this page. |
|
| 561 | - * |
|
| 562 | - * @param string Associative list of configuration options |
|
| 563 | - * @since 2014.03 |
|
| 564 | - * @category Developer |
|
| 565 | - * @see client/html/checkout/standard/url/target |
|
| 566 | - * @see client/html/checkout/standard/url/controller |
|
| 567 | - * @see client/html/checkout/standard/url/action |
|
| 568 | - * @see client/html/url/config |
|
| 569 | - */ |
|
| 570 | - $config = $view->config( 'client/html/checkout/standard/url/config', $config ); |
|
| 571 | - |
|
| 572 | - return $view->url( $target, $cntl, $action, $params, array(), $config ); |
|
| 573 | - } |
|
| 574 | - |
|
| 575 | - |
|
| 576 | - /** |
|
| 577 | - * Returns the URL to the update page. |
|
| 578 | - * |
|
| 579 | - * @param \Aimeos\MW\View\Iface $view View object |
|
| 580 | - * @param array $params Parameters that should be part of the URL |
|
| 581 | - * @param array $config Default URL configuration |
|
| 582 | - * @return string URL string |
|
| 583 | - */ |
|
| 584 | - protected function getUrlUpdate( \Aimeos\MW\View\Iface $view, array $params, array $config ) |
|
| 585 | - { |
|
| 586 | - /** client/html/checkout/update/url/target |
|
| 587 | - * Destination of the URL where the controller specified in the URL is known |
|
| 588 | - * |
|
| 589 | - * The destination can be a page ID like in a content management system or the |
|
| 590 | - * module of a software development framework. This "target" must contain or know |
|
| 591 | - * the controller that should be called by the generated URL. |
|
| 592 | - * |
|
| 593 | - * @param string Destination of the URL |
|
| 594 | - * @since 2014.03 |
|
| 595 | - * @category Developer |
|
| 596 | - * @see client/html/checkout/update/url/controller |
|
| 597 | - * @see client/html/checkout/update/url/action |
|
| 598 | - * @see client/html/checkout/update/url/config |
|
| 599 | - */ |
|
| 600 | - $target = $view->config( 'client/html/checkout/update/url/target' ); |
|
| 601 | - |
|
| 602 | - /** client/html/checkout/update/url/controller |
|
| 603 | - * Name of the controller whose action should be called |
|
| 604 | - * |
|
| 605 | - * In Model-View-Controller (MVC) applications, the controller contains the methods |
|
| 606 | - * that create parts of the output displayed in the generated HTML page. Controller |
|
| 607 | - * names are usually alpha-numeric. |
|
| 608 | - * |
|
| 609 | - * @param string Name of the controller |
|
| 610 | - * @since 2014.03 |
|
| 611 | - * @category Developer |
|
| 612 | - * @see client/html/checkout/update/url/target |
|
| 613 | - * @see client/html/checkout/update/url/action |
|
| 614 | - * @see client/html/checkout/update/url/config |
|
| 615 | - */ |
|
| 616 | - $cntl = $view->config( 'client/html/checkout/update/url/controller', 'checkout' ); |
|
| 617 | - |
|
| 618 | - /** client/html/checkout/update/url/action |
|
| 619 | - * Name of the action that should create the output |
|
| 620 | - * |
|
| 621 | - * In Model-View-Controller (MVC) applications, actions are the methods of a |
|
| 622 | - * controller that create parts of the output displayed in the generated HTML page. |
|
| 623 | - * Action names are usually alpha-numeric. |
|
| 624 | - * |
|
| 625 | - * @param string Name of the action |
|
| 626 | - * @since 2014.03 |
|
| 627 | - * @category Developer |
|
| 628 | - * @see client/html/checkout/update/url/target |
|
| 629 | - * @see client/html/checkout/update/url/controller |
|
| 630 | - * @see client/html/checkout/update/url/config |
|
| 631 | - */ |
|
| 632 | - $action = $view->config( 'client/html/checkout/update/url/action', 'update' ); |
|
| 633 | - |
|
| 634 | - /** client/html/checkout/update/url/config |
|
| 635 | - * Associative list of configuration options used for generating the URL |
|
| 636 | - * |
|
| 637 | - * You can specify additional options as key/value pairs used when generating |
|
| 638 | - * the URLs, like |
|
| 639 | - * |
|
| 640 | - * client/html/<clientname>/url/config = array( 'absoluteUri' => true ) |
|
| 641 | - * |
|
| 642 | - * The available key/value pairs depend on the application that embeds the e-commerce |
|
| 643 | - * framework. This is because the infrastructure of the application is used for |
|
| 644 | - * generating the URLs. The full list of available config options is referenced |
|
| 645 | - * in the "see also" section of this page. |
|
| 646 | - * |
|
| 647 | - * @param string Associative list of configuration options |
|
| 648 | - * @since 2014.03 |
|
| 649 | - * @category Developer |
|
| 650 | - * @see client/html/checkout/update/url/target |
|
| 651 | - * @see client/html/checkout/update/url/controller |
|
| 652 | - * @see client/html/checkout/update/url/action |
|
| 653 | - * @see client/html/url/config |
|
| 654 | - */ |
|
| 655 | - $config = $view->config( 'client/html/checkout/update/url/config', $config ); |
|
| 656 | - |
|
| 657 | - return $view->url( $target, $cntl, $action, $params, array(), $config ); |
|
| 658 | - } |
|
| 659 | - |
|
| 660 | - |
|
| 661 | - /** |
|
| 662 | - * Sets the necessary parameter values in the view. |
|
| 663 | - * |
|
| 664 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 665 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 666 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 667 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 668 | - */ |
|
| 669 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 670 | - { |
|
| 671 | - if( !isset( $this->cache ) ) |
|
| 672 | - { |
|
| 673 | - $view->standardUrlPayment = $this->getUrlSelf( $view, array( 'c_step' => 'payment' ), array() ); |
|
| 674 | - |
|
| 675 | - $this->cache = $view; |
|
| 676 | - } |
|
| 677 | - |
|
| 678 | - return $this->cache; |
|
| 679 | - } |
|
| 28 | + /** client/html/checkout/standard/process/standard/subparts |
|
| 29 | + * List of HTML sub-clients rendered within the checkout standard process section |
|
| 30 | + * |
|
| 31 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 32 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 33 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 34 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 35 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 36 | + * the output that is placed inside the container of its parent. |
|
| 37 | + * |
|
| 38 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 39 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 40 | + * determines the order of the output of these sub-clients inside the parent |
|
| 41 | + * container. If the configured list of clients is |
|
| 42 | + * |
|
| 43 | + * array( "subclient1", "subclient2" ) |
|
| 44 | + * |
|
| 45 | + * you can easily change the order of the output by reordering the subparts: |
|
| 46 | + * |
|
| 47 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 48 | + * |
|
| 49 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 50 | + * |
|
| 51 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 52 | + * |
|
| 53 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 54 | + * should support adding, removing or reordering content by a fluid like |
|
| 55 | + * design. |
|
| 56 | + * |
|
| 57 | + * @param array List of sub-client names |
|
| 58 | + * @since 2014.03 |
|
| 59 | + * @category Developer |
|
| 60 | + */ |
|
| 61 | + private $subPartPath = 'client/html/checkout/standard/process/standard/subparts'; |
|
| 62 | + private $subPartNames = array(); |
|
| 63 | + private $cache; |
|
| 64 | + |
|
| 65 | + |
|
| 66 | + /** |
|
| 67 | + * Returns the HTML code for insertion into the body. |
|
| 68 | + * |
|
| 69 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 70 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 71 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 72 | + * @return string HTML code |
|
| 73 | + */ |
|
| 74 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 75 | + { |
|
| 76 | + $view = $this->getView(); |
|
| 77 | + |
|
| 78 | + if( !in_array( $view->get( 'standardStepActive' ), array( 'order', 'process' ) ) ) { |
|
| 79 | + return ''; |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 83 | + |
|
| 84 | + $html = ''; |
|
| 85 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 86 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 87 | + } |
|
| 88 | + $view->processBody = $html; |
|
| 89 | + |
|
| 90 | + /** client/html/checkout/standard/process/standard/template-body |
|
| 91 | + * Relative path to the HTML body template of the checkout standard process client. |
|
| 92 | + * |
|
| 93 | + * The template file contains the HTML code and processing instructions |
|
| 94 | + * to generate the result shown in the body of the frontend. The |
|
| 95 | + * configuration string is the path to the template file relative |
|
| 96 | + * to the templates directory (usually in client/html/templates). |
|
| 97 | + * |
|
| 98 | + * You can overwrite the template file configuration in extensions and |
|
| 99 | + * provide alternative templates. These alternative templates should be |
|
| 100 | + * named like the default one but with the string "standard" replaced by |
|
| 101 | + * an unique name. You may use the name of your project for this. If |
|
| 102 | + * you've implemented an alternative client class as well, "standard" |
|
| 103 | + * should be replaced by the name of the new class. |
|
| 104 | + * |
|
| 105 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 106 | + * @since 2014.03 |
|
| 107 | + * @category Developer |
|
| 108 | + * @see client/html/checkout/standard/process/standard/template-header |
|
| 109 | + */ |
|
| 110 | + $tplconf = 'client/html/checkout/standard/process/standard/template-body'; |
|
| 111 | + $default = 'checkout/standard/process-body-default.php'; |
|
| 112 | + |
|
| 113 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + |
|
| 117 | + /** |
|
| 118 | + * Returns the HTML string for insertion into the header. |
|
| 119 | + * |
|
| 120 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 121 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 122 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 123 | + * @return string|null String including HTML tags for the header on error |
|
| 124 | + */ |
|
| 125 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 126 | + { |
|
| 127 | + $view = $this->getView(); |
|
| 128 | + |
|
| 129 | + if( !in_array( $view->param( 'standardStepActive' ), array( 'order', 'process' ) ) ) { |
|
| 130 | + return ''; |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 134 | + |
|
| 135 | + $html = ''; |
|
| 136 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 137 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 138 | + } |
|
| 139 | + $view->processHeader = $html; |
|
| 140 | + |
|
| 141 | + /** client/html/checkout/standard/process/standard/template-header |
|
| 142 | + * Relative path to the HTML header template of the checkout standard process client. |
|
| 143 | + * |
|
| 144 | + * The template file contains the HTML code and processing instructions |
|
| 145 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 146 | + * of the rendered page in the frontend. The configuration string is the |
|
| 147 | + * path to the template file relative to the templates directory (usually |
|
| 148 | + * in client/html/templates). |
|
| 149 | + * |
|
| 150 | + * You can overwrite the template file configuration in extensions and |
|
| 151 | + * provide alternative templates. These alternative templates should be |
|
| 152 | + * named like the default one but with the string "standard" replaced by |
|
| 153 | + * an unique name. You may use the name of your project for this. If |
|
| 154 | + * you've implemented an alternative client class as well, "standard" |
|
| 155 | + * should be replaced by the name of the new class. |
|
| 156 | + * |
|
| 157 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 158 | + * @since 2014.03 |
|
| 159 | + * @category Developer |
|
| 160 | + * @see client/html/checkout/standard/process/standard/template-body |
|
| 161 | + */ |
|
| 162 | + $tplconf = 'client/html/checkout/standard/process/standard/template-header'; |
|
| 163 | + $default = 'checkout/standard/process-header-default.php'; |
|
| 164 | + |
|
| 165 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 166 | + } |
|
| 167 | + |
|
| 168 | + |
|
| 169 | + /** |
|
| 170 | + * Returns the sub-client given by its name. |
|
| 171 | + * |
|
| 172 | + * @param string $type Name of the client type |
|
| 173 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 174 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 175 | + */ |
|
| 176 | + public function getSubClient( $type, $name = null ) |
|
| 177 | + { |
|
| 178 | + /** client/html/checkout/standard/process/decorators/excludes |
|
| 179 | + * Excludes decorators added by the "common" option from the checkout standard process html client |
|
| 180 | + * |
|
| 181 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 182 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 183 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 184 | + * modify what is returned to the caller. |
|
| 185 | + * |
|
| 186 | + * This option allows you to remove a decorator added via |
|
| 187 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 188 | + * around the html client. |
|
| 189 | + * |
|
| 190 | + * client/html/checkout/standard/process/decorators/excludes = array( 'decorator1' ) |
|
| 191 | + * |
|
| 192 | + * This would remove the decorator named "decorator1" from the list of |
|
| 193 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 194 | + * "client/html/common/decorators/default" to the html client. |
|
| 195 | + * |
|
| 196 | + * @param array List of decorator names |
|
| 197 | + * @since 2015.08 |
|
| 198 | + * @category Developer |
|
| 199 | + * @see client/html/common/decorators/default |
|
| 200 | + * @see client/html/checkout/standard/process/decorators/global |
|
| 201 | + * @see client/html/checkout/standard/process/decorators/local |
|
| 202 | + */ |
|
| 203 | + |
|
| 204 | + /** client/html/checkout/standard/process/decorators/global |
|
| 205 | + * Adds a list of globally available decorators only to the checkout standard process html client |
|
| 206 | + * |
|
| 207 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 208 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 209 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 210 | + * modify what is returned to the caller. |
|
| 211 | + * |
|
| 212 | + * This option allows you to wrap global decorators |
|
| 213 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 214 | + * |
|
| 215 | + * client/html/checkout/standard/process/decorators/global = array( 'decorator1' ) |
|
| 216 | + * |
|
| 217 | + * This would add the decorator named "decorator1" defined by |
|
| 218 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 219 | + * |
|
| 220 | + * @param array List of decorator names |
|
| 221 | + * @since 2015.08 |
|
| 222 | + * @category Developer |
|
| 223 | + * @see client/html/common/decorators/default |
|
| 224 | + * @see client/html/checkout/standard/process/decorators/excludes |
|
| 225 | + * @see client/html/checkout/standard/process/decorators/local |
|
| 226 | + */ |
|
| 227 | + |
|
| 228 | + /** client/html/checkout/standard/process/decorators/local |
|
| 229 | + * Adds a list of local decorators only to the checkout standard process html client |
|
| 230 | + * |
|
| 231 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 232 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 233 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 234 | + * modify what is returned to the caller. |
|
| 235 | + * |
|
| 236 | + * This option allows you to wrap local decorators |
|
| 237 | + * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 238 | + * |
|
| 239 | + * client/html/checkout/standard/process/decorators/local = array( 'decorator2' ) |
|
| 240 | + * |
|
| 241 | + * This would add the decorator named "decorator2" defined by |
|
| 242 | + * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 243 | + * |
|
| 244 | + * @param array List of decorator names |
|
| 245 | + * @since 2015.08 |
|
| 246 | + * @category Developer |
|
| 247 | + * @see client/html/common/decorators/default |
|
| 248 | + * @see client/html/checkout/standard/process/decorators/excludes |
|
| 249 | + * @see client/html/checkout/standard/process/decorators/global |
|
| 250 | + */ |
|
| 251 | + |
|
| 252 | + return $this->createSubClient( 'checkout/standard/process/' . $type, $name ); |
|
| 253 | + } |
|
| 254 | + |
|
| 255 | + |
|
| 256 | + /** |
|
| 257 | + * Processes the input, e.g. store given order. |
|
| 258 | + * A view must be available and this method doesn't generate any output |
|
| 259 | + * besides setting view variables. |
|
| 260 | + */ |
|
| 261 | + public function process() |
|
| 262 | + { |
|
| 263 | + $view = $this->getView(); |
|
| 264 | + $errors = $view->get( 'standardErrorList', array() ); |
|
| 265 | + |
|
| 266 | + if( !in_array( $view->param( 'c_step' ), array( 'order', 'process' ) ) || !empty( $errors ) ) { |
|
| 267 | + return; |
|
| 268 | + } |
|
| 269 | + |
|
| 270 | + $context = $this->getContext(); |
|
| 271 | + $session = $context->getSession(); |
|
| 272 | + $orderid = $session->get( 'aimeos/orderid' ); |
|
| 273 | + $config = array( 'absoluteUri' => true, 'namespace' => false ); |
|
| 274 | + |
|
| 275 | + try |
|
| 276 | + { |
|
| 277 | + $orderItem = \Aimeos\MShop\Factory::createManager( $context, 'order' )->getItem( $orderid ); |
|
| 278 | + |
|
| 279 | + if( ( $code = $this->getOrderServiceCode( $orderItem->getBaseId() ) ) !== null ) |
|
| 280 | + { |
|
| 281 | + $serviceItem = $this->getServiceItem( $code ); |
|
| 282 | + |
|
| 283 | + $serviceManager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
| 284 | + $provider = $serviceManager->getProvider( $serviceItem ); |
|
| 285 | + |
|
| 286 | + $params = array( 'code' => $serviceItem->getCode(), 'orderid' => $orderid ); |
|
| 287 | + $urls = array( |
|
| 288 | + 'payment.url-self' => $this->getUrlSelf( $view, $params + array( 'c_step' => 'process' ), array() ), |
|
| 289 | + 'payment.url-success' => $this->getUrlConfirm( $view, $params, $config ), |
|
| 290 | + 'payment.url-update' => $this->getUrlUpdate( $view, $params, $config ), |
|
| 291 | + 'client.ipaddress' => $view->request()->getClientAddress(), |
|
| 292 | + ); |
|
| 293 | + $provider->injectGlobalConfigBE( $urls ); |
|
| 294 | + |
|
| 295 | + if( ( $form = $provider->process( $orderItem, $view->param() ) ) === null ) |
|
| 296 | + { |
|
| 297 | + $msg = sprintf( 'Invalid process response from service provider with code "%1$s"', $serviceItem->getCode() ); |
|
| 298 | + throw new \Aimeos\Client\Html\Exception( $msg ); |
|
| 299 | + } |
|
| 300 | + |
|
| 301 | + $view->standardUrlNext = $form->getUrl(); |
|
| 302 | + $view->standardMethod = $form->getMethod(); |
|
| 303 | + $view->standardProcessParams = $form->getValues(); |
|
| 304 | + $view->standardUrlExternal = $form->getExternal(); |
|
| 305 | + } |
|
| 306 | + else |
|
| 307 | + { |
|
| 308 | + $view->standardUrlNext = $this->getUrlConfirm( $view, array(), array() ); |
|
| 309 | + $view->standardMethod = 'GET'; |
|
| 310 | + } |
|
| 311 | + |
|
| 312 | + |
|
| 313 | + parent::process(); |
|
| 314 | + } |
|
| 315 | + catch( \Aimeos\Client\Html\Exception $e ) |
|
| 316 | + { |
|
| 317 | + $error = array( $context->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 318 | + $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 319 | + } |
|
| 320 | + catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 321 | + { |
|
| 322 | + $error = array( $context->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 323 | + $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 324 | + } |
|
| 325 | + catch( \Aimeos\MShop\Exception $e ) |
|
| 326 | + { |
|
| 327 | + $error = array( $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 328 | + $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 329 | + } |
|
| 330 | + catch( \Exception $e ) |
|
| 331 | + { |
|
| 332 | + $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 333 | + |
|
| 334 | + $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 335 | + $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 336 | + } |
|
| 337 | + } |
|
| 338 | + |
|
| 339 | + |
|
| 340 | + /** |
|
| 341 | + * Returns the payment service code from the order with the given base ID. |
|
| 342 | + * |
|
| 343 | + * @param string $baseid ID of the order base item |
|
| 344 | + * @return string|null Code of the service item or null if not found |
|
| 345 | + */ |
|
| 346 | + protected function getOrderServiceCode( $baseid ) |
|
| 347 | + { |
|
| 348 | + $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/service' ); |
|
| 349 | + |
|
| 350 | + $search = $manager->createSearch(); |
|
| 351 | + $expr = array( |
|
| 352 | + $search->compare( '==', 'order.base.service.baseid', $baseid ), |
|
| 353 | + $search->compare( '==', 'order.base.service.type', \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT ), |
|
| 354 | + ); |
|
| 355 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 356 | + |
|
| 357 | + $result = $manager->searchItems( $search ); |
|
| 358 | + |
|
| 359 | + if( ( $item = reset( $result ) ) !== false ) { |
|
| 360 | + return $item->getCode(); |
|
| 361 | + } |
|
| 362 | + } |
|
| 363 | + |
|
| 364 | + |
|
| 365 | + /** |
|
| 366 | + * Returns the payment service item for the given code. |
|
| 367 | + * |
|
| 368 | + * @param string $code Unique service code |
|
| 369 | + * @throws \Aimeos\Client\Html\Exception If no service item for this code is found |
|
| 370 | + * @return \Aimeos\MShop\Service\Item\Iface Service item object |
|
| 371 | + */ |
|
| 372 | + protected function getServiceItem( $code ) |
|
| 373 | + { |
|
| 374 | + $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 375 | + |
|
| 376 | + $search = $serviceManager->createSearch(); |
|
| 377 | + $expr = array( |
|
| 378 | + $search->compare( '==', 'service.code', $code ), |
|
| 379 | + $search->compare( '==', 'service.type.code', 'payment' ), |
|
| 380 | + ); |
|
| 381 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 382 | + |
|
| 383 | + $result = $serviceManager->searchItems( $search ); |
|
| 384 | + |
|
| 385 | + if( ( $serviceItem = reset( $result ) ) === false ) |
|
| 386 | + { |
|
| 387 | + $msg = sprintf( 'No service for code "%1$s" found', $code ); |
|
| 388 | + throw new \Aimeos\Client\Html\Exception( $msg ); |
|
| 389 | + } |
|
| 390 | + |
|
| 391 | + return $serviceItem; |
|
| 392 | + } |
|
| 393 | + |
|
| 394 | + |
|
| 395 | + /** |
|
| 396 | + * Returns the list of sub-client names configured for the client. |
|
| 397 | + * |
|
| 398 | + * @return array List of HTML client names |
|
| 399 | + */ |
|
| 400 | + protected function getSubClientNames() |
|
| 401 | + { |
|
| 402 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 403 | + } |
|
| 404 | + |
|
| 405 | + |
|
| 406 | + /** |
|
| 407 | + * Returns the URL to the confirm page. |
|
| 408 | + * |
|
| 409 | + * @param \Aimeos\MW\View\Iface $view View object |
|
| 410 | + * @param array $params Parameters that should be part of the URL |
|
| 411 | + * @param array $config Default URL configuration |
|
| 412 | + * @return string URL string |
|
| 413 | + */ |
|
| 414 | + protected function getUrlConfirm( \Aimeos\MW\View\Iface $view, array $params, array $config ) |
|
| 415 | + { |
|
| 416 | + /** client/html/checkout/confirm/url/target |
|
| 417 | + * Destination of the URL where the controller specified in the URL is known |
|
| 418 | + * |
|
| 419 | + * The destination can be a page ID like in a content management system or the |
|
| 420 | + * module of a software development framework. This "target" must contain or know |
|
| 421 | + * the controller that should be called by the generated URL. |
|
| 422 | + * |
|
| 423 | + * @param string Destination of the URL |
|
| 424 | + * @since 2014.03 |
|
| 425 | + * @category Developer |
|
| 426 | + * @see client/html/checkout/confirm/url/controller |
|
| 427 | + * @see client/html/checkout/confirm/url/action |
|
| 428 | + * @see client/html/checkout/confirm/url/config |
|
| 429 | + */ |
|
| 430 | + $target = $view->config( 'client/html/checkout/confirm/url/target' ); |
|
| 431 | + |
|
| 432 | + /** client/html/checkout/confirm/url/controller |
|
| 433 | + * Name of the controller whose action should be called |
|
| 434 | + * |
|
| 435 | + * In Model-View-Controller (MVC) applications, the controller contains the methods |
|
| 436 | + * that create parts of the output displayed in the generated HTML page. Controller |
|
| 437 | + * names are usually alpha-numeric. |
|
| 438 | + * |
|
| 439 | + * @param string Name of the controller |
|
| 440 | + * @since 2014.03 |
|
| 441 | + * @category Developer |
|
| 442 | + * @see client/html/checkout/confirm/url/target |
|
| 443 | + * @see client/html/checkout/confirm/url/action |
|
| 444 | + * @see client/html/checkout/confirm/url/config |
|
| 445 | + */ |
|
| 446 | + $cntl = $view->config( 'client/html/checkout/confirm/url/controller', 'checkout' ); |
|
| 447 | + |
|
| 448 | + /** client/html/checkout/confirm/url/action |
|
| 449 | + * Name of the action that should create the output |
|
| 450 | + * |
|
| 451 | + * In Model-View-Controller (MVC) applications, actions are the methods of a |
|
| 452 | + * controller that create parts of the output displayed in the generated HTML page. |
|
| 453 | + * Action names are usually alpha-numeric. |
|
| 454 | + * |
|
| 455 | + * @param string Name of the action |
|
| 456 | + * @since 2014.03 |
|
| 457 | + * @category Developer |
|
| 458 | + * @see client/html/checkout/confirm/url/target |
|
| 459 | + * @see client/html/checkout/confirm/url/controller |
|
| 460 | + * @see client/html/checkout/confirm/url/config |
|
| 461 | + */ |
|
| 462 | + $action = $view->config( 'client/html/checkout/confirm/url/action', 'confirm' ); |
|
| 463 | + |
|
| 464 | + /** client/html/checkout/confirm/url/config |
|
| 465 | + * Associative list of configuration options used for generating the URL |
|
| 466 | + * |
|
| 467 | + * You can specify additional options as key/value pairs used when generating |
|
| 468 | + * the URLs, like |
|
| 469 | + * |
|
| 470 | + * client/html/<clientname>/url/config = array( 'absoluteUri' => true ) |
|
| 471 | + * |
|
| 472 | + * The available key/value pairs depend on the application that embeds the e-commerce |
|
| 473 | + * framework. This is because the infrastructure of the application is used for |
|
| 474 | + * generating the URLs. The full list of available config options is referenced |
|
| 475 | + * in the "see also" section of this page. |
|
| 476 | + * |
|
| 477 | + * @param string Associative list of configuration options |
|
| 478 | + * @since 2014.03 |
|
| 479 | + * @category Developer |
|
| 480 | + * @see client/html/checkout/confirm/url/target |
|
| 481 | + * @see client/html/checkout/confirm/url/controller |
|
| 482 | + * @see client/html/checkout/confirm/url/action |
|
| 483 | + * @see client/html/url/config |
|
| 484 | + */ |
|
| 485 | + $config = $view->config( 'client/html/checkout/confirm/url/config', $config ); |
|
| 486 | + |
|
| 487 | + return $view->url( $target, $cntl, $action, $params, array(), $config ); |
|
| 488 | + } |
|
| 489 | + |
|
| 490 | + |
|
| 491 | + /** |
|
| 492 | + * Returns the URL to the current page. |
|
| 493 | + * |
|
| 494 | + * @param \Aimeos\MW\View\Iface $view View object |
|
| 495 | + * @param array $params Parameters that should be part of the URL |
|
| 496 | + * @param array $config Default URL configuration |
|
| 497 | + * @return string URL string |
|
| 498 | + */ |
|
| 499 | + protected function getUrlSelf( \Aimeos\MW\View\Iface $view, array $params, array $config ) |
|
| 500 | + { |
|
| 501 | + /** client/html/checkout/standard/url/target |
|
| 502 | + * Destination of the URL where the controller specified in the URL is known |
|
| 503 | + * |
|
| 504 | + * The destination can be a page ID like in a content management system or the |
|
| 505 | + * module of a software development framework. This "target" must contain or know |
|
| 506 | + * the controller that should be called by the generated URL. |
|
| 507 | + * |
|
| 508 | + * @param string Destination of the URL |
|
| 509 | + * @since 2014.03 |
|
| 510 | + * @category Developer |
|
| 511 | + * @see client/html/checkout/standard/url/controller |
|
| 512 | + * @see client/html/checkout/standard/url/action |
|
| 513 | + * @see client/html/checkout/standard/url/config |
|
| 514 | + */ |
|
| 515 | + $target = $view->config( 'client/html/checkout/standard/url/target' ); |
|
| 516 | + |
|
| 517 | + /** client/html/checkout/standard/url/controller |
|
| 518 | + * Name of the controller whose action should be called |
|
| 519 | + * |
|
| 520 | + * In Model-View-Controller (MVC) applications, the controller contains the methods |
|
| 521 | + * that create parts of the output displayed in the generated HTML page. Controller |
|
| 522 | + * names are usually alpha-numeric. |
|
| 523 | + * |
|
| 524 | + * @param string Name of the controller |
|
| 525 | + * @since 2014.03 |
|
| 526 | + * @category Developer |
|
| 527 | + * @see client/html/checkout/standard/url/target |
|
| 528 | + * @see client/html/checkout/standard/url/action |
|
| 529 | + * @see client/html/checkout/standard/url/config |
|
| 530 | + */ |
|
| 531 | + $cntl = $view->config( 'client/html/checkout/standard/url/controller', 'checkout' ); |
|
| 532 | + |
|
| 533 | + /** client/html/checkout/standard/url/action |
|
| 534 | + * Name of the action that should create the output |
|
| 535 | + * |
|
| 536 | + * In Model-View-Controller (MVC) applications, actions are the methods of a |
|
| 537 | + * controller that create parts of the output displayed in the generated HTML page. |
|
| 538 | + * Action names are usually alpha-numeric. |
|
| 539 | + * |
|
| 540 | + * @param string Name of the action |
|
| 541 | + * @since 2014.03 |
|
| 542 | + * @category Developer |
|
| 543 | + * @see client/html/checkout/standard/url/target |
|
| 544 | + * @see client/html/checkout/standard/url/controller |
|
| 545 | + * @see client/html/checkout/standard/url/config |
|
| 546 | + */ |
|
| 547 | + $action = $view->config( 'client/html/checkout/standard/url/action', 'standard' ); |
|
| 548 | + |
|
| 549 | + /** client/html/checkout/standard/url/config |
|
| 550 | + * Associative list of configuration options used for generating the URL |
|
| 551 | + * |
|
| 552 | + * You can specify additional options as key/value pairs used when generating |
|
| 553 | + * the URLs, like |
|
| 554 | + * |
|
| 555 | + * client/html/<clientname>/url/config = array( 'absoluteUri' => true ) |
|
| 556 | + * |
|
| 557 | + * The available key/value pairs depend on the application that embeds the e-commerce |
|
| 558 | + * framework. This is because the infrastructure of the application is used for |
|
| 559 | + * generating the URLs. The full list of available config options is referenced |
|
| 560 | + * in the "see also" section of this page. |
|
| 561 | + * |
|
| 562 | + * @param string Associative list of configuration options |
|
| 563 | + * @since 2014.03 |
|
| 564 | + * @category Developer |
|
| 565 | + * @see client/html/checkout/standard/url/target |
|
| 566 | + * @see client/html/checkout/standard/url/controller |
|
| 567 | + * @see client/html/checkout/standard/url/action |
|
| 568 | + * @see client/html/url/config |
|
| 569 | + */ |
|
| 570 | + $config = $view->config( 'client/html/checkout/standard/url/config', $config ); |
|
| 571 | + |
|
| 572 | + return $view->url( $target, $cntl, $action, $params, array(), $config ); |
|
| 573 | + } |
|
| 574 | + |
|
| 575 | + |
|
| 576 | + /** |
|
| 577 | + * Returns the URL to the update page. |
|
| 578 | + * |
|
| 579 | + * @param \Aimeos\MW\View\Iface $view View object |
|
| 580 | + * @param array $params Parameters that should be part of the URL |
|
| 581 | + * @param array $config Default URL configuration |
|
| 582 | + * @return string URL string |
|
| 583 | + */ |
|
| 584 | + protected function getUrlUpdate( \Aimeos\MW\View\Iface $view, array $params, array $config ) |
|
| 585 | + { |
|
| 586 | + /** client/html/checkout/update/url/target |
|
| 587 | + * Destination of the URL where the controller specified in the URL is known |
|
| 588 | + * |
|
| 589 | + * The destination can be a page ID like in a content management system or the |
|
| 590 | + * module of a software development framework. This "target" must contain or know |
|
| 591 | + * the controller that should be called by the generated URL. |
|
| 592 | + * |
|
| 593 | + * @param string Destination of the URL |
|
| 594 | + * @since 2014.03 |
|
| 595 | + * @category Developer |
|
| 596 | + * @see client/html/checkout/update/url/controller |
|
| 597 | + * @see client/html/checkout/update/url/action |
|
| 598 | + * @see client/html/checkout/update/url/config |
|
| 599 | + */ |
|
| 600 | + $target = $view->config( 'client/html/checkout/update/url/target' ); |
|
| 601 | + |
|
| 602 | + /** client/html/checkout/update/url/controller |
|
| 603 | + * Name of the controller whose action should be called |
|
| 604 | + * |
|
| 605 | + * In Model-View-Controller (MVC) applications, the controller contains the methods |
|
| 606 | + * that create parts of the output displayed in the generated HTML page. Controller |
|
| 607 | + * names are usually alpha-numeric. |
|
| 608 | + * |
|
| 609 | + * @param string Name of the controller |
|
| 610 | + * @since 2014.03 |
|
| 611 | + * @category Developer |
|
| 612 | + * @see client/html/checkout/update/url/target |
|
| 613 | + * @see client/html/checkout/update/url/action |
|
| 614 | + * @see client/html/checkout/update/url/config |
|
| 615 | + */ |
|
| 616 | + $cntl = $view->config( 'client/html/checkout/update/url/controller', 'checkout' ); |
|
| 617 | + |
|
| 618 | + /** client/html/checkout/update/url/action |
|
| 619 | + * Name of the action that should create the output |
|
| 620 | + * |
|
| 621 | + * In Model-View-Controller (MVC) applications, actions are the methods of a |
|
| 622 | + * controller that create parts of the output displayed in the generated HTML page. |
|
| 623 | + * Action names are usually alpha-numeric. |
|
| 624 | + * |
|
| 625 | + * @param string Name of the action |
|
| 626 | + * @since 2014.03 |
|
| 627 | + * @category Developer |
|
| 628 | + * @see client/html/checkout/update/url/target |
|
| 629 | + * @see client/html/checkout/update/url/controller |
|
| 630 | + * @see client/html/checkout/update/url/config |
|
| 631 | + */ |
|
| 632 | + $action = $view->config( 'client/html/checkout/update/url/action', 'update' ); |
|
| 633 | + |
|
| 634 | + /** client/html/checkout/update/url/config |
|
| 635 | + * Associative list of configuration options used for generating the URL |
|
| 636 | + * |
|
| 637 | + * You can specify additional options as key/value pairs used when generating |
|
| 638 | + * the URLs, like |
|
| 639 | + * |
|
| 640 | + * client/html/<clientname>/url/config = array( 'absoluteUri' => true ) |
|
| 641 | + * |
|
| 642 | + * The available key/value pairs depend on the application that embeds the e-commerce |
|
| 643 | + * framework. This is because the infrastructure of the application is used for |
|
| 644 | + * generating the URLs. The full list of available config options is referenced |
|
| 645 | + * in the "see also" section of this page. |
|
| 646 | + * |
|
| 647 | + * @param string Associative list of configuration options |
|
| 648 | + * @since 2014.03 |
|
| 649 | + * @category Developer |
|
| 650 | + * @see client/html/checkout/update/url/target |
|
| 651 | + * @see client/html/checkout/update/url/controller |
|
| 652 | + * @see client/html/checkout/update/url/action |
|
| 653 | + * @see client/html/url/config |
|
| 654 | + */ |
|
| 655 | + $config = $view->config( 'client/html/checkout/update/url/config', $config ); |
|
| 656 | + |
|
| 657 | + return $view->url( $target, $cntl, $action, $params, array(), $config ); |
|
| 658 | + } |
|
| 659 | + |
|
| 660 | + |
|
| 661 | + /** |
|
| 662 | + * Sets the necessary parameter values in the view. |
|
| 663 | + * |
|
| 664 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 665 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 666 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 667 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 668 | + */ |
|
| 669 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 670 | + { |
|
| 671 | + if( !isset( $this->cache ) ) |
|
| 672 | + { |
|
| 673 | + $view->standardUrlPayment = $this->getUrlSelf( $view, array( 'c_step' => 'payment' ), array() ); |
|
| 674 | + |
|
| 675 | + $this->cache = $view; |
|
| 676 | + } |
|
| 677 | + |
|
| 678 | + return $this->cache; |
|
| 679 | + } |
|
| 680 | 680 | } |
@@ -23,312 +23,312 @@ |
||
| 23 | 23 | * @subpackage Html |
| 24 | 24 | */ |
| 25 | 25 | class Standard |
| 26 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 27 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 26 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 27 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 28 | 28 | { |
| 29 | - /** client/html/checkout/standard/order/standard/subparts |
|
| 30 | - * List of HTML sub-clients rendered within the checkout standard order section |
|
| 31 | - * |
|
| 32 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 33 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 34 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 35 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 36 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 37 | - * the output that is placed inside the container of its parent. |
|
| 38 | - * |
|
| 39 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 40 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 41 | - * determines the order of the output of these sub-clients inside the parent |
|
| 42 | - * container. If the configured list of clients is |
|
| 43 | - * |
|
| 44 | - * array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * you can easily change the order of the output by reordering the subparts: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 49 | - * |
|
| 50 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 51 | - * |
|
| 52 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 53 | - * |
|
| 54 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 55 | - * should support adding, removing or reordering content by a fluid like |
|
| 56 | - * design. |
|
| 57 | - * |
|
| 58 | - * @param array List of sub-client names |
|
| 59 | - * @since 2014.03 |
|
| 60 | - * @category Developer |
|
| 61 | - */ |
|
| 62 | - private $subPartPath = 'client/html/checkout/standard/order/standard/subparts'; |
|
| 63 | - |
|
| 64 | - /** client/html/checkout/standard/order/account/name |
|
| 65 | - * Name of the account part used by the checkout standard order client implementation |
|
| 66 | - * |
|
| 67 | - * Use "Myname" if your class is named "\Aimeos\Client\Checkout\Standard\Order\Account\Myname". |
|
| 68 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 69 | - * |
|
| 70 | - * @param string Last part of the client class name |
|
| 71 | - * @since 2015.09 |
|
| 72 | - * @category Developer |
|
| 73 | - */ |
|
| 74 | - |
|
| 75 | - /** client/html/checkout/standard/order/address/name |
|
| 76 | - * Name of the address part used by the checkout standard order client implementation |
|
| 77 | - * |
|
| 78 | - * Use "Myname" if your class is named "\Aimeos\Client\Checkout\Standard\Order\Address\Myname". |
|
| 79 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 80 | - * |
|
| 81 | - * @param string Last part of the client class name |
|
| 82 | - * @since 2014.03 |
|
| 83 | - * @category Developer |
|
| 84 | - */ |
|
| 85 | - private $subPartNames = array( 'account', 'address' ); |
|
| 86 | - |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * Returns the HTML code for insertion into the body. |
|
| 90 | - * |
|
| 91 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 92 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 93 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 94 | - * @return string HTML code |
|
| 95 | - */ |
|
| 96 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 97 | - { |
|
| 98 | - $view = $this->getView(); |
|
| 99 | - |
|
| 100 | - if( $view->get( 'standardStepActive' ) != 'order' ) { |
|
| 101 | - return ''; |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 105 | - |
|
| 106 | - $html = ''; |
|
| 107 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 108 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 109 | - } |
|
| 110 | - $view->orderBody = $html; |
|
| 111 | - |
|
| 112 | - /** client/html/checkout/standard/order/standard/template-body |
|
| 113 | - * Relative path to the HTML body template of the checkout standard order client. |
|
| 114 | - * |
|
| 115 | - * The template file contains the HTML code and processing instructions |
|
| 116 | - * to generate the result shown in the body of the frontend. The |
|
| 117 | - * configuration string is the path to the template file relative |
|
| 118 | - * to the templates directory (usually in client/html/templates). |
|
| 119 | - * |
|
| 120 | - * You can overwrite the template file configuration in extensions and |
|
| 121 | - * provide alternative templates. These alternative templates should be |
|
| 122 | - * named like the default one but with the string "standard" replaced by |
|
| 123 | - * an unique name. You may use the name of your project for this. If |
|
| 124 | - * you've implemented an alternative client class as well, "standard" |
|
| 125 | - * should be replaced by the name of the new class. |
|
| 126 | - * |
|
| 127 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 128 | - * @since 2014.03 |
|
| 129 | - * @category Developer |
|
| 130 | - * @see client/html/checkout/standard/order/standard/template-header |
|
| 131 | - */ |
|
| 132 | - $tplconf = 'client/html/checkout/standard/order/standard/template-body'; |
|
| 133 | - $default = 'checkout/standard/order-body-default.php'; |
|
| 134 | - |
|
| 135 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - |
|
| 139 | - /** |
|
| 140 | - * Returns the HTML string for insertion into the header. |
|
| 141 | - * |
|
| 142 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 143 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 144 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 145 | - * @return string|null String including HTML tags for the header on error |
|
| 146 | - */ |
|
| 147 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 148 | - { |
|
| 149 | - $view = $this->getView(); |
|
| 150 | - |
|
| 151 | - if( $view->get( 'standardStepActive' ) != 'order' ) { |
|
| 152 | - return ''; |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 156 | - |
|
| 157 | - $html = ''; |
|
| 158 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 159 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 160 | - } |
|
| 161 | - $view->orderHeader = $html; |
|
| 162 | - |
|
| 163 | - /** client/html/checkout/standard/order/standard/template-header |
|
| 164 | - * Relative path to the HTML header template of the checkout standard order client. |
|
| 165 | - * |
|
| 166 | - * The template file contains the HTML code and processing instructions |
|
| 167 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 168 | - * of the rendered page in the frontend. The configuration string is the |
|
| 169 | - * path to the template file relative to the templates directory (usually |
|
| 170 | - * in client/html/templates). |
|
| 171 | - * |
|
| 172 | - * You can overwrite the template file configuration in extensions and |
|
| 173 | - * provide alternative templates. These alternative templates should be |
|
| 174 | - * named like the default one but with the string "standard" replaced by |
|
| 175 | - * an unique name. You may use the name of your project for this. If |
|
| 176 | - * you've implemented an alternative client class as well, "standard" |
|
| 177 | - * should be replaced by the name of the new class. |
|
| 178 | - * |
|
| 179 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 180 | - * @since 2014.03 |
|
| 181 | - * @category Developer |
|
| 182 | - * @see client/html/checkout/standard/order/standard/template-body |
|
| 183 | - */ |
|
| 184 | - $tplconf = 'client/html/checkout/standard/order/standard/template-header'; |
|
| 185 | - $default = 'checkout/standard/order-header-default.php'; |
|
| 186 | - |
|
| 187 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 188 | - } |
|
| 189 | - |
|
| 190 | - |
|
| 191 | - /** |
|
| 192 | - * Returns the sub-client given by its name. |
|
| 193 | - * |
|
| 194 | - * @param string $type Name of the client type |
|
| 195 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 196 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 197 | - */ |
|
| 198 | - public function getSubClient( $type, $name = null ) |
|
| 199 | - { |
|
| 200 | - /** client/html/checkout/standard/order/decorators/excludes |
|
| 201 | - * Excludes decorators added by the "common" option from the checkout standard order html client |
|
| 202 | - * |
|
| 203 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 204 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 205 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 206 | - * modify what is returned to the caller. |
|
| 207 | - * |
|
| 208 | - * This option allows you to remove a decorator added via |
|
| 209 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 210 | - * around the html client. |
|
| 211 | - * |
|
| 212 | - * client/html/checkout/standard/order/decorators/excludes = array( 'decorator1' ) |
|
| 213 | - * |
|
| 214 | - * This would remove the decorator named "decorator1" from the list of |
|
| 215 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 216 | - * "client/html/common/decorators/default" to the html client. |
|
| 217 | - * |
|
| 218 | - * @param array List of decorator names |
|
| 219 | - * @since 2015.08 |
|
| 220 | - * @category Developer |
|
| 221 | - * @see client/html/common/decorators/default |
|
| 222 | - * @see client/html/checkout/standard/order/decorators/global |
|
| 223 | - * @see client/html/checkout/standard/order/decorators/local |
|
| 224 | - */ |
|
| 225 | - |
|
| 226 | - /** client/html/checkout/standard/order/decorators/global |
|
| 227 | - * Adds a list of globally available decorators only to the checkout standard order html client |
|
| 228 | - * |
|
| 229 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 230 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 231 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 232 | - * modify what is returned to the caller. |
|
| 233 | - * |
|
| 234 | - * This option allows you to wrap global decorators |
|
| 235 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 236 | - * |
|
| 237 | - * client/html/checkout/standard/order/decorators/global = array( 'decorator1' ) |
|
| 238 | - * |
|
| 239 | - * This would add the decorator named "decorator1" defined by |
|
| 240 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 241 | - * |
|
| 242 | - * @param array List of decorator names |
|
| 243 | - * @since 2015.08 |
|
| 244 | - * @category Developer |
|
| 245 | - * @see client/html/common/decorators/default |
|
| 246 | - * @see client/html/checkout/standard/order/decorators/excludes |
|
| 247 | - * @see client/html/checkout/standard/order/decorators/local |
|
| 248 | - */ |
|
| 249 | - |
|
| 250 | - /** client/html/checkout/standard/order/decorators/local |
|
| 251 | - * Adds a list of local decorators only to the checkout standard order html client |
|
| 252 | - * |
|
| 253 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 254 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 255 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 256 | - * modify what is returned to the caller. |
|
| 257 | - * |
|
| 258 | - * This option allows you to wrap local decorators |
|
| 259 | - * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 260 | - * |
|
| 261 | - * client/html/checkout/standard/order/decorators/local = array( 'decorator2' ) |
|
| 262 | - * |
|
| 263 | - * This would add the decorator named "decorator2" defined by |
|
| 264 | - * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 265 | - * |
|
| 266 | - * @param array List of decorator names |
|
| 267 | - * @since 2015.08 |
|
| 268 | - * @category Developer |
|
| 269 | - * @see client/html/common/decorators/default |
|
| 270 | - * @see client/html/checkout/standard/order/decorators/excludes |
|
| 271 | - * @see client/html/checkout/standard/order/decorators/global |
|
| 272 | - */ |
|
| 273 | - |
|
| 274 | - return $this->createSubClient( 'checkout/standard/order/' . $type, $name ); |
|
| 275 | - } |
|
| 276 | - |
|
| 277 | - |
|
| 278 | - /** |
|
| 279 | - * Processes the input, e.g. store given order. |
|
| 280 | - * A view must be available and this method doesn't generate any output |
|
| 281 | - * besides setting view variables. |
|
| 282 | - */ |
|
| 283 | - public function process() |
|
| 284 | - { |
|
| 285 | - $view = $this->getView(); |
|
| 286 | - |
|
| 287 | - try |
|
| 288 | - { |
|
| 289 | - // only start if there's something to do |
|
| 290 | - if( ( $option = $view->param( 'cs_order', null ) ) === null |
|
| 291 | - || $view->get( 'standardStepActive' ) !== null |
|
| 292 | - ) { |
|
| 293 | - return; |
|
| 294 | - } |
|
| 295 | - |
|
| 296 | - $context = $this->getContext(); |
|
| 297 | - $orderBaseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
| 298 | - |
|
| 299 | - $basket = $orderBaseManager->getSession(); |
|
| 300 | - $basket->setCustomerId( $context->getUserId() ); |
|
| 301 | - $basket->finish(); |
|
| 302 | - |
|
| 303 | - $cntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'order' ); |
|
| 304 | - $orderItem = $cntl->store( $basket ); |
|
| 305 | - $cntl->block( $orderItem ); |
|
| 306 | - |
|
| 307 | - $context->getSession()->set( 'aimeos/orderid', $orderItem->getId() ); |
|
| 308 | - |
|
| 309 | - $view->orderItem = $orderItem; |
|
| 310 | - $view->orderBasket = $basket; |
|
| 311 | - |
|
| 312 | - parent::process(); |
|
| 313 | - |
|
| 314 | - // save again after sub-clients modified it's state |
|
| 315 | - \Aimeos\MShop\Factory::createManager( $context, 'order' )->saveItem( $orderItem ); |
|
| 316 | - } |
|
| 317 | - catch( \Exception $e ) |
|
| 318 | - { |
|
| 319 | - $view->standardStepActive = 'order'; |
|
| 320 | - throw $e; |
|
| 321 | - } |
|
| 322 | - } |
|
| 323 | - |
|
| 324 | - |
|
| 325 | - /** |
|
| 326 | - * Returns the list of sub-client names configured for the client. |
|
| 327 | - * |
|
| 328 | - * @return array List of HTML client names |
|
| 329 | - */ |
|
| 330 | - protected function getSubClientNames() |
|
| 331 | - { |
|
| 332 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 333 | - } |
|
| 29 | + /** client/html/checkout/standard/order/standard/subparts |
|
| 30 | + * List of HTML sub-clients rendered within the checkout standard order section |
|
| 31 | + * |
|
| 32 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 33 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 34 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 35 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 36 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 37 | + * the output that is placed inside the container of its parent. |
|
| 38 | + * |
|
| 39 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 40 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 41 | + * determines the order of the output of these sub-clients inside the parent |
|
| 42 | + * container. If the configured list of clients is |
|
| 43 | + * |
|
| 44 | + * array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * you can easily change the order of the output by reordering the subparts: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 49 | + * |
|
| 50 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 51 | + * |
|
| 52 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 53 | + * |
|
| 54 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 55 | + * should support adding, removing or reordering content by a fluid like |
|
| 56 | + * design. |
|
| 57 | + * |
|
| 58 | + * @param array List of sub-client names |
|
| 59 | + * @since 2014.03 |
|
| 60 | + * @category Developer |
|
| 61 | + */ |
|
| 62 | + private $subPartPath = 'client/html/checkout/standard/order/standard/subparts'; |
|
| 63 | + |
|
| 64 | + /** client/html/checkout/standard/order/account/name |
|
| 65 | + * Name of the account part used by the checkout standard order client implementation |
|
| 66 | + * |
|
| 67 | + * Use "Myname" if your class is named "\Aimeos\Client\Checkout\Standard\Order\Account\Myname". |
|
| 68 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 69 | + * |
|
| 70 | + * @param string Last part of the client class name |
|
| 71 | + * @since 2015.09 |
|
| 72 | + * @category Developer |
|
| 73 | + */ |
|
| 74 | + |
|
| 75 | + /** client/html/checkout/standard/order/address/name |
|
| 76 | + * Name of the address part used by the checkout standard order client implementation |
|
| 77 | + * |
|
| 78 | + * Use "Myname" if your class is named "\Aimeos\Client\Checkout\Standard\Order\Address\Myname". |
|
| 79 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 80 | + * |
|
| 81 | + * @param string Last part of the client class name |
|
| 82 | + * @since 2014.03 |
|
| 83 | + * @category Developer |
|
| 84 | + */ |
|
| 85 | + private $subPartNames = array( 'account', 'address' ); |
|
| 86 | + |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * Returns the HTML code for insertion into the body. |
|
| 90 | + * |
|
| 91 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 92 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 93 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 94 | + * @return string HTML code |
|
| 95 | + */ |
|
| 96 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 97 | + { |
|
| 98 | + $view = $this->getView(); |
|
| 99 | + |
|
| 100 | + if( $view->get( 'standardStepActive' ) != 'order' ) { |
|
| 101 | + return ''; |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 105 | + |
|
| 106 | + $html = ''; |
|
| 107 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 108 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 109 | + } |
|
| 110 | + $view->orderBody = $html; |
|
| 111 | + |
|
| 112 | + /** client/html/checkout/standard/order/standard/template-body |
|
| 113 | + * Relative path to the HTML body template of the checkout standard order client. |
|
| 114 | + * |
|
| 115 | + * The template file contains the HTML code and processing instructions |
|
| 116 | + * to generate the result shown in the body of the frontend. The |
|
| 117 | + * configuration string is the path to the template file relative |
|
| 118 | + * to the templates directory (usually in client/html/templates). |
|
| 119 | + * |
|
| 120 | + * You can overwrite the template file configuration in extensions and |
|
| 121 | + * provide alternative templates. These alternative templates should be |
|
| 122 | + * named like the default one but with the string "standard" replaced by |
|
| 123 | + * an unique name. You may use the name of your project for this. If |
|
| 124 | + * you've implemented an alternative client class as well, "standard" |
|
| 125 | + * should be replaced by the name of the new class. |
|
| 126 | + * |
|
| 127 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 128 | + * @since 2014.03 |
|
| 129 | + * @category Developer |
|
| 130 | + * @see client/html/checkout/standard/order/standard/template-header |
|
| 131 | + */ |
|
| 132 | + $tplconf = 'client/html/checkout/standard/order/standard/template-body'; |
|
| 133 | + $default = 'checkout/standard/order-body-default.php'; |
|
| 134 | + |
|
| 135 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + |
|
| 139 | + /** |
|
| 140 | + * Returns the HTML string for insertion into the header. |
|
| 141 | + * |
|
| 142 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 143 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 144 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 145 | + * @return string|null String including HTML tags for the header on error |
|
| 146 | + */ |
|
| 147 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 148 | + { |
|
| 149 | + $view = $this->getView(); |
|
| 150 | + |
|
| 151 | + if( $view->get( 'standardStepActive' ) != 'order' ) { |
|
| 152 | + return ''; |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 156 | + |
|
| 157 | + $html = ''; |
|
| 158 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 159 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 160 | + } |
|
| 161 | + $view->orderHeader = $html; |
|
| 162 | + |
|
| 163 | + /** client/html/checkout/standard/order/standard/template-header |
|
| 164 | + * Relative path to the HTML header template of the checkout standard order client. |
|
| 165 | + * |
|
| 166 | + * The template file contains the HTML code and processing instructions |
|
| 167 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 168 | + * of the rendered page in the frontend. The configuration string is the |
|
| 169 | + * path to the template file relative to the templates directory (usually |
|
| 170 | + * in client/html/templates). |
|
| 171 | + * |
|
| 172 | + * You can overwrite the template file configuration in extensions and |
|
| 173 | + * provide alternative templates. These alternative templates should be |
|
| 174 | + * named like the default one but with the string "standard" replaced by |
|
| 175 | + * an unique name. You may use the name of your project for this. If |
|
| 176 | + * you've implemented an alternative client class as well, "standard" |
|
| 177 | + * should be replaced by the name of the new class. |
|
| 178 | + * |
|
| 179 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 180 | + * @since 2014.03 |
|
| 181 | + * @category Developer |
|
| 182 | + * @see client/html/checkout/standard/order/standard/template-body |
|
| 183 | + */ |
|
| 184 | + $tplconf = 'client/html/checkout/standard/order/standard/template-header'; |
|
| 185 | + $default = 'checkout/standard/order-header-default.php'; |
|
| 186 | + |
|
| 187 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 188 | + } |
|
| 189 | + |
|
| 190 | + |
|
| 191 | + /** |
|
| 192 | + * Returns the sub-client given by its name. |
|
| 193 | + * |
|
| 194 | + * @param string $type Name of the client type |
|
| 195 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 196 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 197 | + */ |
|
| 198 | + public function getSubClient( $type, $name = null ) |
|
| 199 | + { |
|
| 200 | + /** client/html/checkout/standard/order/decorators/excludes |
|
| 201 | + * Excludes decorators added by the "common" option from the checkout standard order html client |
|
| 202 | + * |
|
| 203 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 204 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 205 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 206 | + * modify what is returned to the caller. |
|
| 207 | + * |
|
| 208 | + * This option allows you to remove a decorator added via |
|
| 209 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 210 | + * around the html client. |
|
| 211 | + * |
|
| 212 | + * client/html/checkout/standard/order/decorators/excludes = array( 'decorator1' ) |
|
| 213 | + * |
|
| 214 | + * This would remove the decorator named "decorator1" from the list of |
|
| 215 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 216 | + * "client/html/common/decorators/default" to the html client. |
|
| 217 | + * |
|
| 218 | + * @param array List of decorator names |
|
| 219 | + * @since 2015.08 |
|
| 220 | + * @category Developer |
|
| 221 | + * @see client/html/common/decorators/default |
|
| 222 | + * @see client/html/checkout/standard/order/decorators/global |
|
| 223 | + * @see client/html/checkout/standard/order/decorators/local |
|
| 224 | + */ |
|
| 225 | + |
|
| 226 | + /** client/html/checkout/standard/order/decorators/global |
|
| 227 | + * Adds a list of globally available decorators only to the checkout standard order html client |
|
| 228 | + * |
|
| 229 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 230 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 231 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 232 | + * modify what is returned to the caller. |
|
| 233 | + * |
|
| 234 | + * This option allows you to wrap global decorators |
|
| 235 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 236 | + * |
|
| 237 | + * client/html/checkout/standard/order/decorators/global = array( 'decorator1' ) |
|
| 238 | + * |
|
| 239 | + * This would add the decorator named "decorator1" defined by |
|
| 240 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 241 | + * |
|
| 242 | + * @param array List of decorator names |
|
| 243 | + * @since 2015.08 |
|
| 244 | + * @category Developer |
|
| 245 | + * @see client/html/common/decorators/default |
|
| 246 | + * @see client/html/checkout/standard/order/decorators/excludes |
|
| 247 | + * @see client/html/checkout/standard/order/decorators/local |
|
| 248 | + */ |
|
| 249 | + |
|
| 250 | + /** client/html/checkout/standard/order/decorators/local |
|
| 251 | + * Adds a list of local decorators only to the checkout standard order html client |
|
| 252 | + * |
|
| 253 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 254 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 255 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 256 | + * modify what is returned to the caller. |
|
| 257 | + * |
|
| 258 | + * This option allows you to wrap local decorators |
|
| 259 | + * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 260 | + * |
|
| 261 | + * client/html/checkout/standard/order/decorators/local = array( 'decorator2' ) |
|
| 262 | + * |
|
| 263 | + * This would add the decorator named "decorator2" defined by |
|
| 264 | + * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 265 | + * |
|
| 266 | + * @param array List of decorator names |
|
| 267 | + * @since 2015.08 |
|
| 268 | + * @category Developer |
|
| 269 | + * @see client/html/common/decorators/default |
|
| 270 | + * @see client/html/checkout/standard/order/decorators/excludes |
|
| 271 | + * @see client/html/checkout/standard/order/decorators/global |
|
| 272 | + */ |
|
| 273 | + |
|
| 274 | + return $this->createSubClient( 'checkout/standard/order/' . $type, $name ); |
|
| 275 | + } |
|
| 276 | + |
|
| 277 | + |
|
| 278 | + /** |
|
| 279 | + * Processes the input, e.g. store given order. |
|
| 280 | + * A view must be available and this method doesn't generate any output |
|
| 281 | + * besides setting view variables. |
|
| 282 | + */ |
|
| 283 | + public function process() |
|
| 284 | + { |
|
| 285 | + $view = $this->getView(); |
|
| 286 | + |
|
| 287 | + try |
|
| 288 | + { |
|
| 289 | + // only start if there's something to do |
|
| 290 | + if( ( $option = $view->param( 'cs_order', null ) ) === null |
|
| 291 | + || $view->get( 'standardStepActive' ) !== null |
|
| 292 | + ) { |
|
| 293 | + return; |
|
| 294 | + } |
|
| 295 | + |
|
| 296 | + $context = $this->getContext(); |
|
| 297 | + $orderBaseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
| 298 | + |
|
| 299 | + $basket = $orderBaseManager->getSession(); |
|
| 300 | + $basket->setCustomerId( $context->getUserId() ); |
|
| 301 | + $basket->finish(); |
|
| 302 | + |
|
| 303 | + $cntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'order' ); |
|
| 304 | + $orderItem = $cntl->store( $basket ); |
|
| 305 | + $cntl->block( $orderItem ); |
|
| 306 | + |
|
| 307 | + $context->getSession()->set( 'aimeos/orderid', $orderItem->getId() ); |
|
| 308 | + |
|
| 309 | + $view->orderItem = $orderItem; |
|
| 310 | + $view->orderBasket = $basket; |
|
| 311 | + |
|
| 312 | + parent::process(); |
|
| 313 | + |
|
| 314 | + // save again after sub-clients modified it's state |
|
| 315 | + \Aimeos\MShop\Factory::createManager( $context, 'order' )->saveItem( $orderItem ); |
|
| 316 | + } |
|
| 317 | + catch( \Exception $e ) |
|
| 318 | + { |
|
| 319 | + $view->standardStepActive = 'order'; |
|
| 320 | + throw $e; |
|
| 321 | + } |
|
| 322 | + } |
|
| 323 | + |
|
| 324 | + |
|
| 325 | + /** |
|
| 326 | + * Returns the list of sub-client names configured for the client. |
|
| 327 | + * |
|
| 328 | + * @return array List of HTML client names |
|
| 329 | + */ |
|
| 330 | + protected function getSubClientNames() |
|
| 331 | + { |
|
| 332 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 333 | + } |
|
| 334 | 334 | } |
| 335 | 335 | \ No newline at end of file |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | // Strings for translation |
| 16 | -sprintf( 'order' ); |
|
| 16 | +sprintf('order'); |
|
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 | /** |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * @since 2014.03 |
| 83 | 83 | * @category Developer |
| 84 | 84 | */ |
| 85 | - private $subPartNames = array( 'account', 'address' ); |
|
| 85 | + private $subPartNames = array('account', 'address'); |
|
| 86 | 86 | |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -93,19 +93,19 @@ discard block |
||
| 93 | 93 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 94 | 94 | * @return string HTML code |
| 95 | 95 | */ |
| 96 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 96 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 97 | 97 | { |
| 98 | 98 | $view = $this->getView(); |
| 99 | 99 | |
| 100 | - if( $view->get( 'standardStepActive' ) != 'order' ) { |
|
| 100 | + if ($view->get('standardStepActive') != 'order') { |
|
| 101 | 101 | return ''; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 104 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 105 | 105 | |
| 106 | 106 | $html = ''; |
| 107 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 108 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 107 | + foreach ($this->getSubClients() as $subclient) { |
|
| 108 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 109 | 109 | } |
| 110 | 110 | $view->orderBody = $html; |
| 111 | 111 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $tplconf = 'client/html/checkout/standard/order/standard/template-body'; |
| 133 | 133 | $default = 'checkout/standard/order-body-default.php'; |
| 134 | 134 | |
| 135 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 135 | + return $view->render($view->config($tplconf, $default)); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | |
@@ -144,19 +144,19 @@ discard block |
||
| 144 | 144 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 145 | 145 | * @return string|null String including HTML tags for the header on error |
| 146 | 146 | */ |
| 147 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 147 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 148 | 148 | { |
| 149 | 149 | $view = $this->getView(); |
| 150 | 150 | |
| 151 | - if( $view->get( 'standardStepActive' ) != 'order' ) { |
|
| 151 | + if ($view->get('standardStepActive') != 'order') { |
|
| 152 | 152 | return ''; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 155 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 156 | 156 | |
| 157 | 157 | $html = ''; |
| 158 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 159 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 158 | + foreach ($this->getSubClients() as $subclient) { |
|
| 159 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 160 | 160 | } |
| 161 | 161 | $view->orderHeader = $html; |
| 162 | 162 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $tplconf = 'client/html/checkout/standard/order/standard/template-header'; |
| 185 | 185 | $default = 'checkout/standard/order-header-default.php'; |
| 186 | 186 | |
| 187 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 187 | + return $view->render($view->config($tplconf, $default)); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * @param string|null $name Name of the sub-client (Default if null) |
| 196 | 196 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 197 | 197 | */ |
| 198 | - public function getSubClient( $type, $name = null ) |
|
| 198 | + public function getSubClient($type, $name = null) |
|
| 199 | 199 | { |
| 200 | 200 | /** client/html/checkout/standard/order/decorators/excludes |
| 201 | 201 | * Excludes decorators added by the "common" option from the checkout standard order html client |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | * @see client/html/checkout/standard/order/decorators/global |
| 272 | 272 | */ |
| 273 | 273 | |
| 274 | - return $this->createSubClient( 'checkout/standard/order/' . $type, $name ); |
|
| 274 | + return $this->createSubClient('checkout/standard/order/'.$type, $name); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | |
@@ -287,24 +287,24 @@ discard block |
||
| 287 | 287 | try |
| 288 | 288 | { |
| 289 | 289 | // only start if there's something to do |
| 290 | - if( ( $option = $view->param( 'cs_order', null ) ) === null |
|
| 291 | - || $view->get( 'standardStepActive' ) !== null |
|
| 290 | + if (($option = $view->param('cs_order', null)) === null |
|
| 291 | + || $view->get('standardStepActive') !== null |
|
| 292 | 292 | ) { |
| 293 | 293 | return; |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | $context = $this->getContext(); |
| 297 | - $orderBaseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
| 297 | + $orderBaseManager = \Aimeos\MShop\Factory::createManager($context, 'order/base'); |
|
| 298 | 298 | |
| 299 | 299 | $basket = $orderBaseManager->getSession(); |
| 300 | - $basket->setCustomerId( $context->getUserId() ); |
|
| 300 | + $basket->setCustomerId($context->getUserId()); |
|
| 301 | 301 | $basket->finish(); |
| 302 | 302 | |
| 303 | - $cntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'order' ); |
|
| 304 | - $orderItem = $cntl->store( $basket ); |
|
| 305 | - $cntl->block( $orderItem ); |
|
| 303 | + $cntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'order'); |
|
| 304 | + $orderItem = $cntl->store($basket); |
|
| 305 | + $cntl->block($orderItem); |
|
| 306 | 306 | |
| 307 | - $context->getSession()->set( 'aimeos/orderid', $orderItem->getId() ); |
|
| 307 | + $context->getSession()->set('aimeos/orderid', $orderItem->getId()); |
|
| 308 | 308 | |
| 309 | 309 | $view->orderItem = $orderItem; |
| 310 | 310 | $view->orderBasket = $basket; |
@@ -312,9 +312,9 @@ discard block |
||
| 312 | 312 | parent::process(); |
| 313 | 313 | |
| 314 | 314 | // save again after sub-clients modified it's state |
| 315 | - \Aimeos\MShop\Factory::createManager( $context, 'order' )->saveItem( $orderItem ); |
|
| 315 | + \Aimeos\MShop\Factory::createManager($context, 'order')->saveItem($orderItem); |
|
| 316 | 316 | } |
| 317 | - catch( \Exception $e ) |
|
| 317 | + catch (\Exception $e) |
|
| 318 | 318 | { |
| 319 | 319 | $view->standardStepActive = 'order'; |
| 320 | 320 | throw $e; |
@@ -329,6 +329,6 @@ discard block |
||
| 329 | 329 | */ |
| 330 | 330 | protected function getSubClientNames() |
| 331 | 331 | { |
| 332 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 332 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 333 | 333 | } |
| 334 | 334 | } |
| 335 | 335 | \ No newline at end of file |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -303,8 +303,7 @@ |
||
| 303 | 303 | $view->standardStepActive = 'address'; |
| 304 | 304 | return false; |
| 305 | 305 | } |
| 306 | - } |
|
| 307 | - catch( \Exception $e ) |
|
| 306 | + } catch( \Exception $e ) |
|
| 308 | 307 | { |
| 309 | 308 | $this->getView()->standardStepActive = 'address'; |
| 310 | 309 | throw $e; |
@@ -19,271 +19,271 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/checkout/standard/order/address/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the checkout standard order address section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2014.03 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/checkout/standard/order/address/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 25 | + /** client/html/checkout/standard/order/address/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the checkout standard order address section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2014.03 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/checkout/standard/order/address/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | 60 | |
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Returns the HTML code for insertion into the body. |
|
| 64 | - * |
|
| 65 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 66 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 67 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 68 | - * @return string HTML code |
|
| 69 | - */ |
|
| 70 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | - { |
|
| 72 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 62 | + /** |
|
| 63 | + * Returns the HTML code for insertion into the body. |
|
| 64 | + * |
|
| 65 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 66 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 67 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 68 | + * @return string HTML code |
|
| 69 | + */ |
|
| 70 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | + { |
|
| 72 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | 73 | |
| 74 | - $html = ''; |
|
| 75 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | - } |
|
| 78 | - $view->addressBody = $html; |
|
| 74 | + $html = ''; |
|
| 75 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | + } |
|
| 78 | + $view->addressBody = $html; |
|
| 79 | 79 | |
| 80 | - /** client/html/checkout/standard/order/address/standard/template-body |
|
| 81 | - * Relative path to the HTML body template of the checkout standard order address client. |
|
| 82 | - * |
|
| 83 | - * The template file contains the HTML code and processing instructions |
|
| 84 | - * to generate the result shown in the body of the frontend. The |
|
| 85 | - * configuration string is the path to the template file relative |
|
| 86 | - * to the templates directory (usually in client/html/templates). |
|
| 87 | - * |
|
| 88 | - * You can overwrite the template file configuration in extensions and |
|
| 89 | - * provide alternative templates. These alternative templates should be |
|
| 90 | - * named like the default one but with the string "standard" replaced by |
|
| 91 | - * an unique name. You may use the name of your project for this. If |
|
| 92 | - * you've implemented an alternative client class as well, "standard" |
|
| 93 | - * should be replaced by the name of the new class. |
|
| 94 | - * |
|
| 95 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | - * @since 2014.03 |
|
| 97 | - * @category Developer |
|
| 98 | - * @see client/html/checkout/standard/order/address/standard/template-header |
|
| 99 | - */ |
|
| 100 | - $tplconf = 'client/html/checkout/standard/order/address/standard/template-body'; |
|
| 101 | - $default = 'checkout/standard/order-address-body-default.php'; |
|
| 80 | + /** client/html/checkout/standard/order/address/standard/template-body |
|
| 81 | + * Relative path to the HTML body template of the checkout standard order address client. |
|
| 82 | + * |
|
| 83 | + * The template file contains the HTML code and processing instructions |
|
| 84 | + * to generate the result shown in the body of the frontend. The |
|
| 85 | + * configuration string is the path to the template file relative |
|
| 86 | + * to the templates directory (usually in client/html/templates). |
|
| 87 | + * |
|
| 88 | + * You can overwrite the template file configuration in extensions and |
|
| 89 | + * provide alternative templates. These alternative templates should be |
|
| 90 | + * named like the default one but with the string "standard" replaced by |
|
| 91 | + * an unique name. You may use the name of your project for this. If |
|
| 92 | + * you've implemented an alternative client class as well, "standard" |
|
| 93 | + * should be replaced by the name of the new class. |
|
| 94 | + * |
|
| 95 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | + * @since 2014.03 |
|
| 97 | + * @category Developer |
|
| 98 | + * @see client/html/checkout/standard/order/address/standard/template-header |
|
| 99 | + */ |
|
| 100 | + $tplconf = 'client/html/checkout/standard/order/address/standard/template-body'; |
|
| 101 | + $default = 'checkout/standard/order-address-body-default.php'; |
|
| 102 | 102 | |
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | - } |
|
| 103 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * Returns the HTML string for insertion into the header. |
|
| 109 | - * |
|
| 110 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 114 | - */ |
|
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | - { |
|
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 107 | + /** |
|
| 108 | + * Returns the HTML string for insertion into the header. |
|
| 109 | + * |
|
| 110 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | + * @return string|null String including HTML tags for the header on error |
|
| 114 | + */ |
|
| 115 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | + { |
|
| 117 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | 118 | |
| 119 | - $html = ''; |
|
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | - } |
|
| 123 | - $view->addressHeader = $html; |
|
| 119 | + $html = ''; |
|
| 120 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | + } |
|
| 123 | + $view->addressHeader = $html; |
|
| 124 | 124 | |
| 125 | - /** client/html/checkout/standard/order/address/standard/template-header |
|
| 126 | - * Relative path to the HTML header template of the checkout standard order address client. |
|
| 127 | - * |
|
| 128 | - * The template file contains the HTML code and processing instructions |
|
| 129 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | - * of the rendered page in the frontend. The configuration string is the |
|
| 131 | - * path to the template file relative to the templates directory (usually |
|
| 132 | - * in client/html/templates). |
|
| 133 | - * |
|
| 134 | - * You can overwrite the template file configuration in extensions and |
|
| 135 | - * provide alternative templates. These alternative templates should be |
|
| 136 | - * named like the default one but with the string "standard" replaced by |
|
| 137 | - * an unique name. You may use the name of your project for this. If |
|
| 138 | - * you've implemented an alternative client class as well, "standard" |
|
| 139 | - * should be replaced by the name of the new class. |
|
| 140 | - * |
|
| 141 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | - * @since 2014.03 |
|
| 143 | - * @category Developer |
|
| 144 | - * @see client/html/checkout/standard/order/address/standard/template-body |
|
| 145 | - */ |
|
| 146 | - $tplconf = 'client/html/checkout/standard/order/address/standard/template-header'; |
|
| 147 | - $default = 'checkout/standard/order-address-header-default.php'; |
|
| 125 | + /** client/html/checkout/standard/order/address/standard/template-header |
|
| 126 | + * Relative path to the HTML header template of the checkout standard order address client. |
|
| 127 | + * |
|
| 128 | + * The template file contains the HTML code and processing instructions |
|
| 129 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | + * of the rendered page in the frontend. The configuration string is the |
|
| 131 | + * path to the template file relative to the templates directory (usually |
|
| 132 | + * in client/html/templates). |
|
| 133 | + * |
|
| 134 | + * You can overwrite the template file configuration in extensions and |
|
| 135 | + * provide alternative templates. These alternative templates should be |
|
| 136 | + * named like the default one but with the string "standard" replaced by |
|
| 137 | + * an unique name. You may use the name of your project for this. If |
|
| 138 | + * you've implemented an alternative client class as well, "standard" |
|
| 139 | + * should be replaced by the name of the new class. |
|
| 140 | + * |
|
| 141 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | + * @since 2014.03 |
|
| 143 | + * @category Developer |
|
| 144 | + * @see client/html/checkout/standard/order/address/standard/template-body |
|
| 145 | + */ |
|
| 146 | + $tplconf = 'client/html/checkout/standard/order/address/standard/template-header'; |
|
| 147 | + $default = 'checkout/standard/order-address-header-default.php'; |
|
| 148 | 148 | |
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | - } |
|
| 149 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | 152 | |
| 153 | - /** |
|
| 154 | - * Returns the sub-client given by its name. |
|
| 155 | - * |
|
| 156 | - * @param string $type Name of the client type |
|
| 157 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | - */ |
|
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 161 | - { |
|
| 162 | - /** client/html/checkout/standard/order/address/decorators/excludes |
|
| 163 | - * Excludes decorators added by the "common" option from the checkout standard order address html client |
|
| 164 | - * |
|
| 165 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | - * modify what is returned to the caller. |
|
| 169 | - * |
|
| 170 | - * This option allows you to remove a decorator added via |
|
| 171 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | - * around the html client. |
|
| 173 | - * |
|
| 174 | - * client/html/checkout/standard/order/address/decorators/excludes = array( 'decorator1' ) |
|
| 175 | - * |
|
| 176 | - * This would remove the decorator named "decorator1" from the list of |
|
| 177 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | - * "client/html/common/decorators/default" to the html client. |
|
| 179 | - * |
|
| 180 | - * @param array List of decorator names |
|
| 181 | - * @since 2015.08 |
|
| 182 | - * @category Developer |
|
| 183 | - * @see client/html/common/decorators/default |
|
| 184 | - * @see client/html/checkout/standard/order/address/decorators/global |
|
| 185 | - * @see client/html/checkout/standard/order/address/decorators/local |
|
| 186 | - */ |
|
| 153 | + /** |
|
| 154 | + * Returns the sub-client given by its name. |
|
| 155 | + * |
|
| 156 | + * @param string $type Name of the client type |
|
| 157 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | + */ |
|
| 160 | + public function getSubClient( $type, $name = null ) |
|
| 161 | + { |
|
| 162 | + /** client/html/checkout/standard/order/address/decorators/excludes |
|
| 163 | + * Excludes decorators added by the "common" option from the checkout standard order address html client |
|
| 164 | + * |
|
| 165 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | + * modify what is returned to the caller. |
|
| 169 | + * |
|
| 170 | + * This option allows you to remove a decorator added via |
|
| 171 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | + * around the html client. |
|
| 173 | + * |
|
| 174 | + * client/html/checkout/standard/order/address/decorators/excludes = array( 'decorator1' ) |
|
| 175 | + * |
|
| 176 | + * This would remove the decorator named "decorator1" from the list of |
|
| 177 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | + * "client/html/common/decorators/default" to the html client. |
|
| 179 | + * |
|
| 180 | + * @param array List of decorator names |
|
| 181 | + * @since 2015.08 |
|
| 182 | + * @category Developer |
|
| 183 | + * @see client/html/common/decorators/default |
|
| 184 | + * @see client/html/checkout/standard/order/address/decorators/global |
|
| 185 | + * @see client/html/checkout/standard/order/address/decorators/local |
|
| 186 | + */ |
|
| 187 | 187 | |
| 188 | - /** client/html/checkout/standard/order/address/decorators/global |
|
| 189 | - * Adds a list of globally available decorators only to the checkout standard order address html client |
|
| 190 | - * |
|
| 191 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | - * modify what is returned to the caller. |
|
| 195 | - * |
|
| 196 | - * This option allows you to wrap global decorators |
|
| 197 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | - * |
|
| 199 | - * client/html/checkout/standard/order/address/decorators/global = array( 'decorator1' ) |
|
| 200 | - * |
|
| 201 | - * This would add the decorator named "decorator1" defined by |
|
| 202 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | - * |
|
| 204 | - * @param array List of decorator names |
|
| 205 | - * @since 2015.08 |
|
| 206 | - * @category Developer |
|
| 207 | - * @see client/html/common/decorators/default |
|
| 208 | - * @see client/html/checkout/standard/order/address/decorators/excludes |
|
| 209 | - * @see client/html/checkout/standard/order/address/decorators/local |
|
| 210 | - */ |
|
| 188 | + /** client/html/checkout/standard/order/address/decorators/global |
|
| 189 | + * Adds a list of globally available decorators only to the checkout standard order address html client |
|
| 190 | + * |
|
| 191 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | + * modify what is returned to the caller. |
|
| 195 | + * |
|
| 196 | + * This option allows you to wrap global decorators |
|
| 197 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | + * |
|
| 199 | + * client/html/checkout/standard/order/address/decorators/global = array( 'decorator1' ) |
|
| 200 | + * |
|
| 201 | + * This would add the decorator named "decorator1" defined by |
|
| 202 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | + * |
|
| 204 | + * @param array List of decorator names |
|
| 205 | + * @since 2015.08 |
|
| 206 | + * @category Developer |
|
| 207 | + * @see client/html/common/decorators/default |
|
| 208 | + * @see client/html/checkout/standard/order/address/decorators/excludes |
|
| 209 | + * @see client/html/checkout/standard/order/address/decorators/local |
|
| 210 | + */ |
|
| 211 | 211 | |
| 212 | - /** client/html/checkout/standard/order/address/decorators/local |
|
| 213 | - * Adds a list of local decorators only to the checkout standard order address html client |
|
| 214 | - * |
|
| 215 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | - * modify what is returned to the caller. |
|
| 219 | - * |
|
| 220 | - * This option allows you to wrap local decorators |
|
| 221 | - * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 222 | - * |
|
| 223 | - * client/html/checkout/standard/order/address/decorators/local = array( 'decorator2' ) |
|
| 224 | - * |
|
| 225 | - * This would add the decorator named "decorator2" defined by |
|
| 226 | - * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 227 | - * |
|
| 228 | - * @param array List of decorator names |
|
| 229 | - * @since 2015.08 |
|
| 230 | - * @category Developer |
|
| 231 | - * @see client/html/common/decorators/default |
|
| 232 | - * @see client/html/checkout/standard/order/address/decorators/excludes |
|
| 233 | - * @see client/html/checkout/standard/order/address/decorators/global |
|
| 234 | - */ |
|
| 212 | + /** client/html/checkout/standard/order/address/decorators/local |
|
| 213 | + * Adds a list of local decorators only to the checkout standard order address html client |
|
| 214 | + * |
|
| 215 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | + * modify what is returned to the caller. |
|
| 219 | + * |
|
| 220 | + * This option allows you to wrap local decorators |
|
| 221 | + * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 222 | + * |
|
| 223 | + * client/html/checkout/standard/order/address/decorators/local = array( 'decorator2' ) |
|
| 224 | + * |
|
| 225 | + * This would add the decorator named "decorator2" defined by |
|
| 226 | + * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 227 | + * |
|
| 228 | + * @param array List of decorator names |
|
| 229 | + * @since 2015.08 |
|
| 230 | + * @category Developer |
|
| 231 | + * @see client/html/common/decorators/default |
|
| 232 | + * @see client/html/checkout/standard/order/address/decorators/excludes |
|
| 233 | + * @see client/html/checkout/standard/order/address/decorators/global |
|
| 234 | + */ |
|
| 235 | 235 | |
| 236 | - return $this->createSubClient( 'checkout/standard/order/address/' . $type, $name ); |
|
| 237 | - } |
|
| 236 | + return $this->createSubClient( 'checkout/standard/order/address/' . $type, $name ); |
|
| 237 | + } |
|
| 238 | 238 | |
| 239 | 239 | |
| 240 | - /** |
|
| 241 | - * Processes the input, e.g. provides the address form. |
|
| 242 | - * A view must be available and this method doesn't generate any output |
|
| 243 | - * besides setting view variables. |
|
| 244 | - */ |
|
| 245 | - public function process() |
|
| 246 | - { |
|
| 247 | - $view = $this->getView(); |
|
| 248 | - $basket = $view->orderBasket; |
|
| 249 | - $customerId = $basket->getCustomerId(); |
|
| 240 | + /** |
|
| 241 | + * Processes the input, e.g. provides the address form. |
|
| 242 | + * A view must be available and this method doesn't generate any output |
|
| 243 | + * besides setting view variables. |
|
| 244 | + */ |
|
| 245 | + public function process() |
|
| 246 | + { |
|
| 247 | + $view = $this->getView(); |
|
| 248 | + $basket = $view->orderBasket; |
|
| 249 | + $customerId = $basket->getCustomerId(); |
|
| 250 | 250 | |
| 251 | - try |
|
| 252 | - { |
|
| 253 | - $addr = $basket->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY ); |
|
| 251 | + try |
|
| 252 | + { |
|
| 253 | + $addr = $basket->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY ); |
|
| 254 | 254 | |
| 255 | - if( $customerId != '' && $addr->getAddressId() == '' ) |
|
| 256 | - { |
|
| 257 | - $addrManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
| 258 | - $orderAddrManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/address' ); |
|
| 255 | + if( $customerId != '' && $addr->getAddressId() == '' ) |
|
| 256 | + { |
|
| 257 | + $addrManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
| 258 | + $orderAddrManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/address' ); |
|
| 259 | 259 | |
| 260 | - $item = $addrManager->createItem(); |
|
| 261 | - $item->setParentId( $customerId ); |
|
| 262 | - $item->copyFrom( $addr ); |
|
| 260 | + $item = $addrManager->createItem(); |
|
| 261 | + $item->setParentId( $customerId ); |
|
| 262 | + $item->copyFrom( $addr ); |
|
| 263 | 263 | |
| 264 | - $addrManager->saveItem( $item ); |
|
| 264 | + $addrManager->saveItem( $item ); |
|
| 265 | 265 | |
| 266 | - $addr->setAddressId( $item->getId() ); |
|
| 267 | - $orderAddrManager->saveItem( $addr, false ); |
|
| 268 | - } |
|
| 269 | - } |
|
| 270 | - catch( \Exception $e ) |
|
| 271 | - { |
|
| 272 | - $msg = sprintf( 'Unable to save address for customer "%1$s": %2$s', $customerId, $e->getMessage() ); |
|
| 273 | - $this->getContext()->getLogger()->log( $msg, \Aimeos\MW\Logger\Base::INFO ); |
|
| 274 | - } |
|
| 266 | + $addr->setAddressId( $item->getId() ); |
|
| 267 | + $orderAddrManager->saveItem( $addr, false ); |
|
| 268 | + } |
|
| 269 | + } |
|
| 270 | + catch( \Exception $e ) |
|
| 271 | + { |
|
| 272 | + $msg = sprintf( 'Unable to save address for customer "%1$s": %2$s', $customerId, $e->getMessage() ); |
|
| 273 | + $this->getContext()->getLogger()->log( $msg, \Aimeos\MW\Logger\Base::INFO ); |
|
| 274 | + } |
|
| 275 | 275 | |
| 276 | - parent::process(); |
|
| 277 | - } |
|
| 276 | + parent::process(); |
|
| 277 | + } |
|
| 278 | 278 | |
| 279 | 279 | |
| 280 | - /** |
|
| 281 | - * Returns the list of sub-client names configured for the client. |
|
| 282 | - * |
|
| 283 | - * @return array List of HTML client names |
|
| 284 | - */ |
|
| 285 | - protected function getSubClientNames() |
|
| 286 | - { |
|
| 287 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 288 | - } |
|
| 280 | + /** |
|
| 281 | + * Returns the list of sub-client names configured for the client. |
|
| 282 | + * |
|
| 283 | + * @return array List of HTML client names |
|
| 284 | + */ |
|
| 285 | + protected function getSubClientNames() |
|
| 286 | + { |
|
| 287 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 288 | + } |
|
| 289 | 289 | } |
| 290 | 290 | \ No newline at end of file |
@@ -67,13 +67,13 @@ discard block |
||
| 67 | 67 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 68 | 68 | * @return string HTML code |
| 69 | 69 | */ |
| 70 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 70 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 71 | 71 | { |
| 72 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 72 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 73 | 73 | |
| 74 | 74 | $html = ''; |
| 75 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 75 | + foreach ($this->getSubClients() as $subclient) { |
|
| 76 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 77 | 77 | } |
| 78 | 78 | $view->addressBody = $html; |
| 79 | 79 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $tplconf = 'client/html/checkout/standard/order/address/standard/template-body'; |
| 101 | 101 | $default = 'checkout/standard/order-address-body-default.php'; |
| 102 | 102 | |
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 103 | + return $view->render($view->config($tplconf, $default)); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
@@ -112,13 +112,13 @@ discard block |
||
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | 113 | * @return string|null String including HTML tags for the header on error |
| 114 | 114 | */ |
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 115 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 116 | 116 | { |
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 117 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 118 | 118 | |
| 119 | 119 | $html = ''; |
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 120 | + foreach ($this->getSubClients() as $subclient) { |
|
| 121 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 122 | 122 | } |
| 123 | 123 | $view->addressHeader = $html; |
| 124 | 124 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $tplconf = 'client/html/checkout/standard/order/address/standard/template-header'; |
| 147 | 147 | $default = 'checkout/standard/order-address-header-default.php'; |
| 148 | 148 | |
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 149 | + return $view->render($view->config($tplconf, $default)); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @param string|null $name Name of the sub-client (Default if null) |
| 158 | 158 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 159 | 159 | */ |
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 160 | + public function getSubClient($type, $name = null) |
|
| 161 | 161 | { |
| 162 | 162 | /** client/html/checkout/standard/order/address/decorators/excludes |
| 163 | 163 | * Excludes decorators added by the "common" option from the checkout standard order address html client |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @see client/html/checkout/standard/order/address/decorators/global |
| 234 | 234 | */ |
| 235 | 235 | |
| 236 | - return $this->createSubClient( 'checkout/standard/order/address/' . $type, $name ); |
|
| 236 | + return $this->createSubClient('checkout/standard/order/address/'.$type, $name); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | |
@@ -250,27 +250,27 @@ discard block |
||
| 250 | 250 | |
| 251 | 251 | try |
| 252 | 252 | { |
| 253 | - $addr = $basket->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY ); |
|
| 253 | + $addr = $basket->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY); |
|
| 254 | 254 | |
| 255 | - if( $customerId != '' && $addr->getAddressId() == '' ) |
|
| 255 | + if ($customerId != '' && $addr->getAddressId() == '') |
|
| 256 | 256 | { |
| 257 | - $addrManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'customer/address' ); |
|
| 258 | - $orderAddrManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/address' ); |
|
| 257 | + $addrManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'customer/address'); |
|
| 258 | + $orderAddrManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/address'); |
|
| 259 | 259 | |
| 260 | 260 | $item = $addrManager->createItem(); |
| 261 | - $item->setParentId( $customerId ); |
|
| 262 | - $item->copyFrom( $addr ); |
|
| 261 | + $item->setParentId($customerId); |
|
| 262 | + $item->copyFrom($addr); |
|
| 263 | 263 | |
| 264 | - $addrManager->saveItem( $item ); |
|
| 264 | + $addrManager->saveItem($item); |
|
| 265 | 265 | |
| 266 | - $addr->setAddressId( $item->getId() ); |
|
| 267 | - $orderAddrManager->saveItem( $addr, false ); |
|
| 266 | + $addr->setAddressId($item->getId()); |
|
| 267 | + $orderAddrManager->saveItem($addr, false); |
|
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | - catch( \Exception $e ) |
|
| 270 | + catch (\Exception $e) |
|
| 271 | 271 | { |
| 272 | - $msg = sprintf( 'Unable to save address for customer "%1$s": %2$s', $customerId, $e->getMessage() ); |
|
| 273 | - $this->getContext()->getLogger()->log( $msg, \Aimeos\MW\Logger\Base::INFO ); |
|
| 272 | + $msg = sprintf('Unable to save address for customer "%1$s": %2$s', $customerId, $e->getMessage()); |
|
| 273 | + $this->getContext()->getLogger()->log($msg, \Aimeos\MW\Logger\Base::INFO); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | parent::process(); |
@@ -284,6 +284,6 @@ discard block |
||
| 284 | 284 | */ |
| 285 | 285 | protected function getSubClientNames() |
| 286 | 286 | { |
| 287 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 287 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 288 | 288 | } |
| 289 | 289 | } |
| 290 | 290 | \ No newline at end of file |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -303,8 +303,7 @@ |
||
| 303 | 303 | $view->standardStepActive = 'address'; |
| 304 | 304 | return false; |
| 305 | 305 | } |
| 306 | - } |
|
| 307 | - catch( \Exception $e ) |
|
| 306 | + } catch( \Exception $e ) |
|
| 308 | 307 | { |
| 309 | 308 | $this->getView()->standardStepActive = 'address'; |
| 310 | 309 | throw $e; |
@@ -18,333 +18,333 @@ |
||
| 18 | 18 | * @subpackage Html |
| 19 | 19 | */ |
| 20 | 20 | class Standard |
| 21 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 22 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 21 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 22 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 23 | 23 | { |
| 24 | - /** client/html/checkout/standard/order/account/standard/subparts |
|
| 25 | - * List of HTML sub-clients rendered within the checkout standard order account section |
|
| 26 | - * |
|
| 27 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 28 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 29 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 30 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 31 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 32 | - * the output that is placed inside the container of its parent. |
|
| 33 | - * |
|
| 34 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 35 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 36 | - * determines the order of the output of these sub-clients inside the parent |
|
| 37 | - * container. If the configured list of clients is |
|
| 38 | - * |
|
| 39 | - * array( "subclient1", "subclient2" ) |
|
| 40 | - * |
|
| 41 | - * you can easily change the order of the output by reordering the subparts: |
|
| 42 | - * |
|
| 43 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 44 | - * |
|
| 45 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 46 | - * |
|
| 47 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 48 | - * |
|
| 49 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 50 | - * should support adding, removing or reordering content by a fluid like |
|
| 51 | - * design. |
|
| 52 | - * |
|
| 53 | - * @param array List of sub-client names |
|
| 54 | - * @since 2015.09 |
|
| 55 | - * @category Developer |
|
| 56 | - */ |
|
| 57 | - private $subPartPath = 'client/html/checkout/standard/order/account/standard/subparts'; |
|
| 58 | - private $subPartNames = array(); |
|
| 59 | - |
|
| 60 | - |
|
| 61 | - /** |
|
| 62 | - * Returns the HTML code for insertion into the body. |
|
| 63 | - * |
|
| 64 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 65 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 66 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 67 | - * @return string HTML code |
|
| 68 | - */ |
|
| 69 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 70 | - { |
|
| 71 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 72 | - |
|
| 73 | - $html = ''; |
|
| 74 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 75 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 76 | - } |
|
| 77 | - $view->accountBody = $html; |
|
| 78 | - |
|
| 79 | - /** client/html/checkout/standard/order/account/standard/template-body |
|
| 80 | - * Relative path to the HTML body template of the checkout standard order account client. |
|
| 81 | - * |
|
| 82 | - * The template file contains the HTML code and processing instructions |
|
| 83 | - * to generate the result shown in the body of the frontend. The |
|
| 84 | - * configuration string is the path to the template file relative |
|
| 85 | - * to the templates directory (usually in client/html/templates). |
|
| 86 | - * |
|
| 87 | - * You can overwrite the template file configuration in extensions and |
|
| 88 | - * provide alternative templates. These alternative templates should be |
|
| 89 | - * named like the default one but with the string "standard" replaced by |
|
| 90 | - * an unique name. You may use the name of your project for this. If |
|
| 91 | - * you've implemented an alternative client class as well, "standard" |
|
| 92 | - * should be replaced by the name of the new class. |
|
| 93 | - * |
|
| 94 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 95 | - * @since 2015.09 |
|
| 96 | - * @category Developer |
|
| 97 | - * @see client/html/checkout/standard/order/account/standard/template-header |
|
| 98 | - */ |
|
| 99 | - $tplconf = 'client/html/checkout/standard/order/account/standard/template-body'; |
|
| 100 | - $default = 'checkout/standard/order-account-body-default.php'; |
|
| 101 | - |
|
| 102 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * Returns the HTML string for insertion into the header. |
|
| 108 | - * |
|
| 109 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 110 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 111 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 112 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | - */ |
|
| 114 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 115 | - { |
|
| 116 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 117 | - |
|
| 118 | - $html = ''; |
|
| 119 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 120 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 121 | - } |
|
| 122 | - $view->accountHeader = $html; |
|
| 123 | - |
|
| 124 | - /** client/html/checkout/standard/order/account/standard/template-header |
|
| 125 | - * Relative path to the HTML header template of the checkout standard order account client. |
|
| 126 | - * |
|
| 127 | - * The template file contains the HTML code and processing instructions |
|
| 128 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 129 | - * of the rendered page in the frontend. The configuration string is the |
|
| 130 | - * path to the template file relative to the templates directory (usually |
|
| 131 | - * in client/html/templates). |
|
| 132 | - * |
|
| 133 | - * You can overwrite the template file configuration in extensions and |
|
| 134 | - * provide alternative templates. These alternative templates should be |
|
| 135 | - * named like the default one but with the string "standard" replaced by |
|
| 136 | - * an unique name. You may use the name of your project for this. If |
|
| 137 | - * you've implemented an alternative client class as well, "standard" |
|
| 138 | - * should be replaced by the name of the new class. |
|
| 139 | - * |
|
| 140 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 141 | - * @since 2015.09 |
|
| 142 | - * @category Developer |
|
| 143 | - * @see client/html/checkout/standard/order/account/standard/template-body |
|
| 144 | - */ |
|
| 145 | - $tplconf = 'client/html/checkout/standard/order/account/standard/template-header'; |
|
| 146 | - $default = 'checkout/standard/order-account-header-default.php'; |
|
| 147 | - |
|
| 148 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 149 | - } |
|
| 150 | - |
|
| 151 | - |
|
| 152 | - /** |
|
| 153 | - * Returns the sub-client given by its name. |
|
| 154 | - * |
|
| 155 | - * @param string $type Name of the client type |
|
| 156 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 157 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 158 | - */ |
|
| 159 | - public function getSubClient( $type, $name = null ) |
|
| 160 | - { |
|
| 161 | - /** client/html/checkout/standard/order/account/decorators/excludes |
|
| 162 | - * Excludes decorators added by the "common" option from the checkout standard order account html client |
|
| 163 | - * |
|
| 164 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 165 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 166 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 167 | - * modify what is returned to the caller. |
|
| 168 | - * |
|
| 169 | - * This option allows you to remove a decorator added via |
|
| 170 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 171 | - * around the html client. |
|
| 172 | - * |
|
| 173 | - * client/html/checkout/standard/order/account/decorators/excludes = array( 'decorator1' ) |
|
| 174 | - * |
|
| 175 | - * This would remove the decorator named "decorator1" from the list of |
|
| 176 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 177 | - * "client/html/common/decorators/default" to the html client. |
|
| 178 | - * |
|
| 179 | - * @param array List of decorator names |
|
| 180 | - * @since 2015.09 |
|
| 181 | - * @category Developer |
|
| 182 | - * @see client/html/common/decorators/default |
|
| 183 | - * @see client/html/checkout/standard/order/account/decorators/global |
|
| 184 | - * @see client/html/checkout/standard/order/account/decorators/local |
|
| 185 | - */ |
|
| 186 | - |
|
| 187 | - /** client/html/checkout/standard/order/account/decorators/global |
|
| 188 | - * Adds a list of globally available decorators only to the checkout standard order account html client |
|
| 189 | - * |
|
| 190 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 191 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 192 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 193 | - * modify what is returned to the caller. |
|
| 194 | - * |
|
| 195 | - * This option allows you to wrap global decorators |
|
| 196 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 197 | - * |
|
| 198 | - * client/html/checkout/standard/order/account/decorators/global = array( 'decorator1' ) |
|
| 199 | - * |
|
| 200 | - * This would add the decorator named "decorator1" defined by |
|
| 201 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 202 | - * |
|
| 203 | - * @param array List of decorator names |
|
| 204 | - * @since 2015.09 |
|
| 205 | - * @category Developer |
|
| 206 | - * @see client/html/common/decorators/default |
|
| 207 | - * @see client/html/checkout/standard/order/account/decorators/excludes |
|
| 208 | - * @see client/html/checkout/standard/order/account/decorators/local |
|
| 209 | - */ |
|
| 210 | - |
|
| 211 | - /** client/html/checkout/standard/order/account/decorators/local |
|
| 212 | - * Adds a list of local decorators only to the checkout standard order account html client |
|
| 213 | - * |
|
| 214 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 215 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 216 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 217 | - * modify what is returned to the caller. |
|
| 218 | - * |
|
| 219 | - * This option allows you to wrap local decorators |
|
| 220 | - * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 221 | - * |
|
| 222 | - * client/html/checkout/standard/order/account/decorators/local = array( 'decorator2' ) |
|
| 223 | - * |
|
| 224 | - * This would add the decorator named "decorator2" defined by |
|
| 225 | - * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 226 | - * |
|
| 227 | - * @param array List of decorator names |
|
| 228 | - * @since 2015.09 |
|
| 229 | - * @category Developer |
|
| 230 | - * @see client/html/common/decorators/default |
|
| 231 | - * @see client/html/checkout/standard/order/account/decorators/excludes |
|
| 232 | - * @see client/html/checkout/standard/order/account/decorators/global |
|
| 233 | - */ |
|
| 234 | - |
|
| 235 | - return $this->createSubClient( 'checkout/standard/order/account/' . $type, $name ); |
|
| 236 | - } |
|
| 237 | - |
|
| 238 | - |
|
| 239 | - /** |
|
| 240 | - * Processes the input, e.g. provides the account form. |
|
| 241 | - * A view must be available and this method doesn't generate any output |
|
| 242 | - * besides setting view variables. |
|
| 243 | - */ |
|
| 244 | - public function process() |
|
| 245 | - { |
|
| 246 | - $view = $this->getView(); |
|
| 247 | - $basket = $view->orderBasket; |
|
| 248 | - |
|
| 249 | - if( $basket->getCustomerId() == '' ) |
|
| 250 | - { |
|
| 251 | - $email = '<unknown>'; |
|
| 252 | - $context = $this->getContext(); |
|
| 253 | - |
|
| 254 | - try |
|
| 255 | - { |
|
| 256 | - $addr = $basket->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT ); |
|
| 257 | - $email = $addr->getEmail(); |
|
| 258 | - |
|
| 259 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
| 260 | - $search = $manager->createSearch(); |
|
| 261 | - $search->setConditions( $search->compare( '==', 'customer.code', $email ) ); |
|
| 262 | - $search->setSlice( 0, 1 ); |
|
| 263 | - $result = $manager->searchItems( $search ); |
|
| 264 | - |
|
| 265 | - if( ( $item = reset( $result ) ) === false ) |
|
| 266 | - { |
|
| 267 | - $password = substr( md5( microtime( true ) . getmypid() . rand() ), -8 ); |
|
| 268 | - $item = $this->addCustomerData( $manager->createItem(), $addr, $addr->getEmail(), $password ); |
|
| 269 | - $manager->saveItem( $item ); |
|
| 270 | - |
|
| 271 | - $msg = $item->toArray(); |
|
| 272 | - $msg['customer.password'] = $password; |
|
| 273 | - $context->getMessageQueue( 'mq-email', 'customer/email/account' )->add( json_encode( $msg ) ); |
|
| 274 | - $context->setUserId( $item->getId() ); |
|
| 275 | - } |
|
| 276 | - |
|
| 277 | - $basket->setCustomerId( $item->getId() ); |
|
| 278 | - |
|
| 279 | - $orderBaseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
| 280 | - $orderBaseManager->saveItem( $basket, false ); |
|
| 281 | - } |
|
| 282 | - catch( \Exception $e ) |
|
| 283 | - { |
|
| 284 | - $msg = sprintf( 'Unable to create an account for "%1$s": %2$s', $email, $e->getMessage() ); |
|
| 285 | - $context->getLogger()->log( $msg, \Aimeos\MW\Logger\Base::INFO ); |
|
| 286 | - } |
|
| 287 | - } |
|
| 288 | - |
|
| 289 | - parent::process(); |
|
| 290 | - } |
|
| 291 | - |
|
| 292 | - |
|
| 293 | - /** |
|
| 294 | - * Returns the list of sub-client names configured for the client. |
|
| 295 | - * |
|
| 296 | - * @return array List of HTML client names |
|
| 297 | - */ |
|
| 298 | - protected function getSubClientNames() |
|
| 299 | - { |
|
| 300 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 301 | - } |
|
| 302 | - |
|
| 303 | - |
|
| 304 | - /** |
|
| 305 | - * Adds the customer and address data to the given customer item |
|
| 306 | - * |
|
| 307 | - * @param \Aimeos\MShop\Customer\Item\Iface $customer Customer object |
|
| 308 | - * @param \Aimeos\MShop\Common\Item\Address\Iface $address Billing address object |
|
| 309 | - * @param string $code Unique customer code, e.g. user name or e-mail address |
|
| 310 | - * @param string $password Plain-text password for the customer |
|
| 311 | - * @return \Aimeos\MShop\Customer\Item\Iface Customer object filled with data |
|
| 312 | - */ |
|
| 313 | - protected function addCustomerData( \Aimeos\MShop\Customer\Item\Iface $customer, |
|
| 314 | - \Aimeos\MShop\Common\Item\Address\Iface $address, $code, $password ) |
|
| 315 | - { |
|
| 316 | - $label = $address->getLastname(); |
|
| 317 | - |
|
| 318 | - if( ( $part = $address->getFirstname() ) !== '' ) { |
|
| 319 | - $label = $part . ' ' . $label; |
|
| 320 | - } |
|
| 321 | - |
|
| 322 | - if( ( $part = $address->getCompany() ) !== '' ) { |
|
| 323 | - $label .= ' (' . $part . ')'; |
|
| 324 | - } |
|
| 325 | - |
|
| 326 | - $customer->setPaymentAddress( $address ); |
|
| 327 | - $customer->setCode( $code ); |
|
| 328 | - $customer->setPassword( $password ); |
|
| 329 | - $customer->setLabel( $label ); |
|
| 330 | - $customer->setStatus( 1 ); |
|
| 331 | - |
|
| 332 | - /** client/html/checkout/standard/order/account/standard/groupids |
|
| 333 | - * List of groups new customers should be assigned to |
|
| 334 | - * |
|
| 335 | - * Newly created customers will be assigned automatically to the groups |
|
| 336 | - * given by their IDs. This is especially useful if those groups limit |
|
| 337 | - * functionality for those users. |
|
| 338 | - * |
|
| 339 | - * @param array List of group IDs |
|
| 340 | - * @since 2016.03 |
|
| 341 | - * @category User |
|
| 342 | - * @category Developer |
|
| 343 | - */ |
|
| 344 | - $config = $this->getContext()->getConfig(); |
|
| 345 | - $gids = (array) $config->get( 'client/html/checkout/standard/order/account/standard/groupids', array() ); |
|
| 346 | - $customer->setGroups( $gids ); |
|
| 347 | - |
|
| 348 | - return $customer; |
|
| 349 | - } |
|
| 24 | + /** client/html/checkout/standard/order/account/standard/subparts |
|
| 25 | + * List of HTML sub-clients rendered within the checkout standard order account section |
|
| 26 | + * |
|
| 27 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 28 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 29 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 30 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 31 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 32 | + * the output that is placed inside the container of its parent. |
|
| 33 | + * |
|
| 34 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 35 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 36 | + * determines the order of the output of these sub-clients inside the parent |
|
| 37 | + * container. If the configured list of clients is |
|
| 38 | + * |
|
| 39 | + * array( "subclient1", "subclient2" ) |
|
| 40 | + * |
|
| 41 | + * you can easily change the order of the output by reordering the subparts: |
|
| 42 | + * |
|
| 43 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 44 | + * |
|
| 45 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 46 | + * |
|
| 47 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 48 | + * |
|
| 49 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 50 | + * should support adding, removing or reordering content by a fluid like |
|
| 51 | + * design. |
|
| 52 | + * |
|
| 53 | + * @param array List of sub-client names |
|
| 54 | + * @since 2015.09 |
|
| 55 | + * @category Developer |
|
| 56 | + */ |
|
| 57 | + private $subPartPath = 'client/html/checkout/standard/order/account/standard/subparts'; |
|
| 58 | + private $subPartNames = array(); |
|
| 59 | + |
|
| 60 | + |
|
| 61 | + /** |
|
| 62 | + * Returns the HTML code for insertion into the body. |
|
| 63 | + * |
|
| 64 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 65 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 66 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 67 | + * @return string HTML code |
|
| 68 | + */ |
|
| 69 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 70 | + { |
|
| 71 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 72 | + |
|
| 73 | + $html = ''; |
|
| 74 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 75 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 76 | + } |
|
| 77 | + $view->accountBody = $html; |
|
| 78 | + |
|
| 79 | + /** client/html/checkout/standard/order/account/standard/template-body |
|
| 80 | + * Relative path to the HTML body template of the checkout standard order account client. |
|
| 81 | + * |
|
| 82 | + * The template file contains the HTML code and processing instructions |
|
| 83 | + * to generate the result shown in the body of the frontend. The |
|
| 84 | + * configuration string is the path to the template file relative |
|
| 85 | + * to the templates directory (usually in client/html/templates). |
|
| 86 | + * |
|
| 87 | + * You can overwrite the template file configuration in extensions and |
|
| 88 | + * provide alternative templates. These alternative templates should be |
|
| 89 | + * named like the default one but with the string "standard" replaced by |
|
| 90 | + * an unique name. You may use the name of your project for this. If |
|
| 91 | + * you've implemented an alternative client class as well, "standard" |
|
| 92 | + * should be replaced by the name of the new class. |
|
| 93 | + * |
|
| 94 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 95 | + * @since 2015.09 |
|
| 96 | + * @category Developer |
|
| 97 | + * @see client/html/checkout/standard/order/account/standard/template-header |
|
| 98 | + */ |
|
| 99 | + $tplconf = 'client/html/checkout/standard/order/account/standard/template-body'; |
|
| 100 | + $default = 'checkout/standard/order-account-body-default.php'; |
|
| 101 | + |
|
| 102 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * Returns the HTML string for insertion into the header. |
|
| 108 | + * |
|
| 109 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 110 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 111 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 112 | + * @return string|null String including HTML tags for the header on error |
|
| 113 | + */ |
|
| 114 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 115 | + { |
|
| 116 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 117 | + |
|
| 118 | + $html = ''; |
|
| 119 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 120 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 121 | + } |
|
| 122 | + $view->accountHeader = $html; |
|
| 123 | + |
|
| 124 | + /** client/html/checkout/standard/order/account/standard/template-header |
|
| 125 | + * Relative path to the HTML header template of the checkout standard order account client. |
|
| 126 | + * |
|
| 127 | + * The template file contains the HTML code and processing instructions |
|
| 128 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 129 | + * of the rendered page in the frontend. The configuration string is the |
|
| 130 | + * path to the template file relative to the templates directory (usually |
|
| 131 | + * in client/html/templates). |
|
| 132 | + * |
|
| 133 | + * You can overwrite the template file configuration in extensions and |
|
| 134 | + * provide alternative templates. These alternative templates should be |
|
| 135 | + * named like the default one but with the string "standard" replaced by |
|
| 136 | + * an unique name. You may use the name of your project for this. If |
|
| 137 | + * you've implemented an alternative client class as well, "standard" |
|
| 138 | + * should be replaced by the name of the new class. |
|
| 139 | + * |
|
| 140 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 141 | + * @since 2015.09 |
|
| 142 | + * @category Developer |
|
| 143 | + * @see client/html/checkout/standard/order/account/standard/template-body |
|
| 144 | + */ |
|
| 145 | + $tplconf = 'client/html/checkout/standard/order/account/standard/template-header'; |
|
| 146 | + $default = 'checkout/standard/order-account-header-default.php'; |
|
| 147 | + |
|
| 148 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 149 | + } |
|
| 150 | + |
|
| 151 | + |
|
| 152 | + /** |
|
| 153 | + * Returns the sub-client given by its name. |
|
| 154 | + * |
|
| 155 | + * @param string $type Name of the client type |
|
| 156 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 157 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 158 | + */ |
|
| 159 | + public function getSubClient( $type, $name = null ) |
|
| 160 | + { |
|
| 161 | + /** client/html/checkout/standard/order/account/decorators/excludes |
|
| 162 | + * Excludes decorators added by the "common" option from the checkout standard order account html client |
|
| 163 | + * |
|
| 164 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 165 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 166 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 167 | + * modify what is returned to the caller. |
|
| 168 | + * |
|
| 169 | + * This option allows you to remove a decorator added via |
|
| 170 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 171 | + * around the html client. |
|
| 172 | + * |
|
| 173 | + * client/html/checkout/standard/order/account/decorators/excludes = array( 'decorator1' ) |
|
| 174 | + * |
|
| 175 | + * This would remove the decorator named "decorator1" from the list of |
|
| 176 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 177 | + * "client/html/common/decorators/default" to the html client. |
|
| 178 | + * |
|
| 179 | + * @param array List of decorator names |
|
| 180 | + * @since 2015.09 |
|
| 181 | + * @category Developer |
|
| 182 | + * @see client/html/common/decorators/default |
|
| 183 | + * @see client/html/checkout/standard/order/account/decorators/global |
|
| 184 | + * @see client/html/checkout/standard/order/account/decorators/local |
|
| 185 | + */ |
|
| 186 | + |
|
| 187 | + /** client/html/checkout/standard/order/account/decorators/global |
|
| 188 | + * Adds a list of globally available decorators only to the checkout standard order account html client |
|
| 189 | + * |
|
| 190 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 191 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 192 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 193 | + * modify what is returned to the caller. |
|
| 194 | + * |
|
| 195 | + * This option allows you to wrap global decorators |
|
| 196 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 197 | + * |
|
| 198 | + * client/html/checkout/standard/order/account/decorators/global = array( 'decorator1' ) |
|
| 199 | + * |
|
| 200 | + * This would add the decorator named "decorator1" defined by |
|
| 201 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 202 | + * |
|
| 203 | + * @param array List of decorator names |
|
| 204 | + * @since 2015.09 |
|
| 205 | + * @category Developer |
|
| 206 | + * @see client/html/common/decorators/default |
|
| 207 | + * @see client/html/checkout/standard/order/account/decorators/excludes |
|
| 208 | + * @see client/html/checkout/standard/order/account/decorators/local |
|
| 209 | + */ |
|
| 210 | + |
|
| 211 | + /** client/html/checkout/standard/order/account/decorators/local |
|
| 212 | + * Adds a list of local decorators only to the checkout standard order account html client |
|
| 213 | + * |
|
| 214 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 215 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 216 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 217 | + * modify what is returned to the caller. |
|
| 218 | + * |
|
| 219 | + * This option allows you to wrap local decorators |
|
| 220 | + * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 221 | + * |
|
| 222 | + * client/html/checkout/standard/order/account/decorators/local = array( 'decorator2' ) |
|
| 223 | + * |
|
| 224 | + * This would add the decorator named "decorator2" defined by |
|
| 225 | + * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 226 | + * |
|
| 227 | + * @param array List of decorator names |
|
| 228 | + * @since 2015.09 |
|
| 229 | + * @category Developer |
|
| 230 | + * @see client/html/common/decorators/default |
|
| 231 | + * @see client/html/checkout/standard/order/account/decorators/excludes |
|
| 232 | + * @see client/html/checkout/standard/order/account/decorators/global |
|
| 233 | + */ |
|
| 234 | + |
|
| 235 | + return $this->createSubClient( 'checkout/standard/order/account/' . $type, $name ); |
|
| 236 | + } |
|
| 237 | + |
|
| 238 | + |
|
| 239 | + /** |
|
| 240 | + * Processes the input, e.g. provides the account form. |
|
| 241 | + * A view must be available and this method doesn't generate any output |
|
| 242 | + * besides setting view variables. |
|
| 243 | + */ |
|
| 244 | + public function process() |
|
| 245 | + { |
|
| 246 | + $view = $this->getView(); |
|
| 247 | + $basket = $view->orderBasket; |
|
| 248 | + |
|
| 249 | + if( $basket->getCustomerId() == '' ) |
|
| 250 | + { |
|
| 251 | + $email = '<unknown>'; |
|
| 252 | + $context = $this->getContext(); |
|
| 253 | + |
|
| 254 | + try |
|
| 255 | + { |
|
| 256 | + $addr = $basket->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT ); |
|
| 257 | + $email = $addr->getEmail(); |
|
| 258 | + |
|
| 259 | + $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
| 260 | + $search = $manager->createSearch(); |
|
| 261 | + $search->setConditions( $search->compare( '==', 'customer.code', $email ) ); |
|
| 262 | + $search->setSlice( 0, 1 ); |
|
| 263 | + $result = $manager->searchItems( $search ); |
|
| 264 | + |
|
| 265 | + if( ( $item = reset( $result ) ) === false ) |
|
| 266 | + { |
|
| 267 | + $password = substr( md5( microtime( true ) . getmypid() . rand() ), -8 ); |
|
| 268 | + $item = $this->addCustomerData( $manager->createItem(), $addr, $addr->getEmail(), $password ); |
|
| 269 | + $manager->saveItem( $item ); |
|
| 270 | + |
|
| 271 | + $msg = $item->toArray(); |
|
| 272 | + $msg['customer.password'] = $password; |
|
| 273 | + $context->getMessageQueue( 'mq-email', 'customer/email/account' )->add( json_encode( $msg ) ); |
|
| 274 | + $context->setUserId( $item->getId() ); |
|
| 275 | + } |
|
| 276 | + |
|
| 277 | + $basket->setCustomerId( $item->getId() ); |
|
| 278 | + |
|
| 279 | + $orderBaseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
| 280 | + $orderBaseManager->saveItem( $basket, false ); |
|
| 281 | + } |
|
| 282 | + catch( \Exception $e ) |
|
| 283 | + { |
|
| 284 | + $msg = sprintf( 'Unable to create an account for "%1$s": %2$s', $email, $e->getMessage() ); |
|
| 285 | + $context->getLogger()->log( $msg, \Aimeos\MW\Logger\Base::INFO ); |
|
| 286 | + } |
|
| 287 | + } |
|
| 288 | + |
|
| 289 | + parent::process(); |
|
| 290 | + } |
|
| 291 | + |
|
| 292 | + |
|
| 293 | + /** |
|
| 294 | + * Returns the list of sub-client names configured for the client. |
|
| 295 | + * |
|
| 296 | + * @return array List of HTML client names |
|
| 297 | + */ |
|
| 298 | + protected function getSubClientNames() |
|
| 299 | + { |
|
| 300 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 301 | + } |
|
| 302 | + |
|
| 303 | + |
|
| 304 | + /** |
|
| 305 | + * Adds the customer and address data to the given customer item |
|
| 306 | + * |
|
| 307 | + * @param \Aimeos\MShop\Customer\Item\Iface $customer Customer object |
|
| 308 | + * @param \Aimeos\MShop\Common\Item\Address\Iface $address Billing address object |
|
| 309 | + * @param string $code Unique customer code, e.g. user name or e-mail address |
|
| 310 | + * @param string $password Plain-text password for the customer |
|
| 311 | + * @return \Aimeos\MShop\Customer\Item\Iface Customer object filled with data |
|
| 312 | + */ |
|
| 313 | + protected function addCustomerData( \Aimeos\MShop\Customer\Item\Iface $customer, |
|
| 314 | + \Aimeos\MShop\Common\Item\Address\Iface $address, $code, $password ) |
|
| 315 | + { |
|
| 316 | + $label = $address->getLastname(); |
|
| 317 | + |
|
| 318 | + if( ( $part = $address->getFirstname() ) !== '' ) { |
|
| 319 | + $label = $part . ' ' . $label; |
|
| 320 | + } |
|
| 321 | + |
|
| 322 | + if( ( $part = $address->getCompany() ) !== '' ) { |
|
| 323 | + $label .= ' (' . $part . ')'; |
|
| 324 | + } |
|
| 325 | + |
|
| 326 | + $customer->setPaymentAddress( $address ); |
|
| 327 | + $customer->setCode( $code ); |
|
| 328 | + $customer->setPassword( $password ); |
|
| 329 | + $customer->setLabel( $label ); |
|
| 330 | + $customer->setStatus( 1 ); |
|
| 331 | + |
|
| 332 | + /** client/html/checkout/standard/order/account/standard/groupids |
|
| 333 | + * List of groups new customers should be assigned to |
|
| 334 | + * |
|
| 335 | + * Newly created customers will be assigned automatically to the groups |
|
| 336 | + * given by their IDs. This is especially useful if those groups limit |
|
| 337 | + * functionality for those users. |
|
| 338 | + * |
|
| 339 | + * @param array List of group IDs |
|
| 340 | + * @since 2016.03 |
|
| 341 | + * @category User |
|
| 342 | + * @category Developer |
|
| 343 | + */ |
|
| 344 | + $config = $this->getContext()->getConfig(); |
|
| 345 | + $gids = (array) $config->get( 'client/html/checkout/standard/order/account/standard/groupids', array() ); |
|
| 346 | + $customer->setGroups( $gids ); |
|
| 347 | + |
|
| 348 | + return $customer; |
|
| 349 | + } |
|
| 350 | 350 | } |
| 351 | 351 | \ No newline at end of file |
@@ -66,13 +66,13 @@ discard block |
||
| 66 | 66 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 67 | 67 | * @return string HTML code |
| 68 | 68 | */ |
| 69 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 69 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 70 | 70 | { |
| 71 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 71 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 72 | 72 | |
| 73 | 73 | $html = ''; |
| 74 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 75 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 74 | + foreach ($this->getSubClients() as $subclient) { |
|
| 75 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 76 | 76 | } |
| 77 | 77 | $view->accountBody = $html; |
| 78 | 78 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $tplconf = 'client/html/checkout/standard/order/account/standard/template-body'; |
| 100 | 100 | $default = 'checkout/standard/order-account-body-default.php'; |
| 101 | 101 | |
| 102 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 102 | + return $view->render($view->config($tplconf, $default)); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
@@ -111,13 +111,13 @@ discard block |
||
| 111 | 111 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 112 | 112 | * @return string|null String including HTML tags for the header on error |
| 113 | 113 | */ |
| 114 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 114 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 115 | 115 | { |
| 116 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 116 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 117 | 117 | |
| 118 | 118 | $html = ''; |
| 119 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 120 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 119 | + foreach ($this->getSubClients() as $subclient) { |
|
| 120 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 121 | 121 | } |
| 122 | 122 | $view->accountHeader = $html; |
| 123 | 123 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $tplconf = 'client/html/checkout/standard/order/account/standard/template-header'; |
| 146 | 146 | $default = 'checkout/standard/order-account-header-default.php'; |
| 147 | 147 | |
| 148 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 148 | + return $view->render($view->config($tplconf, $default)); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * @param string|null $name Name of the sub-client (Default if null) |
| 157 | 157 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 158 | 158 | */ |
| 159 | - public function getSubClient( $type, $name = null ) |
|
| 159 | + public function getSubClient($type, $name = null) |
|
| 160 | 160 | { |
| 161 | 161 | /** client/html/checkout/standard/order/account/decorators/excludes |
| 162 | 162 | * Excludes decorators added by the "common" option from the checkout standard order account html client |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | * @see client/html/checkout/standard/order/account/decorators/global |
| 233 | 233 | */ |
| 234 | 234 | |
| 235 | - return $this->createSubClient( 'checkout/standard/order/account/' . $type, $name ); |
|
| 235 | + return $this->createSubClient('checkout/standard/order/account/'.$type, $name); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | |
@@ -246,43 +246,43 @@ discard block |
||
| 246 | 246 | $view = $this->getView(); |
| 247 | 247 | $basket = $view->orderBasket; |
| 248 | 248 | |
| 249 | - if( $basket->getCustomerId() == '' ) |
|
| 249 | + if ($basket->getCustomerId() == '') |
|
| 250 | 250 | { |
| 251 | 251 | $email = '<unknown>'; |
| 252 | 252 | $context = $this->getContext(); |
| 253 | 253 | |
| 254 | 254 | try |
| 255 | 255 | { |
| 256 | - $addr = $basket->getAddress( \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT ); |
|
| 256 | + $addr = $basket->getAddress(\Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_PAYMENT); |
|
| 257 | 257 | $email = $addr->getEmail(); |
| 258 | 258 | |
| 259 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
| 259 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
| 260 | 260 | $search = $manager->createSearch(); |
| 261 | - $search->setConditions( $search->compare( '==', 'customer.code', $email ) ); |
|
| 262 | - $search->setSlice( 0, 1 ); |
|
| 263 | - $result = $manager->searchItems( $search ); |
|
| 261 | + $search->setConditions($search->compare('==', 'customer.code', $email)); |
|
| 262 | + $search->setSlice(0, 1); |
|
| 263 | + $result = $manager->searchItems($search); |
|
| 264 | 264 | |
| 265 | - if( ( $item = reset( $result ) ) === false ) |
|
| 265 | + if (($item = reset($result)) === false) |
|
| 266 | 266 | { |
| 267 | - $password = substr( md5( microtime( true ) . getmypid() . rand() ), -8 ); |
|
| 268 | - $item = $this->addCustomerData( $manager->createItem(), $addr, $addr->getEmail(), $password ); |
|
| 269 | - $manager->saveItem( $item ); |
|
| 267 | + $password = substr(md5(microtime(true).getmypid().rand()), -8); |
|
| 268 | + $item = $this->addCustomerData($manager->createItem(), $addr, $addr->getEmail(), $password); |
|
| 269 | + $manager->saveItem($item); |
|
| 270 | 270 | |
| 271 | 271 | $msg = $item->toArray(); |
| 272 | 272 | $msg['customer.password'] = $password; |
| 273 | - $context->getMessageQueue( 'mq-email', 'customer/email/account' )->add( json_encode( $msg ) ); |
|
| 274 | - $context->setUserId( $item->getId() ); |
|
| 273 | + $context->getMessageQueue('mq-email', 'customer/email/account')->add(json_encode($msg)); |
|
| 274 | + $context->setUserId($item->getId()); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - $basket->setCustomerId( $item->getId() ); |
|
| 277 | + $basket->setCustomerId($item->getId()); |
|
| 278 | 278 | |
| 279 | - $orderBaseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
| 280 | - $orderBaseManager->saveItem( $basket, false ); |
|
| 279 | + $orderBaseManager = \Aimeos\MShop\Factory::createManager($context, 'order/base'); |
|
| 280 | + $orderBaseManager->saveItem($basket, false); |
|
| 281 | 281 | } |
| 282 | - catch( \Exception $e ) |
|
| 282 | + catch (\Exception $e) |
|
| 283 | 283 | { |
| 284 | - $msg = sprintf( 'Unable to create an account for "%1$s": %2$s', $email, $e->getMessage() ); |
|
| 285 | - $context->getLogger()->log( $msg, \Aimeos\MW\Logger\Base::INFO ); |
|
| 284 | + $msg = sprintf('Unable to create an account for "%1$s": %2$s', $email, $e->getMessage()); |
|
| 285 | + $context->getLogger()->log($msg, \Aimeos\MW\Logger\Base::INFO); |
|
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | 288 | |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | */ |
| 298 | 298 | protected function getSubClientNames() |
| 299 | 299 | { |
| 300 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 300 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | |
@@ -310,24 +310,24 @@ discard block |
||
| 310 | 310 | * @param string $password Plain-text password for the customer |
| 311 | 311 | * @return \Aimeos\MShop\Customer\Item\Iface Customer object filled with data |
| 312 | 312 | */ |
| 313 | - protected function addCustomerData( \Aimeos\MShop\Customer\Item\Iface $customer, |
|
| 314 | - \Aimeos\MShop\Common\Item\Address\Iface $address, $code, $password ) |
|
| 313 | + protected function addCustomerData(\Aimeos\MShop\Customer\Item\Iface $customer, |
|
| 314 | + \Aimeos\MShop\Common\Item\Address\Iface $address, $code, $password) |
|
| 315 | 315 | { |
| 316 | 316 | $label = $address->getLastname(); |
| 317 | 317 | |
| 318 | - if( ( $part = $address->getFirstname() ) !== '' ) { |
|
| 319 | - $label = $part . ' ' . $label; |
|
| 318 | + if (($part = $address->getFirstname()) !== '') { |
|
| 319 | + $label = $part.' '.$label; |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | - if( ( $part = $address->getCompany() ) !== '' ) { |
|
| 323 | - $label .= ' (' . $part . ')'; |
|
| 322 | + if (($part = $address->getCompany()) !== '') { |
|
| 323 | + $label .= ' ('.$part.')'; |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | - $customer->setPaymentAddress( $address ); |
|
| 327 | - $customer->setCode( $code ); |
|
| 328 | - $customer->setPassword( $password ); |
|
| 329 | - $customer->setLabel( $label ); |
|
| 330 | - $customer->setStatus( 1 ); |
|
| 326 | + $customer->setPaymentAddress($address); |
|
| 327 | + $customer->setCode($code); |
|
| 328 | + $customer->setPassword($password); |
|
| 329 | + $customer->setLabel($label); |
|
| 330 | + $customer->setStatus(1); |
|
| 331 | 331 | |
| 332 | 332 | /** client/html/checkout/standard/order/account/standard/groupids |
| 333 | 333 | * List of groups new customers should be assigned to |
@@ -342,8 +342,8 @@ discard block |
||
| 342 | 342 | * @category Developer |
| 343 | 343 | */ |
| 344 | 344 | $config = $this->getContext()->getConfig(); |
| 345 | - $gids = (array) $config->get( 'client/html/checkout/standard/order/account/standard/groupids', array() ); |
|
| 346 | - $customer->setGroups( $gids ); |
|
| 345 | + $gids = (array) $config->get('client/html/checkout/standard/order/account/standard/groupids', array()); |
|
| 346 | + $customer->setGroups($gids); |
|
| 347 | 347 | |
| 348 | 348 | return $customer; |
| 349 | 349 | } |
@@ -278,8 +278,7 @@ |
||
| 278 | 278 | |
| 279 | 279 | $orderBaseManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
| 280 | 280 | $orderBaseManager->saveItem( $basket, false ); |
| 281 | - } |
|
| 282 | - catch( \Exception $e ) |
|
| 281 | + } catch( \Exception $e ) |
|
| 283 | 282 | { |
| 284 | 283 | $msg = sprintf( 'Unable to create an account for "%1$s": %2$s', $email, $e->getMessage() ); |
| 285 | 284 | $context->getLogger()->log( $msg, \Aimeos\MW\Logger\Base::INFO ); |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -19,263 +19,263 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Summary\Service\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Summary\Service\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/checkout/standard/summary/service/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the checkout standard summary service section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2015.11 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/checkout/standard/summary/service/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - private $cache; |
|
| 25 | + /** client/html/checkout/standard/summary/service/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the checkout standard summary service section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2015.11 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/checkout/standard/summary/service/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | + private $cache; |
|
| 61 | 61 | |
| 62 | 62 | |
| 63 | - /** |
|
| 64 | - * Returns the HTML code for insertion into the body. |
|
| 65 | - * |
|
| 66 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 67 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 68 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 69 | - * @return string HTML code |
|
| 70 | - */ |
|
| 71 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 72 | - { |
|
| 73 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 63 | + /** |
|
| 64 | + * Returns the HTML code for insertion into the body. |
|
| 65 | + * |
|
| 66 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 67 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 68 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 69 | + * @return string HTML code |
|
| 70 | + */ |
|
| 71 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 72 | + { |
|
| 73 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 74 | 74 | |
| 75 | - $html = ''; |
|
| 76 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | - } |
|
| 79 | - $view->serviceBody = $html; |
|
| 75 | + $html = ''; |
|
| 76 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | + } |
|
| 79 | + $view->serviceBody = $html; |
|
| 80 | 80 | |
| 81 | - /** client/html/checkout/standard/summary/service/standard/template-body |
|
| 82 | - * Relative path to the HTML body template of the checkout standard summary service client. |
|
| 83 | - * |
|
| 84 | - * The template file contains the HTML code and processing instructions |
|
| 85 | - * to generate the result shown in the body of the frontend. The |
|
| 86 | - * configuration string is the path to the template file relative |
|
| 87 | - * to the templates directory (usually in client/html/templates). |
|
| 88 | - * |
|
| 89 | - * You can overwrite the template file configuration in extensions and |
|
| 90 | - * provide alternative templates. These alternative templates should be |
|
| 91 | - * named like the default one but with the string "standard" replaced by |
|
| 92 | - * an unique name. You may use the name of your project for this. If |
|
| 93 | - * you've implemented an alternative client class as well, "standard" |
|
| 94 | - * (second one) should be replaced by the name of the new class in lower |
|
| 95 | - * case. |
|
| 96 | - * |
|
| 97 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 98 | - * @since 2015.11 |
|
| 99 | - * @category Developer |
|
| 100 | - * @see client/html/checkout/standard/summary/service/standard/template-header |
|
| 101 | - */ |
|
| 102 | - $tplconf = 'client/html/checkout/standard/summary/service/standard/template-body'; |
|
| 103 | - $default = 'common/summary/service-body-default.php'; |
|
| 81 | + /** client/html/checkout/standard/summary/service/standard/template-body |
|
| 82 | + * Relative path to the HTML body template of the checkout standard summary service client. |
|
| 83 | + * |
|
| 84 | + * The template file contains the HTML code and processing instructions |
|
| 85 | + * to generate the result shown in the body of the frontend. The |
|
| 86 | + * configuration string is the path to the template file relative |
|
| 87 | + * to the templates directory (usually in client/html/templates). |
|
| 88 | + * |
|
| 89 | + * You can overwrite the template file configuration in extensions and |
|
| 90 | + * provide alternative templates. These alternative templates should be |
|
| 91 | + * named like the default one but with the string "standard" replaced by |
|
| 92 | + * an unique name. You may use the name of your project for this. If |
|
| 93 | + * you've implemented an alternative client class as well, "standard" |
|
| 94 | + * (second one) should be replaced by the name of the new class in lower |
|
| 95 | + * case. |
|
| 96 | + * |
|
| 97 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 98 | + * @since 2015.11 |
|
| 99 | + * @category Developer |
|
| 100 | + * @see client/html/checkout/standard/summary/service/standard/template-header |
|
| 101 | + */ |
|
| 102 | + $tplconf = 'client/html/checkout/standard/summary/service/standard/template-body'; |
|
| 103 | + $default = 'common/summary/service-body-default.php'; |
|
| 104 | 104 | |
| 105 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 106 | - } |
|
| 105 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | 108 | |
| 109 | - /** |
|
| 110 | - * Returns the HTML string for insertion into the header. |
|
| 111 | - * |
|
| 112 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 113 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 114 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 115 | - * @return string|null String including HTML tags for the header on error |
|
| 116 | - */ |
|
| 117 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 118 | - { |
|
| 119 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 109 | + /** |
|
| 110 | + * Returns the HTML string for insertion into the header. |
|
| 111 | + * |
|
| 112 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 113 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 114 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 115 | + * @return string|null String including HTML tags for the header on error |
|
| 116 | + */ |
|
| 117 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 118 | + { |
|
| 119 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 120 | 120 | |
| 121 | - $html = ''; |
|
| 122 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 124 | - } |
|
| 125 | - $view->serviceHeader = $html; |
|
| 121 | + $html = ''; |
|
| 122 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 124 | + } |
|
| 125 | + $view->serviceHeader = $html; |
|
| 126 | 126 | |
| 127 | - /** client/html/checkout/standard/summary/service/standard/template-header |
|
| 128 | - * Relative path to the HTML header template of the checkout standard summary service client. |
|
| 129 | - * |
|
| 130 | - * The template file contains the HTML code and processing instructions |
|
| 131 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 132 | - * of the rendered page in the frontend. The configuration string is the |
|
| 133 | - * path to the template file relative to the templates directory (usually |
|
| 134 | - * in client/html/templates). |
|
| 135 | - * |
|
| 136 | - * You can overwrite the template file configuration in extensions and |
|
| 137 | - * provide alternative templates. These alternative templates should be |
|
| 138 | - * named like the default one but with the string "standard" replaced by |
|
| 139 | - * an unique name. You may use the name of your project for this. If |
|
| 140 | - * you've implemented an alternative client class as well, "standard" |
|
| 141 | - * (second one) should be replaced by the name of the new class in lower |
|
| 142 | - * case. |
|
| 143 | - * |
|
| 144 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 145 | - * @since 2015.11 |
|
| 146 | - * @category Developer |
|
| 147 | - * @see client/html/checkout/standard/summary/service/standard/template-body |
|
| 148 | - */ |
|
| 149 | - $tplconf = 'client/html/checkout/standard/summary/service/standard/template-header'; |
|
| 150 | - $default = 'common/summary/service-header-default.php'; |
|
| 127 | + /** client/html/checkout/standard/summary/service/standard/template-header |
|
| 128 | + * Relative path to the HTML header template of the checkout standard summary service client. |
|
| 129 | + * |
|
| 130 | + * The template file contains the HTML code and processing instructions |
|
| 131 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 132 | + * of the rendered page in the frontend. The configuration string is the |
|
| 133 | + * path to the template file relative to the templates directory (usually |
|
| 134 | + * in client/html/templates). |
|
| 135 | + * |
|
| 136 | + * You can overwrite the template file configuration in extensions and |
|
| 137 | + * provide alternative templates. These alternative templates should be |
|
| 138 | + * named like the default one but with the string "standard" replaced by |
|
| 139 | + * an unique name. You may use the name of your project for this. If |
|
| 140 | + * you've implemented an alternative client class as well, "standard" |
|
| 141 | + * (second one) should be replaced by the name of the new class in lower |
|
| 142 | + * case. |
|
| 143 | + * |
|
| 144 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 145 | + * @since 2015.11 |
|
| 146 | + * @category Developer |
|
| 147 | + * @see client/html/checkout/standard/summary/service/standard/template-body |
|
| 148 | + */ |
|
| 149 | + $tplconf = 'client/html/checkout/standard/summary/service/standard/template-header'; |
|
| 150 | + $default = 'common/summary/service-header-default.php'; |
|
| 151 | 151 | |
| 152 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 153 | - } |
|
| 152 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 153 | + } |
|
| 154 | 154 | |
| 155 | 155 | |
| 156 | - /** |
|
| 157 | - * Returns the sub-client given by its name. |
|
| 158 | - * |
|
| 159 | - * @param string $type Name of the client type |
|
| 160 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 161 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 162 | - */ |
|
| 163 | - public function getSubClient( $type, $name = null ) |
|
| 164 | - { |
|
| 165 | - /** client/html/checkout/standard/summary/service/decorators/excludes |
|
| 166 | - * Excludes decorators added by the "common" option from the checkout standard summary service html client |
|
| 167 | - * |
|
| 168 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 169 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 170 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 171 | - * modify what is returned to the caller. |
|
| 172 | - * |
|
| 173 | - * This option allows you to remove a decorator added via |
|
| 174 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 175 | - * around the html client. |
|
| 176 | - * |
|
| 177 | - * client/html/checkout/standard/summary/service/decorators/excludes = array( 'decorator1' ) |
|
| 178 | - * |
|
| 179 | - * This would remove the decorator named "decorator1" from the list of |
|
| 180 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 181 | - * "client/html/common/decorators/default" to the html client. |
|
| 182 | - * |
|
| 183 | - * @param array List of decorator names |
|
| 184 | - * @since 2015.08 |
|
| 185 | - * @category Developer |
|
| 186 | - * @see client/html/common/decorators/default |
|
| 187 | - * @see client/html/checkout/standard/summary/service/decorators/global |
|
| 188 | - * @see client/html/checkout/standard/summary/service/decorators/local |
|
| 189 | - */ |
|
| 156 | + /** |
|
| 157 | + * Returns the sub-client given by its name. |
|
| 158 | + * |
|
| 159 | + * @param string $type Name of the client type |
|
| 160 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 161 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 162 | + */ |
|
| 163 | + public function getSubClient( $type, $name = null ) |
|
| 164 | + { |
|
| 165 | + /** client/html/checkout/standard/summary/service/decorators/excludes |
|
| 166 | + * Excludes decorators added by the "common" option from the checkout standard summary service html client |
|
| 167 | + * |
|
| 168 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 169 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 170 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 171 | + * modify what is returned to the caller. |
|
| 172 | + * |
|
| 173 | + * This option allows you to remove a decorator added via |
|
| 174 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 175 | + * around the html client. |
|
| 176 | + * |
|
| 177 | + * client/html/checkout/standard/summary/service/decorators/excludes = array( 'decorator1' ) |
|
| 178 | + * |
|
| 179 | + * This would remove the decorator named "decorator1" from the list of |
|
| 180 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 181 | + * "client/html/common/decorators/default" to the html client. |
|
| 182 | + * |
|
| 183 | + * @param array List of decorator names |
|
| 184 | + * @since 2015.08 |
|
| 185 | + * @category Developer |
|
| 186 | + * @see client/html/common/decorators/default |
|
| 187 | + * @see client/html/checkout/standard/summary/service/decorators/global |
|
| 188 | + * @see client/html/checkout/standard/summary/service/decorators/local |
|
| 189 | + */ |
|
| 190 | 190 | |
| 191 | - /** client/html/checkout/standard/summary/service/decorators/global |
|
| 192 | - * Adds a list of globally available decorators only to the checkout standard summary service html client |
|
| 193 | - * |
|
| 194 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 195 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 196 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 197 | - * modify what is returned to the caller. |
|
| 198 | - * |
|
| 199 | - * This option allows you to wrap global decorators |
|
| 200 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 201 | - * |
|
| 202 | - * client/html/checkout/standard/summary/service/decorators/global = array( 'decorator1' ) |
|
| 203 | - * |
|
| 204 | - * This would add the decorator named "decorator1" defined by |
|
| 205 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 206 | - * |
|
| 207 | - * @param array List of decorator names |
|
| 208 | - * @since 2015.08 |
|
| 209 | - * @category Developer |
|
| 210 | - * @see client/html/common/decorators/default |
|
| 211 | - * @see client/html/checkout/standard/summary/service/decorators/excludes |
|
| 212 | - * @see client/html/checkout/standard/summary/service/decorators/local |
|
| 213 | - */ |
|
| 191 | + /** client/html/checkout/standard/summary/service/decorators/global |
|
| 192 | + * Adds a list of globally available decorators only to the checkout standard summary service html client |
|
| 193 | + * |
|
| 194 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 195 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 196 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 197 | + * modify what is returned to the caller. |
|
| 198 | + * |
|
| 199 | + * This option allows you to wrap global decorators |
|
| 200 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 201 | + * |
|
| 202 | + * client/html/checkout/standard/summary/service/decorators/global = array( 'decorator1' ) |
|
| 203 | + * |
|
| 204 | + * This would add the decorator named "decorator1" defined by |
|
| 205 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 206 | + * |
|
| 207 | + * @param array List of decorator names |
|
| 208 | + * @since 2015.08 |
|
| 209 | + * @category Developer |
|
| 210 | + * @see client/html/common/decorators/default |
|
| 211 | + * @see client/html/checkout/standard/summary/service/decorators/excludes |
|
| 212 | + * @see client/html/checkout/standard/summary/service/decorators/local |
|
| 213 | + */ |
|
| 214 | 214 | |
| 215 | - /** client/html/checkout/standard/summary/service/decorators/local |
|
| 216 | - * Adds a list of local decorators only to the checkout standard summary service html client |
|
| 217 | - * |
|
| 218 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 219 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 220 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 221 | - * modify what is returned to the caller. |
|
| 222 | - * |
|
| 223 | - * This option allows you to wrap local decorators |
|
| 224 | - * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 225 | - * |
|
| 226 | - * client/html/checkout/standard/summary/service/decorators/local = array( 'decorator2' ) |
|
| 227 | - * |
|
| 228 | - * This would add the decorator named "decorator2" defined by |
|
| 229 | - * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 230 | - * |
|
| 231 | - * @param array List of decorator names |
|
| 232 | - * @since 2015.08 |
|
| 233 | - * @category Developer |
|
| 234 | - * @see client/html/common/decorators/default |
|
| 235 | - * @see client/html/checkout/standard/summary/service/decorators/excludes |
|
| 236 | - * @see client/html/checkout/standard/summary/service/decorators/global |
|
| 237 | - */ |
|
| 215 | + /** client/html/checkout/standard/summary/service/decorators/local |
|
| 216 | + * Adds a list of local decorators only to the checkout standard summary service html client |
|
| 217 | + * |
|
| 218 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 219 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 220 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 221 | + * modify what is returned to the caller. |
|
| 222 | + * |
|
| 223 | + * This option allows you to wrap local decorators |
|
| 224 | + * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 225 | + * |
|
| 226 | + * client/html/checkout/standard/summary/service/decorators/local = array( 'decorator2' ) |
|
| 227 | + * |
|
| 228 | + * This would add the decorator named "decorator2" defined by |
|
| 229 | + * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 230 | + * |
|
| 231 | + * @param array List of decorator names |
|
| 232 | + * @since 2015.08 |
|
| 233 | + * @category Developer |
|
| 234 | + * @see client/html/common/decorators/default |
|
| 235 | + * @see client/html/checkout/standard/summary/service/decorators/excludes |
|
| 236 | + * @see client/html/checkout/standard/summary/service/decorators/global |
|
| 237 | + */ |
|
| 238 | 238 | |
| 239 | - return $this->createSubClient( 'checkout/standard/summary/service/' . $type, $name ); |
|
| 240 | - } |
|
| 239 | + return $this->createSubClient( 'checkout/standard/summary/service/' . $type, $name ); |
|
| 240 | + } |
|
| 241 | 241 | |
| 242 | 242 | |
| 243 | - /** |
|
| 244 | - * Returns the list of sub-client names configured for the client. |
|
| 245 | - * |
|
| 246 | - * @return array List of HTML client names |
|
| 247 | - */ |
|
| 248 | - protected function getSubClientNames() |
|
| 249 | - { |
|
| 250 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 251 | - } |
|
| 243 | + /** |
|
| 244 | + * Returns the list of sub-client names configured for the client. |
|
| 245 | + * |
|
| 246 | + * @return array List of HTML client names |
|
| 247 | + */ |
|
| 248 | + protected function getSubClientNames() |
|
| 249 | + { |
|
| 250 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 251 | + } |
|
| 252 | 252 | |
| 253 | 253 | |
| 254 | - /** |
|
| 255 | - * Sets the necessary parameter values in the view. |
|
| 256 | - * |
|
| 257 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 258 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 259 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 260 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 261 | - */ |
|
| 262 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 263 | - { |
|
| 264 | - $view = parent::setViewParams( $view, $tags, $expire ); |
|
| 254 | + /** |
|
| 255 | + * Sets the necessary parameter values in the view. |
|
| 256 | + * |
|
| 257 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 258 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 259 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 260 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 261 | + */ |
|
| 262 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 263 | + { |
|
| 264 | + $view = parent::setViewParams( $view, $tags, $expire ); |
|
| 265 | 265 | |
| 266 | - if( !isset( $this->cache ) ) |
|
| 267 | - { |
|
| 268 | - $target = $view->config( 'client/html/checkout/standard/url/target' ); |
|
| 269 | - $cntl = $view->config( 'client/html/checkout/standard/url/controller', 'checkout' ); |
|
| 270 | - $action = $view->config( 'client/html/checkout/standard/url/action', 'index' ); |
|
| 271 | - $config = $view->config( 'client/html/checkout/standard/url/config', array() ); |
|
| 266 | + if( !isset( $this->cache ) ) |
|
| 267 | + { |
|
| 268 | + $target = $view->config( 'client/html/checkout/standard/url/target' ); |
|
| 269 | + $cntl = $view->config( 'client/html/checkout/standard/url/controller', 'checkout' ); |
|
| 270 | + $action = $view->config( 'client/html/checkout/standard/url/action', 'index' ); |
|
| 271 | + $config = $view->config( 'client/html/checkout/standard/url/config', array() ); |
|
| 272 | 272 | |
| 273 | - $view->summaryUrlServicePayment = $view->url( $target, $cntl, $action, array( 'c_step' => 'payment' ), array(), $config ); |
|
| 274 | - $view->summaryUrlServiceDelivery = $view->url( $target, $cntl, $action, array( 'c_step' => 'delivery' ), array(), $config ); |
|
| 273 | + $view->summaryUrlServicePayment = $view->url( $target, $cntl, $action, array( 'c_step' => 'payment' ), array(), $config ); |
|
| 274 | + $view->summaryUrlServiceDelivery = $view->url( $target, $cntl, $action, array( 'c_step' => 'delivery' ), array(), $config ); |
|
| 275 | 275 | |
| 276 | - $this->cache = $view; |
|
| 277 | - } |
|
| 276 | + $this->cache = $view; |
|
| 277 | + } |
|
| 278 | 278 | |
| 279 | - return $this->cache; |
|
| 280 | - } |
|
| 279 | + return $this->cache; |
|
| 280 | + } |
|
| 281 | 281 | } |
| 282 | 282 | \ No newline at end of file |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 69 | 69 | * @return string HTML code |
| 70 | 70 | */ |
| 71 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 72 | 72 | { |
| 73 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 74 | 74 | |
| 75 | 75 | $html = ''; |
| 76 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 76 | + foreach ($this->getSubClients() as $subclient) { |
|
| 77 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 78 | 78 | } |
| 79 | 79 | $view->serviceBody = $html; |
| 80 | 80 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $tplconf = 'client/html/checkout/standard/summary/service/standard/template-body'; |
| 103 | 103 | $default = 'common/summary/service-body-default.php'; |
| 104 | 104 | |
| 105 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | + return $view->render($view->config($tplconf, $default)); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
@@ -114,13 +114,13 @@ discard block |
||
| 114 | 114 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 115 | 115 | * @return string|null String including HTML tags for the header on error |
| 116 | 116 | */ |
| 117 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 118 | 118 | { |
| 119 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 119 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 120 | 120 | |
| 121 | 121 | $html = ''; |
| 122 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | + foreach ($this->getSubClients() as $subclient) { |
|
| 123 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 124 | 124 | } |
| 125 | 125 | $view->serviceHeader = $html; |
| 126 | 126 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $tplconf = 'client/html/checkout/standard/summary/service/standard/template-header'; |
| 150 | 150 | $default = 'common/summary/service-header-default.php'; |
| 151 | 151 | |
| 152 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 152 | + return $view->render($view->config($tplconf, $default)); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @param string|null $name Name of the sub-client (Default if null) |
| 161 | 161 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 162 | 162 | */ |
| 163 | - public function getSubClient( $type, $name = null ) |
|
| 163 | + public function getSubClient($type, $name = null) |
|
| 164 | 164 | { |
| 165 | 165 | /** client/html/checkout/standard/summary/service/decorators/excludes |
| 166 | 166 | * Excludes decorators added by the "common" option from the checkout standard summary service html client |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * @see client/html/checkout/standard/summary/service/decorators/global |
| 237 | 237 | */ |
| 238 | 238 | |
| 239 | - return $this->createSubClient( 'checkout/standard/summary/service/' . $type, $name ); |
|
| 239 | + return $this->createSubClient('checkout/standard/summary/service/'.$type, $name); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | protected function getSubClientNames() |
| 249 | 249 | { |
| 250 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 250 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | |
@@ -259,19 +259,19 @@ discard block |
||
| 259 | 259 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 260 | 260 | * @return \Aimeos\MW\View\Iface Modified view object |
| 261 | 261 | */ |
| 262 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 262 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 263 | 263 | { |
| 264 | - $view = parent::setViewParams( $view, $tags, $expire ); |
|
| 264 | + $view = parent::setViewParams($view, $tags, $expire); |
|
| 265 | 265 | |
| 266 | - if( !isset( $this->cache ) ) |
|
| 266 | + if (!isset($this->cache)) |
|
| 267 | 267 | { |
| 268 | - $target = $view->config( 'client/html/checkout/standard/url/target' ); |
|
| 269 | - $cntl = $view->config( 'client/html/checkout/standard/url/controller', 'checkout' ); |
|
| 270 | - $action = $view->config( 'client/html/checkout/standard/url/action', 'index' ); |
|
| 271 | - $config = $view->config( 'client/html/checkout/standard/url/config', array() ); |
|
| 268 | + $target = $view->config('client/html/checkout/standard/url/target'); |
|
| 269 | + $cntl = $view->config('client/html/checkout/standard/url/controller', 'checkout'); |
|
| 270 | + $action = $view->config('client/html/checkout/standard/url/action', 'index'); |
|
| 271 | + $config = $view->config('client/html/checkout/standard/url/config', array()); |
|
| 272 | 272 | |
| 273 | - $view->summaryUrlServicePayment = $view->url( $target, $cntl, $action, array( 'c_step' => 'payment' ), array(), $config ); |
|
| 274 | - $view->summaryUrlServiceDelivery = $view->url( $target, $cntl, $action, array( 'c_step' => 'delivery' ), array(), $config ); |
|
| 273 | + $view->summaryUrlServicePayment = $view->url($target, $cntl, $action, array('c_step' => 'payment'), array(), $config); |
|
| 274 | + $view->summaryUrlServiceDelivery = $view->url($target, $cntl, $action, array('c_step' => 'delivery'), array(), $config); |
|
| 275 | 275 | |
| 276 | 276 | $this->cache = $view; |
| 277 | 277 | } |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -19,242 +19,242 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/checkout/standard/summary/option/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the checkout standard summary option section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2014.03 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/checkout/standard/summary/option/standard/subparts'; |
|
| 25 | + /** client/html/checkout/standard/summary/option/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the checkout standard summary option section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2014.03 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/checkout/standard/summary/option/standard/subparts'; |
|
| 59 | 59 | |
| 60 | - /** client/html/checkout/standard/summary/option/terms/name |
|
| 61 | - * Name of the terms part used by the checkout standard summary option client implementation |
|
| 62 | - * |
|
| 63 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Summary\Option\Terms\Myname". |
|
| 64 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 65 | - * |
|
| 66 | - * @param string Last part of the client class name |
|
| 67 | - * @since 2014.03 |
|
| 68 | - * @category Developer |
|
| 69 | - */ |
|
| 70 | - private $subPartNames = array( 'terms' ); |
|
| 60 | + /** client/html/checkout/standard/summary/option/terms/name |
|
| 61 | + * Name of the terms part used by the checkout standard summary option client implementation |
|
| 62 | + * |
|
| 63 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Summary\Option\Terms\Myname". |
|
| 64 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 65 | + * |
|
| 66 | + * @param string Last part of the client class name |
|
| 67 | + * @since 2014.03 |
|
| 68 | + * @category Developer |
|
| 69 | + */ |
|
| 70 | + private $subPartNames = array( 'terms' ); |
|
| 71 | 71 | |
| 72 | 72 | |
| 73 | - /** |
|
| 74 | - * Returns the HTML code for insertion into the body. |
|
| 75 | - * |
|
| 76 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 77 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 78 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 79 | - * @return string HTML code |
|
| 80 | - */ |
|
| 81 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 82 | - { |
|
| 83 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | + /** |
|
| 74 | + * Returns the HTML code for insertion into the body. |
|
| 75 | + * |
|
| 76 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 77 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 78 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 79 | + * @return string HTML code |
|
| 80 | + */ |
|
| 81 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 82 | + { |
|
| 83 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 84 | 84 | |
| 85 | - $html = ''; |
|
| 86 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 87 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 88 | - } |
|
| 89 | - $view->optionBody = $html; |
|
| 85 | + $html = ''; |
|
| 86 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 87 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 88 | + } |
|
| 89 | + $view->optionBody = $html; |
|
| 90 | 90 | |
| 91 | - /** client/html/checkout/standard/summary/option/standard/template-body |
|
| 92 | - * Relative path to the HTML body template of the checkout standard summary option client. |
|
| 93 | - * |
|
| 94 | - * The template file contains the HTML code and processing instructions |
|
| 95 | - * to generate the result shown in the body of the frontend. The |
|
| 96 | - * configuration string is the path to the template file relative |
|
| 97 | - * to the templates directory (usually in client/html/templates). |
|
| 98 | - * |
|
| 99 | - * You can overwrite the template file configuration in extensions and |
|
| 100 | - * provide alternative templates. These alternative templates should be |
|
| 101 | - * named like the default one but with the string "standard" replaced by |
|
| 102 | - * an unique name. You may use the name of your project for this. If |
|
| 103 | - * you've implemented an alternative client class as well, "standard" |
|
| 104 | - * should be replaced by the name of the new class. |
|
| 105 | - * |
|
| 106 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 107 | - * @since 2014.03 |
|
| 108 | - * @category Developer |
|
| 109 | - * @see client/html/checkout/standard/summary/option/standard/template-header |
|
| 110 | - */ |
|
| 111 | - $tplconf = 'client/html/checkout/standard/summary/option/standard/template-body'; |
|
| 112 | - $default = 'checkout/standard/summary-option-body-default.php'; |
|
| 91 | + /** client/html/checkout/standard/summary/option/standard/template-body |
|
| 92 | + * Relative path to the HTML body template of the checkout standard summary option client. |
|
| 93 | + * |
|
| 94 | + * The template file contains the HTML code and processing instructions |
|
| 95 | + * to generate the result shown in the body of the frontend. The |
|
| 96 | + * configuration string is the path to the template file relative |
|
| 97 | + * to the templates directory (usually in client/html/templates). |
|
| 98 | + * |
|
| 99 | + * You can overwrite the template file configuration in extensions and |
|
| 100 | + * provide alternative templates. These alternative templates should be |
|
| 101 | + * named like the default one but with the string "standard" replaced by |
|
| 102 | + * an unique name. You may use the name of your project for this. If |
|
| 103 | + * you've implemented an alternative client class as well, "standard" |
|
| 104 | + * should be replaced by the name of the new class. |
|
| 105 | + * |
|
| 106 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 107 | + * @since 2014.03 |
|
| 108 | + * @category Developer |
|
| 109 | + * @see client/html/checkout/standard/summary/option/standard/template-header |
|
| 110 | + */ |
|
| 111 | + $tplconf = 'client/html/checkout/standard/summary/option/standard/template-body'; |
|
| 112 | + $default = 'checkout/standard/summary-option-body-default.php'; |
|
| 113 | 113 | |
| 114 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 115 | - } |
|
| 114 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | 117 | |
| 118 | - /** |
|
| 119 | - * Returns the HTML string for insertion into the header. |
|
| 120 | - * |
|
| 121 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 122 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 123 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 124 | - * @return string|null String including HTML tags for the header on error |
|
| 125 | - */ |
|
| 126 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 127 | - { |
|
| 128 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | + /** |
|
| 119 | + * Returns the HTML string for insertion into the header. |
|
| 120 | + * |
|
| 121 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 122 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 123 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 124 | + * @return string|null String including HTML tags for the header on error |
|
| 125 | + */ |
|
| 126 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 127 | + { |
|
| 128 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 129 | 129 | |
| 130 | - $html = ''; |
|
| 131 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 132 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 133 | - } |
|
| 134 | - $view->optionHeader = $html; |
|
| 130 | + $html = ''; |
|
| 131 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 132 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 133 | + } |
|
| 134 | + $view->optionHeader = $html; |
|
| 135 | 135 | |
| 136 | - /** client/html/checkout/standard/summary/option/standard/template-header |
|
| 137 | - * Relative path to the HTML header template of the checkout standard summary option client. |
|
| 138 | - * |
|
| 139 | - * The template file contains the HTML code and processing instructions |
|
| 140 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 141 | - * of the rendered page in the frontend. The configuration string is the |
|
| 142 | - * path to the template file relative to the templates directory (usually |
|
| 143 | - * in client/html/templates). |
|
| 144 | - * |
|
| 145 | - * You can overwrite the template file configuration in extensions and |
|
| 146 | - * provide alternative templates. These alternative templates should be |
|
| 147 | - * named like the default one but with the string "standard" replaced by |
|
| 148 | - * an unique name. You may use the name of your project for this. If |
|
| 149 | - * you've implemented an alternative client class as well, "standard" |
|
| 150 | - * should be replaced by the name of the new class. |
|
| 151 | - * |
|
| 152 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 153 | - * @since 2014.03 |
|
| 154 | - * @category Developer |
|
| 155 | - * @see client/html/checkout/standard/summary/option/standard/template-body |
|
| 156 | - */ |
|
| 157 | - $tplconf = 'client/html/checkout/standard/summary/option/standard/template-header'; |
|
| 158 | - $default = 'checkout/standard/summary-option-header-default.php'; |
|
| 136 | + /** client/html/checkout/standard/summary/option/standard/template-header |
|
| 137 | + * Relative path to the HTML header template of the checkout standard summary option client. |
|
| 138 | + * |
|
| 139 | + * The template file contains the HTML code and processing instructions |
|
| 140 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 141 | + * of the rendered page in the frontend. The configuration string is the |
|
| 142 | + * path to the template file relative to the templates directory (usually |
|
| 143 | + * in client/html/templates). |
|
| 144 | + * |
|
| 145 | + * You can overwrite the template file configuration in extensions and |
|
| 146 | + * provide alternative templates. These alternative templates should be |
|
| 147 | + * named like the default one but with the string "standard" replaced by |
|
| 148 | + * an unique name. You may use the name of your project for this. If |
|
| 149 | + * you've implemented an alternative client class as well, "standard" |
|
| 150 | + * should be replaced by the name of the new class. |
|
| 151 | + * |
|
| 152 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 153 | + * @since 2014.03 |
|
| 154 | + * @category Developer |
|
| 155 | + * @see client/html/checkout/standard/summary/option/standard/template-body |
|
| 156 | + */ |
|
| 157 | + $tplconf = 'client/html/checkout/standard/summary/option/standard/template-header'; |
|
| 158 | + $default = 'checkout/standard/summary-option-header-default.php'; |
|
| 159 | 159 | |
| 160 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 161 | - } |
|
| 160 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 161 | + } |
|
| 162 | 162 | |
| 163 | 163 | |
| 164 | - /** |
|
| 165 | - * Returns the sub-client given by its name. |
|
| 166 | - * |
|
| 167 | - * @param string $type Name of the client type |
|
| 168 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 169 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 170 | - */ |
|
| 171 | - public function getSubClient( $type, $name = null ) |
|
| 172 | - { |
|
| 173 | - /** client/html/checkout/standard/summary/option/decorators/excludes |
|
| 174 | - * Excludes decorators added by the "common" option from the checkout standard summary option html client |
|
| 175 | - * |
|
| 176 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 177 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 178 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 179 | - * modify what is returned to the caller. |
|
| 180 | - * |
|
| 181 | - * This option allows you to remove a decorator added via |
|
| 182 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 183 | - * around the html client. |
|
| 184 | - * |
|
| 185 | - * client/html/checkout/standard/summary/option/decorators/excludes = array( 'decorator1' ) |
|
| 186 | - * |
|
| 187 | - * This would remove the decorator named "decorator1" from the list of |
|
| 188 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 189 | - * "client/html/common/decorators/default" to the html client. |
|
| 190 | - * |
|
| 191 | - * @param array List of decorator names |
|
| 192 | - * @since 2015.08 |
|
| 193 | - * @category Developer |
|
| 194 | - * @see client/html/common/decorators/default |
|
| 195 | - * @see client/html/checkout/standard/summary/option/decorators/global |
|
| 196 | - * @see client/html/checkout/standard/summary/option/decorators/local |
|
| 197 | - */ |
|
| 164 | + /** |
|
| 165 | + * Returns the sub-client given by its name. |
|
| 166 | + * |
|
| 167 | + * @param string $type Name of the client type |
|
| 168 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 169 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 170 | + */ |
|
| 171 | + public function getSubClient( $type, $name = null ) |
|
| 172 | + { |
|
| 173 | + /** client/html/checkout/standard/summary/option/decorators/excludes |
|
| 174 | + * Excludes decorators added by the "common" option from the checkout standard summary option html client |
|
| 175 | + * |
|
| 176 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 177 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 178 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 179 | + * modify what is returned to the caller. |
|
| 180 | + * |
|
| 181 | + * This option allows you to remove a decorator added via |
|
| 182 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 183 | + * around the html client. |
|
| 184 | + * |
|
| 185 | + * client/html/checkout/standard/summary/option/decorators/excludes = array( 'decorator1' ) |
|
| 186 | + * |
|
| 187 | + * This would remove the decorator named "decorator1" from the list of |
|
| 188 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 189 | + * "client/html/common/decorators/default" to the html client. |
|
| 190 | + * |
|
| 191 | + * @param array List of decorator names |
|
| 192 | + * @since 2015.08 |
|
| 193 | + * @category Developer |
|
| 194 | + * @see client/html/common/decorators/default |
|
| 195 | + * @see client/html/checkout/standard/summary/option/decorators/global |
|
| 196 | + * @see client/html/checkout/standard/summary/option/decorators/local |
|
| 197 | + */ |
|
| 198 | 198 | |
| 199 | - /** client/html/checkout/standard/summary/option/decorators/global |
|
| 200 | - * Adds a list of globally available decorators only to the checkout standard summary option html client |
|
| 201 | - * |
|
| 202 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 203 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 204 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 205 | - * modify what is returned to the caller. |
|
| 206 | - * |
|
| 207 | - * This option allows you to wrap global decorators |
|
| 208 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 209 | - * |
|
| 210 | - * client/html/checkout/standard/summary/option/decorators/global = array( 'decorator1' ) |
|
| 211 | - * |
|
| 212 | - * This would add the decorator named "decorator1" defined by |
|
| 213 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 214 | - * |
|
| 215 | - * @param array List of decorator names |
|
| 216 | - * @since 2015.08 |
|
| 217 | - * @category Developer |
|
| 218 | - * @see client/html/common/decorators/default |
|
| 219 | - * @see client/html/checkout/standard/summary/option/decorators/excludes |
|
| 220 | - * @see client/html/checkout/standard/summary/option/decorators/local |
|
| 221 | - */ |
|
| 199 | + /** client/html/checkout/standard/summary/option/decorators/global |
|
| 200 | + * Adds a list of globally available decorators only to the checkout standard summary option html client |
|
| 201 | + * |
|
| 202 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 203 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 204 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 205 | + * modify what is returned to the caller. |
|
| 206 | + * |
|
| 207 | + * This option allows you to wrap global decorators |
|
| 208 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 209 | + * |
|
| 210 | + * client/html/checkout/standard/summary/option/decorators/global = array( 'decorator1' ) |
|
| 211 | + * |
|
| 212 | + * This would add the decorator named "decorator1" defined by |
|
| 213 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 214 | + * |
|
| 215 | + * @param array List of decorator names |
|
| 216 | + * @since 2015.08 |
|
| 217 | + * @category Developer |
|
| 218 | + * @see client/html/common/decorators/default |
|
| 219 | + * @see client/html/checkout/standard/summary/option/decorators/excludes |
|
| 220 | + * @see client/html/checkout/standard/summary/option/decorators/local |
|
| 221 | + */ |
|
| 222 | 222 | |
| 223 | - /** client/html/checkout/standard/summary/option/decorators/local |
|
| 224 | - * Adds a list of local decorators only to the checkout standard summary option html client |
|
| 225 | - * |
|
| 226 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 227 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 228 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 229 | - * modify what is returned to the caller. |
|
| 230 | - * |
|
| 231 | - * This option allows you to wrap local decorators |
|
| 232 | - * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 233 | - * |
|
| 234 | - * client/html/checkout/standard/summary/option/decorators/local = array( 'decorator2' ) |
|
| 235 | - * |
|
| 236 | - * This would add the decorator named "decorator2" defined by |
|
| 237 | - * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 238 | - * |
|
| 239 | - * @param array List of decorator names |
|
| 240 | - * @since 2015.08 |
|
| 241 | - * @category Developer |
|
| 242 | - * @see client/html/common/decorators/default |
|
| 243 | - * @see client/html/checkout/standard/summary/option/decorators/excludes |
|
| 244 | - * @see client/html/checkout/standard/summary/option/decorators/global |
|
| 245 | - */ |
|
| 223 | + /** client/html/checkout/standard/summary/option/decorators/local |
|
| 224 | + * Adds a list of local decorators only to the checkout standard summary option html client |
|
| 225 | + * |
|
| 226 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 227 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 228 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 229 | + * modify what is returned to the caller. |
|
| 230 | + * |
|
| 231 | + * This option allows you to wrap local decorators |
|
| 232 | + * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 233 | + * |
|
| 234 | + * client/html/checkout/standard/summary/option/decorators/local = array( 'decorator2' ) |
|
| 235 | + * |
|
| 236 | + * This would add the decorator named "decorator2" defined by |
|
| 237 | + * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 238 | + * |
|
| 239 | + * @param array List of decorator names |
|
| 240 | + * @since 2015.08 |
|
| 241 | + * @category Developer |
|
| 242 | + * @see client/html/common/decorators/default |
|
| 243 | + * @see client/html/checkout/standard/summary/option/decorators/excludes |
|
| 244 | + * @see client/html/checkout/standard/summary/option/decorators/global |
|
| 245 | + */ |
|
| 246 | 246 | |
| 247 | - return $this->createSubClient( 'checkout/standard/summary/option/' . $type, $name ); |
|
| 248 | - } |
|
| 247 | + return $this->createSubClient( 'checkout/standard/summary/option/' . $type, $name ); |
|
| 248 | + } |
|
| 249 | 249 | |
| 250 | 250 | |
| 251 | - /** |
|
| 252 | - * Returns the list of sub-client names configured for the client. |
|
| 253 | - * |
|
| 254 | - * @return array List of HTML client names |
|
| 255 | - */ |
|
| 256 | - protected function getSubClientNames() |
|
| 257 | - { |
|
| 258 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 259 | - } |
|
| 251 | + /** |
|
| 252 | + * Returns the list of sub-client names configured for the client. |
|
| 253 | + * |
|
| 254 | + * @return array List of HTML client names |
|
| 255 | + */ |
|
| 256 | + protected function getSubClientNames() |
|
| 257 | + { |
|
| 258 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 259 | + } |
|
| 260 | 260 | } |
| 261 | 261 | \ No newline at end of file |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | * @since 2014.03 |
| 68 | 68 | * @category Developer |
| 69 | 69 | */ |
| 70 | - private $subPartNames = array( 'terms' ); |
|
| 70 | + private $subPartNames = array('terms'); |
|
| 71 | 71 | |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -78,13 +78,13 @@ discard block |
||
| 78 | 78 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 79 | 79 | * @return string HTML code |
| 80 | 80 | */ |
| 81 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 81 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 82 | 82 | { |
| 83 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 83 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 84 | 84 | |
| 85 | 85 | $html = ''; |
| 86 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 87 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 86 | + foreach ($this->getSubClients() as $subclient) { |
|
| 87 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 88 | 88 | } |
| 89 | 89 | $view->optionBody = $html; |
| 90 | 90 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $tplconf = 'client/html/checkout/standard/summary/option/standard/template-body'; |
| 112 | 112 | $default = 'checkout/standard/summary-option-body-default.php'; |
| 113 | 113 | |
| 114 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 114 | + return $view->render($view->config($tplconf, $default)); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | |
@@ -123,13 +123,13 @@ discard block |
||
| 123 | 123 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 124 | 124 | * @return string|null String including HTML tags for the header on error |
| 125 | 125 | */ |
| 126 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 126 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 127 | 127 | { |
| 128 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 128 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 129 | 129 | |
| 130 | 130 | $html = ''; |
| 131 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 132 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 131 | + foreach ($this->getSubClients() as $subclient) { |
|
| 132 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 133 | 133 | } |
| 134 | 134 | $view->optionHeader = $html; |
| 135 | 135 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | $tplconf = 'client/html/checkout/standard/summary/option/standard/template-header'; |
| 158 | 158 | $default = 'checkout/standard/summary-option-header-default.php'; |
| 159 | 159 | |
| 160 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 160 | + return $view->render($view->config($tplconf, $default)); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | * @param string|null $name Name of the sub-client (Default if null) |
| 169 | 169 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 170 | 170 | */ |
| 171 | - public function getSubClient( $type, $name = null ) |
|
| 171 | + public function getSubClient($type, $name = null) |
|
| 172 | 172 | { |
| 173 | 173 | /** client/html/checkout/standard/summary/option/decorators/excludes |
| 174 | 174 | * Excludes decorators added by the "common" option from the checkout standard summary option html client |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | * @see client/html/checkout/standard/summary/option/decorators/global |
| 245 | 245 | */ |
| 246 | 246 | |
| 247 | - return $this->createSubClient( 'checkout/standard/summary/option/' . $type, $name ); |
|
| 247 | + return $this->createSubClient('checkout/standard/summary/option/'.$type, $name); |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | |
@@ -255,6 +255,6 @@ discard block |
||
| 255 | 255 | */ |
| 256 | 256 | protected function getSubClientNames() |
| 257 | 257 | { |
| 258 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 258 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | \ No newline at end of file |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |