Issues (37)

client/html/checkout/standard/payment-body.php (1 issue)

Labels
Severity
1
<?php
2
3
/**
4
 * @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
5
 * @copyright Metaways Infosystems GmbH, 2013
6
 * @copyright Aimeos (aimeos.org), 2015-2025
7
 */
8
9
$enc = $this->encoder();
10
11
12
?>
13
<?php $this->block()->start( 'checkout/standard/payment' ) ?>
14
<div class="section checkout-standard-payment">
15
16
	<h1><?= $enc->html( $this->translate( 'client', 'payment' ), $enc::TRUST ) ?></h1>
17
	<p class="note"><?= $enc->html( $this->translate( 'client', 'Please choose your payment method' ), $enc::TRUST ) ?></p>
18
19
	<?php foreach( $this->get( 'paymentServices', [] ) as $id => $service ) : ?>
20
		<div id="c_payment-<?= $enc->attr( $id ) ?>" class="item item-service row">
21
22
			<div class="col-sm-6">
23
				<label class="description" for="c_paymentoption-<?= $enc->attr( $id ) ?>">
24
25
					<input class="option" type="radio"
26
						id="c_paymentoption-<?= $enc->attr( $id ) ?>"
27
						name="<?= $enc->attr( $this->formparam( ['c_paymentoption'] ) ) ?>"
28
						value="<?= $enc->attr( $id ) ?>"
29
						<?= $id != $this->get( 'paymentOption' ) ?: 'checked="checked"' ?>
0 ignored issues
show
Are you sure $id != $this->get('payme... ?: 'checked="checked"' of type string|true can be used in echo? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

29
						<?= /** @scrutinizer ignore-type */ $id != $this->get( 'paymentOption' ) ?: 'checked="checked"' ?>
Loading history...
30
					>
31
32
					<div class="icons">
33
						<?php foreach( $service->getRefItems( 'media', 'icon', 'default' ) as $mediaItem ) : ?>
34
							<?= $this->partial(
35
								$this->config( 'client/html/common/partials/media', 'common/partials/media' ),
36
								array( 'item' => $mediaItem, 'boxAttributes' => array( 'class' => 'icon' ) )
37
							) ?>
38
						<?php endforeach ?>
39
					</div>
40
41
					<h2><?= $enc->html( $service->getName(), $enc::TRUST ) ?></h2>
42
43
					<?php if( $price = $service->price ) : ?>
44
						<?php if( $price->getValue() > 0 ) : ?>
45
							<div class="price-value">
46
								<?= $enc->html( sprintf( /// Service fee value (%1$s) and shipping cost value (%2$s) with currency (%3$s)
47
									$this->translate( 'client', '%1$s%3$s + %2$s%3$s' ),
48
									$this->number( $price->getValue(), $price->getPrecision() ),
49
									$this->number( $price->getCosts() > 0 ? $price->getCosts() : 0, $price->getPrecision() ),
50
									$this->translate( 'currency', $price->getCurrencyId() )
51
								) ) ?>
52
							</div>
53
						<?php elseif( $price->getCosts() > 0 ) : ?>
54
							<div class="price-value">
55
								<?php $pricetype = 'price:default' ?>
56
								<?= $enc->html( sprintf(
57
									/// Price format with price value (%1$s) and currency (%2$s)
58
									$this->translate( 'client/code', $pricetype, null, 0, false ) ?: $this->translate( 'client', '%1$s %2$s' ),
59
									$this->number( $price->getCosts() > 0 ? $price->getCosts() : 0, $price->getPrecision() ),
60
									$this->translate( 'currency', $price->getCurrencyId() )
61
								) ) ?>
62
							</div>
63
						<?php endif ?>
64
					<?php endif ?>
65
66
					<div class="text">
67
						<?php foreach( $service->getRefItems( 'text', null, 'default' ) as $textItem ) : ?>
68
							<?php if( ( $type = $textItem->getType() ) !== 'name' ) : ?>
69
								<p class="<?= $enc->attr( $type ) ?>"><?= $enc->html( $textItem->getContent(), $enc::TRUST ) ?></p>
70
							<?php endif ?>
71
						<?php endforeach ?>
72
					</div>
73
74
				</label>
75
76
			</div>
77
78
			<div class="col-sm-6">
79
80
				<?php if( $attributes = $service->attributes ) : ?>
81
					<?= $this->partial(
82
						/** client/html/checkout/standard/partials/serviceattr
83
						 * Relative path to the checkout service attribute partial template file
84
						 *
85
						 * Partials are templates which are reused in other templates and generate reoccuring
86
						 * blocks filled with data from the assigned values. The service attribute partial creates
87
						 * an HTML block for the checkout delivery/payment option input/select fields.
88
						 *
89
						 * This is a very generic way to generate the list of service attribute pairs that will be
90
						 * added as order service attributes in the basket. Depending on the type of the attribute,
91
						 * it will create an input field, a select box or a list of selectable items. What attributes
92
						 * are available to the customer depends on the definitions in the service providers and the
93
						 * decorators wrapped around them.
94
						 *
95
						 * If you want to adapt the output to your own project and you know you only have a specific
96
						 * list of attributes, you can create the input and selections in a non-generic, straight
97
						 * forward way. The $serviceAttributes[$id] array contains an associative list of codes as
98
						 * keys (e.g. "directdebit.bankcode") and items implementing \Aimeos\Base\Criteria\Attribute\Iface
99
						 * as values, e.g.
100
						 *   directdebit.bankcode => \Aimeos\Base\Criteria\Attribute\Iface (
101
						 *	   code => 'directdebit.bankcode',
102
						 *	   internalcode => 'bankcode',
103
						 *	   label => 'Bank code',
104
						 *	   type => 'string',
105
						 *	   internaltype => 'string',
106
						 *	   default => '',
107
						 *	   required => true
108
						 *   )
109
						 *
110
						 * @param string Relative path to the template file
111
						 * @since 2017.07
112
						 */
113
						$this->config( 'client/html/checkout/standard/partials/serviceattr', 'checkout/standard/serviceattr-partial' ),
114
						['attributes' => $attributes, 'type' => 'payment', 'id' => $id]
115
					) ?>
116
117
				<?php endif ?>
118
119
			</div>
120
121
		</div>
122
	<?php endforeach ?>
123
124
125
	<div class="button-group">
126
		<a class="btn btn-default btn-lg btn-back" href="<?= $enc->attr( $this->get( 'standardUrlBack' ) ) ?>">
127
			<?= $enc->html( $this->translate( 'client', 'Previous' ), $enc::TRUST ) ?>
128
		</a>
129
		<button type="submit" class="btn btn-primary btn-lg btn-action">
130
			<?= $enc->html( $this->translate( 'client', 'Next' ), $enc::TRUST ) ?>
131
		</button>
132
	</div>
133
134
</div>
135
<?php $this->block()->stop() ?>
136
<?= $this->block()->get( 'checkout/standard/payment' ) ?>
137