@@ -18,232 +18,232 @@ |
||
| 18 | 18 | * @subpackage Html |
| 19 | 19 | */ |
| 20 | 20 | class Standard |
| 21 | - extends \Aimeos\Client\Html\Common\Summary\Address\Base |
|
| 21 | + extends \Aimeos\Client\Html\Common\Summary\Address\Base |
|
| 22 | 22 | { |
| 23 | - /** client/html/checkout/confirm/order/address/standard/subparts |
|
| 24 | - * List of HTML sub-clients rendered within the checkout confirm order address section |
|
| 25 | - * |
|
| 26 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 27 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 28 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 29 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 30 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 31 | - * the output that is placed inside the container of its parent. |
|
| 32 | - * |
|
| 33 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 34 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 35 | - * determines the order of the output of these sub-clients inside the parent |
|
| 36 | - * container. If the configured list of clients is |
|
| 37 | - * |
|
| 38 | - * array( "subclient1", "subclient2" ) |
|
| 39 | - * |
|
| 40 | - * you can easily change the order of the output by reordering the subparts: |
|
| 41 | - * |
|
| 42 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 43 | - * |
|
| 44 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 45 | - * |
|
| 46 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 47 | - * |
|
| 48 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 49 | - * should support adding, removing or reordering content by a fluid like |
|
| 50 | - * design. |
|
| 51 | - * |
|
| 52 | - * @param array List of sub-client names |
|
| 53 | - * @since 2015.11 |
|
| 54 | - * @category Developer |
|
| 55 | - */ |
|
| 56 | - private $subPartPath = 'client/html/checkout/confirm/order/address/standard/subparts'; |
|
| 57 | - private $subPartNames = array(); |
|
| 58 | - |
|
| 59 | - |
|
| 60 | - /** |
|
| 61 | - * Returns the HTML code for insertion into the body. |
|
| 62 | - * |
|
| 63 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 64 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 65 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 66 | - * @return string HTML code |
|
| 67 | - */ |
|
| 68 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 69 | - { |
|
| 70 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 71 | - |
|
| 72 | - $html = ''; |
|
| 73 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 74 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 75 | - } |
|
| 76 | - $view->addressBody = $html; |
|
| 77 | - |
|
| 78 | - /** client/html/checkout/confirm/order/address/standard/template-body |
|
| 79 | - * Relative path to the HTML body template of the checkout confirm order address client. |
|
| 80 | - * |
|
| 81 | - * The template file contains the HTML code and processing instructions |
|
| 82 | - * to generate the result shown in the body of the frontend. The |
|
| 83 | - * configuration string is the path to the template file relative |
|
| 84 | - * to the templates directory (usually in client/html/templates). |
|
| 85 | - * |
|
| 86 | - * You can overwrite the template file configuration in extensions and |
|
| 87 | - * provide alternative templates. These alternative templates should be |
|
| 88 | - * named like the default one but with the string "standard" replaced by |
|
| 89 | - * an unique name. You may use the name of your project for this. If |
|
| 90 | - * you've implemented an alternative client class as well, "standard" |
|
| 91 | - * (second one) should be replaced by the name of the new class in lower |
|
| 92 | - * case. |
|
| 93 | - * |
|
| 94 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 95 | - * @since 2015.11 |
|
| 96 | - * @category Developer |
|
| 97 | - * @see client/html/checkout/confirm/order/address/standard/template-header |
|
| 98 | - */ |
|
| 99 | - $tplconf = 'client/html/checkout/confirm/order/address/standard/template-body'; |
|
| 100 | - $default = 'common/summary/address-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->addressHeader = $html; |
|
| 123 | - |
|
| 124 | - /** client/html/checkout/confirm/order/address/standard/template-header |
|
| 125 | - * Relative path to the HTML header template of the checkout confirm order address 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 | - * (second one) should be replaced by the name of the new class in lower |
|
| 139 | - * case. |
|
| 140 | - * |
|
| 141 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | - * @since 2015.11 |
|
| 143 | - * @category Developer |
|
| 144 | - * @see client/html/checkout/confirm/order/address/standard/template-body |
|
| 145 | - */ |
|
| 146 | - $tplconf = 'client/html/checkout/confirm/order/address/standard/template-header'; |
|
| 147 | - $default = 'common/summary/address-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/order/address/decorators/excludes |
|
| 163 | - * Excludes decorators added by the "common" option from the checkout confirm 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/confirm/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/confirm/order/address/decorators/global |
|
| 185 | - * @see client/html/checkout/confirm/order/address/decorators/local |
|
| 186 | - */ |
|
| 187 | - |
|
| 188 | - /** client/html/checkout/confirm/order/address/decorators/global |
|
| 189 | - * Adds a list of globally available decorators only to the checkout confirm 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/confirm/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/confirm/order/address/decorators/excludes |
|
| 209 | - * @see client/html/checkout/confirm/order/address/decorators/local |
|
| 210 | - */ |
|
| 211 | - |
|
| 212 | - /** client/html/checkout/confirm/order/address/decorators/local |
|
| 213 | - * Adds a list of local decorators only to the checkout confirm 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/confirm/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/confirm/order/address/decorators/excludes |
|
| 233 | - * @see client/html/checkout/confirm/order/address/decorators/global |
|
| 234 | - */ |
|
| 235 | - |
|
| 236 | - return $this->createSubClient( 'checkout/confirm/order/address/' . $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 | - } |
|
| 23 | + /** client/html/checkout/confirm/order/address/standard/subparts |
|
| 24 | + * List of HTML sub-clients rendered within the checkout confirm order address section |
|
| 25 | + * |
|
| 26 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 27 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 28 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 29 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 30 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 31 | + * the output that is placed inside the container of its parent. |
|
| 32 | + * |
|
| 33 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 34 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 35 | + * determines the order of the output of these sub-clients inside the parent |
|
| 36 | + * container. If the configured list of clients is |
|
| 37 | + * |
|
| 38 | + * array( "subclient1", "subclient2" ) |
|
| 39 | + * |
|
| 40 | + * you can easily change the order of the output by reordering the subparts: |
|
| 41 | + * |
|
| 42 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 43 | + * |
|
| 44 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 45 | + * |
|
| 46 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 47 | + * |
|
| 48 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 49 | + * should support adding, removing or reordering content by a fluid like |
|
| 50 | + * design. |
|
| 51 | + * |
|
| 52 | + * @param array List of sub-client names |
|
| 53 | + * @since 2015.11 |
|
| 54 | + * @category Developer |
|
| 55 | + */ |
|
| 56 | + private $subPartPath = 'client/html/checkout/confirm/order/address/standard/subparts'; |
|
| 57 | + private $subPartNames = array(); |
|
| 58 | + |
|
| 59 | + |
|
| 60 | + /** |
|
| 61 | + * Returns the HTML code for insertion into the body. |
|
| 62 | + * |
|
| 63 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 64 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 65 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 66 | + * @return string HTML code |
|
| 67 | + */ |
|
| 68 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 69 | + { |
|
| 70 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 71 | + |
|
| 72 | + $html = ''; |
|
| 73 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 74 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 75 | + } |
|
| 76 | + $view->addressBody = $html; |
|
| 77 | + |
|
| 78 | + /** client/html/checkout/confirm/order/address/standard/template-body |
|
| 79 | + * Relative path to the HTML body template of the checkout confirm order address client. |
|
| 80 | + * |
|
| 81 | + * The template file contains the HTML code and processing instructions |
|
| 82 | + * to generate the result shown in the body of the frontend. The |
|
| 83 | + * configuration string is the path to the template file relative |
|
| 84 | + * to the templates directory (usually in client/html/templates). |
|
| 85 | + * |
|
| 86 | + * You can overwrite the template file configuration in extensions and |
|
| 87 | + * provide alternative templates. These alternative templates should be |
|
| 88 | + * named like the default one but with the string "standard" replaced by |
|
| 89 | + * an unique name. You may use the name of your project for this. If |
|
| 90 | + * you've implemented an alternative client class as well, "standard" |
|
| 91 | + * (second one) should be replaced by the name of the new class in lower |
|
| 92 | + * case. |
|
| 93 | + * |
|
| 94 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 95 | + * @since 2015.11 |
|
| 96 | + * @category Developer |
|
| 97 | + * @see client/html/checkout/confirm/order/address/standard/template-header |
|
| 98 | + */ |
|
| 99 | + $tplconf = 'client/html/checkout/confirm/order/address/standard/template-body'; |
|
| 100 | + $default = 'common/summary/address-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->addressHeader = $html; |
|
| 123 | + |
|
| 124 | + /** client/html/checkout/confirm/order/address/standard/template-header |
|
| 125 | + * Relative path to the HTML header template of the checkout confirm order address 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 | + * (second one) should be replaced by the name of the new class in lower |
|
| 139 | + * case. |
|
| 140 | + * |
|
| 141 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | + * @since 2015.11 |
|
| 143 | + * @category Developer |
|
| 144 | + * @see client/html/checkout/confirm/order/address/standard/template-body |
|
| 145 | + */ |
|
| 146 | + $tplconf = 'client/html/checkout/confirm/order/address/standard/template-header'; |
|
| 147 | + $default = 'common/summary/address-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/order/address/decorators/excludes |
|
| 163 | + * Excludes decorators added by the "common" option from the checkout confirm 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/confirm/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/confirm/order/address/decorators/global |
|
| 185 | + * @see client/html/checkout/confirm/order/address/decorators/local |
|
| 186 | + */ |
|
| 187 | + |
|
| 188 | + /** client/html/checkout/confirm/order/address/decorators/global |
|
| 189 | + * Adds a list of globally available decorators only to the checkout confirm 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/confirm/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/confirm/order/address/decorators/excludes |
|
| 209 | + * @see client/html/checkout/confirm/order/address/decorators/local |
|
| 210 | + */ |
|
| 211 | + |
|
| 212 | + /** client/html/checkout/confirm/order/address/decorators/local |
|
| 213 | + * Adds a list of local decorators only to the checkout confirm 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/confirm/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/confirm/order/address/decorators/excludes |
|
| 233 | + * @see client/html/checkout/confirm/order/address/decorators/global |
|
| 234 | + */ |
|
| 235 | + |
|
| 236 | + return $this->createSubClient( 'checkout/confirm/order/address/' . $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 |
@@ -19,69 +19,69 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Factory |
| 22 | - extends \Aimeos\Client\Html\Common\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** |
|
| 26 | - * Creates a confirm checkout client object. |
|
| 27 | - * |
|
| 28 | - * @param \Aimeos\MShop\Context\Item\Iface $context Shop context instance with necessary objects |
|
| 29 | - * @param array $templatePaths List of file system paths where the templates are stored |
|
| 30 | - * @param string|null $name Client name (default: "Standard") |
|
| 31 | - * @return \Aimeos\Client\Html\Iface Filter part implementing \Aimeos\Client\Html\Iface |
|
| 32 | - * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails |
|
| 33 | - */ |
|
| 34 | - public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null ) |
|
| 35 | - { |
|
| 36 | - /** client/html/checkout/confirm/name |
|
| 37 | - * Class name of the used checkout confirm client implementation |
|
| 38 | - * |
|
| 39 | - * Each default HTML client can be replace by an alternative imlementation. |
|
| 40 | - * To use this implementation, you have to set the last part of the class |
|
| 41 | - * name as configuration value so the client factory knows which class it |
|
| 42 | - * has to instantiate. |
|
| 43 | - * |
|
| 44 | - * For example, if the name of the default class is |
|
| 45 | - * |
|
| 46 | - * \Aimeos\Client\Html\Checkout\Confirm\Standard |
|
| 47 | - * |
|
| 48 | - * and you want to replace it with your own version named |
|
| 49 | - * |
|
| 50 | - * \Aimeos\Client\Html\Checkout\Confirm\Myconfirm |
|
| 51 | - * |
|
| 52 | - * then you have to set the this configuration option: |
|
| 53 | - * |
|
| 54 | - * client/html/checkout/confirm/name = Myconfirm |
|
| 55 | - * |
|
| 56 | - * The value is the last part of your own class name and it's case sensitive, |
|
| 57 | - * so take care that the configuration value is exactly named like the last |
|
| 58 | - * part of the class name. |
|
| 59 | - * |
|
| 60 | - * The allowed characters of the class name are A-Z, a-z and 0-9. No other |
|
| 61 | - * characters are possible! You should always start the last part of the class |
|
| 62 | - * name with an upper case character and continue only with lower case characters |
|
| 63 | - * or numbers. Avoid chamel case names like "MyConfirm"! |
|
| 64 | - * |
|
| 65 | - * @param string Last part of the class name |
|
| 66 | - * @since 2014.03 |
|
| 67 | - * @category Developer |
|
| 68 | - */ |
|
| 69 | - if( $name === null ) { |
|
| 70 | - $name = $context->getConfig()->get( 'client/html/checkout/confirm/name', 'Standard' ); |
|
| 71 | - } |
|
| 25 | + /** |
|
| 26 | + * Creates a confirm checkout client object. |
|
| 27 | + * |
|
| 28 | + * @param \Aimeos\MShop\Context\Item\Iface $context Shop context instance with necessary objects |
|
| 29 | + * @param array $templatePaths List of file system paths where the templates are stored |
|
| 30 | + * @param string|null $name Client name (default: "Standard") |
|
| 31 | + * @return \Aimeos\Client\Html\Iface Filter part implementing \Aimeos\Client\Html\Iface |
|
| 32 | + * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails |
|
| 33 | + */ |
|
| 34 | + public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null ) |
|
| 35 | + { |
|
| 36 | + /** client/html/checkout/confirm/name |
|
| 37 | + * Class name of the used checkout confirm client implementation |
|
| 38 | + * |
|
| 39 | + * Each default HTML client can be replace by an alternative imlementation. |
|
| 40 | + * To use this implementation, you have to set the last part of the class |
|
| 41 | + * name as configuration value so the client factory knows which class it |
|
| 42 | + * has to instantiate. |
|
| 43 | + * |
|
| 44 | + * For example, if the name of the default class is |
|
| 45 | + * |
|
| 46 | + * \Aimeos\Client\Html\Checkout\Confirm\Standard |
|
| 47 | + * |
|
| 48 | + * and you want to replace it with your own version named |
|
| 49 | + * |
|
| 50 | + * \Aimeos\Client\Html\Checkout\Confirm\Myconfirm |
|
| 51 | + * |
|
| 52 | + * then you have to set the this configuration option: |
|
| 53 | + * |
|
| 54 | + * client/html/checkout/confirm/name = Myconfirm |
|
| 55 | + * |
|
| 56 | + * The value is the last part of your own class name and it's case sensitive, |
|
| 57 | + * so take care that the configuration value is exactly named like the last |
|
| 58 | + * part of the class name. |
|
| 59 | + * |
|
| 60 | + * The allowed characters of the class name are A-Z, a-z and 0-9. No other |
|
| 61 | + * characters are possible! You should always start the last part of the class |
|
| 62 | + * name with an upper case character and continue only with lower case characters |
|
| 63 | + * or numbers. Avoid chamel case names like "MyConfirm"! |
|
| 64 | + * |
|
| 65 | + * @param string Last part of the class name |
|
| 66 | + * @since 2014.03 |
|
| 67 | + * @category Developer |
|
| 68 | + */ |
|
| 69 | + if( $name === null ) { |
|
| 70 | + $name = $context->getConfig()->get( 'client/html/checkout/confirm/name', 'Standard' ); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - if( ctype_alnum( $name ) === false ) |
|
| 74 | - { |
|
| 75 | - $classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Checkout\\Confirm\\' . $name : '<not a string>'; |
|
| 76 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 77 | - } |
|
| 73 | + if( ctype_alnum( $name ) === false ) |
|
| 74 | + { |
|
| 75 | + $classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Checkout\\Confirm\\' . $name : '<not a string>'; |
|
| 76 | + throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - $iface = '\\Aimeos\\Client\\Html\\Iface'; |
|
| 80 | - $classname = '\\Aimeos\\Client\\Html\\Checkout\\Confirm\\' . $name; |
|
| 79 | + $iface = '\\Aimeos\\Client\\Html\\Iface'; |
|
| 80 | + $classname = '\\Aimeos\\Client\\Html\\Checkout\\Confirm\\' . $name; |
|
| 81 | 81 | |
| 82 | - $client = self::createClientBase( $context, $classname, $iface, $templatePaths ); |
|
| 82 | + $client = self::createClientBase( $context, $classname, $iface, $templatePaths ); |
|
| 83 | 83 | |
| 84 | - return self::addClientDecorators( $context, $client, $templatePaths, 'checkout/confirm' ); |
|
| 85 | - } |
|
| 84 | + return self::addClientDecorators( $context, $client, $templatePaths, 'checkout/confirm' ); |
|
| 85 | + } |
|
| 86 | 86 | } |
| 87 | 87 | |
@@ -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 | } |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -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 |