@@ -19,258 +19,258 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | - implements \Aimeos\Client\Html\Iface |
|
| 22 | + extends \Aimeos\Client\Html\Common\Client\Factory\Base |
|
| 23 | + implements \Aimeos\Client\Html\Iface |
|
| 24 | 24 | { |
| 25 | - /** client/html/checkout/standard/summary/option/terms/standard/subparts |
|
| 26 | - * List of HTML sub-clients rendered within the checkout standard summary option terms section |
|
| 27 | - * |
|
| 28 | - * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | - * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | - * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | - * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | - * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | - * the output that is placed inside the container of its parent. |
|
| 34 | - * |
|
| 35 | - * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | - * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | - * determines the order of the output of these sub-clients inside the parent |
|
| 38 | - * container. If the configured list of clients is |
|
| 39 | - * |
|
| 40 | - * array( "subclient1", "subclient2" ) |
|
| 41 | - * |
|
| 42 | - * you can easily change the order of the output by reordering the subparts: |
|
| 43 | - * |
|
| 44 | - * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | - * |
|
| 46 | - * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | - * |
|
| 48 | - * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | - * |
|
| 50 | - * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | - * should support adding, removing or reordering content by a fluid like |
|
| 52 | - * design. |
|
| 53 | - * |
|
| 54 | - * @param array List of sub-client names |
|
| 55 | - * @since 2014.03 |
|
| 56 | - * @category Developer |
|
| 57 | - */ |
|
| 58 | - private $subPartPath = 'client/html/checkout/standard/summary/option/terms/standard/subparts'; |
|
| 59 | - private $subPartNames = array(); |
|
| 25 | + /** client/html/checkout/standard/summary/option/terms/standard/subparts |
|
| 26 | + * List of HTML sub-clients rendered within the checkout standard summary option terms section |
|
| 27 | + * |
|
| 28 | + * The output of the frontend is composed of the code generated by the HTML |
|
| 29 | + * clients. Each HTML client can consist of serveral (or none) sub-clients |
|
| 30 | + * that are responsible for rendering certain sub-parts of the output. The |
|
| 31 | + * sub-clients can contain HTML clients themselves and therefore a |
|
| 32 | + * hierarchical tree of HTML clients is composed. Each HTML client creates |
|
| 33 | + * the output that is placed inside the container of its parent. |
|
| 34 | + * |
|
| 35 | + * At first, always the HTML code generated by the parent is printed, then |
|
| 36 | + * the HTML code of its sub-clients. The order of the HTML sub-clients |
|
| 37 | + * determines the order of the output of these sub-clients inside the parent |
|
| 38 | + * container. If the configured list of clients is |
|
| 39 | + * |
|
| 40 | + * array( "subclient1", "subclient2" ) |
|
| 41 | + * |
|
| 42 | + * you can easily change the order of the output by reordering the subparts: |
|
| 43 | + * |
|
| 44 | + * client/html/<clients>/subparts = array( "subclient1", "subclient2" ) |
|
| 45 | + * |
|
| 46 | + * You can also remove one or more parts if they shouldn't be rendered: |
|
| 47 | + * |
|
| 48 | + * client/html/<clients>/subparts = array( "subclient1" ) |
|
| 49 | + * |
|
| 50 | + * As the clients only generates structural HTML, the layout defined via CSS |
|
| 51 | + * should support adding, removing or reordering content by a fluid like |
|
| 52 | + * design. |
|
| 53 | + * |
|
| 54 | + * @param array List of sub-client names |
|
| 55 | + * @since 2014.03 |
|
| 56 | + * @category Developer |
|
| 57 | + */ |
|
| 58 | + private $subPartPath = 'client/html/checkout/standard/summary/option/terms/standard/subparts'; |
|
| 59 | + private $subPartNames = array(); |
|
| 60 | 60 | |
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Returns the HTML code for insertion into the body. |
|
| 64 | - * |
|
| 65 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 66 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 67 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 68 | - * @return string HTML code |
|
| 69 | - */ |
|
| 70 | - public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | - { |
|
| 72 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 62 | + /** |
|
| 63 | + * Returns the HTML code for insertion into the body. |
|
| 64 | + * |
|
| 65 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 66 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 67 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 68 | + * @return string HTML code |
|
| 69 | + */ |
|
| 70 | + public function getBody( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 71 | + { |
|
| 72 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 73 | 73 | |
| 74 | - $html = ''; |
|
| 75 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | - $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | - } |
|
| 78 | - $view->optionBody = $html; |
|
| 74 | + $html = ''; |
|
| 75 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 76 | + $html .= $subclient->setView( $view )->getBody( $uid, $tags, $expire ); |
|
| 77 | + } |
|
| 78 | + $view->optionBody = $html; |
|
| 79 | 79 | |
| 80 | - /** client/html/checkout/standard/summary/option/terms/standard/template-body |
|
| 81 | - * Relative path to the HTML body template of the checkout standard summary option terms client. |
|
| 82 | - * |
|
| 83 | - * The template file contains the HTML code and processing instructions |
|
| 84 | - * to generate the result shown in the body of the frontend. The |
|
| 85 | - * configuration string is the path to the template file relative |
|
| 86 | - * to the templates directory (usually in client/html/templates). |
|
| 87 | - * |
|
| 88 | - * You can overwrite the template file configuration in extensions and |
|
| 89 | - * provide alternative templates. These alternative templates should be |
|
| 90 | - * named like the default one but with the string "standard" replaced by |
|
| 91 | - * an unique name. You may use the name of your project for this. If |
|
| 92 | - * you've implemented an alternative client class as well, "standard" |
|
| 93 | - * should be replaced by the name of the new class. |
|
| 94 | - * |
|
| 95 | - * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | - * @since 2014.03 |
|
| 97 | - * @category Developer |
|
| 98 | - * @see client/html/checkout/standard/summary/option/terms/standard/template-header |
|
| 99 | - */ |
|
| 100 | - $tplconf = 'client/html/checkout/standard/summary/option/terms/standard/template-body'; |
|
| 101 | - $default = 'checkout/standard/summary-option-terms-body-default.php'; |
|
| 80 | + /** client/html/checkout/standard/summary/option/terms/standard/template-body |
|
| 81 | + * Relative path to the HTML body template of the checkout standard summary option terms client. |
|
| 82 | + * |
|
| 83 | + * The template file contains the HTML code and processing instructions |
|
| 84 | + * to generate the result shown in the body of the frontend. The |
|
| 85 | + * configuration string is the path to the template file relative |
|
| 86 | + * to the templates directory (usually in client/html/templates). |
|
| 87 | + * |
|
| 88 | + * You can overwrite the template file configuration in extensions and |
|
| 89 | + * provide alternative templates. These alternative templates should be |
|
| 90 | + * named like the default one but with the string "standard" replaced by |
|
| 91 | + * an unique name. You may use the name of your project for this. If |
|
| 92 | + * you've implemented an alternative client class as well, "standard" |
|
| 93 | + * should be replaced by the name of the new class. |
|
| 94 | + * |
|
| 95 | + * @param string Relative path to the template creating code for the HTML page body |
|
| 96 | + * @since 2014.03 |
|
| 97 | + * @category Developer |
|
| 98 | + * @see client/html/checkout/standard/summary/option/terms/standard/template-header |
|
| 99 | + */ |
|
| 100 | + $tplconf = 'client/html/checkout/standard/summary/option/terms/standard/template-body'; |
|
| 101 | + $default = 'checkout/standard/summary-option-terms-body-default.php'; |
|
| 102 | 102 | |
| 103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | - } |
|
| 103 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * Returns the HTML string for insertion into the header. |
|
| 109 | - * |
|
| 110 | - * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | - * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | - * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | - * @return string|null String including HTML tags for the header on error |
|
| 114 | - */ |
|
| 115 | - public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | - { |
|
| 117 | - $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 107 | + /** |
|
| 108 | + * Returns the HTML string for insertion into the header. |
|
| 109 | + * |
|
| 110 | + * @param string $uid Unique identifier for the output if the content is placed more than once on the same page |
|
| 111 | + * @param array &$tags Result array for the list of tags that are associated to the output |
|
| 112 | + * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) |
|
| 113 | + * @return string|null String including HTML tags for the header on error |
|
| 114 | + */ |
|
| 115 | + public function getHeader( $uid = '', array &$tags = array(), &$expire = null ) |
|
| 116 | + { |
|
| 117 | + $view = $this->setViewParams( $this->getView(), $tags, $expire ); |
|
| 118 | 118 | |
| 119 | - $html = ''; |
|
| 120 | - foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | - $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | - } |
|
| 123 | - $view->optionHeader = $html; |
|
| 119 | + $html = ''; |
|
| 120 | + foreach( $this->getSubClients() as $subclient ) { |
|
| 121 | + $html .= $subclient->setView( $view )->getHeader( $uid, $tags, $expire ); |
|
| 122 | + } |
|
| 123 | + $view->optionHeader = $html; |
|
| 124 | 124 | |
| 125 | - /** client/html/checkout/standard/summary/option/terms/standard/template-header |
|
| 126 | - * Relative path to the HTML header template of the checkout standard summary option terms client. |
|
| 127 | - * |
|
| 128 | - * The template file contains the HTML code and processing instructions |
|
| 129 | - * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | - * of the rendered page in the frontend. The configuration string is the |
|
| 131 | - * path to the template file relative to the templates directory (usually |
|
| 132 | - * in client/html/templates). |
|
| 133 | - * |
|
| 134 | - * You can overwrite the template file configuration in extensions and |
|
| 135 | - * provide alternative templates. These alternative templates should be |
|
| 136 | - * named like the default one but with the string "standard" replaced by |
|
| 137 | - * an unique name. You may use the name of your project for this. If |
|
| 138 | - * you've implemented an alternative client class as well, "standard" |
|
| 139 | - * should be replaced by the name of the new class. |
|
| 140 | - * |
|
| 141 | - * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | - * @since 2014.03 |
|
| 143 | - * @category Developer |
|
| 144 | - * @see client/html/checkout/standard/summary/option/terms/standard/template-body |
|
| 145 | - */ |
|
| 146 | - $tplconf = 'client/html/checkout/standard/summary/option/terms/standard/template-header'; |
|
| 147 | - $default = 'checkout/standard/summary-option-terms-header-default.php'; |
|
| 125 | + /** client/html/checkout/standard/summary/option/terms/standard/template-header |
|
| 126 | + * Relative path to the HTML header template of the checkout standard summary option terms client. |
|
| 127 | + * |
|
| 128 | + * The template file contains the HTML code and processing instructions |
|
| 129 | + * to generate the HTML code that is inserted into the HTML page header |
|
| 130 | + * of the rendered page in the frontend. The configuration string is the |
|
| 131 | + * path to the template file relative to the templates directory (usually |
|
| 132 | + * in client/html/templates). |
|
| 133 | + * |
|
| 134 | + * You can overwrite the template file configuration in extensions and |
|
| 135 | + * provide alternative templates. These alternative templates should be |
|
| 136 | + * named like the default one but with the string "standard" replaced by |
|
| 137 | + * an unique name. You may use the name of your project for this. If |
|
| 138 | + * you've implemented an alternative client class as well, "standard" |
|
| 139 | + * should be replaced by the name of the new class. |
|
| 140 | + * |
|
| 141 | + * @param string Relative path to the template creating code for the HTML page head |
|
| 142 | + * @since 2014.03 |
|
| 143 | + * @category Developer |
|
| 144 | + * @see client/html/checkout/standard/summary/option/terms/standard/template-body |
|
| 145 | + */ |
|
| 146 | + $tplconf = 'client/html/checkout/standard/summary/option/terms/standard/template-header'; |
|
| 147 | + $default = 'checkout/standard/summary-option-terms-header-default.php'; |
|
| 148 | 148 | |
| 149 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | - } |
|
| 149 | + return $view->render( $view->config( $tplconf, $default ) ); |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | 152 | |
| 153 | - /** |
|
| 154 | - * Returns the sub-client given by its name. |
|
| 155 | - * |
|
| 156 | - * @param string $type Name of the client type |
|
| 157 | - * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | - * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | - */ |
|
| 160 | - public function getSubClient( $type, $name = null ) |
|
| 161 | - { |
|
| 162 | - /** client/html/checkout/standard/summary/option/terms/decorators/excludes |
|
| 163 | - * Excludes decorators added by the "common" option from the checkout standard summary option terms html client |
|
| 164 | - * |
|
| 165 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | - * modify what is returned to the caller. |
|
| 169 | - * |
|
| 170 | - * This option allows you to remove a decorator added via |
|
| 171 | - * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | - * around the html client. |
|
| 173 | - * |
|
| 174 | - * client/html/checkout/standard/summary/option/terms/decorators/excludes = array( 'decorator1' ) |
|
| 175 | - * |
|
| 176 | - * This would remove the decorator named "decorator1" from the list of |
|
| 177 | - * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | - * "client/html/common/decorators/default" to the html client. |
|
| 179 | - * |
|
| 180 | - * @param array List of decorator names |
|
| 181 | - * @since 2015.08 |
|
| 182 | - * @category Developer |
|
| 183 | - * @see client/html/common/decorators/default |
|
| 184 | - * @see client/html/checkout/standard/summary/option/terms/decorators/global |
|
| 185 | - * @see client/html/checkout/standard/summary/option/terms/decorators/local |
|
| 186 | - */ |
|
| 153 | + /** |
|
| 154 | + * Returns the sub-client given by its name. |
|
| 155 | + * |
|
| 156 | + * @param string $type Name of the client type |
|
| 157 | + * @param string|null $name Name of the sub-client (Default if null) |
|
| 158 | + * @return \Aimeos\Client\Html\Iface Sub-client object |
|
| 159 | + */ |
|
| 160 | + public function getSubClient( $type, $name = null ) |
|
| 161 | + { |
|
| 162 | + /** client/html/checkout/standard/summary/option/terms/decorators/excludes |
|
| 163 | + * Excludes decorators added by the "common" option from the checkout standard summary option terms html client |
|
| 164 | + * |
|
| 165 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 166 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 167 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 168 | + * modify what is returned to the caller. |
|
| 169 | + * |
|
| 170 | + * This option allows you to remove a decorator added via |
|
| 171 | + * "client/html/common/decorators/default" before they are wrapped |
|
| 172 | + * around the html client. |
|
| 173 | + * |
|
| 174 | + * client/html/checkout/standard/summary/option/terms/decorators/excludes = array( 'decorator1' ) |
|
| 175 | + * |
|
| 176 | + * This would remove the decorator named "decorator1" from the list of |
|
| 177 | + * common decorators ("\Aimeos\Client\Html\Common\Decorator\*") added via |
|
| 178 | + * "client/html/common/decorators/default" to the html client. |
|
| 179 | + * |
|
| 180 | + * @param array List of decorator names |
|
| 181 | + * @since 2015.08 |
|
| 182 | + * @category Developer |
|
| 183 | + * @see client/html/common/decorators/default |
|
| 184 | + * @see client/html/checkout/standard/summary/option/terms/decorators/global |
|
| 185 | + * @see client/html/checkout/standard/summary/option/terms/decorators/local |
|
| 186 | + */ |
|
| 187 | 187 | |
| 188 | - /** client/html/checkout/standard/summary/option/terms/decorators/global |
|
| 189 | - * Adds a list of globally available decorators only to the checkout standard summary option terms html client |
|
| 190 | - * |
|
| 191 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | - * modify what is returned to the caller. |
|
| 195 | - * |
|
| 196 | - * This option allows you to wrap global decorators |
|
| 197 | - * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | - * |
|
| 199 | - * client/html/checkout/standard/summary/option/terms/decorators/global = array( 'decorator1' ) |
|
| 200 | - * |
|
| 201 | - * This would add the decorator named "decorator1" defined by |
|
| 202 | - * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | - * |
|
| 204 | - * @param array List of decorator names |
|
| 205 | - * @since 2015.08 |
|
| 206 | - * @category Developer |
|
| 207 | - * @see client/html/common/decorators/default |
|
| 208 | - * @see client/html/checkout/standard/summary/option/terms/decorators/excludes |
|
| 209 | - * @see client/html/checkout/standard/summary/option/terms/decorators/local |
|
| 210 | - */ |
|
| 188 | + /** client/html/checkout/standard/summary/option/terms/decorators/global |
|
| 189 | + * Adds a list of globally available decorators only to the checkout standard summary option terms html client |
|
| 190 | + * |
|
| 191 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 192 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 193 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 194 | + * modify what is returned to the caller. |
|
| 195 | + * |
|
| 196 | + * This option allows you to wrap global decorators |
|
| 197 | + * ("\Aimeos\Client\Html\Common\Decorator\*") around the html client. |
|
| 198 | + * |
|
| 199 | + * client/html/checkout/standard/summary/option/terms/decorators/global = array( 'decorator1' ) |
|
| 200 | + * |
|
| 201 | + * This would add the decorator named "decorator1" defined by |
|
| 202 | + * "\Aimeos\Client\Html\Common\Decorator\Decorator1" only to the html client. |
|
| 203 | + * |
|
| 204 | + * @param array List of decorator names |
|
| 205 | + * @since 2015.08 |
|
| 206 | + * @category Developer |
|
| 207 | + * @see client/html/common/decorators/default |
|
| 208 | + * @see client/html/checkout/standard/summary/option/terms/decorators/excludes |
|
| 209 | + * @see client/html/checkout/standard/summary/option/terms/decorators/local |
|
| 210 | + */ |
|
| 211 | 211 | |
| 212 | - /** client/html/checkout/standard/summary/option/terms/decorators/local |
|
| 213 | - * Adds a list of local decorators only to the checkout standard summary option terms html client |
|
| 214 | - * |
|
| 215 | - * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | - * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | - * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | - * modify what is returned to the caller. |
|
| 219 | - * |
|
| 220 | - * This option allows you to wrap local decorators |
|
| 221 | - * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 222 | - * |
|
| 223 | - * client/html/checkout/standard/summary/option/terms/decorators/local = array( 'decorator2' ) |
|
| 224 | - * |
|
| 225 | - * This would add the decorator named "decorator2" defined by |
|
| 226 | - * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 227 | - * |
|
| 228 | - * @param array List of decorator names |
|
| 229 | - * @since 2015.08 |
|
| 230 | - * @category Developer |
|
| 231 | - * @see client/html/common/decorators/default |
|
| 232 | - * @see client/html/checkout/standard/summary/option/terms/decorators/excludes |
|
| 233 | - * @see client/html/checkout/standard/summary/option/terms/decorators/global |
|
| 234 | - */ |
|
| 212 | + /** client/html/checkout/standard/summary/option/terms/decorators/local |
|
| 213 | + * Adds a list of local decorators only to the checkout standard summary option terms html client |
|
| 214 | + * |
|
| 215 | + * Decorators extend the functionality of a class by adding new aspects |
|
| 216 | + * (e.g. log what is currently done), executing the methods of the underlying |
|
| 217 | + * class only in certain conditions (e.g. only for logged in users) or |
|
| 218 | + * modify what is returned to the caller. |
|
| 219 | + * |
|
| 220 | + * This option allows you to wrap local decorators |
|
| 221 | + * ("\Aimeos\Client\Html\Checkout\Decorator\*") around the html client. |
|
| 222 | + * |
|
| 223 | + * client/html/checkout/standard/summary/option/terms/decorators/local = array( 'decorator2' ) |
|
| 224 | + * |
|
| 225 | + * This would add the decorator named "decorator2" defined by |
|
| 226 | + * "\Aimeos\Client\Html\Checkout\Decorator\Decorator2" only to the html client. |
|
| 227 | + * |
|
| 228 | + * @param array List of decorator names |
|
| 229 | + * @since 2015.08 |
|
| 230 | + * @category Developer |
|
| 231 | + * @see client/html/common/decorators/default |
|
| 232 | + * @see client/html/checkout/standard/summary/option/terms/decorators/excludes |
|
| 233 | + * @see client/html/checkout/standard/summary/option/terms/decorators/global |
|
| 234 | + */ |
|
| 235 | 235 | |
| 236 | - return $this->createSubClient( 'checkout/standard/summary/option/terms/' . $type, $name ); |
|
| 237 | - } |
|
| 236 | + return $this->createSubClient( 'checkout/standard/summary/option/terms/' . $type, $name ); |
|
| 237 | + } |
|
| 238 | 238 | |
| 239 | 239 | |
| 240 | - /** |
|
| 241 | - * Processes the input, e.g. store given values. |
|
| 242 | - * A view must be available and this method doesn't generate any output |
|
| 243 | - * besides setting view variables. |
|
| 244 | - */ |
|
| 245 | - public function process() |
|
| 246 | - { |
|
| 247 | - $view = $this->getView(); |
|
| 240 | + /** |
|
| 241 | + * Processes the input, e.g. store given values. |
|
| 242 | + * A view must be available and this method doesn't generate any output |
|
| 243 | + * besides setting view variables. |
|
| 244 | + */ |
|
| 245 | + public function process() |
|
| 246 | + { |
|
| 247 | + $view = $this->getView(); |
|
| 248 | 248 | |
| 249 | - // only start if there's something to do |
|
| 250 | - if( ( $option = $view->param( 'cs_option_terms', null ) ) === null ) { |
|
| 251 | - return; |
|
| 252 | - } |
|
| 249 | + // only start if there's something to do |
|
| 250 | + if( ( $option = $view->param( 'cs_option_terms', null ) ) === null ) { |
|
| 251 | + return; |
|
| 252 | + } |
|
| 253 | 253 | |
| 254 | - if( ( $option = $view->param( 'cs_option_terms_value', 0 ) ) != 1 ) |
|
| 255 | - { |
|
| 256 | - $view->standardStepActive = 'summary'; |
|
| 257 | - $view->termsError = true; |
|
| 254 | + if( ( $option = $view->param( 'cs_option_terms_value', 0 ) ) != 1 ) |
|
| 255 | + { |
|
| 256 | + $view->standardStepActive = 'summary'; |
|
| 257 | + $view->termsError = true; |
|
| 258 | 258 | |
| 259 | - $error = array( $view->translate( 'client', 'Please accept the terms and conditions' ) ); |
|
| 260 | - $view->standardErrorList = $error + $view->get( 'standardErrorList', array() ); |
|
| 261 | - } |
|
| 259 | + $error = array( $view->translate( 'client', 'Please accept the terms and conditions' ) ); |
|
| 260 | + $view->standardErrorList = $error + $view->get( 'standardErrorList', array() ); |
|
| 261 | + } |
|
| 262 | 262 | |
| 263 | - parent::process(); |
|
| 264 | - } |
|
| 263 | + parent::process(); |
|
| 264 | + } |
|
| 265 | 265 | |
| 266 | 266 | |
| 267 | - /** |
|
| 268 | - * Returns the list of sub-client names configured for the client. |
|
| 269 | - * |
|
| 270 | - * @return array List of HTML client names |
|
| 271 | - */ |
|
| 272 | - protected function getSubClientNames() |
|
| 273 | - { |
|
| 274 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 275 | - } |
|
| 267 | + /** |
|
| 268 | + * Returns the list of sub-client names configured for the client. |
|
| 269 | + * |
|
| 270 | + * @return array List of HTML client names |
|
| 271 | + */ |
|
| 272 | + protected function getSubClientNames() |
|
| 273 | + { |
|
| 274 | + return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 275 | + } |
|
| 276 | 276 | } |
| 277 | 277 | \ No newline at end of file |
@@ -19,263 +19,263 @@ |
||
| 19 | 19 | * @subpackage Html |
| 20 | 20 | */ |
| 21 | 21 | class Standard |
| 22 | - extends \Aimeos\Client\Html\Common\Summary\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 |
@@ -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 |
@@ -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 |
@@ -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 |
@@ -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 | |
@@ -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 |
@@ -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 |
@@ -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 |