@@ -19,263 +19,263 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Summary\Coupon\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Summary\Coupon\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/checkout/standard/summary/coupon/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the checkout standard summary coupon 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/coupon/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - private $cache; |
|
| 25 | + /** client/html/checkout/standard/summary/coupon/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the checkout standard summary coupon 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/coupon/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->couponBody = $html; |
|
| 75 | + $html = ''; |
|
| 76 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | + } |
|
| 79 | + $view->couponBody = $html; |
|
| 80 | 80 | |
| 81 | - /** client/html/checkout/standard/summary/coupon/standard/template-body |
|
| 82 | - * Relative path to the HTML body template of the checkout standard summary coupon 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/coupon/standard/template-header |
|
| 101 | - */ |
|
| 102 | - $tplconf = 'client/html/checkout/standard/summary/coupon/standard/template-body'; |
|
| 103 | - $default = 'common/summary/coupon-body-default.php'; |
|
| 81 | + /** client/html/checkout/standard/summary/coupon/standard/template-body |
|
| 82 | + * Relative path to the HTML body template of the checkout standard summary coupon 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/coupon/standard/template-header |
|
| 101 | + */ |
|
| 102 | + $tplconf = 'client/html/checkout/standard/summary/coupon/standard/template-body'; |
|
| 103 | + $default = 'common/summary/coupon-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->couponHeader = $html; |
|
| 121 | + $html = ''; |
|
| 122 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 124 | + } |
|
| 125 | + $view->couponHeader = $html; |
|
| 126 | 126 | |
| 127 | - /** client/html/checkout/standard/summary/coupon/standard/template-header |
|
| 128 | - * Relative path to the HTML header template of the checkout standard summary coupon 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/coupon/standard/template-body |
|
| 148 | - */ |
|
| 149 | - $tplconf = 'client/html/checkout/standard/summary/coupon/standard/template-header'; |
|
| 150 | - $default = 'common/summary/coupon-header-default.php'; |
|
| 127 | + /** client/html/checkout/standard/summary/coupon/standard/template-header |
|
| 128 | + * Relative path to the HTML header template of the checkout standard summary coupon 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/coupon/standard/template-body |
|
| 148 | + */ |
|
| 149 | + $tplconf = 'client/html/checkout/standard/summary/coupon/standard/template-header'; |
|
| 150 | + $default = 'common/summary/coupon-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/coupon/decorators/excludes |
|
| 166 | - * Excludes decorators added by the "common" option from the checkout standard summary coupon 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/coupon/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/coupon/decorators/global |
|
| 188 | - * @see client/html/checkout/standard/summary/coupon/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/coupon/decorators/excludes |
|
| 166 | + * Excludes decorators added by the "common" option from the checkout standard summary coupon 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/coupon/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/coupon/decorators/global |
|
| 188 | + * @see client/html/checkout/standard/summary/coupon/decorators/local |
|
| 189 | + */ |
|
| 190 | 190 | |
| 191 | - /** client/html/checkout/standard/summary/coupon/decorators/global |
|
| 192 | - * Adds a list of globally available decorators only to the checkout standard summary coupon 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/coupon/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/coupon/decorators/excludes |
|
| 212 | - * @see client/html/checkout/standard/summary/coupon/decorators/local |
|
| 213 | - */ |
|
| 191 | + /** client/html/checkout/standard/summary/coupon/decorators/global |
|
| 192 | + * Adds a list of globally available decorators only to the checkout standard summary coupon 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/coupon/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/coupon/decorators/excludes |
|
| 212 | + * @see client/html/checkout/standard/summary/coupon/decorators/local |
|
| 213 | + */ |
|
| 214 | 214 | |
| 215 | - /** client/html/checkout/standard/summary/coupon/decorators/local |
|
| 216 | - * Adds a list of local decorators only to the checkout standard summary coupon 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/coupon/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/coupon/decorators/excludes |
|
| 236 | - * @see client/html/checkout/standard/summary/coupon/decorators/global |
|
| 237 | - */ |
|
| 215 | + /** client/html/checkout/standard/summary/coupon/decorators/local |
|
| 216 | + * Adds a list of local decorators only to the checkout standard summary coupon 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/coupon/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/coupon/decorators/excludes |
|
| 236 | + * @see client/html/checkout/standard/summary/coupon/decorators/global |
|
| 237 | + */ |
|
| 238 | 238 | |
| 239 | - return $this->createSubClient( 'checkout/standard/summary/coupon/' . $type, $name ); |
|
| 240 | - } |
|
| 239 | + return $this->createSubClient( 'checkout/standard/summary/coupon/' . $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/basket/standard/url/target' ); |
|
| 269 | - $cntl = $view->config( 'client/html/basket/standard/url/controller', 'basket' ); |
|
| 270 | - $action = $view->config( 'client/html/basket/standard/url/action', 'index' ); |
|
| 271 | - $config = $view->config( 'client/html/basket/standard/url/config', array() ); |
|
| 266 | + if( !isset( $this->cache ) ) |
|
| 267 | + { |
|
| 268 | + $target = $view->config( 'client/html/basket/standard/url/target' ); |
|
| 269 | + $cntl = $view->config( 'client/html/basket/standard/url/controller', 'basket' ); |
|
| 270 | + $action = $view->config( 'client/html/basket/standard/url/action', 'index' ); |
|
| 271 | + $config = $view->config( 'client/html/basket/standard/url/config', array() ); |
|
| 272 | 272 | |
| 273 | - $view->summaryUrlCoupon = $view->url( $target, $cntl, $action, array(), array(), $config ); |
|
| 274 | - $view->summaryBasket = $view->standardBasket; |
|
| 273 | + $view->summaryUrlCoupon = $view->url( $target, $cntl, $action, array(), array(), $config ); |
|
| 274 | + $view->summaryBasket = $view->standardBasket; |
|
| 275 | 275 | |
| 276 | - $this->cache = $view; |
|
| 277 | - } |
|
| 276 | + $this->cache = $view; |
|
| 277 | + } |
|
| 278 | 278 | |
| 279 | - return $this->cache; |
|
| 280 | - } |
|
| 279 | + return $this->cache; |
|
| 280 | + } |
|
| 281 | 281 | } |
| 282 | 282 | \ No newline at end of file |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 69 | 69 | * @return string HTML code |
| 70 | 70 | */ |
| 71 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 72 | 72 | { |
| 73 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 74 | 74 | |
| 75 | 75 | $html = ''; |
| 76 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 76 | + foreach ($this->getSubClients() as $subclient) { |
|
| 77 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 78 | 78 | } |
| 79 | 79 | $view->couponBody = $html; |
| 80 | 80 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $tplconf = 'client/html/checkout/standard/summary/coupon/standard/template-body'; |
| 103 | 103 | $default = 'common/summary/coupon-body-default.php'; |
| 104 | 104 | |
| 105 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | + return $view->render($view->config($tplconf, $default)); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
@@ -114,13 +114,13 @@ discard block |
||
| 114 | 114 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 115 | 115 | * @return string|null String including HTML tags for the header on error |
| 116 | 116 | */ |
| 117 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 118 | 118 | { |
| 119 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 119 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 120 | 120 | |
| 121 | 121 | $html = ''; |
| 122 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | + foreach ($this->getSubClients() as $subclient) { |
|
| 123 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 124 | 124 | } |
| 125 | 125 | $view->couponHeader = $html; |
| 126 | 126 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $tplconf = 'client/html/checkout/standard/summary/coupon/standard/template-header'; |
| 150 | 150 | $default = 'common/summary/coupon-header-default.php'; |
| 151 | 151 | |
| 152 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 152 | + return $view->render($view->config($tplconf, $default)); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @param string|null $name Name of the sub-client (Default if null) |
| 161 | 161 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 162 | 162 | */ |
| 163 | - public function getSubClient( $type, $name = null ) |
|
| 163 | + public function getSubClient($type, $name = null) |
|
| 164 | 164 | { |
| 165 | 165 | /** client/html/checkout/standard/summary/coupon/decorators/excludes |
| 166 | 166 | * Excludes decorators added by the "common" option from the checkout standard summary coupon html client |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * @see client/html/checkout/standard/summary/coupon/decorators/global |
| 237 | 237 | */ |
| 238 | 238 | |
| 239 | - return $this->createSubClient( 'checkout/standard/summary/coupon/' . $type, $name ); |
|
| 239 | + return $this->createSubClient('checkout/standard/summary/coupon/'.$type, $name); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | protected function getSubClientNames() |
| 249 | 249 | { |
| 250 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 250 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | |
@@ -259,18 +259,18 @@ discard block |
||
| 259 | 259 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 260 | 260 | * @return \Aimeos\MW\View\Iface Modified view object |
| 261 | 261 | */ |
| 262 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 262 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 263 | 263 | { |
| 264 | - $view = parent::setViewParams( $view, $tags, $expire ); |
|
| 264 | + $view = parent::setViewParams($view, $tags, $expire); |
|
| 265 | 265 | |
| 266 | - if( !isset( $this->cache ) ) |
|
| 266 | + if (!isset($this->cache)) |
|
| 267 | 267 | { |
| 268 | - $target = $view->config( 'client/html/basket/standard/url/target' ); |
|
| 269 | - $cntl = $view->config( 'client/html/basket/standard/url/controller', 'basket' ); |
|
| 270 | - $action = $view->config( 'client/html/basket/standard/url/action', 'index' ); |
|
| 271 | - $config = $view->config( 'client/html/basket/standard/url/config', array() ); |
|
| 268 | + $target = $view->config('client/html/basket/standard/url/target'); |
|
| 269 | + $cntl = $view->config('client/html/basket/standard/url/controller', 'basket'); |
|
| 270 | + $action = $view->config('client/html/basket/standard/url/action', 'index'); |
|
| 271 | + $config = $view->config('client/html/basket/standard/url/config', array()); |
|
| 272 | 272 | |
| 273 | - $view->summaryUrlCoupon = $view->url( $target, $cntl, $action, array(), array(), $config ); |
|
| 273 | + $view->summaryUrlCoupon = $view->url($target, $cntl, $action, array(), array(), $config); |
|
| 274 | 274 | $view->summaryBasket = $view->standardBasket; |
| 275 | 275 | |
| 276 | 276 | $this->cache = $view; |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -19,273 +19,273 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Summary\Detail\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Summary\Detail\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/checkout/standard/summary/detail/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the checkout standard summary detail 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/detail/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - private $cache; |
|
| 25 | + /** client/html/checkout/standard/summary/detail/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the checkout standard summary detail 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/detail/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->detailBody = $html; |
|
| 75 | + $html = ''; |
|
| 76 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | + } |
|
| 79 | + $view->detailBody = $html; |
|
| 80 | 80 | |
| 81 | - /** client/html/checkout/standard/summary/detail/standard/template-body |
|
| 82 | - * Relative path to the HTML body template of the checkout standard summary detail 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/detail/standard/template-header |
|
| 101 | - */ |
|
| 102 | - $tplconf = 'client/html/checkout/standard/summary/detail/standard/template-body'; |
|
| 103 | - $default = 'common/summary/detail-body-default.php'; |
|
| 81 | + /** client/html/checkout/standard/summary/detail/standard/template-body |
|
| 82 | + * Relative path to the HTML body template of the checkout standard summary detail 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/detail/standard/template-header |
|
| 101 | + */ |
|
| 102 | + $tplconf = 'client/html/checkout/standard/summary/detail/standard/template-body'; |
|
| 103 | + $default = 'common/summary/detail-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->detailHeader = $html; |
|
| 121 | + $html = ''; |
|
| 122 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 124 | + } |
|
| 125 | + $view->detailHeader = $html; |
|
| 126 | 126 | |
| 127 | - /** client/html/checkout/standard/summary/detail/standard/template-header |
|
| 128 | - * Relative path to the HTML header template of the checkout standard summary detail 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/detail/standard/template-body |
|
| 148 | - */ |
|
| 149 | - $tplconf = 'client/html/checkout/standard/summary/detail/standard/template-header'; |
|
| 150 | - $default = 'common/summary/detail-header-default.php'; |
|
| 127 | + /** client/html/checkout/standard/summary/detail/standard/template-header |
|
| 128 | + * Relative path to the HTML header template of the checkout standard summary detail 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/detail/standard/template-body |
|
| 148 | + */ |
|
| 149 | + $tplconf = 'client/html/checkout/standard/summary/detail/standard/template-header'; |
|
| 150 | + $default = 'common/summary/detail-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/detail/decorators/excludes |
|
| 166 | - * Excludes decorators added by the "common" option from the checkout standard summary detail 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/detail/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/detail/decorators/global |
|
| 188 | - * @see client/html/checkout/standard/summary/detail/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/detail/decorators/excludes |
|
| 166 | + * Excludes decorators added by the "common" option from the checkout standard summary detail 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/detail/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/detail/decorators/global |
|
| 188 | + * @see client/html/checkout/standard/summary/detail/decorators/local |
|
| 189 | + */ |
|
| 190 | 190 | |
| 191 | - /** client/html/checkout/standard/summary/detail/decorators/global |
|
| 192 | - * Adds a list of globally available decorators only to the checkout standard summary detail 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/detail/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/detail/decorators/excludes |
|
| 212 | - * @see client/html/checkout/standard/summary/detail/decorators/local |
|
| 213 | - */ |
|
| 191 | + /** client/html/checkout/standard/summary/detail/decorators/global |
|
| 192 | + * Adds a list of globally available decorators only to the checkout standard summary detail 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/detail/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/detail/decorators/excludes |
|
| 212 | + * @see client/html/checkout/standard/summary/detail/decorators/local |
|
| 213 | + */ |
|
| 214 | 214 | |
| 215 | - /** client/html/checkout/standard/summary/detail/decorators/local |
|
| 216 | - * Adds a list of local decorators only to the checkout standard summary detail 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/detail/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/detail/decorators/excludes |
|
| 236 | - * @see client/html/checkout/standard/summary/detail/decorators/global |
|
| 237 | - */ |
|
| 215 | + /** client/html/checkout/standard/summary/detail/decorators/local |
|
| 216 | + * Adds a list of local decorators only to the checkout standard summary detail 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/detail/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/detail/decorators/excludes |
|
| 236 | + * @see client/html/checkout/standard/summary/detail/decorators/global |
|
| 237 | + */ |
|
| 238 | 238 | |
| 239 | - return $this->createSubClient( 'checkout/standard/summary/detail/' . $type, $name ); |
|
| 240 | - } |
|
| 239 | + return $this->createSubClient( 'checkout/standard/summary/detail/' . $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 | - $basket = $view->standardBasket; |
|
| 266 | + if( !isset( $this->cache ) ) |
|
| 267 | + { |
|
| 268 | + $basket = $view->standardBasket; |
|
| 269 | 269 | |
| 270 | - $bTarget = $view->config( 'client/html/basket/standard/url/target' ); |
|
| 271 | - $bCntl = $view->config( 'client/html/basket/standard/url/controller', 'basket' ); |
|
| 272 | - $bAction = $view->config( 'client/html/basket/standard/url/action', 'index' ); |
|
| 273 | - $bConfig = $view->config( 'client/html/basket/standard/url/config', array() ); |
|
| 270 | + $bTarget = $view->config( 'client/html/basket/standard/url/target' ); |
|
| 271 | + $bCntl = $view->config( 'client/html/basket/standard/url/controller', 'basket' ); |
|
| 272 | + $bAction = $view->config( 'client/html/basket/standard/url/action', 'index' ); |
|
| 273 | + $bConfig = $view->config( 'client/html/basket/standard/url/config', array() ); |
|
| 274 | 274 | |
| 275 | - $target = $view->config( 'client/html/checkout/standard/url/target' ); |
|
| 276 | - $cntl = $view->config( 'client/html/checkout/standard/url/controller', 'checkout' ); |
|
| 277 | - $action = $view->config( 'client/html/checkout/standard/url/action', 'index' ); |
|
| 278 | - $config = $view->config( 'client/html/checkout/standard/url/config', array() ); |
|
| 275 | + $target = $view->config( 'client/html/checkout/standard/url/target' ); |
|
| 276 | + $cntl = $view->config( 'client/html/checkout/standard/url/controller', 'checkout' ); |
|
| 277 | + $action = $view->config( 'client/html/checkout/standard/url/action', 'index' ); |
|
| 278 | + $config = $view->config( 'client/html/checkout/standard/url/config', array() ); |
|
| 279 | 279 | |
| 280 | - $view->summaryUrlServicePayment = $view->url( $target, $cntl, $action, array( 'c_step' => 'payment' ), array(), $config ); |
|
| 281 | - $view->summaryUrlServiceDelivery = $view->url( $target, $cntl, $action, array( 'c_step' => 'delivery' ), array(), $config ); |
|
| 282 | - $view->summaryUrlBasket = $view->url( $bTarget, $bCntl, $bAction, array(), array(), $bConfig ); |
|
| 283 | - $view->summaryTaxRates = $this->getTaxRates( $basket ); |
|
| 284 | - $view->summaryBasket = $basket; |
|
| 280 | + $view->summaryUrlServicePayment = $view->url( $target, $cntl, $action, array( 'c_step' => 'payment' ), array(), $config ); |
|
| 281 | + $view->summaryUrlServiceDelivery = $view->url( $target, $cntl, $action, array( 'c_step' => 'delivery' ), array(), $config ); |
|
| 282 | + $view->summaryUrlBasket = $view->url( $bTarget, $bCntl, $bAction, array(), array(), $bConfig ); |
|
| 283 | + $view->summaryTaxRates = $this->getTaxRates( $basket ); |
|
| 284 | + $view->summaryBasket = $basket; |
|
| 285 | 285 | |
| 286 | - $this->cache = $view; |
|
| 287 | - } |
|
| 286 | + $this->cache = $view; |
|
| 287 | + } |
|
| 288 | 288 | |
| 289 | - return $this->cache; |
|
| 290 | - } |
|
| 289 | + return $this->cache; |
|
| 290 | + } |
|
| 291 | 291 | } |
| 292 | 292 | \ No newline at end of file |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 69 | 69 | * @return string HTML code |
| 70 | 70 | */ |
| 71 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 72 | 72 | { |
| 73 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 74 | 74 | |
| 75 | 75 | $html = ''; |
| 76 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 76 | + foreach ($this->getSubClients() as $subclient) { |
|
| 77 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 78 | 78 | } |
| 79 | 79 | $view->detailBody = $html; |
| 80 | 80 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $tplconf = 'client/html/checkout/standard/summary/detail/standard/template-body'; |
| 103 | 103 | $default = 'common/summary/detail-body-default.php'; |
| 104 | 104 | |
| 105 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | + return $view->render($view->config($tplconf, $default)); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
@@ -114,13 +114,13 @@ discard block |
||
| 114 | 114 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 115 | 115 | * @return string|null String including HTML tags for the header on error |
| 116 | 116 | */ |
| 117 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 118 | 118 | { |
| 119 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 119 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 120 | 120 | |
| 121 | 121 | $html = ''; |
| 122 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | + foreach ($this->getSubClients() as $subclient) { |
|
| 123 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 124 | 124 | } |
| 125 | 125 | $view->detailHeader = $html; |
| 126 | 126 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $tplconf = 'client/html/checkout/standard/summary/detail/standard/template-header'; |
| 150 | 150 | $default = 'common/summary/detail-header-default.php'; |
| 151 | 151 | |
| 152 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 152 | + return $view->render($view->config($tplconf, $default)); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @param string|null $name Name of the sub-client (Default if null) |
| 161 | 161 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 162 | 162 | */ |
| 163 | - public function getSubClient( $type, $name = null ) |
|
| 163 | + public function getSubClient($type, $name = null) |
|
| 164 | 164 | { |
| 165 | 165 | /** client/html/checkout/standard/summary/detail/decorators/excludes |
| 166 | 166 | * Excludes decorators added by the "common" option from the checkout standard summary detail html client |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * @see client/html/checkout/standard/summary/detail/decorators/global |
| 237 | 237 | */ |
| 238 | 238 | |
| 239 | - return $this->createSubClient( 'checkout/standard/summary/detail/' . $type, $name ); |
|
| 239 | + return $this->createSubClient('checkout/standard/summary/detail/'.$type, $name); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | protected function getSubClientNames() |
| 249 | 249 | { |
| 250 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 250 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | |
@@ -259,28 +259,28 @@ discard block |
||
| 259 | 259 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 260 | 260 | * @return \Aimeos\MW\View\Iface Modified view object |
| 261 | 261 | */ |
| 262 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 262 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 263 | 263 | { |
| 264 | - $view = parent::setViewParams( $view, $tags, $expire ); |
|
| 264 | + $view = parent::setViewParams($view, $tags, $expire); |
|
| 265 | 265 | |
| 266 | - if( !isset( $this->cache ) ) |
|
| 266 | + if (!isset($this->cache)) |
|
| 267 | 267 | { |
| 268 | 268 | $basket = $view->standardBasket; |
| 269 | 269 | |
| 270 | - $bTarget = $view->config( 'client/html/basket/standard/url/target' ); |
|
| 271 | - $bCntl = $view->config( 'client/html/basket/standard/url/controller', 'basket' ); |
|
| 272 | - $bAction = $view->config( 'client/html/basket/standard/url/action', 'index' ); |
|
| 273 | - $bConfig = $view->config( 'client/html/basket/standard/url/config', array() ); |
|
| 270 | + $bTarget = $view->config('client/html/basket/standard/url/target'); |
|
| 271 | + $bCntl = $view->config('client/html/basket/standard/url/controller', 'basket'); |
|
| 272 | + $bAction = $view->config('client/html/basket/standard/url/action', 'index'); |
|
| 273 | + $bConfig = $view->config('client/html/basket/standard/url/config', array()); |
|
| 274 | 274 | |
| 275 | - $target = $view->config( 'client/html/checkout/standard/url/target' ); |
|
| 276 | - $cntl = $view->config( 'client/html/checkout/standard/url/controller', 'checkout' ); |
|
| 277 | - $action = $view->config( 'client/html/checkout/standard/url/action', 'index' ); |
|
| 278 | - $config = $view->config( 'client/html/checkout/standard/url/config', array() ); |
|
| 275 | + $target = $view->config('client/html/checkout/standard/url/target'); |
|
| 276 | + $cntl = $view->config('client/html/checkout/standard/url/controller', 'checkout'); |
|
| 277 | + $action = $view->config('client/html/checkout/standard/url/action', 'index'); |
|
| 278 | + $config = $view->config('client/html/checkout/standard/url/config', array()); |
|
| 279 | 279 | |
| 280 | - $view->summaryUrlServicePayment = $view->url( $target, $cntl, $action, array( 'c_step' => 'payment' ), array(), $config ); |
|
| 281 | - $view->summaryUrlServiceDelivery = $view->url( $target, $cntl, $action, array( 'c_step' => 'delivery' ), array(), $config ); |
|
| 282 | - $view->summaryUrlBasket = $view->url( $bTarget, $bCntl, $bAction, array(), array(), $bConfig ); |
|
| 283 | - $view->summaryTaxRates = $this->getTaxRates( $basket ); |
|
| 280 | + $view->summaryUrlServicePayment = $view->url($target, $cntl, $action, array('c_step' => 'payment'), array(), $config); |
|
| 281 | + $view->summaryUrlServiceDelivery = $view->url($target, $cntl, $action, array('c_step' => 'delivery'), array(), $config); |
|
| 282 | + $view->summaryUrlBasket = $view->url($bTarget, $bCntl, $bAction, array(), array(), $bConfig); |
|
| 283 | + $view->summaryTaxRates = $this->getTaxRates($basket); |
|
| 284 | 284 | $view->summaryBasket = $basket; |
| 285 | 285 | |
| 286 | 286 | $this->cache = $view; |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -23,330 +23,330 @@ |
||
| 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/summary/standard/subparts |
|
| 30 | - * List of HTML sub-clients rendered within the checkout standard summary 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/summary/standard/subparts'; |
|
| 63 | - |
|
| 64 | - /** client/html/checkout/standard/summary/address/name |
|
| 65 | - * Name of the address part used by the checkout standard summary client implementation |
|
| 66 | - * |
|
| 67 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Summary\Address\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 2014.03 |
|
| 72 | - * @category Developer |
|
| 73 | - */ |
|
| 74 | - |
|
| 75 | - /** client/html/checkout/standard/summary/service/name |
|
| 76 | - * Name of the service part used by the checkout standard summary client implementation |
|
| 77 | - * |
|
| 78 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Summary\Service\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 | - |
|
| 86 | - /** client/html/checkout/standard/summary/coupon/name |
|
| 87 | - * Name of the coupon part used by the checkout standard summary client implementation |
|
| 88 | - * |
|
| 89 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Summary\Coupon\Myname". |
|
| 90 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 91 | - * |
|
| 92 | - * @param string Last part of the client class name |
|
| 93 | - * @since 2014.03 |
|
| 94 | - * @category Developer |
|
| 95 | - */ |
|
| 96 | - |
|
| 97 | - /** client/html/checkout/standard/summary/option/name |
|
| 98 | - * Name of the option part used by the checkout standard summary client implementation |
|
| 99 | - * |
|
| 100 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Summary\Option\Myname". |
|
| 101 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 102 | - * |
|
| 103 | - * @param string Last part of the client class name |
|
| 104 | - * @since 2014.03 |
|
| 105 | - * @category Developer |
|
| 106 | - */ |
|
| 107 | - |
|
| 108 | - /** client/html/checkout/standard/summary/detail/name |
|
| 109 | - * Name of the detail part used by the checkout standard summary client implementation |
|
| 110 | - * |
|
| 111 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Summary\Detail\Myname". |
|
| 112 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 113 | - * |
|
| 114 | - * @param string Last part of the client class name |
|
| 115 | - * @since 2014.03 |
|
| 116 | - * @category Developer |
|
| 117 | - */ |
|
| 118 | - private $subPartNames = array( 'address', 'service', 'coupon', 'option', 'detail' ); |
|
| 119 | - |
|
| 120 | - |
|
| 121 | - /** |
|
| 122 | - * Returns the HTML code for insertion into the body. |
|
| 123 | - * |
|
| 124 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 125 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 126 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 127 | - * @return string HTML code |
|
| 128 | - */ |
|
| 129 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 130 | - { |
|
| 131 | - $view = $this->getView(); |
|
| 132 | - $step = $view->get( 'standardStepActive' ); |
|
| 133 | - $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 134 | - |
|
| 135 | - if( $step != 'summary' && !( in_array( 'summary', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 136 | - return ''; |
|
| 137 | - } |
|
| 138 | - |
|
| 139 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 140 | - |
|
| 141 | - $html = ''; |
|
| 142 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 143 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 144 | - } |
|
| 145 | - $view->summaryBody = $html; |
|
| 146 | - |
|
| 147 | - /** client/html/checkout/standard/summary/standard/template-body |
|
| 148 | - * Relative path to the HTML body template of the checkout standard summary client. |
|
| 149 | - * |
|
| 150 | - * The template file contains the HTML code and processing instructions |
|
| 151 | - * to generate the result shown in the body of the frontend. The |
|
| 152 | - * configuration string is the path to the template file relative |
|
| 153 | - * to the templates directory (usually in client/html/templates). |
|
| 154 | - * |
|
| 155 | - * You can overwrite the template file configuration in extensions and |
|
| 156 | - * provide alternative templates. These alternative templates should be |
|
| 157 | - * named like the default one but with the string "standard" replaced by |
|
| 158 | - * an unique name. You may use the name of your project for this. If |
|
| 159 | - * you've implemented an alternative client class as well, "standard" |
|
| 160 | - * should be replaced by the name of the new class. |
|
| 161 | - * |
|
| 162 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 163 | - * @since 2014.03 |
|
| 164 | - * @category Developer |
|
| 165 | - * @see client/html/checkout/standard/summary/standard/template-header |
|
| 166 | - */ |
|
| 167 | - $tplconf = 'client/html/checkout/standard/summary/standard/template-body'; |
|
| 168 | - $default = 'checkout/standard/summary-body-default.php'; |
|
| 169 | - |
|
| 170 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - |
|
| 174 | - /** |
|
| 175 | - * Returns the HTML string for insertion into the header. |
|
| 176 | - * |
|
| 177 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 178 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 179 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 180 | - * @return string|null String including HTML tags for the header on error |
|
| 181 | - */ |
|
| 182 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 183 | - { |
|
| 184 | - $view = $this->getView(); |
|
| 185 | - $step = $view->get( 'standardStepActive' ); |
|
| 186 | - $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 187 | - |
|
| 188 | - if( $step != 'summary' && !( in_array( 'summary', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 189 | - return ''; |
|
| 190 | - } |
|
| 191 | - |
|
| 192 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 193 | - |
|
| 194 | - $html = ''; |
|
| 195 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 196 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 197 | - } |
|
| 198 | - $view->summaryHeader = $html; |
|
| 199 | - |
|
| 200 | - /** client/html/checkout/standard/summary/standard/template-header |
|
| 201 | - * Relative path to the HTML header template of the checkout standard summary 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/standard/summary/standard/template-body |
|
| 220 | - */ |
|
| 221 | - $tplconf = 'client/html/checkout/standard/summary/standard/template-header'; |
|
| 222 | - $default = 'checkout/standard/summary-header-default.php'; |
|
| 223 | - |
|
| 224 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 225 | - } |
|
| 226 | - |
|
| 227 | - |
|
| 228 | - /** |
|
| 229 | - * Returns the sub-client given by its name. |
|
| 230 | - * |
|
| 231 | - * @param string $type Name of the client type |
|
| 232 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 233 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 234 | - */ |
|
| 235 | - public function getSubClient( $type, $name = null ) |
|
| 236 | - { |
|
| 237 | - /** client/html/checkout/standard/summary/decorators/excludes |
|
| 238 | - * Excludes decorators added by the "common" option from the checkout standard summary html client |
|
| 239 | - * |
|
| 240 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 241 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 242 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 243 | - * modify what is returned to the caller. |
|
| 244 | - * |
|
| 245 | - * This option allows you to remove a decorator added via |
|
| 246 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 247 | - * around the html client. |
|
| 248 | - * |
|
| 249 | - * client/html/checkout/standard/summary/decorators/excludes = array( 'decorator1' ) |
|
| 250 | - * |
|
| 251 | - * This would remove the decorator named "decorator1" from the list of |
|
| 252 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 253 | - * "client/html/common/decorators/default" to the html client. |
|
| 254 | - * |
|
| 255 | - * @param array List of decorator names |
|
| 256 | - * @since 2015.08 |
|
| 257 | - * @category Developer |
|
| 258 | - * @see client/html/common/decorators/default |
|
| 259 | - * @see client/html/checkout/standard/summary/decorators/global |
|
| 260 | - * @see client/html/checkout/standard/summary/decorators/local |
|
| 261 | - */ |
|
| 262 | - |
|
| 263 | - /** client/html/checkout/standard/summary/decorators/global |
|
| 264 | - * Adds a list of globally available decorators only to the checkout standard summary html client |
|
| 265 | - * |
|
| 266 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 267 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 268 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 269 | - * modify what is returned to the caller. |
|
| 270 | - * |
|
| 271 | - * This option allows you to wrap global decorators |
|
| 272 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 273 | - * |
|
| 274 | - * client/html/checkout/standard/summary/decorators/global = array( 'decorator1' ) |
|
| 275 | - * |
|
| 276 | - * This would add the decorator named "decorator1" defined by |
|
| 277 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 278 | - * |
|
| 279 | - * @param array List of decorator names |
|
| 280 | - * @since 2015.08 |
|
| 281 | - * @category Developer |
|
| 282 | - * @see client/html/common/decorators/default |
|
| 283 | - * @see client/html/checkout/standard/summary/decorators/excludes |
|
| 284 | - * @see client/html/checkout/standard/summary/decorators/local |
|
| 285 | - */ |
|
| 286 | - |
|
| 287 | - /** client/html/checkout/standard/summary/decorators/local |
|
| 288 | - * Adds a list of local decorators only to the checkout standard summary html client |
|
| 289 | - * |
|
| 290 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 291 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 292 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 293 | - * modify what is returned to the caller. |
|
| 294 | - * |
|
| 295 | - * This option allows you to wrap local decorators |
|
| 296 | - * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 297 | - * |
|
| 298 | - * client/html/checkout/standard/summary/decorators/local = array( 'decorator2' ) |
|
| 299 | - * |
|
| 300 | - * This would add the decorator named "decorator2" defined by |
|
| 301 | - * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 302 | - * |
|
| 303 | - * @param array List of decorator names |
|
| 304 | - * @since 2015.08 |
|
| 305 | - * @category Developer |
|
| 306 | - * @see client/html/common/decorators/default |
|
| 307 | - * @see client/html/checkout/standard/summary/decorators/excludes |
|
| 308 | - * @see client/html/checkout/standard/summary/decorators/global |
|
| 309 | - */ |
|
| 310 | - |
|
| 311 | - return $this->createSubClient( 'checkout/standard/summary/' . $type, $name ); |
|
| 312 | - } |
|
| 313 | - |
|
| 314 | - |
|
| 315 | - /** |
|
| 316 | - * Processes the input, e.g. store given values. |
|
| 317 | - * A view must be available and this method doesn't generate any output |
|
| 318 | - * besides setting view variables. |
|
| 319 | - */ |
|
| 320 | - public function process() |
|
| 321 | - { |
|
| 322 | - $view = $this->getView(); |
|
| 323 | - |
|
| 324 | - if( $view->param( 'cs_order', null ) === null ) { |
|
| 325 | - return; |
|
| 326 | - } |
|
| 327 | - |
|
| 328 | - try |
|
| 329 | - { |
|
| 330 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'basket' ); |
|
| 331 | - $controller->get()->check( \Aimeos\MShop\Order\Item\Base\Base::PARTS_ALL ); |
|
| 332 | - |
|
| 333 | - parent::process(); |
|
| 334 | - } |
|
| 335 | - catch( \Exception $e ) |
|
| 336 | - { |
|
| 337 | - $view->standardStepActive = 'summary'; |
|
| 338 | - throw $e; |
|
| 339 | - } |
|
| 340 | - } |
|
| 341 | - |
|
| 342 | - |
|
| 343 | - /** |
|
| 344 | - * Returns the list of sub-client names configured for the client. |
|
| 345 | - * |
|
| 346 | - * @return array List of HTML client names |
|
| 347 | - */ |
|
| 348 | - protected function getSubClientNames() |
|
| 349 | - { |
|
| 350 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 351 | - } |
|
| 29 | + /** client/html/checkout/standard/summary/standard/subparts |
|
| 30 | + * List of HTML sub-clients rendered within the checkout standard summary 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/summary/standard/subparts'; |
|
| 63 | + |
|
| 64 | + /** client/html/checkout/standard/summary/address/name |
|
| 65 | + * Name of the address part used by the checkout standard summary client implementation |
|
| 66 | + * |
|
| 67 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Summary\Address\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 2014.03 |
|
| 72 | + * @category Developer |
|
| 73 | + */ |
|
| 74 | + |
|
| 75 | + /** client/html/checkout/standard/summary/service/name |
|
| 76 | + * Name of the service part used by the checkout standard summary client implementation |
|
| 77 | + * |
|
| 78 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Summary\Service\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 | + |
|
| 86 | + /** client/html/checkout/standard/summary/coupon/name |
|
| 87 | + * Name of the coupon part used by the checkout standard summary client implementation |
|
| 88 | + * |
|
| 89 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Summary\Coupon\Myname". |
|
| 90 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 91 | + * |
|
| 92 | + * @param string Last part of the client class name |
|
| 93 | + * @since 2014.03 |
|
| 94 | + * @category Developer |
|
| 95 | + */ |
|
| 96 | + |
|
| 97 | + /** client/html/checkout/standard/summary/option/name |
|
| 98 | + * Name of the option part used by the checkout standard summary client implementation |
|
| 99 | + * |
|
| 100 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Summary\Option\Myname". |
|
| 101 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 102 | + * |
|
| 103 | + * @param string Last part of the client class name |
|
| 104 | + * @since 2014.03 |
|
| 105 | + * @category Developer |
|
| 106 | + */ |
|
| 107 | + |
|
| 108 | + /** client/html/checkout/standard/summary/detail/name |
|
| 109 | + * Name of the detail part used by the checkout standard summary client implementation |
|
| 110 | + * |
|
| 111 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Summary\Detail\Myname". |
|
| 112 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 113 | + * |
|
| 114 | + * @param string Last part of the client class name |
|
| 115 | + * @since 2014.03 |
|
| 116 | + * @category Developer |
|
| 117 | + */ |
|
| 118 | + private $subPartNames = array( 'address', 'service', 'coupon', 'option', 'detail' ); |
|
| 119 | + |
|
| 120 | + |
|
| 121 | + /** |
|
| 122 | + * Returns the HTML code for insertion into the body. |
|
| 123 | + * |
|
| 124 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 125 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 126 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 127 | + * @return string HTML code |
|
| 128 | + */ |
|
| 129 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 130 | + { |
|
| 131 | + $view = $this->getView(); |
|
| 132 | + $step = $view->get( 'standardStepActive' ); |
|
| 133 | + $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 134 | + |
|
| 135 | + if( $step != 'summary' && !( in_array( 'summary', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 136 | + return ''; |
|
| 137 | + } |
|
| 138 | + |
|
| 139 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 140 | + |
|
| 141 | + $html = ''; |
|
| 142 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 143 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 144 | + } |
|
| 145 | + $view->summaryBody = $html; |
|
| 146 | + |
|
| 147 | + /** client/html/checkout/standard/summary/standard/template-body |
|
| 148 | + * Relative path to the HTML body template of the checkout standard summary client. |
|
| 149 | + * |
|
| 150 | + * The template file contains the HTML code and processing instructions |
|
| 151 | + * to generate the result shown in the body of the frontend. The |
|
| 152 | + * configuration string is the path to the template file relative |
|
| 153 | + * to the templates directory (usually in client/html/templates). |
|
| 154 | + * |
|
| 155 | + * You can overwrite the template file configuration in extensions and |
|
| 156 | + * provide alternative templates. These alternative templates should be |
|
| 157 | + * named like the default one but with the string "standard" replaced by |
|
| 158 | + * an unique name. You may use the name of your project for this. If |
|
| 159 | + * you've implemented an alternative client class as well, "standard" |
|
| 160 | + * should be replaced by the name of the new class. |
|
| 161 | + * |
|
| 162 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 163 | + * @since 2014.03 |
|
| 164 | + * @category Developer |
|
| 165 | + * @see client/html/checkout/standard/summary/standard/template-header |
|
| 166 | + */ |
|
| 167 | + $tplconf = 'client/html/checkout/standard/summary/standard/template-body'; |
|
| 168 | + $default = 'checkout/standard/summary-body-default.php'; |
|
| 169 | + |
|
| 170 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + |
|
| 174 | + /** |
|
| 175 | + * Returns the HTML string for insertion into the header. |
|
| 176 | + * |
|
| 177 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 178 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 179 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 180 | + * @return string|null String including HTML tags for the header on error |
|
| 181 | + */ |
|
| 182 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 183 | + { |
|
| 184 | + $view = $this->getView(); |
|
| 185 | + $step = $view->get( 'standardStepActive' ); |
|
| 186 | + $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 187 | + |
|
| 188 | + if( $step != 'summary' && !( in_array( 'summary', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 189 | + return ''; |
|
| 190 | + } |
|
| 191 | + |
|
| 192 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 193 | + |
|
| 194 | + $html = ''; |
|
| 195 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 196 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 197 | + } |
|
| 198 | + $view->summaryHeader = $html; |
|
| 199 | + |
|
| 200 | + /** client/html/checkout/standard/summary/standard/template-header |
|
| 201 | + * Relative path to the HTML header template of the checkout standard summary 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/standard/summary/standard/template-body |
|
| 220 | + */ |
|
| 221 | + $tplconf = 'client/html/checkout/standard/summary/standard/template-header'; |
|
| 222 | + $default = 'checkout/standard/summary-header-default.php'; |
|
| 223 | + |
|
| 224 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 225 | + } |
|
| 226 | + |
|
| 227 | + |
|
| 228 | + /** |
|
| 229 | + * Returns the sub-client given by its name. |
|
| 230 | + * |
|
| 231 | + * @param string $type Name of the client type |
|
| 232 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 233 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 234 | + */ |
|
| 235 | + public function getSubClient( $type, $name = null ) |
|
| 236 | + { |
|
| 237 | + /** client/html/checkout/standard/summary/decorators/excludes |
|
| 238 | + * Excludes decorators added by the "common" option from the checkout standard summary html client |
|
| 239 | + * |
|
| 240 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 241 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 242 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 243 | + * modify what is returned to the caller. |
|
| 244 | + * |
|
| 245 | + * This option allows you to remove a decorator added via |
|
| 246 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 247 | + * around the html client. |
|
| 248 | + * |
|
| 249 | + * client/html/checkout/standard/summary/decorators/excludes = array( 'decorator1' ) |
|
| 250 | + * |
|
| 251 | + * This would remove the decorator named "decorator1" from the list of |
|
| 252 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 253 | + * "client/html/common/decorators/default" to the html client. |
|
| 254 | + * |
|
| 255 | + * @param array List of decorator names |
|
| 256 | + * @since 2015.08 |
|
| 257 | + * @category Developer |
|
| 258 | + * @see client/html/common/decorators/default |
|
| 259 | + * @see client/html/checkout/standard/summary/decorators/global |
|
| 260 | + * @see client/html/checkout/standard/summary/decorators/local |
|
| 261 | + */ |
|
| 262 | + |
|
| 263 | + /** client/html/checkout/standard/summary/decorators/global |
|
| 264 | + * Adds a list of globally available decorators only to the checkout standard summary html client |
|
| 265 | + * |
|
| 266 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 267 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 268 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 269 | + * modify what is returned to the caller. |
|
| 270 | + * |
|
| 271 | + * This option allows you to wrap global decorators |
|
| 272 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 273 | + * |
|
| 274 | + * client/html/checkout/standard/summary/decorators/global = array( 'decorator1' ) |
|
| 275 | + * |
|
| 276 | + * This would add the decorator named "decorator1" defined by |
|
| 277 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 278 | + * |
|
| 279 | + * @param array List of decorator names |
|
| 280 | + * @since 2015.08 |
|
| 281 | + * @category Developer |
|
| 282 | + * @see client/html/common/decorators/default |
|
| 283 | + * @see client/html/checkout/standard/summary/decorators/excludes |
|
| 284 | + * @see client/html/checkout/standard/summary/decorators/local |
|
| 285 | + */ |
|
| 286 | + |
|
| 287 | + /** client/html/checkout/standard/summary/decorators/local |
|
| 288 | + * Adds a list of local decorators only to the checkout standard summary html client |
|
| 289 | + * |
|
| 290 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 291 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 292 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 293 | + * modify what is returned to the caller. |
|
| 294 | + * |
|
| 295 | + * This option allows you to wrap local decorators |
|
| 296 | + * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 297 | + * |
|
| 298 | + * client/html/checkout/standard/summary/decorators/local = array( 'decorator2' ) |
|
| 299 | + * |
|
| 300 | + * This would add the decorator named "decorator2" defined by |
|
| 301 | + * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 302 | + * |
|
| 303 | + * @param array List of decorator names |
|
| 304 | + * @since 2015.08 |
|
| 305 | + * @category Developer |
|
| 306 | + * @see client/html/common/decorators/default |
|
| 307 | + * @see client/html/checkout/standard/summary/decorators/excludes |
|
| 308 | + * @see client/html/checkout/standard/summary/decorators/global |
|
| 309 | + */ |
|
| 310 | + |
|
| 311 | + return $this->createSubClient( 'checkout/standard/summary/' . $type, $name ); |
|
| 312 | + } |
|
| 313 | + |
|
| 314 | + |
|
| 315 | + /** |
|
| 316 | + * Processes the input, e.g. store given values. |
|
| 317 | + * A view must be available and this method doesn't generate any output |
|
| 318 | + * besides setting view variables. |
|
| 319 | + */ |
|
| 320 | + public function process() |
|
| 321 | + { |
|
| 322 | + $view = $this->getView(); |
|
| 323 | + |
|
| 324 | + if( $view->param( 'cs_order', null ) === null ) { |
|
| 325 | + return; |
|
| 326 | + } |
|
| 327 | + |
|
| 328 | + try |
|
| 329 | + { |
|
| 330 | + $controller = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'basket' ); |
|
| 331 | + $controller->get()->check( \Aimeos\MShop\Order\Item\Base\Base::PARTS_ALL ); |
|
| 332 | + |
|
| 333 | + parent::process(); |
|
| 334 | + } |
|
| 335 | + catch( \Exception $e ) |
|
| 336 | + { |
|
| 337 | + $view->standardStepActive = 'summary'; |
|
| 338 | + throw $e; |
|
| 339 | + } |
|
| 340 | + } |
|
| 341 | + |
|
| 342 | + |
|
| 343 | + /** |
|
| 344 | + * Returns the list of sub-client names configured for the client. |
|
| 345 | + * |
|
| 346 | + * @return array List of HTML client names |
|
| 347 | + */ |
|
| 348 | + protected function getSubClientNames() |
|
| 349 | + { |
|
| 350 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 351 | + } |
|
| 352 | 352 | } |
| 353 | 353 | \ No newline at end of file |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | // Strings for translation |
| 16 | -sprintf( 'summary' ); |
|
| 16 | +sprintf('summary'); |
|
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 | /** |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * @since 2014.03 |
| 116 | 116 | * @category Developer |
| 117 | 117 | */ |
| 118 | - private $subPartNames = array( 'address', 'service', 'coupon', 'option', 'detail' ); |
|
| 118 | + private $subPartNames = array('address', 'service', 'coupon', 'option', 'detail'); |
|
| 119 | 119 | |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -126,21 +126,21 @@ discard block |
||
| 126 | 126 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 127 | 127 | * @return string HTML code |
| 128 | 128 | */ |
| 129 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 129 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 130 | 130 | { |
| 131 | 131 | $view = $this->getView(); |
| 132 | - $step = $view->get( 'standardStepActive' ); |
|
| 133 | - $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 132 | + $step = $view->get('standardStepActive'); |
|
| 133 | + $onepage = $view->config('client/html/checkout/standard/onepage', array()); |
|
| 134 | 134 | |
| 135 | - if( $step != 'summary' && !( in_array( 'summary', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 135 | + if ($step != 'summary' && !(in_array('summary', $onepage) && in_array($step, $onepage))) { |
|
| 136 | 136 | return ''; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 139 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 140 | 140 | |
| 141 | 141 | $html = ''; |
| 142 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 143 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 142 | + foreach ($this->getSubClients() as $subclient) { |
|
| 143 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 144 | 144 | } |
| 145 | 145 | $view->summaryBody = $html; |
| 146 | 146 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $tplconf = 'client/html/checkout/standard/summary/standard/template-body'; |
| 168 | 168 | $default = 'checkout/standard/summary-body-default.php'; |
| 169 | 169 | |
| 170 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 170 | + return $view->render($view->config($tplconf, $default)); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | |
@@ -179,21 +179,21 @@ discard block |
||
| 179 | 179 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 180 | 180 | * @return string|null String including HTML tags for the header on error |
| 181 | 181 | */ |
| 182 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 182 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 183 | 183 | { |
| 184 | 184 | $view = $this->getView(); |
| 185 | - $step = $view->get( 'standardStepActive' ); |
|
| 186 | - $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 185 | + $step = $view->get('standardStepActive'); |
|
| 186 | + $onepage = $view->config('client/html/checkout/standard/onepage', array()); |
|
| 187 | 187 | |
| 188 | - if( $step != 'summary' && !( in_array( 'summary', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 188 | + if ($step != 'summary' && !(in_array('summary', $onepage) && in_array($step, $onepage))) { |
|
| 189 | 189 | return ''; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 192 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 193 | 193 | |
| 194 | 194 | $html = ''; |
| 195 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 196 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 195 | + foreach ($this->getSubClients() as $subclient) { |
|
| 196 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 197 | 197 | } |
| 198 | 198 | $view->summaryHeader = $html; |
| 199 | 199 | |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | $tplconf = 'client/html/checkout/standard/summary/standard/template-header'; |
| 222 | 222 | $default = 'checkout/standard/summary-header-default.php'; |
| 223 | 223 | |
| 224 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 224 | + return $view->render($view->config($tplconf, $default)); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | * @param string|null $name Name of the sub-client (Default if null) |
| 233 | 233 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 234 | 234 | */ |
| 235 | - public function getSubClient( $type, $name = null ) |
|
| 235 | + public function getSubClient($type, $name = null) |
|
| 236 | 236 | { |
| 237 | 237 | /** client/html/checkout/standard/summary/decorators/excludes |
| 238 | 238 | * Excludes decorators added by the "common" option from the checkout standard summary html client |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | * @see client/html/checkout/standard/summary/decorators/global |
| 309 | 309 | */ |
| 310 | 310 | |
| 311 | - return $this->createSubClient( 'checkout/standard/summary/' . $type, $name ); |
|
| 311 | + return $this->createSubClient('checkout/standard/summary/'.$type, $name); |
|
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | |
@@ -321,18 +321,18 @@ discard block |
||
| 321 | 321 | { |
| 322 | 322 | $view = $this->getView(); |
| 323 | 323 | |
| 324 | - if( $view->param( 'cs_order', null ) === null ) { |
|
| 324 | + if ($view->param('cs_order', null) === null) { |
|
| 325 | 325 | return; |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | try |
| 329 | 329 | { |
| 330 | - $controller = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'basket' ); |
|
| 331 | - $controller->get()->check( \Aimeos\MShop\Order\Item\Base\Base::PARTS_ALL ); |
|
| 330 | + $controller = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'basket'); |
|
| 331 | + $controller->get()->check(\Aimeos\MShop\Order\Item\Base\Base::PARTS_ALL); |
|
| 332 | 332 | |
| 333 | 333 | parent::process(); |
| 334 | 334 | } |
| 335 | - catch( \Exception $e ) |
|
| 335 | + catch (\Exception $e) |
|
| 336 | 336 | { |
| 337 | 337 | $view->standardStepActive = 'summary'; |
| 338 | 338 | throw $e; |
@@ -347,6 +347,6 @@ discard block |
||
| 347 | 347 | */ |
| 348 | 348 | protected function getSubClientNames() |
| 349 | 349 | { |
| 350 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 350 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 351 | 351 | } |
| 352 | 352 | } |
| 353 | 353 | \ No newline at end of file |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -303,8 +303,7 @@ |
||
| 303 | 303 | $view->standardStepActive = 'address'; |
| 304 | 304 | return false; |
| 305 | 305 | } |
| 306 | - } |
|
| 307 | - catch( \Exception $e ) |
|
| 306 | + } catch( \Exception $e ) |
|
| 308 | 307 | { |
| 309 | 308 | $this->getView()->standardStepActive = 'address'; |
| 310 | 309 | throw $e; |
@@ -19,266 +19,266 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Summary\Address\Base |
|
| 23 | - implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Summary\Address\Base |
|
| 23 | + implements \Aimeos\Client\Html\Common\Client\Factory\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/checkout/standard/summary/address/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the checkout standard summary 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 2015.11 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/checkout/standard/summary/address/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 60 | - private $cache; |
|
| 25 | + /** client/html/checkout/standard/summary/address/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the checkout standard summary 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 2015.11 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/checkout/standard/summary/address/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->addressBody = $html; |
|
| 75 | + $html = ''; |
|
| 76 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 78 | + } |
|
| 79 | + $view->addressBody = $html; |
|
| 80 | 80 | |
| 81 | - /** client/html/checkout/standard/summary/address/standard/template-body |
|
| 82 | - * Relative path to the HTML body template of the checkout standard summary address 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/address/standard/template-header |
|
| 101 | - */ |
|
| 102 | - $tplconf = 'client/html/checkout/standard/summary/address/standard/template-body'; |
|
| 103 | - $default = 'common/summary/address-body-default.php'; |
|
| 81 | + /** client/html/checkout/standard/summary/address/standard/template-body |
|
| 82 | + * Relative path to the HTML body template of the checkout standard summary address 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/address/standard/template-header |
|
| 101 | + */ |
|
| 102 | + $tplconf = 'client/html/checkout/standard/summary/address/standard/template-body'; |
|
| 103 | + $default = 'common/summary/address-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->addressHeader = $html; |
|
| 121 | + $html = ''; |
|
| 122 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 124 | + } |
|
| 125 | + $view->addressHeader = $html; |
|
| 126 | 126 | |
| 127 | - /** client/html/checkout/standard/summary/address/standard/template-header |
|
| 128 | - * Relative path to the HTML header template of the checkout standard summary address 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/address/standard/template-body |
|
| 148 | - */ |
|
| 149 | - $tplconf = 'client/html/checkout/standard/summary/address/standard/template-header'; |
|
| 150 | - $default = 'common/summary/address-header-default.php'; |
|
| 127 | + /** client/html/checkout/standard/summary/address/standard/template-header |
|
| 128 | + * Relative path to the HTML header template of the checkout standard summary address 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/address/standard/template-body |
|
| 148 | + */ |
|
| 149 | + $tplconf = 'client/html/checkout/standard/summary/address/standard/template-header'; |
|
| 150 | + $default = 'common/summary/address-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/address/decorators/excludes |
|
| 166 | - * Excludes decorators added by the "common" option from the checkout standard summary address 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/address/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/address/decorators/global |
|
| 188 | - * @see client/html/checkout/standard/summary/address/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/address/decorators/excludes |
|
| 166 | + * Excludes decorators added by the "common" option from the checkout standard summary address 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/address/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/address/decorators/global |
|
| 188 | + * @see client/html/checkout/standard/summary/address/decorators/local |
|
| 189 | + */ |
|
| 190 | 190 | |
| 191 | - /** client/html/checkout/standard/summary/address/decorators/global |
|
| 192 | - * Adds a list of globally available decorators only to the checkout standard summary address 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/address/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/address/decorators/excludes |
|
| 212 | - * @see client/html/checkout/standard/summary/address/decorators/local |
|
| 213 | - */ |
|
| 191 | + /** client/html/checkout/standard/summary/address/decorators/global |
|
| 192 | + * Adds a list of globally available decorators only to the checkout standard summary address 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/address/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/address/decorators/excludes |
|
| 212 | + * @see client/html/checkout/standard/summary/address/decorators/local |
|
| 213 | + */ |
|
| 214 | 214 | |
| 215 | - /** client/html/checkout/standard/summary/address/decorators/local |
|
| 216 | - * Adds a list of local decorators only to the checkout standard summary address 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/address/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/address/decorators/excludes |
|
| 236 | - * @see client/html/checkout/standard/summary/address/decorators/global |
|
| 237 | - */ |
|
| 215 | + /** client/html/checkout/standard/summary/address/decorators/local |
|
| 216 | + * Adds a list of local decorators only to the checkout standard summary address 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/address/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/address/decorators/excludes |
|
| 236 | + * @see client/html/checkout/standard/summary/address/decorators/global |
|
| 237 | + */ |
|
| 238 | 238 | |
| 239 | - return $this->createSubClient( 'checkout/standard/summary/address/' . $type, $name ); |
|
| 240 | - } |
|
| 239 | + return $this->createSubClient( 'checkout/standard/summary/address/' . $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 | - $url = $view->url( $target, $cntl, $action, array( 'c_step' => 'address' ), array(), $config ); |
|
| 273 | + $url = $view->url( $target, $cntl, $action, array( 'c_step' => 'address' ), array(), $config ); |
|
| 274 | 274 | |
| 275 | - $view->summaryUrlAddressBilling = $url; |
|
| 276 | - $view->summaryUrlAddressDelivery = $url; |
|
| 277 | - $view->summaryBasket = $view->standardBasket; |
|
| 275 | + $view->summaryUrlAddressBilling = $url; |
|
| 276 | + $view->summaryUrlAddressDelivery = $url; |
|
| 277 | + $view->summaryBasket = $view->standardBasket; |
|
| 278 | 278 | |
| 279 | - $this->cache = $view; |
|
| 280 | - } |
|
| 279 | + $this->cache = $view; |
|
| 280 | + } |
|
| 281 | 281 | |
| 282 | - return $this->cache; |
|
| 283 | - } |
|
| 282 | + return $this->cache; |
|
| 283 | + } |
|
| 284 | 284 | } |
| 285 | 285 | \ No newline at end of file |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 69 | 69 | * @return string HTML code |
| 70 | 70 | */ |
| 71 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 72 | 72 | { |
| 73 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 74 | 74 | |
| 75 | 75 | $html = ''; |
| 76 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 77 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 76 | + foreach ($this->getSubClients() as $subclient) { |
|
| 77 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 78 | 78 | } |
| 79 | 79 | $view->addressBody = $html; |
| 80 | 80 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $tplconf = 'client/html/checkout/standard/summary/address/standard/template-body'; |
| 103 | 103 | $default = 'common/summary/address-body-default.php'; |
| 104 | 104 | |
| 105 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 105 | + return $view->render($view->config($tplconf, $default)); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
@@ -114,13 +114,13 @@ discard block |
||
| 114 | 114 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 115 | 115 | * @return string|null String including HTML tags for the header on error |
| 116 | 116 | */ |
| 117 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 117 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 118 | 118 | { |
| 119 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 119 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 120 | 120 | |
| 121 | 121 | $html = ''; |
| 122 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 123 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | + foreach ($this->getSubClients() as $subclient) { |
|
| 123 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 124 | 124 | } |
| 125 | 125 | $view->addressHeader = $html; |
| 126 | 126 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $tplconf = 'client/html/checkout/standard/summary/address/standard/template-header'; |
| 150 | 150 | $default = 'common/summary/address-header-default.php'; |
| 151 | 151 | |
| 152 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 152 | + return $view->render($view->config($tplconf, $default)); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @param string|null $name Name of the sub-client (Default if null) |
| 161 | 161 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 162 | 162 | */ |
| 163 | - public function getSubClient( $type, $name = null ) |
|
| 163 | + public function getSubClient($type, $name = null) |
|
| 164 | 164 | { |
| 165 | 165 | /** client/html/checkout/standard/summary/address/decorators/excludes |
| 166 | 166 | * Excludes decorators added by the "common" option from the checkout standard summary address html client |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * @see client/html/checkout/standard/summary/address/decorators/global |
| 237 | 237 | */ |
| 238 | 238 | |
| 239 | - return $this->createSubClient( 'checkout/standard/summary/address/' . $type, $name ); |
|
| 239 | + return $this->createSubClient('checkout/standard/summary/address/'.$type, $name); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | protected function getSubClientNames() |
| 249 | 249 | { |
| 250 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 250 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | |
@@ -259,18 +259,18 @@ discard block |
||
| 259 | 259 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 260 | 260 | * @return \Aimeos\MW\View\Iface Modified view object |
| 261 | 261 | */ |
| 262 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 262 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 263 | 263 | { |
| 264 | - $view = parent::setViewParams( $view, $tags, $expire ); |
|
| 264 | + $view = parent::setViewParams($view, $tags, $expire); |
|
| 265 | 265 | |
| 266 | - if( !isset( $this->cache ) ) |
|
| 266 | + if (!isset($this->cache)) |
|
| 267 | 267 | { |
| 268 | - $target = $view->config( 'client/html/checkout/standard/url/target' ); |
|
| 269 | - $cntl = $view->config( 'client/html/checkout/standard/url/controller', 'checkout' ); |
|
| 270 | - $action = $view->config( 'client/html/checkout/standard/url/action', 'index' ); |
|
| 271 | - $config = $view->config( 'client/html/checkout/standard/url/config', array() ); |
|
| 268 | + $target = $view->config('client/html/checkout/standard/url/target'); |
|
| 269 | + $cntl = $view->config('client/html/checkout/standard/url/controller', 'checkout'); |
|
| 270 | + $action = $view->config('client/html/checkout/standard/url/action', 'index'); |
|
| 271 | + $config = $view->config('client/html/checkout/standard/url/config', array()); |
|
| 272 | 272 | |
| 273 | - $url = $view->url( $target, $cntl, $action, array( 'c_step' => 'address' ), array(), $config ); |
|
| 273 | + $url = $view->url($target, $cntl, $action, array('c_step' => 'address'), array(), $config); |
|
| 274 | 274 | |
| 275 | 275 | $view->summaryUrlAddressBilling = $url; |
| 276 | 276 | $view->summaryUrlAddressDelivery = $url; |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -19,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 standard 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/standard/name |
|
| 37 | - * Class name of the used checkout standard 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\Standard\Standard |
|
| 47 | - * |
|
| 48 | - * and you want to replace it with your own version named |
|
| 49 | - * |
|
| 50 | - * \Aimeos\Client\Html\Checkout\Standard\Mycheckout |
|
| 51 | - * |
|
| 52 | - * then you have to set the this configuration option: |
|
| 53 | - * |
|
| 54 | - * client/html/checkout/standard/name = Mycheckout |
|
| 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 "MyCheckout"! |
|
| 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/standard/name', 'Standard' ); |
|
| 71 | - } |
|
| 25 | + /** |
|
| 26 | + * Creates a standard 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/standard/name |
|
| 37 | + * Class name of the used checkout standard 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\Standard\Standard |
|
| 47 | + * |
|
| 48 | + * and you want to replace it with your own version named |
|
| 49 | + * |
|
| 50 | + * \Aimeos\Client\Html\Checkout\Standard\Mycheckout |
|
| 51 | + * |
|
| 52 | + * then you have to set the this configuration option: |
|
| 53 | + * |
|
| 54 | + * client/html/checkout/standard/name = Mycheckout |
|
| 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 "MyCheckout"! |
|
| 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/standard/name', 'Standard' ); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - if( ctype_alnum( $name ) === false ) |
|
| 74 | - { |
|
| 75 | - $classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Checkout\\Standard\\' . $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\\Standard\\' . $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\\Standard\\' . $name; |
|
| 79 | + $iface = '\\Aimeos\\Client\\Html\\Iface'; |
|
| 80 | + $classname = '\\Aimeos\\Client\\Html\\Checkout\\Standard\\' . $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/standard' ); |
|
| 85 | - } |
|
| 84 | + return self::addClientDecorators( $context, $client, $templatePaths, 'checkout/standard' ); |
|
| 85 | + } |
|
| 86 | 86 | } |
| 87 | 87 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @return \Aimeos\Client\Html\Iface Filter part implementing \Aimeos\Client\Html\Iface |
| 32 | 32 | * @throws \Aimeos\Client\Html\Exception If requested client implementation couldn't be found or initialisation fails |
| 33 | 33 | */ |
| 34 | - public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null ) |
|
| 34 | + public static function createClient(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null) |
|
| 35 | 35 | { |
| 36 | 36 | /** client/html/checkout/standard/name |
| 37 | 37 | * Class name of the used checkout standard client implementation |
@@ -66,22 +66,22 @@ discard block |
||
| 66 | 66 | * @since 2014.03 |
| 67 | 67 | * @category Developer |
| 68 | 68 | */ |
| 69 | - if( $name === null ) { |
|
| 70 | - $name = $context->getConfig()->get( 'client/html/checkout/standard/name', 'Standard' ); |
|
| 69 | + if ($name === null) { |
|
| 70 | + $name = $context->getConfig()->get('client/html/checkout/standard/name', 'Standard'); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if( ctype_alnum( $name ) === false ) |
|
| 73 | + if (ctype_alnum($name) === false) |
|
| 74 | 74 | { |
| 75 | - $classname = is_string( $name ) ? '\\Aimeos\\Client\\Html\\Checkout\\Standard\\' . $name : '<not a string>'; |
|
| 76 | - throw new \Aimeos\Client\Html\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 75 | + $classname = is_string($name) ? '\\Aimeos\\Client\\Html\\Checkout\\Standard\\'.$name : '<not a string>'; |
|
| 76 | + throw new \Aimeos\Client\Html\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $iface = '\\Aimeos\\Client\\Html\\Iface'; |
| 80 | - $classname = '\\Aimeos\\Client\\Html\\Checkout\\Standard\\' . $name; |
|
| 80 | + $classname = '\\Aimeos\\Client\\Html\\Checkout\\Standard\\'.$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/standard' ); |
|
| 84 | + return self::addClientDecorators($context, $client, $templatePaths, 'checkout/standard'); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
@@ -148,23 +148,19 @@ discard block |
||
| 148 | 148 | $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
| 149 | 149 | } |
| 150 | 150 | $view->standardBody = $html; |
| 151 | - } |
|
| 152 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 151 | + } catch( \Aimeos\Client\Html\Exception $e ) |
|
| 153 | 152 | { |
| 154 | 153 | $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) ); |
| 155 | 154 | $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
| 156 | - } |
|
| 157 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 155 | + } catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 158 | 156 | { |
| 159 | 157 | $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
| 160 | 158 | $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
| 161 | - } |
|
| 162 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 159 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 163 | 160 | { |
| 164 | 161 | $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 165 | 162 | $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
| 166 | - } |
|
| 167 | - catch( \Exception $e ) |
|
| 163 | + } catch( \Exception $e ) |
|
| 168 | 164 | { |
| 169 | 165 | $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 170 | 166 | |
@@ -244,8 +240,7 @@ discard block |
||
| 244 | 240 | $default = 'checkout/standard/header-default.php'; |
| 245 | 241 | |
| 246 | 242 | return $view->render( $view->config( $tplconf, $default ) ); |
| 247 | - } |
|
| 248 | - catch( \Exception $e ) |
|
| 243 | + } catch( \Exception $e ) |
|
| 249 | 244 | { |
| 250 | 245 | $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 251 | 246 | } |
@@ -352,31 +347,26 @@ discard block |
||
| 352 | 347 | try |
| 353 | 348 | { |
| 354 | 349 | parent::process(); |
| 355 | - } |
|
| 356 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 350 | + } catch( \Aimeos\Client\Html\Exception $e ) |
|
| 357 | 351 | { |
| 358 | 352 | $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) ); |
| 359 | 353 | $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
| 360 | - } |
|
| 361 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 354 | + } catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 362 | 355 | { |
| 363 | 356 | $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
| 364 | 357 | $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
| 365 | - } |
|
| 366 | - catch( \Aimeos\MShop\Plugin\Provider\Exception $e ) |
|
| 358 | + } catch( \Aimeos\MShop\Plugin\Provider\Exception $e ) |
|
| 367 | 359 | { |
| 368 | 360 | $errors = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 369 | 361 | $errors = array_merge( $errors, $this->translatePluginErrorCodes( $e->getErrorCodes() ) ); |
| 370 | 362 | |
| 371 | 363 | $view->summaryErrorCodes = $e->getErrorCodes(); |
| 372 | 364 | $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $errors; |
| 373 | - } |
|
| 374 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 365 | + } catch( \Aimeos\MShop\Exception $e ) |
|
| 375 | 366 | { |
| 376 | 367 | $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 377 | 368 | $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
| 378 | - } |
|
| 379 | - catch( \Exception $e ) |
|
| 369 | + } catch( \Exception $e ) |
|
| 380 | 370 | { |
| 381 | 371 | $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
| 382 | 372 | |
@@ -19,598 +19,598 @@ |
||
| 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/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the checkout standard 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/standard/subparts'; |
|
| 59 | - |
|
| 60 | - /** client/html/checkout/standard/address/name |
|
| 61 | - * Name of the address part used by the checkout standard client implementation |
|
| 62 | - * |
|
| 63 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Address\Myname". |
|
| 64 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 65 | - * |
|
| 66 | - * @param string Last part of the client class name |
|
| 67 | - * @since 2014.03 |
|
| 68 | - * @category Developer |
|
| 69 | - */ |
|
| 70 | - |
|
| 71 | - /** client/html/checkout/standard/delivery/name |
|
| 72 | - * Name of the delivery part used by the checkout standard client implementation |
|
| 73 | - * |
|
| 74 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Delivery\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/standard/payment/name |
|
| 83 | - * Name of the payment part used by the checkout standard client implementation |
|
| 84 | - * |
|
| 85 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Payment\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.03 |
|
| 90 | - * @category Developer |
|
| 91 | - */ |
|
| 92 | - |
|
| 93 | - /** client/html/checkout/standard/summary/name |
|
| 94 | - * Name of the summary part used by the checkout standard client implementation |
|
| 95 | - * |
|
| 96 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Summary\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 2014.03 |
|
| 101 | - * @category Developer |
|
| 102 | - */ |
|
| 103 | - |
|
| 104 | - /** client/html/checkout/standard/order/name |
|
| 105 | - * Name of the order part used by the checkout standard client implementation |
|
| 106 | - * |
|
| 107 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Order\Myname". |
|
| 108 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 109 | - * |
|
| 110 | - * @param string Last part of the client class name |
|
| 111 | - * @since 2014.03 |
|
| 112 | - * @category Developer |
|
| 113 | - */ |
|
| 114 | - |
|
| 115 | - /** client/html/checkout/standard/process/name |
|
| 116 | - * Name of the process part used by the checkout standard client implementation |
|
| 117 | - * |
|
| 118 | - * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Process\Myname". |
|
| 119 | - * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 120 | - * |
|
| 121 | - * @param string Last part of the client class name |
|
| 122 | - * @since 2015.07 |
|
| 123 | - * @category Developer |
|
| 124 | - */ |
|
| 125 | - private $subPartNames = array( 'address', 'delivery', 'payment', 'summary', 'order', 'process' ); |
|
| 126 | - private $cache; |
|
| 127 | - |
|
| 128 | - |
|
| 129 | - /** |
|
| 130 | - * Returns the HTML code for insertion into the body. |
|
| 131 | - * |
|
| 132 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 133 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 134 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 135 | - * @return string HTML code |
|
| 136 | - */ |
|
| 137 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 138 | - { |
|
| 139 | - $context = $this->getContext(); |
|
| 140 | - $view = $this->getView(); |
|
| 141 | - |
|
| 142 | - try |
|
| 143 | - { |
|
| 144 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 145 | - |
|
| 146 | - $html = ''; |
|
| 147 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 148 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 149 | - } |
|
| 150 | - $view->standardBody = $html; |
|
| 151 | - } |
|
| 152 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 153 | - { |
|
| 154 | - $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 155 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 156 | - } |
|
| 157 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 158 | - { |
|
| 159 | - $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 160 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 161 | - } |
|
| 162 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 163 | - { |
|
| 164 | - $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 165 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 166 | - } |
|
| 167 | - catch( \Exception $e ) |
|
| 168 | - { |
|
| 169 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 170 | - |
|
| 171 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 172 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - /** client/html/checkout/standard/standard/template-body |
|
| 176 | - * Relative path to the HTML body template of the checkout standard client. |
|
| 177 | - * |
|
| 178 | - * The template file contains the HTML code and processing instructions |
|
| 179 | - * to generate the result shown in the body of the frontend. The |
|
| 180 | - * configuration string is the path to the template file relative |
|
| 181 | - * to the templates directory (usually in client/html/templates). |
|
| 182 | - * |
|
| 183 | - * You can overwrite the template file configuration in extensions and |
|
| 184 | - * provide alternative templates. These alternative templates should be |
|
| 185 | - * named like the default one but with the string "standard" replaced by |
|
| 186 | - * an unique name. You may use the name of your project for this. If |
|
| 187 | - * you've implemented an alternative client class as well, "standard" |
|
| 188 | - * should be replaced by the name of the new class. |
|
| 189 | - * |
|
| 190 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 191 | - * @since 2014.03 |
|
| 192 | - * @category Developer |
|
| 193 | - * @see client/html/checkout/standard/standard/template-header |
|
| 194 | - */ |
|
| 195 | - $tplconf = 'client/html/checkout/standard/standard/template-body'; |
|
| 196 | - $default = 'checkout/standard/body-default.php'; |
|
| 197 | - |
|
| 198 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 199 | - } |
|
| 200 | - |
|
| 201 | - |
|
| 202 | - /** |
|
| 203 | - * Returns the HTML string for insertion into the header. |
|
| 204 | - * |
|
| 205 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 206 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 207 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 208 | - * @return string|null String including HTML tags for the header on error |
|
| 209 | - */ |
|
| 210 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 211 | - { |
|
| 212 | - try |
|
| 213 | - { |
|
| 214 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 215 | - |
|
| 216 | - $html = ''; |
|
| 217 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 218 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 219 | - } |
|
| 220 | - $view->standardHeader = $html; |
|
| 221 | - |
|
| 222 | - /** client/html/checkout/standard/standard/template-header |
|
| 223 | - * Relative path to the HTML header template of the checkout standard client. |
|
| 224 | - * |
|
| 225 | - * The template file contains the HTML code and processing instructions |
|
| 226 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 227 | - * of the rendered page in the frontend. The configuration string is the |
|
| 228 | - * path to the template file relative to the templates directory (usually |
|
| 229 | - * in client/html/templates). |
|
| 230 | - * |
|
| 231 | - * You can overwrite the template file configuration in extensions and |
|
| 232 | - * provide alternative templates. These alternative templates should be |
|
| 233 | - * named like the default one but with the string "standard" replaced by |
|
| 234 | - * an unique name. You may use the name of your project for this. If |
|
| 235 | - * you've implemented an alternative client class as well, "standard" |
|
| 236 | - * should be replaced by the name of the new class. |
|
| 237 | - * |
|
| 238 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 239 | - * @since 2014.03 |
|
| 240 | - * @category Developer |
|
| 241 | - * @see client/html/checkout/standard/standard/template-body |
|
| 242 | - */ |
|
| 243 | - $tplconf = 'client/html/checkout/standard/standard/template-header'; |
|
| 244 | - $default = 'checkout/standard/header-default.php'; |
|
| 245 | - |
|
| 246 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 247 | - } |
|
| 248 | - catch( \Exception $e ) |
|
| 249 | - { |
|
| 250 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 251 | - } |
|
| 252 | - } |
|
| 253 | - |
|
| 254 | - |
|
| 255 | - /** |
|
| 256 | - * Returns the sub-client given by its name. |
|
| 257 | - * |
|
| 258 | - * @param string $type Name of the client type |
|
| 259 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 260 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 261 | - */ |
|
| 262 | - public function getSubClient( $type, $name = null ) |
|
| 263 | - { |
|
| 264 | - /** client/html/checkout/standard/decorators/excludes |
|
| 265 | - * Excludes decorators added by the "common" option from the checkout standard html client |
|
| 266 | - * |
|
| 267 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 268 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 269 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 270 | - * modify what is returned to the caller. |
|
| 271 | - * |
|
| 272 | - * This option allows you to remove a decorator added via |
|
| 273 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 274 | - * around the html client. |
|
| 275 | - * |
|
| 276 | - * client/html/checkout/standard/decorators/excludes = array( 'decorator1' ) |
|
| 277 | - * |
|
| 278 | - * This would remove the decorator named "decorator1" from the list of |
|
| 279 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 280 | - * "client/html/common/decorators/default" to the html client. |
|
| 281 | - * |
|
| 282 | - * @param array List of decorator names |
|
| 283 | - * @since 2014.05 |
|
| 284 | - * @category Developer |
|
| 285 | - * @see client/html/common/decorators/default |
|
| 286 | - * @see client/html/checkout/standard/decorators/global |
|
| 287 | - * @see client/html/checkout/standard/decorators/local |
|
| 288 | - */ |
|
| 289 | - |
|
| 290 | - /** client/html/checkout/standard/decorators/global |
|
| 291 | - * Adds a list of globally available decorators only to the checkout standard html client |
|
| 292 | - * |
|
| 293 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 294 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 295 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 296 | - * modify what is returned to the caller. |
|
| 297 | - * |
|
| 298 | - * This option allows you to wrap global decorators |
|
| 299 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 300 | - * |
|
| 301 | - * client/html/checkout/standard/decorators/global = array( 'decorator1' ) |
|
| 302 | - * |
|
| 303 | - * This would add the decorator named "decorator1" defined by |
|
| 304 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 305 | - * |
|
| 306 | - * @param array List of decorator names |
|
| 307 | - * @since 2014.05 |
|
| 308 | - * @category Developer |
|
| 309 | - * @see client/html/common/decorators/default |
|
| 310 | - * @see client/html/checkout/standard/decorators/excludes |
|
| 311 | - * @see client/html/checkout/standard/decorators/local |
|
| 312 | - */ |
|
| 313 | - |
|
| 314 | - /** client/html/checkout/standard/decorators/local |
|
| 315 | - * Adds a list of local decorators only to the checkout standard html client |
|
| 316 | - * |
|
| 317 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 318 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 319 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 320 | - * modify what is returned to the caller. |
|
| 321 | - * |
|
| 322 | - * This option allows you to wrap local decorators |
|
| 323 | - * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 324 | - * |
|
| 325 | - * client/html/checkout/standard/decorators/local = array( 'decorator2' ) |
|
| 326 | - * |
|
| 327 | - * This would add the decorator named "decorator2" defined by |
|
| 328 | - * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 329 | - * |
|
| 330 | - * @param array List of decorator names |
|
| 331 | - * @since 2014.05 |
|
| 332 | - * @category Developer |
|
| 333 | - * @see client/html/common/decorators/default |
|
| 334 | - * @see client/html/checkout/standard/decorators/excludes |
|
| 335 | - * @see client/html/checkout/standard/decorators/global |
|
| 336 | - */ |
|
| 337 | - |
|
| 338 | - return $this->createSubClient( 'checkout/standard/' . $type, $name ); |
|
| 339 | - } |
|
| 340 | - |
|
| 341 | - |
|
| 342 | - /** |
|
| 343 | - * Processes the input, e.g. store given values. |
|
| 344 | - * A view must be available and this method doesn't generate any output |
|
| 345 | - * besides setting view variables. |
|
| 346 | - */ |
|
| 347 | - public function process() |
|
| 348 | - { |
|
| 349 | - $view = $this->getView(); |
|
| 350 | - $context = $this->getContext(); |
|
| 351 | - |
|
| 352 | - try |
|
| 353 | - { |
|
| 354 | - parent::process(); |
|
| 355 | - } |
|
| 356 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 357 | - { |
|
| 358 | - $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 359 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 360 | - } |
|
| 361 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 362 | - { |
|
| 363 | - $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 364 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 365 | - } |
|
| 366 | - catch( \Aimeos\MShop\Plugin\Provider\Exception $e ) |
|
| 367 | - { |
|
| 368 | - $errors = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 369 | - $errors = array_merge( $errors, $this->translatePluginErrorCodes( $e->getErrorCodes() ) ); |
|
| 370 | - |
|
| 371 | - $view->summaryErrorCodes = $e->getErrorCodes(); |
|
| 372 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $errors; |
|
| 373 | - } |
|
| 374 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 375 | - { |
|
| 376 | - $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 377 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 378 | - } |
|
| 379 | - catch( \Exception $e ) |
|
| 380 | - { |
|
| 381 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 382 | - |
|
| 383 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 384 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 385 | - } |
|
| 386 | - } |
|
| 387 | - |
|
| 388 | - |
|
| 389 | - /** |
|
| 390 | - * Returns the list of sub-client names configured for the client. |
|
| 391 | - * |
|
| 392 | - * @return array List of HTML client names |
|
| 393 | - */ |
|
| 394 | - protected function getSubClientNames() |
|
| 395 | - { |
|
| 396 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 397 | - } |
|
| 398 | - |
|
| 399 | - |
|
| 400 | - /** |
|
| 401 | - * Sets the necessary parameter values in the view. |
|
| 402 | - * |
|
| 403 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 404 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 405 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 406 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 407 | - */ |
|
| 408 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 409 | - { |
|
| 410 | - if( !isset( $this->cache ) ) |
|
| 411 | - { |
|
| 412 | - $context = $this->getContext(); |
|
| 413 | - |
|
| 414 | - $basketCntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 415 | - $view->standardBasket = $basketCntl->get(); |
|
| 416 | - |
|
| 417 | - |
|
| 418 | - /** client/html/checkout/standard/url/step-active |
|
| 419 | - * Name of the checkout process step to jump to if no previous step requires attention |
|
| 420 | - * |
|
| 421 | - * The checkout process consists of several steps which are usually |
|
| 422 | - * displayed one by another to the customer. If the data of a step |
|
| 423 | - * is already available, then that step is skipped. The active step |
|
| 424 | - * is the one that is displayed if all other steps are skipped. |
|
| 425 | - * |
|
| 426 | - * If one of the previous steps misses some data the customer has |
|
| 427 | - * to enter, then this step is displayed first. After providing |
|
| 428 | - * the missing data, the whole series of steps are tested again |
|
| 429 | - * and if no other step requests attention, the configured active |
|
| 430 | - * step will be displayed. |
|
| 431 | - * |
|
| 432 | - * The order of the steps is determined by the order of sub-parts |
|
| 433 | - * that are configured for the checkout client. |
|
| 434 | - * |
|
| 435 | - * @param string Name of the confirm standard HTML client |
|
| 436 | - * @since 2014.07 |
|
| 437 | - * @category Developer |
|
| 438 | - * @category User |
|
| 439 | - * @see client/html/checkout/standard/standard/subparts |
|
| 440 | - */ |
|
| 441 | - $default = $view->config( 'client/html/checkout/standard/url/step-active', 'summary' ); |
|
| 442 | - |
|
| 443 | - /** client/html/checkout/standard/onepage |
|
| 444 | - * Shows all named checkout subparts at once for a one page checkout |
|
| 445 | - * |
|
| 446 | - * Normally, the checkout process is divided into several steps for entering |
|
| 447 | - * addresses, select delivery and payment options as well as showing the |
|
| 448 | - * summary page. This enables dependencies between two steps like showing |
|
| 449 | - * delivery options based on the address entered by the customer. Furthermore, |
|
| 450 | - * this is good way to limit the amount of information displayed which is |
|
| 451 | - * preferred by mobile users. |
|
| 452 | - * |
|
| 453 | - * Contrary to that, a one page checkout displays all information on only |
|
| 454 | - * one page and customers get an immediate overview of which information |
|
| 455 | - * they have to enter and what options they can select from. This is an |
|
| 456 | - * advantage if only a very limited amount of information must be entered |
|
| 457 | - * or if there are almost no options to choose from and no dependencies |
|
| 458 | - * between exist. |
|
| 459 | - * |
|
| 460 | - * Using this config options, shop developers are able to define which |
|
| 461 | - * checkout subparts are combined to a one page view. Simply add the names |
|
| 462 | - * of all checkout subparts to the list. Available checkout subparts for |
|
| 463 | - * a one page checkout are: |
|
| 464 | - * * address |
|
| 465 | - * * delivery |
|
| 466 | - * * payment |
|
| 467 | - * * summary |
|
| 468 | - * |
|
| 469 | - * @param array List of checkout subparts name |
|
| 470 | - * @since 2015.05 |
|
| 471 | - * @category Developer |
|
| 472 | - */ |
|
| 473 | - $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 474 | - $onestep = array_shift( $onepage ); // keep the first one page step |
|
| 475 | - |
|
| 476 | - $steps = (array) $context->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 477 | - $steps = array_diff( $steps, $onepage ); // remove all remaining steps in $onepage |
|
| 478 | - |
|
| 479 | - // use first step if default step isn't available |
|
| 480 | - $default = ( !in_array( $default, $steps ) ? reset( $steps ) : $default ); |
|
| 481 | - |
|
| 482 | - $current = $view->param( 'c_step', $default ); |
|
| 483 | - // use $onestep if current step isn't available due to one page layout |
|
| 484 | - $current = ( !in_array( $current, $steps ) ? $onestep : $current ); |
|
| 485 | - |
|
| 486 | - $cpos = $cpos = array_search( $current, $steps ); |
|
| 487 | - |
|
| 488 | - if( !isset( $view->standardStepActive ) |
|
| 489 | - || ( ( $apos = array_search( $view->standardStepActive, $steps ) ) !== false |
|
| 490 | - && $cpos !== false && $cpos < $apos ) |
|
| 491 | - ) { |
|
| 492 | - $view->standardStepActive = $current; |
|
| 493 | - } |
|
| 494 | - |
|
| 495 | - $view->standardSteps = $steps; |
|
| 496 | - |
|
| 497 | - |
|
| 498 | - $this->cache = $this->addNavigationUrls( $view, $steps, $view->standardStepActive ); |
|
| 499 | - } |
|
| 500 | - |
|
| 501 | - return $this->cache; |
|
| 502 | - } |
|
| 503 | - |
|
| 504 | - |
|
| 505 | - /** |
|
| 506 | - * Adds the "back" and "next" URLs to the view |
|
| 507 | - * |
|
| 508 | - * @param \Aimeos\MW\View\Iface $view View object |
|
| 509 | - * @param array $steps List of checkout step names |
|
| 510 | - * @param unknown $activeStep Name of the active step |
|
| 511 | - * @return \Aimeos\MW\View\Iface Enhanced view object |
|
| 512 | - * @since 2016.05 |
|
| 513 | - */ |
|
| 514 | - protected function addNavigationUrls( \Aimeos\MW\View\Iface $view, array $steps, $activeStep ) |
|
| 515 | - { |
|
| 516 | - /** client/html/checkout/standard/url/target |
|
| 517 | - * Destination of the URL where the controller specified in the URL is known |
|
| 518 | - * |
|
| 519 | - * The destination can be a page ID like in a content management system or the |
|
| 520 | - * module of a software development framework. This "target" must contain or know |
|
| 521 | - * the controller that should be called by the generated URL. |
|
| 522 | - * |
|
| 523 | - * @param string Destination of the URL |
|
| 524 | - * @since 2014.03 |
|
| 525 | - * @category Developer |
|
| 526 | - * @see client/html/checkout/standard/url/controller |
|
| 527 | - * @see client/html/checkout/standard/url/action |
|
| 528 | - * @see client/html/checkout/standard/url/config |
|
| 529 | - */ |
|
| 530 | - $cTarget = $view->config( 'client/html/checkout/standard/url/target' ); |
|
| 531 | - |
|
| 532 | - /** client/html/checkout/standard/url/controller |
|
| 533 | - * Name of the controller whose action should be called |
|
| 534 | - * |
|
| 535 | - * In Model-View-Controller (MVC) applications, the controller contains the methods |
|
| 536 | - * that create parts of the output displayed in the generated HTML page. Controller |
|
| 537 | - * names are usually alpha-numeric. |
|
| 538 | - * |
|
| 539 | - * @param string Name of the controller |
|
| 540 | - * @since 2014.03 |
|
| 541 | - * @category Developer |
|
| 542 | - * @see client/html/checkout/standard/url/target |
|
| 543 | - * @see client/html/checkout/standard/url/action |
|
| 544 | - * @see client/html/checkout/standard/url/config |
|
| 545 | - */ |
|
| 546 | - $cCntl = $view->config( 'client/html/checkout/standard/url/controller', 'checkout' ); |
|
| 547 | - |
|
| 548 | - /** client/html/checkout/standard/url/action |
|
| 549 | - * Name of the action that should create the output |
|
| 550 | - * |
|
| 551 | - * In Model-View-Controller (MVC) applications, actions are the methods of a |
|
| 552 | - * controller that create parts of the output displayed in the generated HTML page. |
|
| 553 | - * Action names are usually alpha-numeric. |
|
| 554 | - * |
|
| 555 | - * @param string Name of the action |
|
| 556 | - * @since 2014.03 |
|
| 557 | - * @category Developer |
|
| 558 | - * @see client/html/checkout/standard/url/target |
|
| 559 | - * @see client/html/checkout/standard/url/controller |
|
| 560 | - * @see client/html/checkout/standard/url/config |
|
| 561 | - */ |
|
| 562 | - $cAction = $view->config( 'client/html/checkout/standard/url/action', 'index' ); |
|
| 563 | - |
|
| 564 | - /** client/html/checkout/standard/url/config |
|
| 565 | - * Associative list of configuration options used for generating the URL |
|
| 566 | - * |
|
| 567 | - * You can specify additional options as key/value pairs used when generating |
|
| 568 | - * the URLs, like |
|
| 569 | - * |
|
| 570 | - * client/html/<clientname>/url/config = array( 'absoluteUri' => true ) |
|
| 571 | - * |
|
| 572 | - * The available key/value pairs depend on the application that embeds the e-commerce |
|
| 573 | - * framework. This is because the infrastructure of the application is used for |
|
| 574 | - * generating the URLs. The full list of available config options is referenced |
|
| 575 | - * in the "see also" section of this page. |
|
| 576 | - * |
|
| 577 | - * @param string Associative list of configuration options |
|
| 578 | - * @since 2014.03 |
|
| 579 | - * @category Developer |
|
| 580 | - * @see client/html/checkout/standard/url/target |
|
| 581 | - * @see client/html/checkout/standard/url/controller |
|
| 582 | - * @see client/html/checkout/standard/url/action |
|
| 583 | - * @see client/html/url/config |
|
| 584 | - */ |
|
| 585 | - $cConfig = $view->config( 'client/html/checkout/standard/url/config', array() ); |
|
| 586 | - |
|
| 587 | - |
|
| 588 | - $bTarget = $view->config( 'client/html/basket/standard/url/target' ); |
|
| 589 | - $bCntl = $view->config( 'client/html/basket/standard/url/controller', 'basket' ); |
|
| 590 | - $bAction = $view->config( 'client/html/basket/standard/url/action', 'index' ); |
|
| 591 | - $bConfig = $view->config( 'client/html/basket/standard/url/config', array() ); |
|
| 592 | - |
|
| 593 | - |
|
| 594 | - $step = null; |
|
| 595 | - do { |
|
| 596 | - $lastStep = $step; |
|
| 597 | - } |
|
| 598 | - while( ( $step = array_shift( $steps ) ) !== null && $step !== $activeStep ); |
|
| 599 | - |
|
| 600 | - |
|
| 601 | - if( $lastStep !== null ) { |
|
| 602 | - $param = array( 'c_step' => $lastStep ); |
|
| 603 | - $view->standardUrlBack = $view->url( $cTarget, $cCntl, $cAction, $param, array(), $cConfig ); |
|
| 604 | - } else { |
|
| 605 | - $view->standardUrlBack = $view->url( $bTarget, $bCntl, $bAction, array(), array(), $bConfig ); |
|
| 606 | - } |
|
| 607 | - |
|
| 608 | - if( !isset( $view->standardUrlNext ) && ( $nextStep = array_shift( $steps ) ) !== null ) { |
|
| 609 | - $param = array( 'c_step' => $nextStep ); |
|
| 610 | - $view->standardUrlNext = $view->url( $cTarget, $cCntl, $cAction, $param, array(), $cConfig ); |
|
| 611 | - } |
|
| 612 | - // don't overwrite $view->standardUrlNext so order step URL is used |
|
| 613 | - |
|
| 614 | - return $view; |
|
| 615 | - } |
|
| 25 | + /** client/html/checkout/standard/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the checkout standard 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/standard/subparts'; |
|
| 59 | + |
|
| 60 | + /** client/html/checkout/standard/address/name |
|
| 61 | + * Name of the address part used by the checkout standard client implementation |
|
| 62 | + * |
|
| 63 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Address\Myname". |
|
| 64 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 65 | + * |
|
| 66 | + * @param string Last part of the client class name |
|
| 67 | + * @since 2014.03 |
|
| 68 | + * @category Developer |
|
| 69 | + */ |
|
| 70 | + |
|
| 71 | + /** client/html/checkout/standard/delivery/name |
|
| 72 | + * Name of the delivery part used by the checkout standard client implementation |
|
| 73 | + * |
|
| 74 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Delivery\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/standard/payment/name |
|
| 83 | + * Name of the payment part used by the checkout standard client implementation |
|
| 84 | + * |
|
| 85 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Payment\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.03 |
|
| 90 | + * @category Developer |
|
| 91 | + */ |
|
| 92 | + |
|
| 93 | + /** client/html/checkout/standard/summary/name |
|
| 94 | + * Name of the summary part used by the checkout standard client implementation |
|
| 95 | + * |
|
| 96 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Summary\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 2014.03 |
|
| 101 | + * @category Developer |
|
| 102 | + */ |
|
| 103 | + |
|
| 104 | + /** client/html/checkout/standard/order/name |
|
| 105 | + * Name of the order part used by the checkout standard client implementation |
|
| 106 | + * |
|
| 107 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Order\Myname". |
|
| 108 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 109 | + * |
|
| 110 | + * @param string Last part of the client class name |
|
| 111 | + * @since 2014.03 |
|
| 112 | + * @category Developer |
|
| 113 | + */ |
|
| 114 | + |
|
| 115 | + /** client/html/checkout/standard/process/name |
|
| 116 | + * Name of the process part used by the checkout standard client implementation |
|
| 117 | + * |
|
| 118 | + * Use "Myname" if your class is named "\Aimeos\Client\Html\Checkout\Standard\Process\Myname". |
|
| 119 | + * The name is case-sensitive and you should avoid camel case names like "MyName". |
|
| 120 | + * |
|
| 121 | + * @param string Last part of the client class name |
|
| 122 | + * @since 2015.07 |
|
| 123 | + * @category Developer |
|
| 124 | + */ |
|
| 125 | + private $subPartNames = array( 'address', 'delivery', 'payment', 'summary', 'order', 'process' ); |
|
| 126 | + private $cache; |
|
| 127 | + |
|
| 128 | + |
|
| 129 | + /** |
|
| 130 | + * Returns the HTML code for insertion into the body. |
|
| 131 | + * |
|
| 132 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 133 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 134 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 135 | + * @return string HTML code |
|
| 136 | + */ |
|
| 137 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 138 | + { |
|
| 139 | + $context = $this->getContext(); |
|
| 140 | + $view = $this->getView(); |
|
| 141 | + |
|
| 142 | + try |
|
| 143 | + { |
|
| 144 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 145 | + |
|
| 146 | + $html = ''; |
|
| 147 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 148 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 149 | + } |
|
| 150 | + $view->standardBody = $html; |
|
| 151 | + } |
|
| 152 | + catch( \Aimeos\Client\Html\Exception $e ) |
|
| 153 | + { |
|
| 154 | + $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 155 | + $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 156 | + } |
|
| 157 | + catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 158 | + { |
|
| 159 | + $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 160 | + $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 161 | + } |
|
| 162 | + catch( \Aimeos\MShop\Exception $e ) |
|
| 163 | + { |
|
| 164 | + $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 165 | + $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 166 | + } |
|
| 167 | + catch( \Exception $e ) |
|
| 168 | + { |
|
| 169 | + $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 170 | + |
|
| 171 | + $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 172 | + $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + /** client/html/checkout/standard/standard/template-body |
|
| 176 | + * Relative path to the HTML body template of the checkout standard client. |
|
| 177 | + * |
|
| 178 | + * The template file contains the HTML code and processing instructions |
|
| 179 | + * to generate the result shown in the body of the frontend. The |
|
| 180 | + * configuration string is the path to the template file relative |
|
| 181 | + * to the templates directory (usually in client/html/templates). |
|
| 182 | + * |
|
| 183 | + * You can overwrite the template file configuration in extensions and |
|
| 184 | + * provide alternative templates. These alternative templates should be |
|
| 185 | + * named like the default one but with the string "standard" replaced by |
|
| 186 | + * an unique name. You may use the name of your project for this. If |
|
| 187 | + * you've implemented an alternative client class as well, "standard" |
|
| 188 | + * should be replaced by the name of the new class. |
|
| 189 | + * |
|
| 190 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 191 | + * @since 2014.03 |
|
| 192 | + * @category Developer |
|
| 193 | + * @see client/html/checkout/standard/standard/template-header |
|
| 194 | + */ |
|
| 195 | + $tplconf = 'client/html/checkout/standard/standard/template-body'; |
|
| 196 | + $default = 'checkout/standard/body-default.php'; |
|
| 197 | + |
|
| 198 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 199 | + } |
|
| 200 | + |
|
| 201 | + |
|
| 202 | + /** |
|
| 203 | + * Returns the HTML string for insertion into the header. |
|
| 204 | + * |
|
| 205 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 206 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 207 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 208 | + * @return string|null String including HTML tags for the header on error |
|
| 209 | + */ |
|
| 210 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 211 | + { |
|
| 212 | + try |
|
| 213 | + { |
|
| 214 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 215 | + |
|
| 216 | + $html = ''; |
|
| 217 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 218 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 219 | + } |
|
| 220 | + $view->standardHeader = $html; |
|
| 221 | + |
|
| 222 | + /** client/html/checkout/standard/standard/template-header |
|
| 223 | + * Relative path to the HTML header template of the checkout standard client. |
|
| 224 | + * |
|
| 225 | + * The template file contains the HTML code and processing instructions |
|
| 226 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 227 | + * of the rendered page in the frontend. The configuration string is the |
|
| 228 | + * path to the template file relative to the templates directory (usually |
|
| 229 | + * in client/html/templates). |
|
| 230 | + * |
|
| 231 | + * You can overwrite the template file configuration in extensions and |
|
| 232 | + * provide alternative templates. These alternative templates should be |
|
| 233 | + * named like the default one but with the string "standard" replaced by |
|
| 234 | + * an unique name. You may use the name of your project for this. If |
|
| 235 | + * you've implemented an alternative client class as well, "standard" |
|
| 236 | + * should be replaced by the name of the new class. |
|
| 237 | + * |
|
| 238 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 239 | + * @since 2014.03 |
|
| 240 | + * @category Developer |
|
| 241 | + * @see client/html/checkout/standard/standard/template-body |
|
| 242 | + */ |
|
| 243 | + $tplconf = 'client/html/checkout/standard/standard/template-header'; |
|
| 244 | + $default = 'checkout/standard/header-default.php'; |
|
| 245 | + |
|
| 246 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 247 | + } |
|
| 248 | + catch( \Exception $e ) |
|
| 249 | + { |
|
| 250 | + $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 251 | + } |
|
| 252 | + } |
|
| 253 | + |
|
| 254 | + |
|
| 255 | + /** |
|
| 256 | + * Returns the sub-client given by its name. |
|
| 257 | + * |
|
| 258 | + * @param string $type Name of the client type |
|
| 259 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 260 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 261 | + */ |
|
| 262 | + public function getSubClient( $type, $name = null ) |
|
| 263 | + { |
|
| 264 | + /** client/html/checkout/standard/decorators/excludes |
|
| 265 | + * Excludes decorators added by the "common" option from the checkout standard html client |
|
| 266 | + * |
|
| 267 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 268 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 269 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 270 | + * modify what is returned to the caller. |
|
| 271 | + * |
|
| 272 | + * This option allows you to remove a decorator added via |
|
| 273 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 274 | + * around the html client. |
|
| 275 | + * |
|
| 276 | + * client/html/checkout/standard/decorators/excludes = array( 'decorator1' ) |
|
| 277 | + * |
|
| 278 | + * This would remove the decorator named "decorator1" from the list of |
|
| 279 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 280 | + * "client/html/common/decorators/default" to the html client. |
|
| 281 | + * |
|
| 282 | + * @param array List of decorator names |
|
| 283 | + * @since 2014.05 |
|
| 284 | + * @category Developer |
|
| 285 | + * @see client/html/common/decorators/default |
|
| 286 | + * @see client/html/checkout/standard/decorators/global |
|
| 287 | + * @see client/html/checkout/standard/decorators/local |
|
| 288 | + */ |
|
| 289 | + |
|
| 290 | + /** client/html/checkout/standard/decorators/global |
|
| 291 | + * Adds a list of globally available decorators only to the checkout standard html client |
|
| 292 | + * |
|
| 293 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 294 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 295 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 296 | + * modify what is returned to the caller. |
|
| 297 | + * |
|
| 298 | + * This option allows you to wrap global decorators |
|
| 299 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 300 | + * |
|
| 301 | + * client/html/checkout/standard/decorators/global = array( 'decorator1' ) |
|
| 302 | + * |
|
| 303 | + * This would add the decorator named "decorator1" defined by |
|
| 304 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 305 | + * |
|
| 306 | + * @param array List of decorator names |
|
| 307 | + * @since 2014.05 |
|
| 308 | + * @category Developer |
|
| 309 | + * @see client/html/common/decorators/default |
|
| 310 | + * @see client/html/checkout/standard/decorators/excludes |
|
| 311 | + * @see client/html/checkout/standard/decorators/local |
|
| 312 | + */ |
|
| 313 | + |
|
| 314 | + /** client/html/checkout/standard/decorators/local |
|
| 315 | + * Adds a list of local decorators only to the checkout standard html client |
|
| 316 | + * |
|
| 317 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 318 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 319 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 320 | + * modify what is returned to the caller. |
|
| 321 | + * |
|
| 322 | + * This option allows you to wrap local decorators |
|
| 323 | + * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 324 | + * |
|
| 325 | + * client/html/checkout/standard/decorators/local = array( 'decorator2' ) |
|
| 326 | + * |
|
| 327 | + * This would add the decorator named "decorator2" defined by |
|
| 328 | + * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 329 | + * |
|
| 330 | + * @param array List of decorator names |
|
| 331 | + * @since 2014.05 |
|
| 332 | + * @category Developer |
|
| 333 | + * @see client/html/common/decorators/default |
|
| 334 | + * @see client/html/checkout/standard/decorators/excludes |
|
| 335 | + * @see client/html/checkout/standard/decorators/global |
|
| 336 | + */ |
|
| 337 | + |
|
| 338 | + return $this->createSubClient( 'checkout/standard/' . $type, $name ); |
|
| 339 | + } |
|
| 340 | + |
|
| 341 | + |
|
| 342 | + /** |
|
| 343 | + * Processes the input, e.g. store given values. |
|
| 344 | + * A view must be available and this method doesn't generate any output |
|
| 345 | + * besides setting view variables. |
|
| 346 | + */ |
|
| 347 | + public function process() |
|
| 348 | + { |
|
| 349 | + $view = $this->getView(); |
|
| 350 | + $context = $this->getContext(); |
|
| 351 | + |
|
| 352 | + try |
|
| 353 | + { |
|
| 354 | + parent::process(); |
|
| 355 | + } |
|
| 356 | + catch( \Aimeos\Client\Html\Exception $e ) |
|
| 357 | + { |
|
| 358 | + $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 359 | + $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 360 | + } |
|
| 361 | + catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 362 | + { |
|
| 363 | + $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 364 | + $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 365 | + } |
|
| 366 | + catch( \Aimeos\MShop\Plugin\Provider\Exception $e ) |
|
| 367 | + { |
|
| 368 | + $errors = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 369 | + $errors = array_merge( $errors, $this->translatePluginErrorCodes( $e->getErrorCodes() ) ); |
|
| 370 | + |
|
| 371 | + $view->summaryErrorCodes = $e->getErrorCodes(); |
|
| 372 | + $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $errors; |
|
| 373 | + } |
|
| 374 | + catch( \Aimeos\MShop\Exception $e ) |
|
| 375 | + { |
|
| 376 | + $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 377 | + $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 378 | + } |
|
| 379 | + catch( \Exception $e ) |
|
| 380 | + { |
|
| 381 | + $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 382 | + |
|
| 383 | + $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 384 | + $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 385 | + } |
|
| 386 | + } |
|
| 387 | + |
|
| 388 | + |
|
| 389 | + /** |
|
| 390 | + * Returns the list of sub-client names configured for the client. |
|
| 391 | + * |
|
| 392 | + * @return array List of HTML client names |
|
| 393 | + */ |
|
| 394 | + protected function getSubClientNames() |
|
| 395 | + { |
|
| 396 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 397 | + } |
|
| 398 | + |
|
| 399 | + |
|
| 400 | + /** |
|
| 401 | + * Sets the necessary parameter values in the view. |
|
| 402 | + * |
|
| 403 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 404 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 405 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 406 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 407 | + */ |
|
| 408 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 409 | + { |
|
| 410 | + if( !isset( $this->cache ) ) |
|
| 411 | + { |
|
| 412 | + $context = $this->getContext(); |
|
| 413 | + |
|
| 414 | + $basketCntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 415 | + $view->standardBasket = $basketCntl->get(); |
|
| 416 | + |
|
| 417 | + |
|
| 418 | + /** client/html/checkout/standard/url/step-active |
|
| 419 | + * Name of the checkout process step to jump to if no previous step requires attention |
|
| 420 | + * |
|
| 421 | + * The checkout process consists of several steps which are usually |
|
| 422 | + * displayed one by another to the customer. If the data of a step |
|
| 423 | + * is already available, then that step is skipped. The active step |
|
| 424 | + * is the one that is displayed if all other steps are skipped. |
|
| 425 | + * |
|
| 426 | + * If one of the previous steps misses some data the customer has |
|
| 427 | + * to enter, then this step is displayed first. After providing |
|
| 428 | + * the missing data, the whole series of steps are tested again |
|
| 429 | + * and if no other step requests attention, the configured active |
|
| 430 | + * step will be displayed. |
|
| 431 | + * |
|
| 432 | + * The order of the steps is determined by the order of sub-parts |
|
| 433 | + * that are configured for the checkout client. |
|
| 434 | + * |
|
| 435 | + * @param string Name of the confirm standard HTML client |
|
| 436 | + * @since 2014.07 |
|
| 437 | + * @category Developer |
|
| 438 | + * @category User |
|
| 439 | + * @see client/html/checkout/standard/standard/subparts |
|
| 440 | + */ |
|
| 441 | + $default = $view->config( 'client/html/checkout/standard/url/step-active', 'summary' ); |
|
| 442 | + |
|
| 443 | + /** client/html/checkout/standard/onepage |
|
| 444 | + * Shows all named checkout subparts at once for a one page checkout |
|
| 445 | + * |
|
| 446 | + * Normally, the checkout process is divided into several steps for entering |
|
| 447 | + * addresses, select delivery and payment options as well as showing the |
|
| 448 | + * summary page. This enables dependencies between two steps like showing |
|
| 449 | + * delivery options based on the address entered by the customer. Furthermore, |
|
| 450 | + * this is good way to limit the amount of information displayed which is |
|
| 451 | + * preferred by mobile users. |
|
| 452 | + * |
|
| 453 | + * Contrary to that, a one page checkout displays all information on only |
|
| 454 | + * one page and customers get an immediate overview of which information |
|
| 455 | + * they have to enter and what options they can select from. This is an |
|
| 456 | + * advantage if only a very limited amount of information must be entered |
|
| 457 | + * or if there are almost no options to choose from and no dependencies |
|
| 458 | + * between exist. |
|
| 459 | + * |
|
| 460 | + * Using this config options, shop developers are able to define which |
|
| 461 | + * checkout subparts are combined to a one page view. Simply add the names |
|
| 462 | + * of all checkout subparts to the list. Available checkout subparts for |
|
| 463 | + * a one page checkout are: |
|
| 464 | + * * address |
|
| 465 | + * * delivery |
|
| 466 | + * * payment |
|
| 467 | + * * summary |
|
| 468 | + * |
|
| 469 | + * @param array List of checkout subparts name |
|
| 470 | + * @since 2015.05 |
|
| 471 | + * @category Developer |
|
| 472 | + */ |
|
| 473 | + $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 474 | + $onestep = array_shift( $onepage ); // keep the first one page step |
|
| 475 | + |
|
| 476 | + $steps = (array) $context->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 477 | + $steps = array_diff( $steps, $onepage ); // remove all remaining steps in $onepage |
|
| 478 | + |
|
| 479 | + // use first step if default step isn't available |
|
| 480 | + $default = ( !in_array( $default, $steps ) ? reset( $steps ) : $default ); |
|
| 481 | + |
|
| 482 | + $current = $view->param( 'c_step', $default ); |
|
| 483 | + // use $onestep if current step isn't available due to one page layout |
|
| 484 | + $current = ( !in_array( $current, $steps ) ? $onestep : $current ); |
|
| 485 | + |
|
| 486 | + $cpos = $cpos = array_search( $current, $steps ); |
|
| 487 | + |
|
| 488 | + if( !isset( $view->standardStepActive ) |
|
| 489 | + || ( ( $apos = array_search( $view->standardStepActive, $steps ) ) !== false |
|
| 490 | + && $cpos !== false && $cpos < $apos ) |
|
| 491 | + ) { |
|
| 492 | + $view->standardStepActive = $current; |
|
| 493 | + } |
|
| 494 | + |
|
| 495 | + $view->standardSteps = $steps; |
|
| 496 | + |
|
| 497 | + |
|
| 498 | + $this->cache = $this->addNavigationUrls( $view, $steps, $view->standardStepActive ); |
|
| 499 | + } |
|
| 500 | + |
|
| 501 | + return $this->cache; |
|
| 502 | + } |
|
| 503 | + |
|
| 504 | + |
|
| 505 | + /** |
|
| 506 | + * Adds the "back" and "next" URLs to the view |
|
| 507 | + * |
|
| 508 | + * @param \Aimeos\MW\View\Iface $view View object |
|
| 509 | + * @param array $steps List of checkout step names |
|
| 510 | + * @param unknown $activeStep Name of the active step |
|
| 511 | + * @return \Aimeos\MW\View\Iface Enhanced view object |
|
| 512 | + * @since 2016.05 |
|
| 513 | + */ |
|
| 514 | + protected function addNavigationUrls( \Aimeos\MW\View\Iface $view, array $steps, $activeStep ) |
|
| 515 | + { |
|
| 516 | + /** client/html/checkout/standard/url/target |
|
| 517 | + * Destination of the URL where the controller specified in the URL is known |
|
| 518 | + * |
|
| 519 | + * The destination can be a page ID like in a content management system or the |
|
| 520 | + * module of a software development framework. This "target" must contain or know |
|
| 521 | + * the controller that should be called by the generated URL. |
|
| 522 | + * |
|
| 523 | + * @param string Destination of the URL |
|
| 524 | + * @since 2014.03 |
|
| 525 | + * @category Developer |
|
| 526 | + * @see client/html/checkout/standard/url/controller |
|
| 527 | + * @see client/html/checkout/standard/url/action |
|
| 528 | + * @see client/html/checkout/standard/url/config |
|
| 529 | + */ |
|
| 530 | + $cTarget = $view->config( 'client/html/checkout/standard/url/target' ); |
|
| 531 | + |
|
| 532 | + /** client/html/checkout/standard/url/controller |
|
| 533 | + * Name of the controller whose action should be called |
|
| 534 | + * |
|
| 535 | + * In Model-View-Controller (MVC) applications, the controller contains the methods |
|
| 536 | + * that create parts of the output displayed in the generated HTML page. Controller |
|
| 537 | + * names are usually alpha-numeric. |
|
| 538 | + * |
|
| 539 | + * @param string Name of the controller |
|
| 540 | + * @since 2014.03 |
|
| 541 | + * @category Developer |
|
| 542 | + * @see client/html/checkout/standard/url/target |
|
| 543 | + * @see client/html/checkout/standard/url/action |
|
| 544 | + * @see client/html/checkout/standard/url/config |
|
| 545 | + */ |
|
| 546 | + $cCntl = $view->config( 'client/html/checkout/standard/url/controller', 'checkout' ); |
|
| 547 | + |
|
| 548 | + /** client/html/checkout/standard/url/action |
|
| 549 | + * Name of the action that should create the output |
|
| 550 | + * |
|
| 551 | + * In Model-View-Controller (MVC) applications, actions are the methods of a |
|
| 552 | + * controller that create parts of the output displayed in the generated HTML page. |
|
| 553 | + * Action names are usually alpha-numeric. |
|
| 554 | + * |
|
| 555 | + * @param string Name of the action |
|
| 556 | + * @since 2014.03 |
|
| 557 | + * @category Developer |
|
| 558 | + * @see client/html/checkout/standard/url/target |
|
| 559 | + * @see client/html/checkout/standard/url/controller |
|
| 560 | + * @see client/html/checkout/standard/url/config |
|
| 561 | + */ |
|
| 562 | + $cAction = $view->config( 'client/html/checkout/standard/url/action', 'index' ); |
|
| 563 | + |
|
| 564 | + /** client/html/checkout/standard/url/config |
|
| 565 | + * Associative list of configuration options used for generating the URL |
|
| 566 | + * |
|
| 567 | + * You can specify additional options as key/value pairs used when generating |
|
| 568 | + * the URLs, like |
|
| 569 | + * |
|
| 570 | + * client/html/<clientname>/url/config = array( 'absoluteUri' => true ) |
|
| 571 | + * |
|
| 572 | + * The available key/value pairs depend on the application that embeds the e-commerce |
|
| 573 | + * framework. This is because the infrastructure of the application is used for |
|
| 574 | + * generating the URLs. The full list of available config options is referenced |
|
| 575 | + * in the "see also" section of this page. |
|
| 576 | + * |
|
| 577 | + * @param string Associative list of configuration options |
|
| 578 | + * @since 2014.03 |
|
| 579 | + * @category Developer |
|
| 580 | + * @see client/html/checkout/standard/url/target |
|
| 581 | + * @see client/html/checkout/standard/url/controller |
|
| 582 | + * @see client/html/checkout/standard/url/action |
|
| 583 | + * @see client/html/url/config |
|
| 584 | + */ |
|
| 585 | + $cConfig = $view->config( 'client/html/checkout/standard/url/config', array() ); |
|
| 586 | + |
|
| 587 | + |
|
| 588 | + $bTarget = $view->config( 'client/html/basket/standard/url/target' ); |
|
| 589 | + $bCntl = $view->config( 'client/html/basket/standard/url/controller', 'basket' ); |
|
| 590 | + $bAction = $view->config( 'client/html/basket/standard/url/action', 'index' ); |
|
| 591 | + $bConfig = $view->config( 'client/html/basket/standard/url/config', array() ); |
|
| 592 | + |
|
| 593 | + |
|
| 594 | + $step = null; |
|
| 595 | + do { |
|
| 596 | + $lastStep = $step; |
|
| 597 | + } |
|
| 598 | + while( ( $step = array_shift( $steps ) ) !== null && $step !== $activeStep ); |
|
| 599 | + |
|
| 600 | + |
|
| 601 | + if( $lastStep !== null ) { |
|
| 602 | + $param = array( 'c_step' => $lastStep ); |
|
| 603 | + $view->standardUrlBack = $view->url( $cTarget, $cCntl, $cAction, $param, array(), $cConfig ); |
|
| 604 | + } else { |
|
| 605 | + $view->standardUrlBack = $view->url( $bTarget, $bCntl, $bAction, array(), array(), $bConfig ); |
|
| 606 | + } |
|
| 607 | + |
|
| 608 | + if( !isset( $view->standardUrlNext ) && ( $nextStep = array_shift( $steps ) ) !== null ) { |
|
| 609 | + $param = array( 'c_step' => $nextStep ); |
|
| 610 | + $view->standardUrlNext = $view->url( $cTarget, $cCntl, $cAction, $param, array(), $cConfig ); |
|
| 611 | + } |
|
| 612 | + // don't overwrite $view->standardUrlNext so order step URL is used |
|
| 613 | + |
|
| 614 | + return $view; |
|
| 615 | + } |
|
| 616 | 616 | } |
| 617 | 617 | \ No newline at end of file |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * @since 2015.07 |
| 123 | 123 | * @category Developer |
| 124 | 124 | */ |
| 125 | - private $subPartNames = array( 'address', 'delivery', 'payment', 'summary', 'order', 'process' ); |
|
| 125 | + private $subPartNames = array('address', 'delivery', 'payment', 'summary', 'order', 'process'); |
|
| 126 | 126 | private $cache; |
| 127 | 127 | |
| 128 | 128 | |
@@ -134,42 +134,42 @@ discard block |
||
| 134 | 134 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 135 | 135 | * @return string HTML code |
| 136 | 136 | */ |
| 137 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 137 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 138 | 138 | { |
| 139 | 139 | $context = $this->getContext(); |
| 140 | 140 | $view = $this->getView(); |
| 141 | 141 | |
| 142 | 142 | try |
| 143 | 143 | { |
| 144 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 144 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 145 | 145 | |
| 146 | 146 | $html = ''; |
| 147 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 148 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 147 | + foreach ($this->getSubClients() as $subclient) { |
|
| 148 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 149 | 149 | } |
| 150 | 150 | $view->standardBody = $html; |
| 151 | 151 | } |
| 152 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 152 | + catch (\Aimeos\Client\Html\Exception $e) |
|
| 153 | 153 | { |
| 154 | - $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 155 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 154 | + $error = array($this->getContext()->getI18n()->dt('client', $e->getMessage())); |
|
| 155 | + $view->standardErrorList = $view->get('standardErrorList', array()) + $error; |
|
| 156 | 156 | } |
| 157 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 157 | + catch (\Aimeos\Controller\Frontend\Exception $e) |
|
| 158 | 158 | { |
| 159 | - $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 160 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 159 | + $error = array($this->getContext()->getI18n()->dt('controller/frontend', $e->getMessage())); |
|
| 160 | + $view->standardErrorList = $view->get('standardErrorList', array()) + $error; |
|
| 161 | 161 | } |
| 162 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 162 | + catch (\Aimeos\MShop\Exception $e) |
|
| 163 | 163 | { |
| 164 | - $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 165 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 164 | + $error = array($this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
| 165 | + $view->standardErrorList = $view->get('standardErrorList', array()) + $error; |
|
| 166 | 166 | } |
| 167 | - catch( \Exception $e ) |
|
| 167 | + catch (\Exception $e) |
|
| 168 | 168 | { |
| 169 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 169 | + $context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 170 | 170 | |
| 171 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 172 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 171 | + $error = array($context->getI18n()->dt('client', 'A non-recoverable error occured')); |
|
| 172 | + $view->standardErrorList = $view->get('standardErrorList', array()) + $error; |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | /** client/html/checkout/standard/standard/template-body |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | $tplconf = 'client/html/checkout/standard/standard/template-body'; |
| 196 | 196 | $default = 'checkout/standard/body-default.php'; |
| 197 | 197 | |
| 198 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 198 | + return $view->render($view->config($tplconf, $default)); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | |
@@ -207,15 +207,15 @@ discard block |
||
| 207 | 207 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 208 | 208 | * @return string|null String including HTML tags for the header on error |
| 209 | 209 | */ |
| 210 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 210 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 211 | 211 | { |
| 212 | 212 | try |
| 213 | 213 | { |
| 214 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 214 | + $view = $this->setViewParams($this->getView(), $tags, $expire); |
|
| 215 | 215 | |
| 216 | 216 | $html = ''; |
| 217 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 218 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 217 | + foreach ($this->getSubClients() as $subclient) { |
|
| 218 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 219 | 219 | } |
| 220 | 220 | $view->standardHeader = $html; |
| 221 | 221 | |
@@ -243,11 +243,11 @@ discard block |
||
| 243 | 243 | $tplconf = 'client/html/checkout/standard/standard/template-header'; |
| 244 | 244 | $default = 'checkout/standard/header-default.php'; |
| 245 | 245 | |
| 246 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 246 | + return $view->render($view->config($tplconf, $default)); |
|
| 247 | 247 | } |
| 248 | - catch( \Exception $e ) |
|
| 248 | + catch (\Exception $e) |
|
| 249 | 249 | { |
| 250 | - $this->getContext()->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 250 | + $this->getContext()->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | * @param string|null $name Name of the sub-client (Default if null) |
| 260 | 260 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 261 | 261 | */ |
| 262 | - public function getSubClient( $type, $name = null ) |
|
| 262 | + public function getSubClient($type, $name = null) |
|
| 263 | 263 | { |
| 264 | 264 | /** client/html/checkout/standard/decorators/excludes |
| 265 | 265 | * Excludes decorators added by the "common" option from the checkout standard html client |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | * @see client/html/checkout/standard/decorators/global |
| 336 | 336 | */ |
| 337 | 337 | |
| 338 | - return $this->createSubClient( 'checkout/standard/' . $type, $name ); |
|
| 338 | + return $this->createSubClient('checkout/standard/'.$type, $name); |
|
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | |
@@ -353,35 +353,35 @@ discard block |
||
| 353 | 353 | { |
| 354 | 354 | parent::process(); |
| 355 | 355 | } |
| 356 | - catch( \Aimeos\Client\Html\Exception $e ) |
|
| 356 | + catch (\Aimeos\Client\Html\Exception $e) |
|
| 357 | 357 | { |
| 358 | - $error = array( $this->getContext()->getI18n()->dt( 'client', $e->getMessage() ) ); |
|
| 359 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 358 | + $error = array($this->getContext()->getI18n()->dt('client', $e->getMessage())); |
|
| 359 | + $view->standardErrorList = $view->get('standardErrorList', array()) + $error; |
|
| 360 | 360 | } |
| 361 | - catch( \Aimeos\Controller\Frontend\Exception $e ) |
|
| 361 | + catch (\Aimeos\Controller\Frontend\Exception $e) |
|
| 362 | 362 | { |
| 363 | - $error = array( $this->getContext()->getI18n()->dt( 'controller/frontend', $e->getMessage() ) ); |
|
| 364 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 363 | + $error = array($this->getContext()->getI18n()->dt('controller/frontend', $e->getMessage())); |
|
| 364 | + $view->standardErrorList = $view->get('standardErrorList', array()) + $error; |
|
| 365 | 365 | } |
| 366 | - catch( \Aimeos\MShop\Plugin\Provider\Exception $e ) |
|
| 366 | + catch (\Aimeos\MShop\Plugin\Provider\Exception $e) |
|
| 367 | 367 | { |
| 368 | - $errors = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 369 | - $errors = array_merge( $errors, $this->translatePluginErrorCodes( $e->getErrorCodes() ) ); |
|
| 368 | + $errors = array($this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
| 369 | + $errors = array_merge($errors, $this->translatePluginErrorCodes($e->getErrorCodes())); |
|
| 370 | 370 | |
| 371 | 371 | $view->summaryErrorCodes = $e->getErrorCodes(); |
| 372 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $errors; |
|
| 372 | + $view->standardErrorList = $view->get('standardErrorList', array()) + $errors; |
|
| 373 | 373 | } |
| 374 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 374 | + catch (\Aimeos\MShop\Exception $e) |
|
| 375 | 375 | { |
| 376 | - $error = array( $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 377 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 376 | + $error = array($this->getContext()->getI18n()->dt('mshop', $e->getMessage())); |
|
| 377 | + $view->standardErrorList = $view->get('standardErrorList', array()) + $error; |
|
| 378 | 378 | } |
| 379 | - catch( \Exception $e ) |
|
| 379 | + catch (\Exception $e) |
|
| 380 | 380 | { |
| 381 | - $context->getLogger()->log( $e->getMessage() . PHP_EOL . $e->getTraceAsString() ); |
|
| 381 | + $context->getLogger()->log($e->getMessage().PHP_EOL.$e->getTraceAsString()); |
|
| 382 | 382 | |
| 383 | - $error = array( $context->getI18n()->dt( 'client', 'A non-recoverable error occured' ) ); |
|
| 384 | - $view->standardErrorList = $view->get( 'standardErrorList', array() ) + $error; |
|
| 383 | + $error = array($context->getI18n()->dt('client', 'A non-recoverable error occured')); |
|
| 384 | + $view->standardErrorList = $view->get('standardErrorList', array()) + $error; |
|
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | 387 | |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | */ |
| 394 | 394 | protected function getSubClientNames() |
| 395 | 395 | { |
| 396 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 396 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | |
@@ -405,13 +405,13 @@ discard block |
||
| 405 | 405 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 406 | 406 | * @return \Aimeos\MW\View\Iface Modified view object |
| 407 | 407 | */ |
| 408 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 408 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 409 | 409 | { |
| 410 | - if( !isset( $this->cache ) ) |
|
| 410 | + if (!isset($this->cache)) |
|
| 411 | 411 | { |
| 412 | 412 | $context = $this->getContext(); |
| 413 | 413 | |
| 414 | - $basketCntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 414 | + $basketCntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
| 415 | 415 | $view->standardBasket = $basketCntl->get(); |
| 416 | 416 | |
| 417 | 417 | |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | * @category User |
| 439 | 439 | * @see client/html/checkout/standard/standard/subparts |
| 440 | 440 | */ |
| 441 | - $default = $view->config( 'client/html/checkout/standard/url/step-active', 'summary' ); |
|
| 441 | + $default = $view->config('client/html/checkout/standard/url/step-active', 'summary'); |
|
| 442 | 442 | |
| 443 | 443 | /** client/html/checkout/standard/onepage |
| 444 | 444 | * Shows all named checkout subparts at once for a one page checkout |
@@ -470,24 +470,24 @@ discard block |
||
| 470 | 470 | * @since 2015.05 |
| 471 | 471 | * @category Developer |
| 472 | 472 | */ |
| 473 | - $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 474 | - $onestep = array_shift( $onepage ); // keep the first one page step |
|
| 473 | + $onepage = $view->config('client/html/checkout/standard/onepage', array()); |
|
| 474 | + $onestep = array_shift($onepage); // keep the first one page step |
|
| 475 | 475 | |
| 476 | - $steps = (array) $context->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 477 | - $steps = array_diff( $steps, $onepage ); // remove all remaining steps in $onepage |
|
| 476 | + $steps = (array) $context->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 477 | + $steps = array_diff($steps, $onepage); // remove all remaining steps in $onepage |
|
| 478 | 478 | |
| 479 | 479 | // use first step if default step isn't available |
| 480 | - $default = ( !in_array( $default, $steps ) ? reset( $steps ) : $default ); |
|
| 480 | + $default = (!in_array($default, $steps) ? reset($steps) : $default); |
|
| 481 | 481 | |
| 482 | - $current = $view->param( 'c_step', $default ); |
|
| 482 | + $current = $view->param('c_step', $default); |
|
| 483 | 483 | // use $onestep if current step isn't available due to one page layout |
| 484 | - $current = ( !in_array( $current, $steps ) ? $onestep : $current ); |
|
| 484 | + $current = (!in_array($current, $steps) ? $onestep : $current); |
|
| 485 | 485 | |
| 486 | - $cpos = $cpos = array_search( $current, $steps ); |
|
| 486 | + $cpos = $cpos = array_search($current, $steps); |
|
| 487 | 487 | |
| 488 | - if( !isset( $view->standardStepActive ) |
|
| 489 | - || ( ( $apos = array_search( $view->standardStepActive, $steps ) ) !== false |
|
| 490 | - && $cpos !== false && $cpos < $apos ) |
|
| 488 | + if (!isset($view->standardStepActive) |
|
| 489 | + || (($apos = array_search($view->standardStepActive, $steps)) !== false |
|
| 490 | + && $cpos !== false && $cpos < $apos) |
|
| 491 | 491 | ) { |
| 492 | 492 | $view->standardStepActive = $current; |
| 493 | 493 | } |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | $view->standardSteps = $steps; |
| 496 | 496 | |
| 497 | 497 | |
| 498 | - $this->cache = $this->addNavigationUrls( $view, $steps, $view->standardStepActive ); |
|
| 498 | + $this->cache = $this->addNavigationUrls($view, $steps, $view->standardStepActive); |
|
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | return $this->cache; |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | * @return \Aimeos\MW\View\Iface Enhanced view object |
| 512 | 512 | * @since 2016.05 |
| 513 | 513 | */ |
| 514 | - protected function addNavigationUrls( \Aimeos\MW\View\Iface $view, array $steps, $activeStep ) |
|
| 514 | + protected function addNavigationUrls(\Aimeos\MW\View\Iface $view, array $steps, $activeStep) |
|
| 515 | 515 | { |
| 516 | 516 | /** client/html/checkout/standard/url/target |
| 517 | 517 | * Destination of the URL where the controller specified in the URL is known |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | * @see client/html/checkout/standard/url/action |
| 528 | 528 | * @see client/html/checkout/standard/url/config |
| 529 | 529 | */ |
| 530 | - $cTarget = $view->config( 'client/html/checkout/standard/url/target' ); |
|
| 530 | + $cTarget = $view->config('client/html/checkout/standard/url/target'); |
|
| 531 | 531 | |
| 532 | 532 | /** client/html/checkout/standard/url/controller |
| 533 | 533 | * Name of the controller whose action should be called |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | * @see client/html/checkout/standard/url/action |
| 544 | 544 | * @see client/html/checkout/standard/url/config |
| 545 | 545 | */ |
| 546 | - $cCntl = $view->config( 'client/html/checkout/standard/url/controller', 'checkout' ); |
|
| 546 | + $cCntl = $view->config('client/html/checkout/standard/url/controller', 'checkout'); |
|
| 547 | 547 | |
| 548 | 548 | /** client/html/checkout/standard/url/action |
| 549 | 549 | * Name of the action that should create the output |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | * @see client/html/checkout/standard/url/controller |
| 560 | 560 | * @see client/html/checkout/standard/url/config |
| 561 | 561 | */ |
| 562 | - $cAction = $view->config( 'client/html/checkout/standard/url/action', 'index' ); |
|
| 562 | + $cAction = $view->config('client/html/checkout/standard/url/action', 'index'); |
|
| 563 | 563 | |
| 564 | 564 | /** client/html/checkout/standard/url/config |
| 565 | 565 | * Associative list of configuration options used for generating the URL |
@@ -582,32 +582,32 @@ discard block |
||
| 582 | 582 | * @see client/html/checkout/standard/url/action |
| 583 | 583 | * @see client/html/url/config |
| 584 | 584 | */ |
| 585 | - $cConfig = $view->config( 'client/html/checkout/standard/url/config', array() ); |
|
| 585 | + $cConfig = $view->config('client/html/checkout/standard/url/config', array()); |
|
| 586 | 586 | |
| 587 | 587 | |
| 588 | - $bTarget = $view->config( 'client/html/basket/standard/url/target' ); |
|
| 589 | - $bCntl = $view->config( 'client/html/basket/standard/url/controller', 'basket' ); |
|
| 590 | - $bAction = $view->config( 'client/html/basket/standard/url/action', 'index' ); |
|
| 591 | - $bConfig = $view->config( 'client/html/basket/standard/url/config', array() ); |
|
| 588 | + $bTarget = $view->config('client/html/basket/standard/url/target'); |
|
| 589 | + $bCntl = $view->config('client/html/basket/standard/url/controller', 'basket'); |
|
| 590 | + $bAction = $view->config('client/html/basket/standard/url/action', 'index'); |
|
| 591 | + $bConfig = $view->config('client/html/basket/standard/url/config', array()); |
|
| 592 | 592 | |
| 593 | 593 | |
| 594 | 594 | $step = null; |
| 595 | 595 | do { |
| 596 | 596 | $lastStep = $step; |
| 597 | 597 | } |
| 598 | - while( ( $step = array_shift( $steps ) ) !== null && $step !== $activeStep ); |
|
| 598 | + while (($step = array_shift($steps)) !== null && $step !== $activeStep); |
|
| 599 | 599 | |
| 600 | 600 | |
| 601 | - if( $lastStep !== null ) { |
|
| 602 | - $param = array( 'c_step' => $lastStep ); |
|
| 603 | - $view->standardUrlBack = $view->url( $cTarget, $cCntl, $cAction, $param, array(), $cConfig ); |
|
| 601 | + if ($lastStep !== null) { |
|
| 602 | + $param = array('c_step' => $lastStep); |
|
| 603 | + $view->standardUrlBack = $view->url($cTarget, $cCntl, $cAction, $param, array(), $cConfig); |
|
| 604 | 604 | } else { |
| 605 | - $view->standardUrlBack = $view->url( $bTarget, $bCntl, $bAction, array(), array(), $bConfig ); |
|
| 605 | + $view->standardUrlBack = $view->url($bTarget, $bCntl, $bAction, array(), array(), $bConfig); |
|
| 606 | 606 | } |
| 607 | 607 | |
| 608 | - if( !isset( $view->standardUrlNext ) && ( $nextStep = array_shift( $steps ) ) !== null ) { |
|
| 609 | - $param = array( 'c_step' => $nextStep ); |
|
| 610 | - $view->standardUrlNext = $view->url( $cTarget, $cCntl, $cAction, $param, array(), $cConfig ); |
|
| 608 | + if (!isset($view->standardUrlNext) && ($nextStep = array_shift($steps)) !== null) { |
|
| 609 | + $param = array('c_step' => $nextStep); |
|
| 610 | + $view->standardUrlNext = $view->url($cTarget, $cCntl, $cAction, $param, array(), $cConfig); |
|
| 611 | 611 | } |
| 612 | 612 | // don't overwrite $view->standardUrlNext so order step URL is used |
| 613 | 613 | |
@@ -23,345 +23,345 @@ |
||
| 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/delivery/standard/subparts |
|
| 30 | - * List of HTML sub-clients rendered within the checkout standard delivery 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/delivery/standard/subparts'; |
|
| 63 | - private $subPartNames = array(); |
|
| 64 | - private $cache; |
|
| 65 | - |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * Returns the HTML code for insertion into the body. |
|
| 69 | - * |
|
| 70 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 71 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 72 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 73 | - * @return string HTML code |
|
| 74 | - */ |
|
| 75 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 76 | - { |
|
| 77 | - $view = $this->getView(); |
|
| 78 | - $step = $view->get( 'standardStepActive' ); |
|
| 79 | - $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 80 | - |
|
| 81 | - if( $step != 'delivery' && !( in_array( 'delivery', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 82 | - return ''; |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 86 | - |
|
| 87 | - $html = ''; |
|
| 88 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 89 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 90 | - } |
|
| 91 | - $view->deliveryBody = $html; |
|
| 92 | - |
|
| 93 | - /** client/html/checkout/standard/delivery/standard/template-body |
|
| 94 | - * Relative path to the HTML body template of the checkout standard delivery client. |
|
| 95 | - * |
|
| 96 | - * The template file contains the HTML code and processing instructions |
|
| 97 | - * to generate the result shown in the body of the frontend. The |
|
| 98 | - * configuration string is the path to the template file relative |
|
| 99 | - * to the templates directory (usually in client/html/templates). |
|
| 100 | - * |
|
| 101 | - * You can overwrite the template file configuration in extensions and |
|
| 102 | - * provide alternative templates. These alternative templates should be |
|
| 103 | - * named like the default one but with the string "standard" replaced by |
|
| 104 | - * an unique name. You may use the name of your project for this. If |
|
| 105 | - * you've implemented an alternative client class as well, "standard" |
|
| 106 | - * should be replaced by the name of the new class. |
|
| 107 | - * |
|
| 108 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 109 | - * @since 2014.03 |
|
| 110 | - * @category Developer |
|
| 111 | - * @see client/html/checkout/standard/delivery/standard/template-header |
|
| 112 | - */ |
|
| 113 | - $tplconf = 'client/html/checkout/standard/delivery/standard/template-body'; |
|
| 114 | - $default = 'checkout/standard/delivery-body-default.php'; |
|
| 115 | - |
|
| 116 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - |
|
| 120 | - /** |
|
| 121 | - * Returns the HTML string for insertion into the header. |
|
| 122 | - * |
|
| 123 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 124 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 125 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 126 | - * @return string|null String including HTML tags for the header on error |
|
| 127 | - */ |
|
| 128 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 129 | - { |
|
| 130 | - $view = $this->getView(); |
|
| 131 | - $step = $view->get( 'standardStepActive' ); |
|
| 132 | - $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 133 | - |
|
| 134 | - if( $step != 'delivery' && !( in_array( 'delivery', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 135 | - return ''; |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 139 | - |
|
| 140 | - $html = ''; |
|
| 141 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 142 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 143 | - } |
|
| 144 | - $view->deliveryHeader = $html; |
|
| 145 | - |
|
| 146 | - /** client/html/checkout/standard/delivery/standard/template-header |
|
| 147 | - * Relative path to the HTML header template of the checkout standard delivery client. |
|
| 148 | - * |
|
| 149 | - * The template file contains the HTML code and processing instructions |
|
| 150 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 151 | - * of the rendered page in the frontend. The configuration string is the |
|
| 152 | - * path to the template file relative to the templates directory (usually |
|
| 153 | - * in client/html/templates). |
|
| 154 | - * |
|
| 155 | - * You can overwrite the template file configuration in extensions and |
|
| 156 | - * provide alternative templates. These alternative templates should be |
|
| 157 | - * named like the default one but with the string "standard" replaced by |
|
| 158 | - * an unique name. You may use the name of your project for this. If |
|
| 159 | - * you've implemented an alternative client class as well, "standard" |
|
| 160 | - * should be replaced by the name of the new class. |
|
| 161 | - * |
|
| 162 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 163 | - * @since 2014.03 |
|
| 164 | - * @category Developer |
|
| 165 | - * @see client/html/checkout/standard/delivery/standard/template-body |
|
| 166 | - */ |
|
| 167 | - $tplconf = 'client/html/checkout/standard/delivery/standard/template-header'; |
|
| 168 | - $default = 'checkout/standard/delivery-header-default.php'; |
|
| 169 | - |
|
| 170 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - |
|
| 174 | - /** |
|
| 175 | - * Returns the sub-client given by its name. |
|
| 176 | - * |
|
| 177 | - * @param string $type Name of the client type |
|
| 178 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 179 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 180 | - */ |
|
| 181 | - public function getSubClient( $type, $name = null ) |
|
| 182 | - { |
|
| 183 | - /** client/html/checkout/standard/delivery/decorators/excludes |
|
| 184 | - * Excludes decorators added by the "common" option from the checkout standard delivery html client |
|
| 185 | - * |
|
| 186 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 187 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 188 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 189 | - * modify what is returned to the caller. |
|
| 190 | - * |
|
| 191 | - * This option allows you to remove a decorator added via |
|
| 192 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 193 | - * around the html client. |
|
| 194 | - * |
|
| 195 | - * client/html/checkout/standard/delivery/decorators/excludes = array( 'decorator1' ) |
|
| 196 | - * |
|
| 197 | - * This would remove the decorator named "decorator1" from the list of |
|
| 198 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 199 | - * "client/html/common/decorators/default" to the html client. |
|
| 200 | - * |
|
| 201 | - * @param array List of decorator names |
|
| 202 | - * @since 2015.08 |
|
| 203 | - * @category Developer |
|
| 204 | - * @see client/html/common/decorators/default |
|
| 205 | - * @see client/html/checkout/standard/delivery/decorators/global |
|
| 206 | - * @see client/html/checkout/standard/delivery/decorators/local |
|
| 207 | - */ |
|
| 208 | - |
|
| 209 | - /** client/html/checkout/standard/delivery/decorators/global |
|
| 210 | - * Adds a list of globally available decorators only to the checkout standard delivery html client |
|
| 211 | - * |
|
| 212 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 213 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 214 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 215 | - * modify what is returned to the caller. |
|
| 216 | - * |
|
| 217 | - * This option allows you to wrap global decorators |
|
| 218 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 219 | - * |
|
| 220 | - * client/html/checkout/standard/delivery/decorators/global = array( 'decorator1' ) |
|
| 221 | - * |
|
| 222 | - * This would add the decorator named "decorator1" defined by |
|
| 223 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 224 | - * |
|
| 225 | - * @param array List of decorator names |
|
| 226 | - * @since 2015.08 |
|
| 227 | - * @category Developer |
|
| 228 | - * @see client/html/common/decorators/default |
|
| 229 | - * @see client/html/checkout/standard/delivery/decorators/excludes |
|
| 230 | - * @see client/html/checkout/standard/delivery/decorators/local |
|
| 231 | - */ |
|
| 232 | - |
|
| 233 | - /** client/html/checkout/standard/delivery/decorators/local |
|
| 234 | - * Adds a list of local decorators only to the checkout standard delivery html client |
|
| 235 | - * |
|
| 236 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 237 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 238 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 239 | - * modify what is returned to the caller. |
|
| 240 | - * |
|
| 241 | - * This option allows you to wrap local decorators |
|
| 242 | - * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 243 | - * |
|
| 244 | - * client/html/checkout/standard/delivery/decorators/local = array( 'decorator2' ) |
|
| 245 | - * |
|
| 246 | - * This would add the decorator named "decorator2" defined by |
|
| 247 | - * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 248 | - * |
|
| 249 | - * @param array List of decorator names |
|
| 250 | - * @since 2015.08 |
|
| 251 | - * @category Developer |
|
| 252 | - * @see client/html/common/decorators/default |
|
| 253 | - * @see client/html/checkout/standard/delivery/decorators/excludes |
|
| 254 | - * @see client/html/checkout/standard/delivery/decorators/global |
|
| 255 | - */ |
|
| 256 | - |
|
| 257 | - return $this->createSubClient( 'checkout/standard/delivery/' . $type, $name ); |
|
| 258 | - } |
|
| 259 | - |
|
| 260 | - |
|
| 261 | - /** |
|
| 262 | - * Processes the input, e.g. store given values. |
|
| 263 | - * A view must be available and this method doesn't generate any output |
|
| 264 | - * besides setting view variables. |
|
| 265 | - */ |
|
| 266 | - public function process() |
|
| 267 | - { |
|
| 268 | - $view = $this->getView(); |
|
| 269 | - |
|
| 270 | - try |
|
| 271 | - { |
|
| 272 | - $context = $this->getContext(); |
|
| 273 | - $basketCtrl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 274 | - |
|
| 275 | - // only start if there's something to do |
|
| 276 | - if( ( $serviceId = $view->param( 'c_deliveryoption', null ) ) !== null ) |
|
| 277 | - { |
|
| 278 | - $serviceCtrl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'service' ); |
|
| 279 | - |
|
| 280 | - $attributes = $view->param( 'c_delivery/' . $serviceId, array() ); |
|
| 281 | - $errors = $serviceCtrl->checkServiceAttributes( 'delivery', $serviceId, $attributes ); |
|
| 282 | - |
|
| 283 | - foreach( $errors as $key => $msg ) |
|
| 284 | - { |
|
| 285 | - if( $msg === null ) { |
|
| 286 | - unset( $errors[$key] ); |
|
| 287 | - } |
|
| 288 | - } |
|
| 289 | - |
|
| 290 | - if( count( $errors ) === 0 ) { |
|
| 291 | - $basketCtrl->setService( 'delivery', $serviceId, $attributes ); |
|
| 292 | - } else { |
|
| 293 | - $view->standardStepActive = 'delivery'; |
|
| 294 | - } |
|
| 295 | - |
|
| 296 | - $view->deliveryError = $errors; |
|
| 297 | - } |
|
| 298 | - |
|
| 299 | - |
|
| 300 | - parent::process(); |
|
| 301 | - |
|
| 302 | - |
|
| 303 | - // Test if delivery service is available |
|
| 304 | - $services = $basketCtrl->get()->getServices(); |
|
| 305 | - if( !isset( $view->standardStepActive ) && !array_key_exists( 'delivery', $services ) ) |
|
| 306 | - { |
|
| 307 | - $view->standardStepActive = 'delivery'; |
|
| 308 | - return false; |
|
| 309 | - } |
|
| 310 | - } |
|
| 311 | - catch( \Exception $e ) |
|
| 312 | - { |
|
| 313 | - $view->standardStepActive = 'delivery'; |
|
| 314 | - throw $e; |
|
| 315 | - } |
|
| 316 | - } |
|
| 317 | - |
|
| 318 | - |
|
| 319 | - /** |
|
| 320 | - * Returns the list of sub-client names configured for the client. |
|
| 321 | - * |
|
| 322 | - * @return array List of HTML client names |
|
| 323 | - */ |
|
| 324 | - protected function getSubClientNames() |
|
| 325 | - { |
|
| 326 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 327 | - } |
|
| 328 | - |
|
| 329 | - |
|
| 330 | - /** |
|
| 331 | - * Sets the necessary parameter values in the view. |
|
| 332 | - * |
|
| 333 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 334 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 335 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 336 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 337 | - */ |
|
| 338 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 339 | - { |
|
| 340 | - if( !isset( $this->cache ) ) |
|
| 341 | - { |
|
| 342 | - $context = $this->getContext(); |
|
| 343 | - |
|
| 344 | - $basketCntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 345 | - $serviceCntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'service' ); |
|
| 346 | - |
|
| 347 | - $basket = $basketCntl->get(); |
|
| 348 | - |
|
| 349 | - $services = $serviceCntl->getServices( 'delivery', $basket ); |
|
| 350 | - $serviceAttributes = $servicePrices = array(); |
|
| 351 | - |
|
| 352 | - foreach( $services as $id => $service ) |
|
| 353 | - { |
|
| 354 | - $serviceAttributes[$id] = $serviceCntl->getServiceAttributes( 'delivery', $id, $basket ); |
|
| 355 | - $servicePrices[$id] = $serviceCntl->getServicePrice( 'delivery', $id, $basket ); |
|
| 356 | - } |
|
| 357 | - |
|
| 358 | - $view->deliveryServices = $services; |
|
| 359 | - $view->deliveryServiceAttributes = $serviceAttributes; |
|
| 360 | - $view->deliveryServicePrices = $servicePrices; |
|
| 361 | - |
|
| 362 | - $this->cache = $view; |
|
| 363 | - } |
|
| 364 | - |
|
| 365 | - return $this->cache; |
|
| 366 | - } |
|
| 29 | + /** client/html/checkout/standard/delivery/standard/subparts |
|
| 30 | + * List of HTML sub-clients rendered within the checkout standard delivery 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/delivery/standard/subparts'; |
|
| 63 | + private $subPartNames = array(); |
|
| 64 | + private $cache; |
|
| 65 | + |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * Returns the HTML code for insertion into the body. |
|
| 69 | + * |
|
| 70 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 71 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 72 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 73 | + * @return string HTML code |
|
| 74 | + */ |
|
| 75 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 76 | + { |
|
| 77 | + $view = $this->getView(); |
|
| 78 | + $step = $view->get( 'standardStepActive' ); |
|
| 79 | + $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 80 | + |
|
| 81 | + if( $step != 'delivery' && !( in_array( 'delivery', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 82 | + return ''; |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 86 | + |
|
| 87 | + $html = ''; |
|
| 88 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 89 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 90 | + } |
|
| 91 | + $view->deliveryBody = $html; |
|
| 92 | + |
|
| 93 | + /** client/html/checkout/standard/delivery/standard/template-body |
|
| 94 | + * Relative path to the HTML body template of the checkout standard delivery client. |
|
| 95 | + * |
|
| 96 | + * The template file contains the HTML code and processing instructions |
|
| 97 | + * to generate the result shown in the body of the frontend. The |
|
| 98 | + * configuration string is the path to the template file relative |
|
| 99 | + * to the templates directory (usually in client/html/templates). |
|
| 100 | + * |
|
| 101 | + * You can overwrite the template file configuration in extensions and |
|
| 102 | + * provide alternative templates. These alternative templates should be |
|
| 103 | + * named like the default one but with the string "standard" replaced by |
|
| 104 | + * an unique name. You may use the name of your project for this. If |
|
| 105 | + * you've implemented an alternative client class as well, "standard" |
|
| 106 | + * should be replaced by the name of the new class. |
|
| 107 | + * |
|
| 108 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 109 | + * @since 2014.03 |
|
| 110 | + * @category Developer |
|
| 111 | + * @see client/html/checkout/standard/delivery/standard/template-header |
|
| 112 | + */ |
|
| 113 | + $tplconf = 'client/html/checkout/standard/delivery/standard/template-body'; |
|
| 114 | + $default = 'checkout/standard/delivery-body-default.php'; |
|
| 115 | + |
|
| 116 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + |
|
| 120 | + /** |
|
| 121 | + * Returns the HTML string for insertion into the header. |
|
| 122 | + * |
|
| 123 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 124 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 125 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 126 | + * @return string|null String including HTML tags for the header on error |
|
| 127 | + */ |
|
| 128 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 129 | + { |
|
| 130 | + $view = $this->getView(); |
|
| 131 | + $step = $view->get( 'standardStepActive' ); |
|
| 132 | + $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 133 | + |
|
| 134 | + if( $step != 'delivery' && !( in_array( 'delivery', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 135 | + return ''; |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 139 | + |
|
| 140 | + $html = ''; |
|
| 141 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 142 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 143 | + } |
|
| 144 | + $view->deliveryHeader = $html; |
|
| 145 | + |
|
| 146 | + /** client/html/checkout/standard/delivery/standard/template-header |
|
| 147 | + * Relative path to the HTML header template of the checkout standard delivery client. |
|
| 148 | + * |
|
| 149 | + * The template file contains the HTML code and processing instructions |
|
| 150 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 151 | + * of the rendered page in the frontend. The configuration string is the |
|
| 152 | + * path to the template file relative to the templates directory (usually |
|
| 153 | + * in client/html/templates). |
|
| 154 | + * |
|
| 155 | + * You can overwrite the template file configuration in extensions and |
|
| 156 | + * provide alternative templates. These alternative templates should be |
|
| 157 | + * named like the default one but with the string "standard" replaced by |
|
| 158 | + * an unique name. You may use the name of your project for this. If |
|
| 159 | + * you've implemented an alternative client class as well, "standard" |
|
| 160 | + * should be replaced by the name of the new class. |
|
| 161 | + * |
|
| 162 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 163 | + * @since 2014.03 |
|
| 164 | + * @category Developer |
|
| 165 | + * @see client/html/checkout/standard/delivery/standard/template-body |
|
| 166 | + */ |
|
| 167 | + $tplconf = 'client/html/checkout/standard/delivery/standard/template-header'; |
|
| 168 | + $default = 'checkout/standard/delivery-header-default.php'; |
|
| 169 | + |
|
| 170 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + |
|
| 174 | + /** |
|
| 175 | + * Returns the sub-client given by its name. |
|
| 176 | + * |
|
| 177 | + * @param string $type Name of the client type |
|
| 178 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 179 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 180 | + */ |
|
| 181 | + public function getSubClient( $type, $name = null ) |
|
| 182 | + { |
|
| 183 | + /** client/html/checkout/standard/delivery/decorators/excludes |
|
| 184 | + * Excludes decorators added by the "common" option from the checkout standard delivery html client |
|
| 185 | + * |
|
| 186 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 187 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 188 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 189 | + * modify what is returned to the caller. |
|
| 190 | + * |
|
| 191 | + * This option allows you to remove a decorator added via |
|
| 192 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 193 | + * around the html client. |
|
| 194 | + * |
|
| 195 | + * client/html/checkout/standard/delivery/decorators/excludes = array( 'decorator1' ) |
|
| 196 | + * |
|
| 197 | + * This would remove the decorator named "decorator1" from the list of |
|
| 198 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 199 | + * "client/html/common/decorators/default" to the html client. |
|
| 200 | + * |
|
| 201 | + * @param array List of decorator names |
|
| 202 | + * @since 2015.08 |
|
| 203 | + * @category Developer |
|
| 204 | + * @see client/html/common/decorators/default |
|
| 205 | + * @see client/html/checkout/standard/delivery/decorators/global |
|
| 206 | + * @see client/html/checkout/standard/delivery/decorators/local |
|
| 207 | + */ |
|
| 208 | + |
|
| 209 | + /** client/html/checkout/standard/delivery/decorators/global |
|
| 210 | + * Adds a list of globally available decorators only to the checkout standard delivery html client |
|
| 211 | + * |
|
| 212 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 213 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 214 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 215 | + * modify what is returned to the caller. |
|
| 216 | + * |
|
| 217 | + * This option allows you to wrap global decorators |
|
| 218 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 219 | + * |
|
| 220 | + * client/html/checkout/standard/delivery/decorators/global = array( 'decorator1' ) |
|
| 221 | + * |
|
| 222 | + * This would add the decorator named "decorator1" defined by |
|
| 223 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 224 | + * |
|
| 225 | + * @param array List of decorator names |
|
| 226 | + * @since 2015.08 |
|
| 227 | + * @category Developer |
|
| 228 | + * @see client/html/common/decorators/default |
|
| 229 | + * @see client/html/checkout/standard/delivery/decorators/excludes |
|
| 230 | + * @see client/html/checkout/standard/delivery/decorators/local |
|
| 231 | + */ |
|
| 232 | + |
|
| 233 | + /** client/html/checkout/standard/delivery/decorators/local |
|
| 234 | + * Adds a list of local decorators only to the checkout standard delivery html client |
|
| 235 | + * |
|
| 236 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 237 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 238 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 239 | + * modify what is returned to the caller. |
|
| 240 | + * |
|
| 241 | + * This option allows you to wrap local decorators |
|
| 242 | + * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 243 | + * |
|
| 244 | + * client/html/checkout/standard/delivery/decorators/local = array( 'decorator2' ) |
|
| 245 | + * |
|
| 246 | + * This would add the decorator named "decorator2" defined by |
|
| 247 | + * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 248 | + * |
|
| 249 | + * @param array List of decorator names |
|
| 250 | + * @since 2015.08 |
|
| 251 | + * @category Developer |
|
| 252 | + * @see client/html/common/decorators/default |
|
| 253 | + * @see client/html/checkout/standard/delivery/decorators/excludes |
|
| 254 | + * @see client/html/checkout/standard/delivery/decorators/global |
|
| 255 | + */ |
|
| 256 | + |
|
| 257 | + return $this->createSubClient( 'checkout/standard/delivery/' . $type, $name ); |
|
| 258 | + } |
|
| 259 | + |
|
| 260 | + |
|
| 261 | + /** |
|
| 262 | + * Processes the input, e.g. store given values. |
|
| 263 | + * A view must be available and this method doesn't generate any output |
|
| 264 | + * besides setting view variables. |
|
| 265 | + */ |
|
| 266 | + public function process() |
|
| 267 | + { |
|
| 268 | + $view = $this->getView(); |
|
| 269 | + |
|
| 270 | + try |
|
| 271 | + { |
|
| 272 | + $context = $this->getContext(); |
|
| 273 | + $basketCtrl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 274 | + |
|
| 275 | + // only start if there's something to do |
|
| 276 | + if( ( $serviceId = $view->param( 'c_deliveryoption', null ) ) !== null ) |
|
| 277 | + { |
|
| 278 | + $serviceCtrl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'service' ); |
|
| 279 | + |
|
| 280 | + $attributes = $view->param( 'c_delivery/' . $serviceId, array() ); |
|
| 281 | + $errors = $serviceCtrl->checkServiceAttributes( 'delivery', $serviceId, $attributes ); |
|
| 282 | + |
|
| 283 | + foreach( $errors as $key => $msg ) |
|
| 284 | + { |
|
| 285 | + if( $msg === null ) { |
|
| 286 | + unset( $errors[$key] ); |
|
| 287 | + } |
|
| 288 | + } |
|
| 289 | + |
|
| 290 | + if( count( $errors ) === 0 ) { |
|
| 291 | + $basketCtrl->setService( 'delivery', $serviceId, $attributes ); |
|
| 292 | + } else { |
|
| 293 | + $view->standardStepActive = 'delivery'; |
|
| 294 | + } |
|
| 295 | + |
|
| 296 | + $view->deliveryError = $errors; |
|
| 297 | + } |
|
| 298 | + |
|
| 299 | + |
|
| 300 | + parent::process(); |
|
| 301 | + |
|
| 302 | + |
|
| 303 | + // Test if delivery service is available |
|
| 304 | + $services = $basketCtrl->get()->getServices(); |
|
| 305 | + if( !isset( $view->standardStepActive ) && !array_key_exists( 'delivery', $services ) ) |
|
| 306 | + { |
|
| 307 | + $view->standardStepActive = 'delivery'; |
|
| 308 | + return false; |
|
| 309 | + } |
|
| 310 | + } |
|
| 311 | + catch( \Exception $e ) |
|
| 312 | + { |
|
| 313 | + $view->standardStepActive = 'delivery'; |
|
| 314 | + throw $e; |
|
| 315 | + } |
|
| 316 | + } |
|
| 317 | + |
|
| 318 | + |
|
| 319 | + /** |
|
| 320 | + * Returns the list of sub-client names configured for the client. |
|
| 321 | + * |
|
| 322 | + * @return array List of HTML client names |
|
| 323 | + */ |
|
| 324 | + protected function getSubClientNames() |
|
| 325 | + { |
|
| 326 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 327 | + } |
|
| 328 | + |
|
| 329 | + |
|
| 330 | + /** |
|
| 331 | + * Sets the necessary parameter values in the view. |
|
| 332 | + * |
|
| 333 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 334 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 335 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 336 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 337 | + */ |
|
| 338 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 339 | + { |
|
| 340 | + if( !isset( $this->cache ) ) |
|
| 341 | + { |
|
| 342 | + $context = $this->getContext(); |
|
| 343 | + |
|
| 344 | + $basketCntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 345 | + $serviceCntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'service' ); |
|
| 346 | + |
|
| 347 | + $basket = $basketCntl->get(); |
|
| 348 | + |
|
| 349 | + $services = $serviceCntl->getServices( 'delivery', $basket ); |
|
| 350 | + $serviceAttributes = $servicePrices = array(); |
|
| 351 | + |
|
| 352 | + foreach( $services as $id => $service ) |
|
| 353 | + { |
|
| 354 | + $serviceAttributes[$id] = $serviceCntl->getServiceAttributes( 'delivery', $id, $basket ); |
|
| 355 | + $servicePrices[$id] = $serviceCntl->getServicePrice( 'delivery', $id, $basket ); |
|
| 356 | + } |
|
| 357 | + |
|
| 358 | + $view->deliveryServices = $services; |
|
| 359 | + $view->deliveryServiceAttributes = $serviceAttributes; |
|
| 360 | + $view->deliveryServicePrices = $servicePrices; |
|
| 361 | + |
|
| 362 | + $this->cache = $view; |
|
| 363 | + } |
|
| 364 | + |
|
| 365 | + return $this->cache; |
|
| 366 | + } |
|
| 367 | 367 | } |
| 368 | 368 | \ No newline at end of file |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | // Strings for translation |
| 16 | -sprintf( 'delivery' ); |
|
| 16 | +sprintf('delivery'); |
|
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 | /** |
@@ -72,21 +72,21 @@ discard block |
||
| 72 | 72 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 73 | 73 | * @return string HTML code |
| 74 | 74 | */ |
| 75 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 75 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 76 | 76 | { |
| 77 | 77 | $view = $this->getView(); |
| 78 | - $step = $view->get( 'standardStepActive' ); |
|
| 79 | - $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 78 | + $step = $view->get('standardStepActive'); |
|
| 79 | + $onepage = $view->config('client/html/checkout/standard/onepage', array()); |
|
| 80 | 80 | |
| 81 | - if( $step != 'delivery' && !( in_array( 'delivery', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 81 | + if ($step != 'delivery' && !(in_array('delivery', $onepage) && in_array($step, $onepage))) { |
|
| 82 | 82 | return ''; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 85 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 86 | 86 | |
| 87 | 87 | $html = ''; |
| 88 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 89 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 88 | + foreach ($this->getSubClients() as $subclient) { |
|
| 89 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 90 | 90 | } |
| 91 | 91 | $view->deliveryBody = $html; |
| 92 | 92 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $tplconf = 'client/html/checkout/standard/delivery/standard/template-body'; |
| 114 | 114 | $default = 'checkout/standard/delivery-body-default.php'; |
| 115 | 115 | |
| 116 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 116 | + return $view->render($view->config($tplconf, $default)); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | |
@@ -125,21 +125,21 @@ discard block |
||
| 125 | 125 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 126 | 126 | * @return string|null String including HTML tags for the header on error |
| 127 | 127 | */ |
| 128 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 128 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 129 | 129 | { |
| 130 | 130 | $view = $this->getView(); |
| 131 | - $step = $view->get( 'standardStepActive' ); |
|
| 132 | - $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 131 | + $step = $view->get('standardStepActive'); |
|
| 132 | + $onepage = $view->config('client/html/checkout/standard/onepage', array()); |
|
| 133 | 133 | |
| 134 | - if( $step != 'delivery' && !( in_array( 'delivery', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 134 | + if ($step != 'delivery' && !(in_array('delivery', $onepage) && in_array($step, $onepage))) { |
|
| 135 | 135 | return ''; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 138 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 139 | 139 | |
| 140 | 140 | $html = ''; |
| 141 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 142 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 141 | + foreach ($this->getSubClients() as $subclient) { |
|
| 142 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 143 | 143 | } |
| 144 | 144 | $view->deliveryHeader = $html; |
| 145 | 145 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $tplconf = 'client/html/checkout/standard/delivery/standard/template-header'; |
| 168 | 168 | $default = 'checkout/standard/delivery-header-default.php'; |
| 169 | 169 | |
| 170 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 170 | + return $view->render($view->config($tplconf, $default)); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * @param string|null $name Name of the sub-client (Default if null) |
| 179 | 179 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 180 | 180 | */ |
| 181 | - public function getSubClient( $type, $name = null ) |
|
| 181 | + public function getSubClient($type, $name = null) |
|
| 182 | 182 | { |
| 183 | 183 | /** client/html/checkout/standard/delivery/decorators/excludes |
| 184 | 184 | * Excludes decorators added by the "common" option from the checkout standard delivery html client |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | * @see client/html/checkout/standard/delivery/decorators/global |
| 255 | 255 | */ |
| 256 | 256 | |
| 257 | - return $this->createSubClient( 'checkout/standard/delivery/' . $type, $name ); |
|
| 257 | + return $this->createSubClient('checkout/standard/delivery/'.$type, $name); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | |
@@ -270,25 +270,25 @@ discard block |
||
| 270 | 270 | try |
| 271 | 271 | { |
| 272 | 272 | $context = $this->getContext(); |
| 273 | - $basketCtrl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 273 | + $basketCtrl = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
| 274 | 274 | |
| 275 | 275 | // only start if there's something to do |
| 276 | - if( ( $serviceId = $view->param( 'c_deliveryoption', null ) ) !== null ) |
|
| 276 | + if (($serviceId = $view->param('c_deliveryoption', null)) !== null) |
|
| 277 | 277 | { |
| 278 | - $serviceCtrl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'service' ); |
|
| 278 | + $serviceCtrl = \Aimeos\Controller\Frontend\Factory::createController($context, 'service'); |
|
| 279 | 279 | |
| 280 | - $attributes = $view->param( 'c_delivery/' . $serviceId, array() ); |
|
| 281 | - $errors = $serviceCtrl->checkServiceAttributes( 'delivery', $serviceId, $attributes ); |
|
| 280 | + $attributes = $view->param('c_delivery/'.$serviceId, array()); |
|
| 281 | + $errors = $serviceCtrl->checkServiceAttributes('delivery', $serviceId, $attributes); |
|
| 282 | 282 | |
| 283 | - foreach( $errors as $key => $msg ) |
|
| 283 | + foreach ($errors as $key => $msg) |
|
| 284 | 284 | { |
| 285 | - if( $msg === null ) { |
|
| 286 | - unset( $errors[$key] ); |
|
| 285 | + if ($msg === null) { |
|
| 286 | + unset($errors[$key]); |
|
| 287 | 287 | } |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - if( count( $errors ) === 0 ) { |
|
| 291 | - $basketCtrl->setService( 'delivery', $serviceId, $attributes ); |
|
| 290 | + if (count($errors) === 0) { |
|
| 291 | + $basketCtrl->setService('delivery', $serviceId, $attributes); |
|
| 292 | 292 | } else { |
| 293 | 293 | $view->standardStepActive = 'delivery'; |
| 294 | 294 | } |
@@ -302,13 +302,13 @@ discard block |
||
| 302 | 302 | |
| 303 | 303 | // Test if delivery service is available |
| 304 | 304 | $services = $basketCtrl->get()->getServices(); |
| 305 | - if( !isset( $view->standardStepActive ) && !array_key_exists( 'delivery', $services ) ) |
|
| 305 | + if (!isset($view->standardStepActive) && !array_key_exists('delivery', $services)) |
|
| 306 | 306 | { |
| 307 | 307 | $view->standardStepActive = 'delivery'; |
| 308 | 308 | return false; |
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | - catch( \Exception $e ) |
|
| 311 | + catch (\Exception $e) |
|
| 312 | 312 | { |
| 313 | 313 | $view->standardStepActive = 'delivery'; |
| 314 | 314 | throw $e; |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | */ |
| 324 | 324 | protected function getSubClientNames() |
| 325 | 325 | { |
| 326 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 326 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | |
@@ -335,24 +335,24 @@ discard block |
||
| 335 | 335 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 336 | 336 | * @return \Aimeos\MW\View\Iface Modified view object |
| 337 | 337 | */ |
| 338 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 338 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 339 | 339 | { |
| 340 | - if( !isset( $this->cache ) ) |
|
| 340 | + if (!isset($this->cache)) |
|
| 341 | 341 | { |
| 342 | 342 | $context = $this->getContext(); |
| 343 | 343 | |
| 344 | - $basketCntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 345 | - $serviceCntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'service' ); |
|
| 344 | + $basketCntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
| 345 | + $serviceCntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'service'); |
|
| 346 | 346 | |
| 347 | 347 | $basket = $basketCntl->get(); |
| 348 | 348 | |
| 349 | - $services = $serviceCntl->getServices( 'delivery', $basket ); |
|
| 349 | + $services = $serviceCntl->getServices('delivery', $basket); |
|
| 350 | 350 | $serviceAttributes = $servicePrices = array(); |
| 351 | 351 | |
| 352 | - foreach( $services as $id => $service ) |
|
| 352 | + foreach ($services as $id => $service) |
|
| 353 | 353 | { |
| 354 | - $serviceAttributes[$id] = $serviceCntl->getServiceAttributes( 'delivery', $id, $basket ); |
|
| 355 | - $servicePrices[$id] = $serviceCntl->getServicePrice( 'delivery', $id, $basket ); |
|
| 354 | + $serviceAttributes[$id] = $serviceCntl->getServiceAttributes('delivery', $id, $basket); |
|
| 355 | + $servicePrices[$id] = $serviceCntl->getServicePrice('delivery', $id, $basket); |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | $view->deliveryServices = $services; |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -303,8 +303,7 @@ |
||
| 303 | 303 | $view->standardStepActive = 'address'; |
| 304 | 304 | return false; |
| 305 | 305 | } |
| 306 | - } |
|
| 307 | - catch( \Exception $e ) |
|
| 306 | + } catch( \Exception $e ) |
|
| 308 | 307 | { |
| 309 | 308 | $this->getView()->standardStepActive = 'address'; |
| 310 | 309 | throw $e; |
@@ -23,345 +23,345 @@ |
||
| 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/payment/standard/subparts |
|
| 30 | - * List of HTML sub-clients rendered within the checkout standard payment 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/payment/standard/subparts'; |
|
| 63 | - private $subPartNames = array(); |
|
| 64 | - private $cache; |
|
| 65 | - |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * Returns the HTML code for insertion into the body. |
|
| 69 | - * |
|
| 70 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 71 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 72 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 73 | - * @return string HTML code |
|
| 74 | - */ |
|
| 75 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 76 | - { |
|
| 77 | - $view = $this->getView(); |
|
| 78 | - $step = $view->get( 'standardStepActive' ); |
|
| 79 | - $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 80 | - |
|
| 81 | - if( $step != 'payment' && !( in_array( 'payment', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 82 | - return ''; |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 86 | - |
|
| 87 | - $html = ''; |
|
| 88 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 89 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 90 | - } |
|
| 91 | - $view->paymentBody = $html; |
|
| 92 | - |
|
| 93 | - /** client/html/checkout/standard/payment/standard/template-body |
|
| 94 | - * Relative path to the HTML body template of the checkout standard payment client. |
|
| 95 | - * |
|
| 96 | - * The template file contains the HTML code and processing instructions |
|
| 97 | - * to generate the result shown in the body of the frontend. The |
|
| 98 | - * configuration string is the path to the template file relative |
|
| 99 | - * to the templates directory (usually in client/html/templates). |
|
| 100 | - * |
|
| 101 | - * You can overwrite the template file configuration in extensions and |
|
| 102 | - * provide alternative templates. These alternative templates should be |
|
| 103 | - * named like the default one but with the string "standard" replaced by |
|
| 104 | - * an unique name. You may use the name of your project for this. If |
|
| 105 | - * you've implemented an alternative client class as well, "standard" |
|
| 106 | - * should be replaced by the name of the new class. |
|
| 107 | - * |
|
| 108 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 109 | - * @since 2014.03 |
|
| 110 | - * @category Developer |
|
| 111 | - * @see client/html/checkout/standard/payment/standard/template-header |
|
| 112 | - */ |
|
| 113 | - $tplconf = 'client/html/checkout/standard/payment/standard/template-body'; |
|
| 114 | - $default = 'checkout/standard/payment-body-default.php'; |
|
| 115 | - |
|
| 116 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - |
|
| 120 | - /** |
|
| 121 | - * Returns the HTML string for insertion into the header. |
|
| 122 | - * |
|
| 123 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 124 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 125 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 126 | - * @return string|null String including HTML tags for the header on error |
|
| 127 | - */ |
|
| 128 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 129 | - { |
|
| 130 | - $view = $this->getView(); |
|
| 131 | - $step = $view->get( 'standardStepActive' ); |
|
| 132 | - $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 133 | - |
|
| 134 | - if( $step != 'payment' && !( in_array( 'payment', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 135 | - return ''; |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 139 | - |
|
| 140 | - $html = ''; |
|
| 141 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 142 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 143 | - } |
|
| 144 | - $view->paymentHeader = $html; |
|
| 145 | - |
|
| 146 | - /** client/html/checkout/standard/payment/standard/template-header |
|
| 147 | - * Relative path to the HTML header template of the checkout standard payment client. |
|
| 148 | - * |
|
| 149 | - * The template file contains the HTML code and processing instructions |
|
| 150 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 151 | - * of the rendered page in the frontend. The configuration string is the |
|
| 152 | - * path to the template file relative to the templates directory (usually |
|
| 153 | - * in client/html/templates). |
|
| 154 | - * |
|
| 155 | - * You can overwrite the template file configuration in extensions and |
|
| 156 | - * provide alternative templates. These alternative templates should be |
|
| 157 | - * named like the default one but with the string "standard" replaced by |
|
| 158 | - * an unique name. You may use the name of your project for this. If |
|
| 159 | - * you've implemented an alternative client class as well, "standard" |
|
| 160 | - * should be replaced by the name of the new class. |
|
| 161 | - * |
|
| 162 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 163 | - * @since 2014.03 |
|
| 164 | - * @category Developer |
|
| 165 | - * @see client/html/checkout/standard/payment/standard/template-body |
|
| 166 | - */ |
|
| 167 | - $tplconf = 'client/html/checkout/standard/payment/standard/template-header'; |
|
| 168 | - $default = 'checkout/standard/payment-header-default.php'; |
|
| 169 | - |
|
| 170 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - |
|
| 174 | - /** |
|
| 175 | - * Returns the sub-client given by its name. |
|
| 176 | - * |
|
| 177 | - * @param string $type Name of the client type |
|
| 178 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 179 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 180 | - */ |
|
| 181 | - public function getSubClient( $type, $name = null ) |
|
| 182 | - { |
|
| 183 | - /** client/html/checkout/standard/payment/decorators/excludes |
|
| 184 | - * Excludes decorators added by the "common" option from the checkout standard payment html client |
|
| 185 | - * |
|
| 186 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 187 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 188 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 189 | - * modify what is returned to the caller. |
|
| 190 | - * |
|
| 191 | - * This option allows you to remove a decorator added via |
|
| 192 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 193 | - * around the html client. |
|
| 194 | - * |
|
| 195 | - * client/html/checkout/standard/payment/decorators/excludes = array( 'decorator1' ) |
|
| 196 | - * |
|
| 197 | - * This would remove the decorator named "decorator1" from the list of |
|
| 198 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 199 | - * "client/html/common/decorators/default" to the html client. |
|
| 200 | - * |
|
| 201 | - * @param array List of decorator names |
|
| 202 | - * @since 2015.08 |
|
| 203 | - * @category Developer |
|
| 204 | - * @see client/html/common/decorators/default |
|
| 205 | - * @see client/html/checkout/standard/payment/decorators/global |
|
| 206 | - * @see client/html/checkout/standard/payment/decorators/local |
|
| 207 | - */ |
|
| 208 | - |
|
| 209 | - /** client/html/checkout/standard/payment/decorators/global |
|
| 210 | - * Adds a list of globally available decorators only to the checkout standard payment html client |
|
| 211 | - * |
|
| 212 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 213 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 214 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 215 | - * modify what is returned to the caller. |
|
| 216 | - * |
|
| 217 | - * This option allows you to wrap global decorators |
|
| 218 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 219 | - * |
|
| 220 | - * client/html/checkout/standard/payment/decorators/global = array( 'decorator1' ) |
|
| 221 | - * |
|
| 222 | - * This would add the decorator named "decorator1" defined by |
|
| 223 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 224 | - * |
|
| 225 | - * @param array List of decorator names |
|
| 226 | - * @since 2015.08 |
|
| 227 | - * @category Developer |
|
| 228 | - * @see client/html/common/decorators/default |
|
| 229 | - * @see client/html/checkout/standard/payment/decorators/excludes |
|
| 230 | - * @see client/html/checkout/standard/payment/decorators/local |
|
| 231 | - */ |
|
| 232 | - |
|
| 233 | - /** client/html/checkout/standard/payment/decorators/local |
|
| 234 | - * Adds a list of local decorators only to the checkout standard payment html client |
|
| 235 | - * |
|
| 236 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 237 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 238 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 239 | - * modify what is returned to the caller. |
|
| 240 | - * |
|
| 241 | - * This option allows you to wrap local decorators |
|
| 242 | - * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 243 | - * |
|
| 244 | - * client/html/checkout/standard/payment/decorators/local = array( 'decorator2' ) |
|
| 245 | - * |
|
| 246 | - * This would add the decorator named "decorator2" defined by |
|
| 247 | - * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 248 | - * |
|
| 249 | - * @param array List of decorator names |
|
| 250 | - * @since 2015.08 |
|
| 251 | - * @category Developer |
|
| 252 | - * @see client/html/common/decorators/default |
|
| 253 | - * @see client/html/checkout/standard/payment/decorators/excludes |
|
| 254 | - * @see client/html/checkout/standard/payment/decorators/global |
|
| 255 | - */ |
|
| 256 | - |
|
| 257 | - return $this->createSubClient( 'checkout/standard/payment/' . $type, $name ); |
|
| 258 | - } |
|
| 259 | - |
|
| 260 | - |
|
| 261 | - /** |
|
| 262 | - * Processes the input, e.g. store given values. |
|
| 263 | - * A view must be available and this method doesn't generate any output |
|
| 264 | - * besides setting view variables. |
|
| 265 | - */ |
|
| 266 | - public function process() |
|
| 267 | - { |
|
| 268 | - $view = $this->getView(); |
|
| 269 | - |
|
| 270 | - try |
|
| 271 | - { |
|
| 272 | - $context = $this->getContext(); |
|
| 273 | - $basketCtrl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 274 | - |
|
| 275 | - // only start if there's something to do |
|
| 276 | - if( ( $serviceId = $view->param( 'c_paymentoption', null ) ) !== null ) |
|
| 277 | - { |
|
| 278 | - $serviceCtrl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'service' ); |
|
| 279 | - |
|
| 280 | - $attributes = $view->param( 'c_payment/' . $serviceId, array() ); |
|
| 281 | - $errors = $serviceCtrl->checkServiceAttributes( 'payment', $serviceId, $attributes ); |
|
| 282 | - |
|
| 283 | - foreach( $errors as $key => $msg ) |
|
| 284 | - { |
|
| 285 | - if( $msg === null ) { |
|
| 286 | - unset( $errors[$key] ); |
|
| 287 | - } |
|
| 288 | - } |
|
| 289 | - |
|
| 290 | - if( count( $errors ) === 0 ) { |
|
| 291 | - $basketCtrl->setService( 'payment', $serviceId, $attributes ); |
|
| 292 | - } else { |
|
| 293 | - $view->standardStepActive = 'payment'; |
|
| 294 | - } |
|
| 295 | - |
|
| 296 | - $view->paymentError = $errors; |
|
| 297 | - } |
|
| 298 | - |
|
| 299 | - |
|
| 300 | - parent::process(); |
|
| 301 | - |
|
| 302 | - |
|
| 303 | - // Test if payment service is available |
|
| 304 | - $services = $basketCtrl->get()->getServices(); |
|
| 305 | - if( !isset( $view->standardStepActive ) && !array_key_exists( 'payment', $services ) ) |
|
| 306 | - { |
|
| 307 | - $view->standardStepActive = 'payment'; |
|
| 308 | - return false; |
|
| 309 | - } |
|
| 310 | - } |
|
| 311 | - catch( \Exception $e ) |
|
| 312 | - { |
|
| 313 | - $view->standardStepActive = 'payment'; |
|
| 314 | - throw $e; |
|
| 315 | - } |
|
| 316 | - } |
|
| 317 | - |
|
| 318 | - |
|
| 319 | - /** |
|
| 320 | - * Returns the list of sub-client names configured for the client. |
|
| 321 | - * |
|
| 322 | - * @return array List of HTML client names |
|
| 323 | - */ |
|
| 324 | - protected function getSubClientNames() |
|
| 325 | - { |
|
| 326 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 327 | - } |
|
| 328 | - |
|
| 329 | - |
|
| 330 | - /** |
|
| 331 | - * Sets the necessary parameter values in the view. |
|
| 332 | - * |
|
| 333 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 334 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 335 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 336 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 337 | - */ |
|
| 338 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 339 | - { |
|
| 340 | - if( !isset( $this->cache ) ) |
|
| 341 | - { |
|
| 342 | - $context = $this->getContext(); |
|
| 343 | - |
|
| 344 | - $basketCntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 345 | - $serviceCntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'service' ); |
|
| 346 | - |
|
| 347 | - $basket = $basketCntl->get(); |
|
| 348 | - |
|
| 349 | - $services = $serviceCntl->getServices( 'payment', $basket ); |
|
| 350 | - $serviceAttributes = $servicePrices = array(); |
|
| 351 | - |
|
| 352 | - foreach( $services as $id => $service ) |
|
| 353 | - { |
|
| 354 | - $serviceAttributes[$id] = $serviceCntl->getServiceAttributes( 'payment', $id, $basket ); |
|
| 355 | - $servicePrices[$id] = $serviceCntl->getServicePrice( 'payment', $id, $basket ); |
|
| 356 | - } |
|
| 357 | - |
|
| 358 | - $view->paymentServices = $services; |
|
| 359 | - $view->paymentServiceAttributes = $serviceAttributes; |
|
| 360 | - $view->paymentServicePrices = $servicePrices; |
|
| 361 | - |
|
| 362 | - $this->cache = $view; |
|
| 363 | - } |
|
| 364 | - |
|
| 365 | - return $this->cache; |
|
| 366 | - } |
|
| 29 | + /** client/html/checkout/standard/payment/standard/subparts |
|
| 30 | + * List of HTML sub-clients rendered within the checkout standard payment 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/payment/standard/subparts'; |
|
| 63 | + private $subPartNames = array(); |
|
| 64 | + private $cache; |
|
| 65 | + |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * Returns the HTML code for insertion into the body. |
|
| 69 | + * |
|
| 70 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 71 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 72 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 73 | + * @return string HTML code |
|
| 74 | + */ |
|
| 75 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 76 | + { |
|
| 77 | + $view = $this->getView(); |
|
| 78 | + $step = $view->get( 'standardStepActive' ); |
|
| 79 | + $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 80 | + |
|
| 81 | + if( $step != 'payment' && !( in_array( 'payment', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 82 | + return ''; |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 86 | + |
|
| 87 | + $html = ''; |
|
| 88 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 89 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 90 | + } |
|
| 91 | + $view->paymentBody = $html; |
|
| 92 | + |
|
| 93 | + /** client/html/checkout/standard/payment/standard/template-body |
|
| 94 | + * Relative path to the HTML body template of the checkout standard payment client. |
|
| 95 | + * |
|
| 96 | + * The template file contains the HTML code and processing instructions |
|
| 97 | + * to generate the result shown in the body of the frontend. The |
|
| 98 | + * configuration string is the path to the template file relative |
|
| 99 | + * to the templates directory (usually in client/html/templates). |
|
| 100 | + * |
|
| 101 | + * You can overwrite the template file configuration in extensions and |
|
| 102 | + * provide alternative templates. These alternative templates should be |
|
| 103 | + * named like the default one but with the string "standard" replaced by |
|
| 104 | + * an unique name. You may use the name of your project for this. If |
|
| 105 | + * you've implemented an alternative client class as well, "standard" |
|
| 106 | + * should be replaced by the name of the new class. |
|
| 107 | + * |
|
| 108 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 109 | + * @since 2014.03 |
|
| 110 | + * @category Developer |
|
| 111 | + * @see client/html/checkout/standard/payment/standard/template-header |
|
| 112 | + */ |
|
| 113 | + $tplconf = 'client/html/checkout/standard/payment/standard/template-body'; |
|
| 114 | + $default = 'checkout/standard/payment-body-default.php'; |
|
| 115 | + |
|
| 116 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + |
|
| 120 | + /** |
|
| 121 | + * Returns the HTML string for insertion into the header. |
|
| 122 | + * |
|
| 123 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 124 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 125 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 126 | + * @return string|null String including HTML tags for the header on error |
|
| 127 | + */ |
|
| 128 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 129 | + { |
|
| 130 | + $view = $this->getView(); |
|
| 131 | + $step = $view->get( 'standardStepActive' ); |
|
| 132 | + $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 133 | + |
|
| 134 | + if( $step != 'payment' && !( in_array( 'payment', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 135 | + return ''; |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 139 | + |
|
| 140 | + $html = ''; |
|
| 141 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 142 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 143 | + } |
|
| 144 | + $view->paymentHeader = $html; |
|
| 145 | + |
|
| 146 | + /** client/html/checkout/standard/payment/standard/template-header |
|
| 147 | + * Relative path to the HTML header template of the checkout standard payment client. |
|
| 148 | + * |
|
| 149 | + * The template file contains the HTML code and processing instructions |
|
| 150 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 151 | + * of the rendered page in the frontend. The configuration string is the |
|
| 152 | + * path to the template file relative to the templates directory (usually |
|
| 153 | + * in client/html/templates). |
|
| 154 | + * |
|
| 155 | + * You can overwrite the template file configuration in extensions and |
|
| 156 | + * provide alternative templates. These alternative templates should be |
|
| 157 | + * named like the default one but with the string "standard" replaced by |
|
| 158 | + * an unique name. You may use the name of your project for this. If |
|
| 159 | + * you've implemented an alternative client class as well, "standard" |
|
| 160 | + * should be replaced by the name of the new class. |
|
| 161 | + * |
|
| 162 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 163 | + * @since 2014.03 |
|
| 164 | + * @category Developer |
|
| 165 | + * @see client/html/checkout/standard/payment/standard/template-body |
|
| 166 | + */ |
|
| 167 | + $tplconf = 'client/html/checkout/standard/payment/standard/template-header'; |
|
| 168 | + $default = 'checkout/standard/payment-header-default.php'; |
|
| 169 | + |
|
| 170 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + |
|
| 174 | + /** |
|
| 175 | + * Returns the sub-client given by its name. |
|
| 176 | + * |
|
| 177 | + * @param string $type Name of the client type |
|
| 178 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 179 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 180 | + */ |
|
| 181 | + public function getSubClient( $type, $name = null ) |
|
| 182 | + { |
|
| 183 | + /** client/html/checkout/standard/payment/decorators/excludes |
|
| 184 | + * Excludes decorators added by the "common" option from the checkout standard payment html client |
|
| 185 | + * |
|
| 186 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 187 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 188 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 189 | + * modify what is returned to the caller. |
|
| 190 | + * |
|
| 191 | + * This option allows you to remove a decorator added via |
|
| 192 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 193 | + * around the html client. |
|
| 194 | + * |
|
| 195 | + * client/html/checkout/standard/payment/decorators/excludes = array( 'decorator1' ) |
|
| 196 | + * |
|
| 197 | + * This would remove the decorator named "decorator1" from the list of |
|
| 198 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 199 | + * "client/html/common/decorators/default" to the html client. |
|
| 200 | + * |
|
| 201 | + * @param array List of decorator names |
|
| 202 | + * @since 2015.08 |
|
| 203 | + * @category Developer |
|
| 204 | + * @see client/html/common/decorators/default |
|
| 205 | + * @see client/html/checkout/standard/payment/decorators/global |
|
| 206 | + * @see client/html/checkout/standard/payment/decorators/local |
|
| 207 | + */ |
|
| 208 | + |
|
| 209 | + /** client/html/checkout/standard/payment/decorators/global |
|
| 210 | + * Adds a list of globally available decorators only to the checkout standard payment html client |
|
| 211 | + * |
|
| 212 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 213 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 214 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 215 | + * modify what is returned to the caller. |
|
| 216 | + * |
|
| 217 | + * This option allows you to wrap global decorators |
|
| 218 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 219 | + * |
|
| 220 | + * client/html/checkout/standard/payment/decorators/global = array( 'decorator1' ) |
|
| 221 | + * |
|
| 222 | + * This would add the decorator named "decorator1" defined by |
|
| 223 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 224 | + * |
|
| 225 | + * @param array List of decorator names |
|
| 226 | + * @since 2015.08 |
|
| 227 | + * @category Developer |
|
| 228 | + * @see client/html/common/decorators/default |
|
| 229 | + * @see client/html/checkout/standard/payment/decorators/excludes |
|
| 230 | + * @see client/html/checkout/standard/payment/decorators/local |
|
| 231 | + */ |
|
| 232 | + |
|
| 233 | + /** client/html/checkout/standard/payment/decorators/local |
|
| 234 | + * Adds a list of local decorators only to the checkout standard payment html client |
|
| 235 | + * |
|
| 236 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 237 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 238 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 239 | + * modify what is returned to the caller. |
|
| 240 | + * |
|
| 241 | + * This option allows you to wrap local decorators |
|
| 242 | + * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 243 | + * |
|
| 244 | + * client/html/checkout/standard/payment/decorators/local = array( 'decorator2' ) |
|
| 245 | + * |
|
| 246 | + * This would add the decorator named "decorator2" defined by |
|
| 247 | + * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 248 | + * |
|
| 249 | + * @param array List of decorator names |
|
| 250 | + * @since 2015.08 |
|
| 251 | + * @category Developer |
|
| 252 | + * @see client/html/common/decorators/default |
|
| 253 | + * @see client/html/checkout/standard/payment/decorators/excludes |
|
| 254 | + * @see client/html/checkout/standard/payment/decorators/global |
|
| 255 | + */ |
|
| 256 | + |
|
| 257 | + return $this->createSubClient( 'checkout/standard/payment/' . $type, $name ); |
|
| 258 | + } |
|
| 259 | + |
|
| 260 | + |
|
| 261 | + /** |
|
| 262 | + * Processes the input, e.g. store given values. |
|
| 263 | + * A view must be available and this method doesn't generate any output |
|
| 264 | + * besides setting view variables. |
|
| 265 | + */ |
|
| 266 | + public function process() |
|
| 267 | + { |
|
| 268 | + $view = $this->getView(); |
|
| 269 | + |
|
| 270 | + try |
|
| 271 | + { |
|
| 272 | + $context = $this->getContext(); |
|
| 273 | + $basketCtrl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 274 | + |
|
| 275 | + // only start if there's something to do |
|
| 276 | + if( ( $serviceId = $view->param( 'c_paymentoption', null ) ) !== null ) |
|
| 277 | + { |
|
| 278 | + $serviceCtrl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'service' ); |
|
| 279 | + |
|
| 280 | + $attributes = $view->param( 'c_payment/' . $serviceId, array() ); |
|
| 281 | + $errors = $serviceCtrl->checkServiceAttributes( 'payment', $serviceId, $attributes ); |
|
| 282 | + |
|
| 283 | + foreach( $errors as $key => $msg ) |
|
| 284 | + { |
|
| 285 | + if( $msg === null ) { |
|
| 286 | + unset( $errors[$key] ); |
|
| 287 | + } |
|
| 288 | + } |
|
| 289 | + |
|
| 290 | + if( count( $errors ) === 0 ) { |
|
| 291 | + $basketCtrl->setService( 'payment', $serviceId, $attributes ); |
|
| 292 | + } else { |
|
| 293 | + $view->standardStepActive = 'payment'; |
|
| 294 | + } |
|
| 295 | + |
|
| 296 | + $view->paymentError = $errors; |
|
| 297 | + } |
|
| 298 | + |
|
| 299 | + |
|
| 300 | + parent::process(); |
|
| 301 | + |
|
| 302 | + |
|
| 303 | + // Test if payment service is available |
|
| 304 | + $services = $basketCtrl->get()->getServices(); |
|
| 305 | + if( !isset( $view->standardStepActive ) && !array_key_exists( 'payment', $services ) ) |
|
| 306 | + { |
|
| 307 | + $view->standardStepActive = 'payment'; |
|
| 308 | + return false; |
|
| 309 | + } |
|
| 310 | + } |
|
| 311 | + catch( \Exception $e ) |
|
| 312 | + { |
|
| 313 | + $view->standardStepActive = 'payment'; |
|
| 314 | + throw $e; |
|
| 315 | + } |
|
| 316 | + } |
|
| 317 | + |
|
| 318 | + |
|
| 319 | + /** |
|
| 320 | + * Returns the list of sub-client names configured for the client. |
|
| 321 | + * |
|
| 322 | + * @return array List of HTML client names |
|
| 323 | + */ |
|
| 324 | + protected function getSubClientNames() |
|
| 325 | + { |
|
| 326 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 327 | + } |
|
| 328 | + |
|
| 329 | + |
|
| 330 | + /** |
|
| 331 | + * Sets the necessary parameter values in the view. |
|
| 332 | + * |
|
| 333 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 334 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 335 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 336 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 337 | + */ |
|
| 338 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 339 | + { |
|
| 340 | + if( !isset( $this->cache ) ) |
|
| 341 | + { |
|
| 342 | + $context = $this->getContext(); |
|
| 343 | + |
|
| 344 | + $basketCntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 345 | + $serviceCntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'service' ); |
|
| 346 | + |
|
| 347 | + $basket = $basketCntl->get(); |
|
| 348 | + |
|
| 349 | + $services = $serviceCntl->getServices( 'payment', $basket ); |
|
| 350 | + $serviceAttributes = $servicePrices = array(); |
|
| 351 | + |
|
| 352 | + foreach( $services as $id => $service ) |
|
| 353 | + { |
|
| 354 | + $serviceAttributes[$id] = $serviceCntl->getServiceAttributes( 'payment', $id, $basket ); |
|
| 355 | + $servicePrices[$id] = $serviceCntl->getServicePrice( 'payment', $id, $basket ); |
|
| 356 | + } |
|
| 357 | + |
|
| 358 | + $view->paymentServices = $services; |
|
| 359 | + $view->paymentServiceAttributes = $serviceAttributes; |
|
| 360 | + $view->paymentServicePrices = $servicePrices; |
|
| 361 | + |
|
| 362 | + $this->cache = $view; |
|
| 363 | + } |
|
| 364 | + |
|
| 365 | + return $this->cache; |
|
| 366 | + } |
|
| 367 | 367 | } |
| 368 | 368 | \ No newline at end of file |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | // Strings for translation |
| 16 | -sprintf( 'payment' ); |
|
| 16 | +sprintf('payment'); |
|
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 | /** |
@@ -72,21 +72,21 @@ discard block |
||
| 72 | 72 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 73 | 73 | * @return string HTML code |
| 74 | 74 | */ |
| 75 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 75 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 76 | 76 | { |
| 77 | 77 | $view = $this->getView(); |
| 78 | - $step = $view->get( 'standardStepActive' ); |
|
| 79 | - $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 78 | + $step = $view->get('standardStepActive'); |
|
| 79 | + $onepage = $view->config('client/html/checkout/standard/onepage', array()); |
|
| 80 | 80 | |
| 81 | - if( $step != 'payment' && !( in_array( 'payment', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 81 | + if ($step != 'payment' && !(in_array('payment', $onepage) && in_array($step, $onepage))) { |
|
| 82 | 82 | return ''; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 85 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 86 | 86 | |
| 87 | 87 | $html = ''; |
| 88 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 89 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 88 | + foreach ($this->getSubClients() as $subclient) { |
|
| 89 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 90 | 90 | } |
| 91 | 91 | $view->paymentBody = $html; |
| 92 | 92 | |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | $tplconf = 'client/html/checkout/standard/payment/standard/template-body'; |
| 114 | 114 | $default = 'checkout/standard/payment-body-default.php'; |
| 115 | 115 | |
| 116 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 116 | + return $view->render($view->config($tplconf, $default)); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | |
@@ -125,21 +125,21 @@ discard block |
||
| 125 | 125 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 126 | 126 | * @return string|null String including HTML tags for the header on error |
| 127 | 127 | */ |
| 128 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 128 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 129 | 129 | { |
| 130 | 130 | $view = $this->getView(); |
| 131 | - $step = $view->get( 'standardStepActive' ); |
|
| 132 | - $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 131 | + $step = $view->get('standardStepActive'); |
|
| 132 | + $onepage = $view->config('client/html/checkout/standard/onepage', array()); |
|
| 133 | 133 | |
| 134 | - if( $step != 'payment' && !( in_array( 'payment', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 134 | + if ($step != 'payment' && !(in_array('payment', $onepage) && in_array($step, $onepage))) { |
|
| 135 | 135 | return ''; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 138 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 139 | 139 | |
| 140 | 140 | $html = ''; |
| 141 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 142 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 141 | + foreach ($this->getSubClients() as $subclient) { |
|
| 142 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 143 | 143 | } |
| 144 | 144 | $view->paymentHeader = $html; |
| 145 | 145 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $tplconf = 'client/html/checkout/standard/payment/standard/template-header'; |
| 168 | 168 | $default = 'checkout/standard/payment-header-default.php'; |
| 169 | 169 | |
| 170 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 170 | + return $view->render($view->config($tplconf, $default)); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * @param string|null $name Name of the sub-client (Default if null) |
| 179 | 179 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 180 | 180 | */ |
| 181 | - public function getSubClient( $type, $name = null ) |
|
| 181 | + public function getSubClient($type, $name = null) |
|
| 182 | 182 | { |
| 183 | 183 | /** client/html/checkout/standard/payment/decorators/excludes |
| 184 | 184 | * Excludes decorators added by the "common" option from the checkout standard payment html client |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | * @see client/html/checkout/standard/payment/decorators/global |
| 255 | 255 | */ |
| 256 | 256 | |
| 257 | - return $this->createSubClient( 'checkout/standard/payment/' . $type, $name ); |
|
| 257 | + return $this->createSubClient('checkout/standard/payment/'.$type, $name); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | |
@@ -270,25 +270,25 @@ discard block |
||
| 270 | 270 | try |
| 271 | 271 | { |
| 272 | 272 | $context = $this->getContext(); |
| 273 | - $basketCtrl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 273 | + $basketCtrl = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
| 274 | 274 | |
| 275 | 275 | // only start if there's something to do |
| 276 | - if( ( $serviceId = $view->param( 'c_paymentoption', null ) ) !== null ) |
|
| 276 | + if (($serviceId = $view->param('c_paymentoption', null)) !== null) |
|
| 277 | 277 | { |
| 278 | - $serviceCtrl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'service' ); |
|
| 278 | + $serviceCtrl = \Aimeos\Controller\Frontend\Factory::createController($context, 'service'); |
|
| 279 | 279 | |
| 280 | - $attributes = $view->param( 'c_payment/' . $serviceId, array() ); |
|
| 281 | - $errors = $serviceCtrl->checkServiceAttributes( 'payment', $serviceId, $attributes ); |
|
| 280 | + $attributes = $view->param('c_payment/'.$serviceId, array()); |
|
| 281 | + $errors = $serviceCtrl->checkServiceAttributes('payment', $serviceId, $attributes); |
|
| 282 | 282 | |
| 283 | - foreach( $errors as $key => $msg ) |
|
| 283 | + foreach ($errors as $key => $msg) |
|
| 284 | 284 | { |
| 285 | - if( $msg === null ) { |
|
| 286 | - unset( $errors[$key] ); |
|
| 285 | + if ($msg === null) { |
|
| 286 | + unset($errors[$key]); |
|
| 287 | 287 | } |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - if( count( $errors ) === 0 ) { |
|
| 291 | - $basketCtrl->setService( 'payment', $serviceId, $attributes ); |
|
| 290 | + if (count($errors) === 0) { |
|
| 291 | + $basketCtrl->setService('payment', $serviceId, $attributes); |
|
| 292 | 292 | } else { |
| 293 | 293 | $view->standardStepActive = 'payment'; |
| 294 | 294 | } |
@@ -302,13 +302,13 @@ discard block |
||
| 302 | 302 | |
| 303 | 303 | // Test if payment service is available |
| 304 | 304 | $services = $basketCtrl->get()->getServices(); |
| 305 | - if( !isset( $view->standardStepActive ) && !array_key_exists( 'payment', $services ) ) |
|
| 305 | + if (!isset($view->standardStepActive) && !array_key_exists('payment', $services)) |
|
| 306 | 306 | { |
| 307 | 307 | $view->standardStepActive = 'payment'; |
| 308 | 308 | return false; |
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | - catch( \Exception $e ) |
|
| 311 | + catch (\Exception $e) |
|
| 312 | 312 | { |
| 313 | 313 | $view->standardStepActive = 'payment'; |
| 314 | 314 | throw $e; |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | */ |
| 324 | 324 | protected function getSubClientNames() |
| 325 | 325 | { |
| 326 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 326 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | |
@@ -335,24 +335,24 @@ discard block |
||
| 335 | 335 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 336 | 336 | * @return \Aimeos\MW\View\Iface Modified view object |
| 337 | 337 | */ |
| 338 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 338 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 339 | 339 | { |
| 340 | - if( !isset( $this->cache ) ) |
|
| 340 | + if (!isset($this->cache)) |
|
| 341 | 341 | { |
| 342 | 342 | $context = $this->getContext(); |
| 343 | 343 | |
| 344 | - $basketCntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' ); |
|
| 345 | - $serviceCntl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'service' ); |
|
| 344 | + $basketCntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket'); |
|
| 345 | + $serviceCntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'service'); |
|
| 346 | 346 | |
| 347 | 347 | $basket = $basketCntl->get(); |
| 348 | 348 | |
| 349 | - $services = $serviceCntl->getServices( 'payment', $basket ); |
|
| 349 | + $services = $serviceCntl->getServices('payment', $basket); |
|
| 350 | 350 | $serviceAttributes = $servicePrices = array(); |
| 351 | 351 | |
| 352 | - foreach( $services as $id => $service ) |
|
| 352 | + foreach ($services as $id => $service) |
|
| 353 | 353 | { |
| 354 | - $serviceAttributes[$id] = $serviceCntl->getServiceAttributes( 'payment', $id, $basket ); |
|
| 355 | - $servicePrices[$id] = $serviceCntl->getServicePrice( 'payment', $id, $basket ); |
|
| 354 | + $serviceAttributes[$id] = $serviceCntl->getServiceAttributes('payment', $id, $basket); |
|
| 355 | + $servicePrices[$id] = $serviceCntl->getServicePrice('payment', $id, $basket); |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | $view->paymentServices = $services; |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |
@@ -303,8 +303,7 @@ |
||
| 303 | 303 | $view->standardStepActive = 'address'; |
| 304 | 304 | return false; |
| 305 | 305 | } |
| 306 | - } |
|
| 307 | - catch( \Exception $e ) |
|
| 306 | + } catch( \Exception $e ) |
|
| 308 | 307 | { |
| 309 | 308 | $this->getView()->standardStepActive = 'address'; |
| 310 | 309 | throw $e; |
@@ -23,454 +23,454 @@ |
||
| 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/address/standard/subparts |
|
| 30 | - * List of HTML sub-clients rendered within the checkout standard address 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/address/standard/subparts'; |
|
| 63 | - |
|
| 64 | - /** client/html/checkout/standard/address/billing/name |
|
| 65 | - * Name of the billing part used by the checkout standard address client implementation |
|
| 66 | - * |
|
| 67 | - * Use "Myname" if your class is named "\Aimeos\Client\Checkout\Standard\Address\Billing\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 2014.03 |
|
| 72 | - * @category Developer |
|
| 73 | - */ |
|
| 74 | - |
|
| 75 | - /** client/html/checkout/standard/address/delivery/name |
|
| 76 | - * Name of the delivery part used by the checkout standard address client implementation |
|
| 77 | - * |
|
| 78 | - * Use "Myname" if your class is named "\Aimeos\Client\Checkout\Standard\Address\Delivery\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( 'billing', 'delivery' ); |
|
| 86 | - |
|
| 87 | - private $cache; |
|
| 88 | - |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * Returns the HTML code for insertion into the body. |
|
| 92 | - * |
|
| 93 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 94 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 95 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 96 | - * @return string HTML code |
|
| 97 | - */ |
|
| 98 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 99 | - { |
|
| 100 | - $view = $this->getView(); |
|
| 101 | - $step = $view->get( 'standardStepActive', 'address' ); |
|
| 102 | - $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 103 | - |
|
| 104 | - if( $step != 'address' && !( in_array( 'address', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 105 | - return ''; |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 109 | - |
|
| 110 | - $html = ''; |
|
| 111 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 112 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 113 | - } |
|
| 114 | - $view->addressBody = $html; |
|
| 115 | - |
|
| 116 | - /** client/html/checkout/standard/address/standard/template-body |
|
| 117 | - * Relative path to the HTML body template of the checkout standard address client. |
|
| 118 | - * |
|
| 119 | - * The template file contains the HTML code and processing instructions |
|
| 120 | - * to generate the result shown in the body of the frontend. The |
|
| 121 | - * configuration string is the path to the template file relative |
|
| 122 | - * to the templates directory (usually in client/html/templates). |
|
| 123 | - * |
|
| 124 | - * You can overwrite the template file configuration in extensions and |
|
| 125 | - * provide alternative templates. These alternative templates should be |
|
| 126 | - * named like the default one but with the string "standard" replaced by |
|
| 127 | - * an unique name. You may use the name of your project for this. If |
|
| 128 | - * you've implemented an alternative client class as well, "standard" |
|
| 129 | - * should be replaced by the name of the new class. |
|
| 130 | - * |
|
| 131 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 132 | - * @since 2014.03 |
|
| 133 | - * @category Developer |
|
| 134 | - * @see client/html/checkout/standard/address/standard/template-header |
|
| 135 | - */ |
|
| 136 | - $tplconf = 'client/html/checkout/standard/address/standard/template-body'; |
|
| 137 | - $default = 'checkout/standard/address-body-default.php'; |
|
| 138 | - |
|
| 139 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - |
|
| 143 | - /** |
|
| 144 | - * Returns the HTML string for insertion into the header. |
|
| 145 | - * |
|
| 146 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 147 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 148 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 149 | - * @return string|null String including HTML tags for the header on error |
|
| 150 | - */ |
|
| 151 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 152 | - { |
|
| 153 | - $view = $this->getView(); |
|
| 154 | - $step = $view->get( 'standardStepActive' ); |
|
| 155 | - $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 156 | - |
|
| 157 | - if( $step != 'address' && !( in_array( 'address', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 158 | - return ''; |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 162 | - |
|
| 163 | - $html = ''; |
|
| 164 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 165 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 166 | - } |
|
| 167 | - $view->addressHeader = $html; |
|
| 168 | - |
|
| 169 | - /** client/html/checkout/standard/address/standard/template-header |
|
| 170 | - * Relative path to the HTML header template of the checkout standard address client. |
|
| 171 | - * |
|
| 172 | - * The template file contains the HTML code and processing instructions |
|
| 173 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 174 | - * of the rendered page in the frontend. The configuration string is the |
|
| 175 | - * path to the template file relative to the templates directory (usually |
|
| 176 | - * in client/html/templates). |
|
| 177 | - * |
|
| 178 | - * You can overwrite the template file configuration in extensions and |
|
| 179 | - * provide alternative templates. These alternative templates should be |
|
| 180 | - * named like the default one but with the string "standard" replaced by |
|
| 181 | - * an unique name. You may use the name of your project for this. If |
|
| 182 | - * you've implemented an alternative client class as well, "standard" |
|
| 183 | - * should be replaced by the name of the new class. |
|
| 184 | - * |
|
| 185 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 186 | - * @since 2014.03 |
|
| 187 | - * @category Developer |
|
| 188 | - * @see client/html/checkout/standard/address/standard/template-body |
|
| 189 | - */ |
|
| 190 | - $tplconf = 'client/html/checkout/standard/address/standard/template-header'; |
|
| 191 | - $default = 'checkout/standard/address-header-default.php'; |
|
| 192 | - |
|
| 193 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 194 | - } |
|
| 195 | - |
|
| 196 | - |
|
| 197 | - /** |
|
| 198 | - * Returns the sub-client given by its name. |
|
| 199 | - * |
|
| 200 | - * @param string $type Name of the client type |
|
| 201 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 202 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 203 | - */ |
|
| 204 | - public function getSubClient( $type, $name = null ) |
|
| 205 | - { |
|
| 206 | - /** client/html/checkout/standard/address/decorators/excludes |
|
| 207 | - * Excludes decorators added by the "common" option from the checkout standard address html client |
|
| 208 | - * |
|
| 209 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 210 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 211 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 212 | - * modify what is returned to the caller. |
|
| 213 | - * |
|
| 214 | - * This option allows you to remove a decorator added via |
|
| 215 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 216 | - * around the html client. |
|
| 217 | - * |
|
| 218 | - * client/html/checkout/standard/address/decorators/excludes = array( 'decorator1' ) |
|
| 219 | - * |
|
| 220 | - * This would remove the decorator named "decorator1" from the list of |
|
| 221 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 222 | - * "client/html/common/decorators/default" 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/standard/address/decorators/global |
|
| 229 | - * @see client/html/checkout/standard/address/decorators/local |
|
| 230 | - */ |
|
| 231 | - |
|
| 232 | - /** client/html/checkout/standard/address/decorators/global |
|
| 233 | - * Adds a list of globally available decorators only to the checkout standard address 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 global decorators |
|
| 241 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 242 | - * |
|
| 243 | - * client/html/checkout/standard/address/decorators/global = array( 'decorator1' ) |
|
| 244 | - * |
|
| 245 | - * This would add the decorator named "decorator1" defined by |
|
| 246 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" 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/standard/address/decorators/excludes |
|
| 253 | - * @see client/html/checkout/standard/address/decorators/local |
|
| 254 | - */ |
|
| 255 | - |
|
| 256 | - /** client/html/checkout/standard/address/decorators/local |
|
| 257 | - * Adds a list of local decorators only to the checkout standard address html client |
|
| 258 | - * |
|
| 259 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 260 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 261 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 262 | - * modify what is returned to the caller. |
|
| 263 | - * |
|
| 264 | - * This option allows you to wrap local decorators |
|
| 265 | - * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 266 | - * |
|
| 267 | - * client/html/checkout/standard/address/decorators/local = array( 'decorator2' ) |
|
| 268 | - * |
|
| 269 | - * This would add the decorator named "decorator2" defined by |
|
| 270 | - * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 271 | - * |
|
| 272 | - * @param array List of decorator names |
|
| 273 | - * @since 2015.08 |
|
| 274 | - * @category Developer |
|
| 275 | - * @see client/html/common/decorators/default |
|
| 276 | - * @see client/html/checkout/standard/address/decorators/excludes |
|
| 277 | - * @see client/html/checkout/standard/address/decorators/global |
|
| 278 | - */ |
|
| 279 | - |
|
| 280 | - return $this->createSubClient( 'checkout/standard/address/' . $type, $name ); |
|
| 281 | - } |
|
| 282 | - |
|
| 283 | - |
|
| 284 | - /** |
|
| 285 | - * Processes the input, e.g. store given values. |
|
| 286 | - * A view must be available and this method doesn't generate any output |
|
| 287 | - * besides setting view variables. |
|
| 288 | - */ |
|
| 289 | - public function process() |
|
| 290 | - { |
|
| 291 | - $view = $this->getView(); |
|
| 292 | - |
|
| 293 | - try |
|
| 294 | - { |
|
| 295 | - parent::process(); |
|
| 296 | - |
|
| 297 | - $basketCntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'basket' ); |
|
| 298 | - |
|
| 299 | - // Test if addresses are available |
|
| 300 | - $addresses = $basketCntl->get()->getAddresses(); |
|
| 301 | - if( !isset( $view->standardStepActive ) && count( $addresses ) === 0 ) |
|
| 302 | - { |
|
| 303 | - $view->standardStepActive = 'address'; |
|
| 304 | - return false; |
|
| 305 | - } |
|
| 306 | - } |
|
| 307 | - catch( \Exception $e ) |
|
| 308 | - { |
|
| 309 | - $this->getView()->standardStepActive = 'address'; |
|
| 310 | - throw $e; |
|
| 311 | - } |
|
| 312 | - |
|
| 313 | - } |
|
| 314 | - |
|
| 315 | - |
|
| 316 | - /** |
|
| 317 | - * Returns the list of sub-client names configured for the client. |
|
| 318 | - * |
|
| 319 | - * @return array List of HTML client names |
|
| 320 | - */ |
|
| 321 | - protected function getSubClientNames() |
|
| 322 | - { |
|
| 323 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 324 | - } |
|
| 325 | - |
|
| 326 | - |
|
| 327 | - /** |
|
| 328 | - * Sets the necessary parameter values in the view. |
|
| 329 | - * |
|
| 330 | - * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 331 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 332 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 333 | - * @return \Aimeos\MW\View\Iface Modified view object |
|
| 334 | - */ |
|
| 335 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 336 | - { |
|
| 337 | - if( !isset( $this->cache ) ) |
|
| 338 | - { |
|
| 339 | - $context = $this->getContext(); |
|
| 340 | - |
|
| 341 | - |
|
| 342 | - $customerManager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
| 343 | - |
|
| 344 | - $search = $customerManager->createSearch( true ); |
|
| 345 | - $expr = array( |
|
| 346 | - $search->compare( '==', 'customer.id', $context->getUserId() ), |
|
| 347 | - $search->getConditions(), |
|
| 348 | - ); |
|
| 349 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 350 | - |
|
| 351 | - $items = $customerManager->searchItems( $search ); |
|
| 352 | - |
|
| 353 | - if( ( $item = reset( $items ) ) !== false ) |
|
| 354 | - { |
|
| 355 | - $deliveryAddressItems = array(); |
|
| 356 | - |
|
| 357 | - $orderAddressManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/address' ); |
|
| 358 | - $customerAddressManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
| 359 | - |
|
| 360 | - $search = $customerAddressManager->createSearch(); |
|
| 361 | - $search->setConditions( $search->compare( '==', 'customer.address.parentid', $item->getId() ) ); |
|
| 362 | - |
|
| 363 | - foreach( $customerAddressManager->searchItems( $search ) as $id => $address ) |
|
| 364 | - { |
|
| 365 | - $deliveryAddressItem = $orderAddressManager->createItem(); |
|
| 366 | - $deliveryAddressItem->copyFrom( $address ); |
|
| 367 | - |
|
| 368 | - $deliveryAddressItems[$id] = $deliveryAddressItem; |
|
| 369 | - } |
|
| 370 | - |
|
| 371 | - $paymentAddressItem = $orderAddressManager->createItem(); |
|
| 372 | - $paymentAddressItem->copyFrom( $item->getPaymentAddress() ); |
|
| 373 | - |
|
| 374 | - $view->addressCustomerItem = $item; |
|
| 375 | - $view->addressPaymentItem = $paymentAddressItem; |
|
| 376 | - $view->addressDeliveryItems = $deliveryAddressItems; |
|
| 377 | - } |
|
| 378 | - |
|
| 379 | - |
|
| 380 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
| 381 | - $locales = $localeManager->searchItems( $localeManager->createSearch( true ) ); |
|
| 382 | - |
|
| 383 | - $languages = array(); |
|
| 384 | - foreach( $locales as $locale ) { |
|
| 385 | - $languages[$locale->getLanguageId()] = $locale->getLanguageId(); |
|
| 386 | - } |
|
| 387 | - |
|
| 388 | - $view->addressLanguages = $languages; |
|
| 389 | - |
|
| 390 | - /** client/html/checkout/standard/address/countries |
|
| 391 | - * List of available countries that that users can select from in the front-end |
|
| 392 | - * |
|
| 393 | - * This configration option is used whenever a list of countries is |
|
| 394 | - * shown in the front-end users can select from. It's used e.g. |
|
| 395 | - * if the customer should select the country he is living in the |
|
| 396 | - * checkout process. In case that the list is empty, no country |
|
| 397 | - * selection is shown. |
|
| 398 | - * |
|
| 399 | - * Each list entry must be a two letter ISO country code that is then |
|
| 400 | - * translated into its name. The codes have to be upper case |
|
| 401 | - * characters like "DE" for Germany or "GB" for Great Britain, e.g. |
|
| 402 | - * |
|
| 403 | - * array( 'DE', 'GB', ... ) |
|
| 404 | - * |
|
| 405 | - * To display the country selection, you have to add the key for the |
|
| 406 | - * country ID (order.base.address.languageid) to the "mandatory" or |
|
| 407 | - * "optional" configuration option for billing and delivery addresses. |
|
| 408 | - * |
|
| 409 | - * Until 2015-02, the configuration option was available as |
|
| 410 | - * "client/html/common/address/countries" starting from 2014-03. |
|
| 411 | - * |
|
| 412 | - * @param array List of two letter ISO country codes |
|
| 413 | - * @since 2015.02 |
|
| 414 | - * @category User |
|
| 415 | - * @category Developer |
|
| 416 | - * @see client/html/checkout/standard/address/billing/mandatory |
|
| 417 | - * @see client/html/checkout/standard/address/billing/optional |
|
| 418 | - * @see client/html/checkout/standard/address/delivery/mandatory |
|
| 419 | - * @see client/html/checkout/standard/address/delivery/optional |
|
| 420 | - */ |
|
| 421 | - $view->addressCountries = $view->config( 'client/html/checkout/standard/address/countries', array() ); |
|
| 422 | - |
|
| 423 | - /** client/html/checkout/standard/address/states |
|
| 424 | - * List of available states that that users can select from in the front-end |
|
| 425 | - * |
|
| 426 | - * This configration option is used whenever a list of states is |
|
| 427 | - * shown in the front-end users can select from. It's used e.g. |
|
| 428 | - * if the customer should select the state he is living in the |
|
| 429 | - * checkout process. In case that the list is empty, no state |
|
| 430 | - * selection is shown. |
|
| 431 | - * |
|
| 432 | - * A two letter ISO country code must be the key for the list of |
|
| 433 | - * states that belong to this country. The list of states must then |
|
| 434 | - * contain the state code as key and its name as values, e.g. |
|
| 435 | - * |
|
| 436 | - * array( |
|
| 437 | - * 'US' => array( |
|
| 438 | - * 'CA' => 'California', |
|
| 439 | - * 'NY' => 'New York', |
|
| 440 | - * ... |
|
| 441 | - * ), |
|
| 442 | - * ... |
|
| 443 | - * ); |
|
| 444 | - * |
|
| 445 | - * The codes have to be upper case characters like "US" for the |
|
| 446 | - * United States or "DE" for Germany. The order of the country and |
|
| 447 | - * state codes determine the order of the states in the frontend and |
|
| 448 | - * the state codes are later used for per state tax calculation. |
|
| 449 | - * |
|
| 450 | - * To display the country selection, you have to add the key for the |
|
| 451 | - * state (order.base.address.state) to the "mandatory" or |
|
| 452 | - * "optional" configuration option for billing and delivery addresses. |
|
| 453 | - * You also need to add order.base.address.countryid as well because |
|
| 454 | - * it is required to display the states that belong to this country. |
|
| 455 | - * |
|
| 456 | - * Until 2015-02, the configuration option was available as |
|
| 457 | - * "client/html/common/address/states" starting from 2014-09. |
|
| 458 | - * |
|
| 459 | - * @param array Multi-dimensional list ISO country codes and state codes/names |
|
| 460 | - * @since 2015.02 |
|
| 461 | - * @category User |
|
| 462 | - * @category Developer |
|
| 463 | - * @see client/html/checkout/standard/address/billing/mandatory |
|
| 464 | - * @see client/html/checkout/standard/address/billing/optional |
|
| 465 | - * @see client/html/checkout/standard/address/delivery/mandatory |
|
| 466 | - * @see client/html/checkout/standard/address/delivery/optional |
|
| 467 | - */ |
|
| 468 | - $view->addressStates = $view->config( 'client/html/checkout/standard/address/states', array() ); |
|
| 469 | - |
|
| 470 | - |
|
| 471 | - $this->cache = $view; |
|
| 472 | - } |
|
| 473 | - |
|
| 474 | - return $this->cache; |
|
| 475 | - } |
|
| 29 | + /** client/html/checkout/standard/address/standard/subparts |
|
| 30 | + * List of HTML sub-clients rendered within the checkout standard address 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/address/standard/subparts'; |
|
| 63 | + |
|
| 64 | + /** client/html/checkout/standard/address/billing/name |
|
| 65 | + * Name of the billing part used by the checkout standard address client implementation |
|
| 66 | + * |
|
| 67 | + * Use "Myname" if your class is named "\Aimeos\Client\Checkout\Standard\Address\Billing\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 2014.03 |
|
| 72 | + * @category Developer |
|
| 73 | + */ |
|
| 74 | + |
|
| 75 | + /** client/html/checkout/standard/address/delivery/name |
|
| 76 | + * Name of the delivery part used by the checkout standard address client implementation |
|
| 77 | + * |
|
| 78 | + * Use "Myname" if your class is named "\Aimeos\Client\Checkout\Standard\Address\Delivery\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( 'billing', 'delivery' ); |
|
| 86 | + |
|
| 87 | + private $cache; |
|
| 88 | + |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * Returns the HTML code for insertion into the body. |
|
| 92 | + * |
|
| 93 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 94 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 95 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 96 | + * @return string HTML code |
|
| 97 | + */ |
|
| 98 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 99 | + { |
|
| 100 | + $view = $this->getView(); |
|
| 101 | + $step = $view->get( 'standardStepActive', 'address' ); |
|
| 102 | + $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 103 | + |
|
| 104 | + if( $step != 'address' && !( in_array( 'address', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 105 | + return ''; |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 109 | + |
|
| 110 | + $html = ''; |
|
| 111 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 112 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 113 | + } |
|
| 114 | + $view->addressBody = $html; |
|
| 115 | + |
|
| 116 | + /** client/html/checkout/standard/address/standard/template-body |
|
| 117 | + * Relative path to the HTML body template of the checkout standard address client. |
|
| 118 | + * |
|
| 119 | + * The template file contains the HTML code and processing instructions |
|
| 120 | + * to generate the result shown in the body of the frontend. The |
|
| 121 | + * configuration string is the path to the template file relative |
|
| 122 | + * to the templates directory (usually in client/html/templates). |
|
| 123 | + * |
|
| 124 | + * You can overwrite the template file configuration in extensions and |
|
| 125 | + * provide alternative templates. These alternative templates should be |
|
| 126 | + * named like the default one but with the string "standard" replaced by |
|
| 127 | + * an unique name. You may use the name of your project for this. If |
|
| 128 | + * you've implemented an alternative client class as well, "standard" |
|
| 129 | + * should be replaced by the name of the new class. |
|
| 130 | + * |
|
| 131 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 132 | + * @since 2014.03 |
|
| 133 | + * @category Developer |
|
| 134 | + * @see client/html/checkout/standard/address/standard/template-header |
|
| 135 | + */ |
|
| 136 | + $tplconf = 'client/html/checkout/standard/address/standard/template-body'; |
|
| 137 | + $default = 'checkout/standard/address-body-default.php'; |
|
| 138 | + |
|
| 139 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + |
|
| 143 | + /** |
|
| 144 | + * Returns the HTML string for insertion into the header. |
|
| 145 | + * |
|
| 146 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 147 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 148 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 149 | + * @return string|null String including HTML tags for the header on error |
|
| 150 | + */ |
|
| 151 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 152 | + { |
|
| 153 | + $view = $this->getView(); |
|
| 154 | + $step = $view->get( 'standardStepActive' ); |
|
| 155 | + $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 156 | + |
|
| 157 | + if( $step != 'address' && !( in_array( 'address', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 158 | + return ''; |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 162 | + |
|
| 163 | + $html = ''; |
|
| 164 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 165 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 166 | + } |
|
| 167 | + $view->addressHeader = $html; |
|
| 168 | + |
|
| 169 | + /** client/html/checkout/standard/address/standard/template-header |
|
| 170 | + * Relative path to the HTML header template of the checkout standard address client. |
|
| 171 | + * |
|
| 172 | + * The template file contains the HTML code and processing instructions |
|
| 173 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 174 | + * of the rendered page in the frontend. The configuration string is the |
|
| 175 | + * path to the template file relative to the templates directory (usually |
|
| 176 | + * in client/html/templates). |
|
| 177 | + * |
|
| 178 | + * You can overwrite the template file configuration in extensions and |
|
| 179 | + * provide alternative templates. These alternative templates should be |
|
| 180 | + * named like the default one but with the string "standard" replaced by |
|
| 181 | + * an unique name. You may use the name of your project for this. If |
|
| 182 | + * you've implemented an alternative client class as well, "standard" |
|
| 183 | + * should be replaced by the name of the new class. |
|
| 184 | + * |
|
| 185 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 186 | + * @since 2014.03 |
|
| 187 | + * @category Developer |
|
| 188 | + * @see client/html/checkout/standard/address/standard/template-body |
|
| 189 | + */ |
|
| 190 | + $tplconf = 'client/html/checkout/standard/address/standard/template-header'; |
|
| 191 | + $default = 'checkout/standard/address-header-default.php'; |
|
| 192 | + |
|
| 193 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 194 | + } |
|
| 195 | + |
|
| 196 | + |
|
| 197 | + /** |
|
| 198 | + * Returns the sub-client given by its name. |
|
| 199 | + * |
|
| 200 | + * @param string $type Name of the client type |
|
| 201 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 202 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 203 | + */ |
|
| 204 | + public function getSubClient( $type, $name = null ) |
|
| 205 | + { |
|
| 206 | + /** client/html/checkout/standard/address/decorators/excludes |
|
| 207 | + * Excludes decorators added by the "common" option from the checkout standard address html client |
|
| 208 | + * |
|
| 209 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 210 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 211 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 212 | + * modify what is returned to the caller. |
|
| 213 | + * |
|
| 214 | + * This option allows you to remove a decorator added via |
|
| 215 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 216 | + * around the html client. |
|
| 217 | + * |
|
| 218 | + * client/html/checkout/standard/address/decorators/excludes = array( 'decorator1' ) |
|
| 219 | + * |
|
| 220 | + * This would remove the decorator named "decorator1" from the list of |
|
| 221 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 222 | + * "client/html/common/decorators/default" 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/standard/address/decorators/global |
|
| 229 | + * @see client/html/checkout/standard/address/decorators/local |
|
| 230 | + */ |
|
| 231 | + |
|
| 232 | + /** client/html/checkout/standard/address/decorators/global |
|
| 233 | + * Adds a list of globally available decorators only to the checkout standard address 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 global decorators |
|
| 241 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 242 | + * |
|
| 243 | + * client/html/checkout/standard/address/decorators/global = array( 'decorator1' ) |
|
| 244 | + * |
|
| 245 | + * This would add the decorator named "decorator1" defined by |
|
| 246 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" 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/standard/address/decorators/excludes |
|
| 253 | + * @see client/html/checkout/standard/address/decorators/local |
|
| 254 | + */ |
|
| 255 | + |
|
| 256 | + /** client/html/checkout/standard/address/decorators/local |
|
| 257 | + * Adds a list of local decorators only to the checkout standard address html client |
|
| 258 | + * |
|
| 259 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 260 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 261 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 262 | + * modify what is returned to the caller. |
|
| 263 | + * |
|
| 264 | + * This option allows you to wrap local decorators |
|
| 265 | + * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 266 | + * |
|
| 267 | + * client/html/checkout/standard/address/decorators/local = array( 'decorator2' ) |
|
| 268 | + * |
|
| 269 | + * This would add the decorator named "decorator2" defined by |
|
| 270 | + * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 271 | + * |
|
| 272 | + * @param array List of decorator names |
|
| 273 | + * @since 2015.08 |
|
| 274 | + * @category Developer |
|
| 275 | + * @see client/html/common/decorators/default |
|
| 276 | + * @see client/html/checkout/standard/address/decorators/excludes |
|
| 277 | + * @see client/html/checkout/standard/address/decorators/global |
|
| 278 | + */ |
|
| 279 | + |
|
| 280 | + return $this->createSubClient( 'checkout/standard/address/' . $type, $name ); |
|
| 281 | + } |
|
| 282 | + |
|
| 283 | + |
|
| 284 | + /** |
|
| 285 | + * Processes the input, e.g. store given values. |
|
| 286 | + * A view must be available and this method doesn't generate any output |
|
| 287 | + * besides setting view variables. |
|
| 288 | + */ |
|
| 289 | + public function process() |
|
| 290 | + { |
|
| 291 | + $view = $this->getView(); |
|
| 292 | + |
|
| 293 | + try |
|
| 294 | + { |
|
| 295 | + parent::process(); |
|
| 296 | + |
|
| 297 | + $basketCntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'basket' ); |
|
| 298 | + |
|
| 299 | + // Test if addresses are available |
|
| 300 | + $addresses = $basketCntl->get()->getAddresses(); |
|
| 301 | + if( !isset( $view->standardStepActive ) && count( $addresses ) === 0 ) |
|
| 302 | + { |
|
| 303 | + $view->standardStepActive = 'address'; |
|
| 304 | + return false; |
|
| 305 | + } |
|
| 306 | + } |
|
| 307 | + catch( \Exception $e ) |
|
| 308 | + { |
|
| 309 | + $this->getView()->standardStepActive = 'address'; |
|
| 310 | + throw $e; |
|
| 311 | + } |
|
| 312 | + |
|
| 313 | + } |
|
| 314 | + |
|
| 315 | + |
|
| 316 | + /** |
|
| 317 | + * Returns the list of sub-client names configured for the client. |
|
| 318 | + * |
|
| 319 | + * @return array List of HTML client names |
|
| 320 | + */ |
|
| 321 | + protected function getSubClientNames() |
|
| 322 | + { |
|
| 323 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 324 | + } |
|
| 325 | + |
|
| 326 | + |
|
| 327 | + /** |
|
| 328 | + * Sets the necessary parameter values in the view. |
|
| 329 | + * |
|
| 330 | + * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output |
|
| 331 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 332 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 333 | + * @return \Aimeos\MW\View\Iface Modified view object |
|
| 334 | + */ |
|
| 335 | + protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 336 | + { |
|
| 337 | + if( !isset( $this->cache ) ) |
|
| 338 | + { |
|
| 339 | + $context = $this->getContext(); |
|
| 340 | + |
|
| 341 | + |
|
| 342 | + $customerManager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
| 343 | + |
|
| 344 | + $search = $customerManager->createSearch( true ); |
|
| 345 | + $expr = array( |
|
| 346 | + $search->compare( '==', 'customer.id', $context->getUserId() ), |
|
| 347 | + $search->getConditions(), |
|
| 348 | + ); |
|
| 349 | + $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 350 | + |
|
| 351 | + $items = $customerManager->searchItems( $search ); |
|
| 352 | + |
|
| 353 | + if( ( $item = reset( $items ) ) !== false ) |
|
| 354 | + { |
|
| 355 | + $deliveryAddressItems = array(); |
|
| 356 | + |
|
| 357 | + $orderAddressManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/address' ); |
|
| 358 | + $customerAddressManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
| 359 | + |
|
| 360 | + $search = $customerAddressManager->createSearch(); |
|
| 361 | + $search->setConditions( $search->compare( '==', 'customer.address.parentid', $item->getId() ) ); |
|
| 362 | + |
|
| 363 | + foreach( $customerAddressManager->searchItems( $search ) as $id => $address ) |
|
| 364 | + { |
|
| 365 | + $deliveryAddressItem = $orderAddressManager->createItem(); |
|
| 366 | + $deliveryAddressItem->copyFrom( $address ); |
|
| 367 | + |
|
| 368 | + $deliveryAddressItems[$id] = $deliveryAddressItem; |
|
| 369 | + } |
|
| 370 | + |
|
| 371 | + $paymentAddressItem = $orderAddressManager->createItem(); |
|
| 372 | + $paymentAddressItem->copyFrom( $item->getPaymentAddress() ); |
|
| 373 | + |
|
| 374 | + $view->addressCustomerItem = $item; |
|
| 375 | + $view->addressPaymentItem = $paymentAddressItem; |
|
| 376 | + $view->addressDeliveryItems = $deliveryAddressItems; |
|
| 377 | + } |
|
| 378 | + |
|
| 379 | + |
|
| 380 | + $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
| 381 | + $locales = $localeManager->searchItems( $localeManager->createSearch( true ) ); |
|
| 382 | + |
|
| 383 | + $languages = array(); |
|
| 384 | + foreach( $locales as $locale ) { |
|
| 385 | + $languages[$locale->getLanguageId()] = $locale->getLanguageId(); |
|
| 386 | + } |
|
| 387 | + |
|
| 388 | + $view->addressLanguages = $languages; |
|
| 389 | + |
|
| 390 | + /** client/html/checkout/standard/address/countries |
|
| 391 | + * List of available countries that that users can select from in the front-end |
|
| 392 | + * |
|
| 393 | + * This configration option is used whenever a list of countries is |
|
| 394 | + * shown in the front-end users can select from. It's used e.g. |
|
| 395 | + * if the customer should select the country he is living in the |
|
| 396 | + * checkout process. In case that the list is empty, no country |
|
| 397 | + * selection is shown. |
|
| 398 | + * |
|
| 399 | + * Each list entry must be a two letter ISO country code that is then |
|
| 400 | + * translated into its name. The codes have to be upper case |
|
| 401 | + * characters like "DE" for Germany or "GB" for Great Britain, e.g. |
|
| 402 | + * |
|
| 403 | + * array( 'DE', 'GB', ... ) |
|
| 404 | + * |
|
| 405 | + * To display the country selection, you have to add the key for the |
|
| 406 | + * country ID (order.base.address.languageid) to the "mandatory" or |
|
| 407 | + * "optional" configuration option for billing and delivery addresses. |
|
| 408 | + * |
|
| 409 | + * Until 2015-02, the configuration option was available as |
|
| 410 | + * "client/html/common/address/countries" starting from 2014-03. |
|
| 411 | + * |
|
| 412 | + * @param array List of two letter ISO country codes |
|
| 413 | + * @since 2015.02 |
|
| 414 | + * @category User |
|
| 415 | + * @category Developer |
|
| 416 | + * @see client/html/checkout/standard/address/billing/mandatory |
|
| 417 | + * @see client/html/checkout/standard/address/billing/optional |
|
| 418 | + * @see client/html/checkout/standard/address/delivery/mandatory |
|
| 419 | + * @see client/html/checkout/standard/address/delivery/optional |
|
| 420 | + */ |
|
| 421 | + $view->addressCountries = $view->config( 'client/html/checkout/standard/address/countries', array() ); |
|
| 422 | + |
|
| 423 | + /** client/html/checkout/standard/address/states |
|
| 424 | + * List of available states that that users can select from in the front-end |
|
| 425 | + * |
|
| 426 | + * This configration option is used whenever a list of states is |
|
| 427 | + * shown in the front-end users can select from. It's used e.g. |
|
| 428 | + * if the customer should select the state he is living in the |
|
| 429 | + * checkout process. In case that the list is empty, no state |
|
| 430 | + * selection is shown. |
|
| 431 | + * |
|
| 432 | + * A two letter ISO country code must be the key for the list of |
|
| 433 | + * states that belong to this country. The list of states must then |
|
| 434 | + * contain the state code as key and its name as values, e.g. |
|
| 435 | + * |
|
| 436 | + * array( |
|
| 437 | + * 'US' => array( |
|
| 438 | + * 'CA' => 'California', |
|
| 439 | + * 'NY' => 'New York', |
|
| 440 | + * ... |
|
| 441 | + * ), |
|
| 442 | + * ... |
|
| 443 | + * ); |
|
| 444 | + * |
|
| 445 | + * The codes have to be upper case characters like "US" for the |
|
| 446 | + * United States or "DE" for Germany. The order of the country and |
|
| 447 | + * state codes determine the order of the states in the frontend and |
|
| 448 | + * the state codes are later used for per state tax calculation. |
|
| 449 | + * |
|
| 450 | + * To display the country selection, you have to add the key for the |
|
| 451 | + * state (order.base.address.state) to the "mandatory" or |
|
| 452 | + * "optional" configuration option for billing and delivery addresses. |
|
| 453 | + * You also need to add order.base.address.countryid as well because |
|
| 454 | + * it is required to display the states that belong to this country. |
|
| 455 | + * |
|
| 456 | + * Until 2015-02, the configuration option was available as |
|
| 457 | + * "client/html/common/address/states" starting from 2014-09. |
|
| 458 | + * |
|
| 459 | + * @param array Multi-dimensional list ISO country codes and state codes/names |
|
| 460 | + * @since 2015.02 |
|
| 461 | + * @category User |
|
| 462 | + * @category Developer |
|
| 463 | + * @see client/html/checkout/standard/address/billing/mandatory |
|
| 464 | + * @see client/html/checkout/standard/address/billing/optional |
|
| 465 | + * @see client/html/checkout/standard/address/delivery/mandatory |
|
| 466 | + * @see client/html/checkout/standard/address/delivery/optional |
|
| 467 | + */ |
|
| 468 | + $view->addressStates = $view->config( 'client/html/checkout/standard/address/states', array() ); |
|
| 469 | + |
|
| 470 | + |
|
| 471 | + $this->cache = $view; |
|
| 472 | + } |
|
| 473 | + |
|
| 474 | + return $this->cache; |
|
| 475 | + } |
|
| 476 | 476 | } |
| 477 | 477 | \ No newline at end of file |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | // Strings for translation |
| 16 | -sprintf( 'address' ); |
|
| 16 | +sprintf('address'); |
|
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 | /** |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * @since 2014.03 |
| 83 | 83 | * @category Developer |
| 84 | 84 | */ |
| 85 | - private $subPartNames = array( 'billing', 'delivery' ); |
|
| 85 | + private $subPartNames = array('billing', 'delivery'); |
|
| 86 | 86 | |
| 87 | 87 | private $cache; |
| 88 | 88 | |
@@ -95,21 +95,21 @@ discard block |
||
| 95 | 95 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 96 | 96 | * @return string HTML code |
| 97 | 97 | */ |
| 98 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 98 | + public function getBody($uid = '', array &$tags = array(), &$expire = null) |
|
| 99 | 99 | { |
| 100 | 100 | $view = $this->getView(); |
| 101 | - $step = $view->get( 'standardStepActive', 'address' ); |
|
| 102 | - $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 101 | + $step = $view->get('standardStepActive', 'address'); |
|
| 102 | + $onepage = $view->config('client/html/checkout/standard/onepage', array()); |
|
| 103 | 103 | |
| 104 | - if( $step != 'address' && !( in_array( 'address', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 104 | + if ($step != 'address' && !(in_array('address', $onepage) && in_array($step, $onepage))) { |
|
| 105 | 105 | return ''; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 108 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 109 | 109 | |
| 110 | 110 | $html = ''; |
| 111 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 112 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 111 | + foreach ($this->getSubClients() as $subclient) { |
|
| 112 | + $html .= $subclient->setView($view)->getBody($uid, $tags, $expire); |
|
| 113 | 113 | } |
| 114 | 114 | $view->addressBody = $html; |
| 115 | 115 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $tplconf = 'client/html/checkout/standard/address/standard/template-body'; |
| 137 | 137 | $default = 'checkout/standard/address-body-default.php'; |
| 138 | 138 | |
| 139 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 139 | + return $view->render($view->config($tplconf, $default)); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | |
@@ -148,21 +148,21 @@ discard block |
||
| 148 | 148 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 149 | 149 | * @return string|null String including HTML tags for the header on error |
| 150 | 150 | */ |
| 151 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 151 | + public function getHeader($uid = '', array &$tags = array(), &$expire = null) |
|
| 152 | 152 | { |
| 153 | 153 | $view = $this->getView(); |
| 154 | - $step = $view->get( 'standardStepActive' ); |
|
| 155 | - $onepage = $view->config( 'client/html/checkout/standard/onepage', array() ); |
|
| 154 | + $step = $view->get('standardStepActive'); |
|
| 155 | + $onepage = $view->config('client/html/checkout/standard/onepage', array()); |
|
| 156 | 156 | |
| 157 | - if( $step != 'address' && !( in_array( 'address', $onepage ) && in_array( $step, $onepage ) ) ) { |
|
| 157 | + if ($step != 'address' && !(in_array('address', $onepage) && in_array($step, $onepage))) { |
|
| 158 | 158 | return ''; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - $view = $this->setViewParams( $view, $tags, $expire ); |
|
| 161 | + $view = $this->setViewParams($view, $tags, $expire); |
|
| 162 | 162 | |
| 163 | 163 | $html = ''; |
| 164 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 165 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 164 | + foreach ($this->getSubClients() as $subclient) { |
|
| 165 | + $html .= $subclient->setView($view)->getHeader($uid, $tags, $expire); |
|
| 166 | 166 | } |
| 167 | 167 | $view->addressHeader = $html; |
| 168 | 168 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | $tplconf = 'client/html/checkout/standard/address/standard/template-header'; |
| 191 | 191 | $default = 'checkout/standard/address-header-default.php'; |
| 192 | 192 | |
| 193 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 193 | + return $view->render($view->config($tplconf, $default)); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | * @param string|null $name Name of the sub-client (Default if null) |
| 202 | 202 | * @return \Aimeos\Client\Html\Iface Sub-client object |
| 203 | 203 | */ |
| 204 | - public function getSubClient( $type, $name = null ) |
|
| 204 | + public function getSubClient($type, $name = null) |
|
| 205 | 205 | { |
| 206 | 206 | /** client/html/checkout/standard/address/decorators/excludes |
| 207 | 207 | * Excludes decorators added by the "common" option from the checkout standard address html client |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | * @see client/html/checkout/standard/address/decorators/global |
| 278 | 278 | */ |
| 279 | 279 | |
| 280 | - return $this->createSubClient( 'checkout/standard/address/' . $type, $name ); |
|
| 280 | + return $this->createSubClient('checkout/standard/address/'.$type, $name); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | |
@@ -294,17 +294,17 @@ discard block |
||
| 294 | 294 | { |
| 295 | 295 | parent::process(); |
| 296 | 296 | |
| 297 | - $basketCntl = \Aimeos\Controller\Frontend\Factory::createController( $this->getContext(), 'basket' ); |
|
| 297 | + $basketCntl = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'basket'); |
|
| 298 | 298 | |
| 299 | 299 | // Test if addresses are available |
| 300 | 300 | $addresses = $basketCntl->get()->getAddresses(); |
| 301 | - if( !isset( $view->standardStepActive ) && count( $addresses ) === 0 ) |
|
| 301 | + if (!isset($view->standardStepActive) && count($addresses) === 0) |
|
| 302 | 302 | { |
| 303 | 303 | $view->standardStepActive = 'address'; |
| 304 | 304 | return false; |
| 305 | 305 | } |
| 306 | 306 | } |
| 307 | - catch( \Exception $e ) |
|
| 307 | + catch (\Exception $e) |
|
| 308 | 308 | { |
| 309 | 309 | $this->getView()->standardStepActive = 'address'; |
| 310 | 310 | throw $e; |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | protected function getSubClientNames() |
| 322 | 322 | { |
| 323 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 323 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | |
@@ -332,44 +332,44 @@ discard block |
||
| 332 | 332 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 333 | 333 | * @return \Aimeos\MW\View\Iface Modified view object |
| 334 | 334 | */ |
| 335 | - protected function setViewParams( \Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null ) |
|
| 335 | + protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null) |
|
| 336 | 336 | { |
| 337 | - if( !isset( $this->cache ) ) |
|
| 337 | + if (!isset($this->cache)) |
|
| 338 | 338 | { |
| 339 | 339 | $context = $this->getContext(); |
| 340 | 340 | |
| 341 | 341 | |
| 342 | - $customerManager = \Aimeos\MShop\Factory::createManager( $context, 'customer' ); |
|
| 342 | + $customerManager = \Aimeos\MShop\Factory::createManager($context, 'customer'); |
|
| 343 | 343 | |
| 344 | - $search = $customerManager->createSearch( true ); |
|
| 344 | + $search = $customerManager->createSearch(true); |
|
| 345 | 345 | $expr = array( |
| 346 | - $search->compare( '==', 'customer.id', $context->getUserId() ), |
|
| 346 | + $search->compare('==', 'customer.id', $context->getUserId()), |
|
| 347 | 347 | $search->getConditions(), |
| 348 | 348 | ); |
| 349 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 349 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 350 | 350 | |
| 351 | - $items = $customerManager->searchItems( $search ); |
|
| 351 | + $items = $customerManager->searchItems($search); |
|
| 352 | 352 | |
| 353 | - if( ( $item = reset( $items ) ) !== false ) |
|
| 353 | + if (($item = reset($items)) !== false) |
|
| 354 | 354 | { |
| 355 | 355 | $deliveryAddressItems = array(); |
| 356 | 356 | |
| 357 | - $orderAddressManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/address' ); |
|
| 358 | - $customerAddressManager = \Aimeos\MShop\Factory::createManager( $context, 'customer/address' ); |
|
| 357 | + $orderAddressManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/address'); |
|
| 358 | + $customerAddressManager = \Aimeos\MShop\Factory::createManager($context, 'customer/address'); |
|
| 359 | 359 | |
| 360 | 360 | $search = $customerAddressManager->createSearch(); |
| 361 | - $search->setConditions( $search->compare( '==', 'customer.address.parentid', $item->getId() ) ); |
|
| 361 | + $search->setConditions($search->compare('==', 'customer.address.parentid', $item->getId())); |
|
| 362 | 362 | |
| 363 | - foreach( $customerAddressManager->searchItems( $search ) as $id => $address ) |
|
| 363 | + foreach ($customerAddressManager->searchItems($search) as $id => $address) |
|
| 364 | 364 | { |
| 365 | 365 | $deliveryAddressItem = $orderAddressManager->createItem(); |
| 366 | - $deliveryAddressItem->copyFrom( $address ); |
|
| 366 | + $deliveryAddressItem->copyFrom($address); |
|
| 367 | 367 | |
| 368 | 368 | $deliveryAddressItems[$id] = $deliveryAddressItem; |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | $paymentAddressItem = $orderAddressManager->createItem(); |
| 372 | - $paymentAddressItem->copyFrom( $item->getPaymentAddress() ); |
|
| 372 | + $paymentAddressItem->copyFrom($item->getPaymentAddress()); |
|
| 373 | 373 | |
| 374 | 374 | $view->addressCustomerItem = $item; |
| 375 | 375 | $view->addressPaymentItem = $paymentAddressItem; |
@@ -377,11 +377,11 @@ discard block |
||
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | |
| 380 | - $localeManager = \Aimeos\MShop\Factory::createManager( $context, 'locale' ); |
|
| 381 | - $locales = $localeManager->searchItems( $localeManager->createSearch( true ) ); |
|
| 380 | + $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale'); |
|
| 381 | + $locales = $localeManager->searchItems($localeManager->createSearch(true)); |
|
| 382 | 382 | |
| 383 | 383 | $languages = array(); |
| 384 | - foreach( $locales as $locale ) { |
|
| 384 | + foreach ($locales as $locale) { |
|
| 385 | 385 | $languages[$locale->getLanguageId()] = $locale->getLanguageId(); |
| 386 | 386 | } |
| 387 | 387 | |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | * @see client/html/checkout/standard/address/delivery/mandatory |
| 419 | 419 | * @see client/html/checkout/standard/address/delivery/optional |
| 420 | 420 | */ |
| 421 | - $view->addressCountries = $view->config( 'client/html/checkout/standard/address/countries', array() ); |
|
| 421 | + $view->addressCountries = $view->config('client/html/checkout/standard/address/countries', array()); |
|
| 422 | 422 | |
| 423 | 423 | /** client/html/checkout/standard/address/states |
| 424 | 424 | * List of available states that that users can select from in the front-end |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | * @see client/html/checkout/standard/address/delivery/mandatory |
| 466 | 466 | * @see client/html/checkout/standard/address/delivery/optional |
| 467 | 467 | */ |
| 468 | - $view->addressStates = $view->config( 'client/html/checkout/standard/address/states', array() ); |
|
| 468 | + $view->addressStates = $view->config('client/html/checkout/standard/address/states', array()); |
|
| 469 | 469 | |
| 470 | 470 | |
| 471 | 471 | $this->cache = $view; |
@@ -303,8 +303,7 @@ |
||
| 303 | 303 | $view->standardStepActive = 'address'; |
| 304 | 304 | return false; |
| 305 | 305 | } |
| 306 | - } |
|
| 307 | - catch( \Exception $e ) |
|
| 306 | + } catch( \Exception $e ) |
|
| 308 | 307 | { |
| 309 | 308 | $this->getView()->standardStepActive = 'address'; |
| 310 | 309 | throw $e; |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
| 111 | 111 | * @param array &$tags Result array for the list of tags that are associated to the output |
| 112 | 112 | * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 113 | + * @return string String including HTML tags for the header on error |
|
| 114 | 114 | */ |
| 115 | 115 | public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
| 116 | 116 | { |