| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * @copyright Aimeos (aimeos.org), 2018-2022 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * @package Client | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * @subpackage Html | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | namespace Aimeos\Client\Html\Account\Subscription; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * Default implementation of account subscription HTML client. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  * @package Client | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  * @subpackage Html | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | class Standard | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | 	extends \Aimeos\Client\Html\Common\Client\Summary\Base | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | 	implements \Aimeos\Client\Html\Iface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | 	 * Sets the necessary parameter values in the view. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | 	 * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | 	 * @param array &$tags Result array for the list of tags that are associated to the output | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | 	 * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | 	 * @return \Aimeos\MW\View\Iface Modified view object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | 	public function data( \Aimeos\MW\View\Iface $view, array &$tags = [], string &$expire = null ) : \Aimeos\MW\View\Iface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | 		$cntl = \Aimeos\Controller\Frontend::create( $this->context(), 'subscription' ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | 		$view->subscriptionIntervals = $cntl->getIntervals(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | 		$view->subscriptionItems = $cntl->uses( ['order/base', 'order/base/address', 'order/base/product'] ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | 			->sort( '-subscription.id' ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | 			->search() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | 			->each( function( $item ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  | 				$basket = $item->getBaseItem(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | 				$basket->set( 'summaryTaxrates', $this->getTaxRates( $basket ) ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  | 					->set( 'summaryNamedTaxes', $this->getNamedTaxes( $basket ) ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  | 					->set( 'summaryCostsPayment', $this->getCostsPayment( $basket ) ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | 					->set( 'summaryCostsDelivery', $this->getCostsDelivery( $basket ) ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  | 			} ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  | 		return parent::data( $view, $tags, $expire ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  | 	/** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  | 	 * Processes the input, e.g. store given values. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  | 	 * A view must be available and this method doesn't generate any output | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  | 	 * besides setting view variables if necessary. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  | 	public function init() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  | 	{ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  | 		$view = $this->view(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  | 		if( ( $id = $view->param( 'sub_id' ) ) != null && $view->param( 'sub_action' ) === 'cancel' ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  | 			\Aimeos\Controller\Frontend::create( $this->context(), 'subscription' )->cancel( $id ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  | 	/** client/html/account/subscription/template-body | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  | 	 * Relative path to the HTML body template of the account subscription client. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  | 	 * The template file contains the HTML code and processing instructions | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  | 	 * to generate the result shown in the body of the frontend. The | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  | 	 * configuration string is the path to the template file relative | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  | 	 * to the templates directory (usually in client/html/templates). | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  | 	 * You can overwrite the template file configuration in extensions and | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  | 	 * provide alternative templates. These alternative templates should be | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  | 	 * named like the default one but suffixed by | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  | 	 * an unique name. You may use the name of your project for this. If | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  | 	 * you've implemented an alternative client class as well, it | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  | 	 * should be suffixed by the name of the new class. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  | 	 * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  | 	 * @param string Relative path to the template creating code for the HTML page body | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  | 	 * @since 2018.04 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  | 	 * @category Developer | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  | 	 * @see client/html/account/subscription/template-header | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  | 	 */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 89 |  |  | 	/** client/html/account/subscription/template-header | 
            
                                                        
            
                                    
            
            
                | 90 |  |  | 	 * Relative path to the HTML header template of the account subscription client. | 
            
                                                        
            
                                    
            
            
                | 91 |  |  | 	 * | 
            
                                                        
            
                                    
            
            
                | 92 |  |  | 	 * The template file contains the HTML code and processing instructions | 
            
                                                        
            
                                    
            
            
                | 93 |  |  | 	 * to generate the HTML code that is inserted into the HTML page header | 
            
                                                        
            
                                    
            
            
                | 94 |  |  | 	 * of the rendered page in the frontend. The configuration string is the | 
            
                                                        
            
                                    
            
            
                | 95 |  |  | 	 * path to the template file relative to the templates directory (usually | 
            
                                                        
            
                                    
            
            
                | 96 |  |  | 	 * in client/html/templates). | 
            
                                                        
            
                                    
            
            
                | 97 |  |  | 	 * | 
            
                                                        
            
                                    
            
            
                | 98 |  |  | 	 * You can overwrite the template file configuration in extensions and | 
            
                                                        
            
                                    
            
            
                | 99 |  |  | 	 * provide alternative templates. These alternative templates should be | 
            
                                                        
            
                                    
            
            
                | 100 |  |  | 	 * named like the default one but suffixed by | 
            
                                                        
            
                                    
            
            
                | 101 |  |  | 	 * an unique name. You may use the name of your project for this. If | 
            
                                                        
            
                                    
            
            
                | 102 |  |  | 	 * you've implemented an alternative client class as well, it | 
            
                                                        
            
                                    
            
            
                | 103 |  |  | 	 * should be suffixed by the name of the new class. | 
            
                                                        
            
                                    
            
            
                | 104 |  |  | 	 * | 
            
                                                        
            
                                    
            
            
                | 105 |  |  | 	 * @param string Relative path to the template creating code for the HTML page head | 
            
                                                        
            
                                    
            
            
                | 106 |  |  | 	 * @since 2018.04 | 
            
                                                        
            
                                    
            
            
                | 107 |  |  | 	 * @category Developer | 
            
                                                        
            
                                    
            
            
                | 108 |  |  | 	 * @see client/html/account/subscription/template-body | 
            
                                                        
            
                                    
            
            
                | 109 |  |  | 	 */ | 
            
                                                        
            
                                    
            
            
                | 110 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 111 |  |  |  |