Adding VAT to total price


#1

Hello,
Could you please help me how to add VAT to total price in check out page?
this is the code:

<?php if (!isset($data[0])) return; $seller = $data[0]->User(); $shop_currency_code = \User\User::getCurrencyCode($data[0]->seller_id); $title = $seller->getUserFullName(); $components = [ 'user_id' => $seller->id, 'query' => $this->urlQuery($seller->username)]; $route = 'user'; ?>
<h3 class="title-2 title-border-bottom-1 color-2">
	<?php echo $this->_('Order From:') ?>
	<a href="<?php echo $this->url($components, $route) ?>" class="color-1"><?php echo $title ?></a>
</h3>

<div class="container container-size-6 margin-top-30 fleft">

	<div class="hide form-1 form-margin-10 event-merchant-status">
		<div class="form-row">
			<div class="table-grid">
				<div class="table-grid-cell fill">
					<div class="notification notification-color-1 margin-bottom-20"></div>
				</div>
			</div>
		</div>
	</div>

	<div class="form-1 form-margin-10">
		<?php $x = 0; ?>
		<?php foreach ($data as $cartContent): ?>
			<?php
			$pinQuantity = $cartContent->PinQuantity();
			$pin = $pinQuantity->Pin();

			if (!$pin)
				continue;

			$user = $pin->User();
			$image = NULL;

			try {
				$image = \Pin\Helper\Image::getImage('small', $pin)->image;
			} catch (\Exception $e) {

			}
			?>

			<div class="form-row <?php if ($x != 0): ?>form-row-group-top form-row-group-top-padding-3 margin-top-40<?php endif; ?> event-cart-items">
				<div class="table-grid">
					<div class="table-grid-cell">
						<ul class="list-10 clearfix">
							<li>
								<p class="avatar">
									<a href="<?php echo $this->url([ 'pin_id' => $pin->id, 'query' => $this->urlQuery($pin->title)], 'pin') ?>">
										<img src="<?php echo $image ?>" alt="<?php echo $this->_('Preview') ?>">
									</a>
									<a href="javascript:void(0)" class="text-3 color-3 event-delete-item" data-id="<?php echo $cartContent->id ?>"><?php echo $this->_('Delete Product') ?></a>
								</p>
								<h4 class="title-4">
									<a href="<?php echo $this->url([ 'pin_id' => $pin->id, 'query' => $this->urlQuery($pin->title)], 'pin') ?>" class="color-2"><?php echo $pin->title ?></a>
								</h4>
								<ul class="list-11 margin-top-10">
									<?php if(!$pinQuantity->digital) : ?>
									<li>
										<span class="color-3"><?php echo $this->_('Quantity:') ?></span>
										<a class="icon icon-type-3 icon-37 event-qty-decrease" href="javascript:void(0)" data-id="<?php echo $cartContent->id ?>">Icon</a>
										<?php echo $cartContent->quantity ?>
										<a class="icon icon-type-3 icon-36 event-qty-increase" href="javascript:void(0)" data-id="<?php echo $cartContent->id ?>">Icon</a>
									</li>
									<?php endif; ?>
									<?php if ($pinQuantity->option): ?>
										<li>
											<span class="color-3"><?php echo $this->_('Option:') ?></span> <?php echo $pinQuantity->option ?>
										</li>
									<?php endif ?>
									<li>
										<span class="color-3"><?php echo $this->_('Price:') ?></span> <?php echo \Currency\Helper\Format::format_convert($cartContent->getPrice(), $shop_currency_code, \Currency\Helper\Format::setCode()) ?>
										<?php if($shop_currency_code != \Currency\Helper\Format::setCode()) { ?>
										<br /><span class="color-3"><?php echo $this->_('Original price:') ?></span> <?php echo \Currency\Helper\Format::format($cartContent->getPrice(), $shop_currency_code, 1) ?>
										<?php } ?>
									</li>
									<?php if ($cartContent->licensed()): ?>
										<li>
											<span class="color-3"><?php echo $this->_('License:') ?></span> <?php echo $cartContent->item()->license->Description()->title ?>
										</li>
									<?php endif ?>
								</ul>
							</li>
						</ul>
					</div>
				</div>
			</div>

			<?php if($cartContent->quantity > $pinQuantity->qty()): ?>
			<div class="notification notification-color-1 margin-top-30"><?php echo $this->_('This item is out of stock. You can select another option or you can remove it.') ?></div>
			<?php endif ?>

		<?php ++$x; endforeach ?>

		<?php
		$menu = \Base\PermissionMenu::getMenu('StoreViewBottom');
		if ($menu) {
			foreach ($menu as $widget) {
				if (!$widget->is_widget)
					continue;

				$config = [];
				if ($widget->config)
					$config = unserialize($widget->config);

				$config['instance'] = $widget;
				$config['pin'] = $pin;
				$config['module'] = $this->getRequest()->getModule();
				$config['position'] = 'storeBottom';
				$config['seller_id'] = $seller->id;
				$config['cart_id'] = $this->cart;

				echo $this->widget($widget->widget, $config);
			}
		}
		?>
	</div>
</div>
<div class="container container-size-7 margin-top-30 fright">
	<div class="form-1 form-margin-10">

		<div class="form-row form-row-group-top form-row-group-top-padding-3 margin-top-20">
			<div class="table-grid table-grid-cols-2 table-grid-conrete">
				<div class="table-grid-cell">
					<p class="text-1 color-3"><?php echo $this->_('Sub Total') ?></p>
				</div>
				<div class="table-grid-cell">
					<p class="text-1 color-3 tright">
						<?php echo \Currency\Helper\Format::format_convert($sub_total, $shop_currency_code, \Currency\Helper\Format::setCode()) ?>
						<?php if($shop_currency_code != \Currency\Helper\Format::setCode()) { ?>
						/ <?php echo \Currency\Helper\Format::format($sub_total, $shop_currency_code, 1) ?>
						<?php } ?>
					</p>
				</div>
			</div>
		</div>

		<?php
		$menu = \Base\PermissionMenu::getMenu('StoreViewCalc');
		if ($menu) {
			foreach ($menu as $widget) {
				if (!$widget->is_widget)
					continue;

				$config = [];
				if ($widget->config)
					$config = unserialize($widget->config);

				$config['instance'] = $widget;
				$config['pin'] = $pin;
				$config['module'] = $this->getRequest()->getModule();
				$config['position'] = 'storeCalc';
				$config['seller_id'] = $seller->id;
				$config['sub_total'] = $sub_total;
				$config['total'] = &$total;

				echo $this->widget($widget->widget, $config);
			}
		}
		?>

		<div class="form-row">
			<div class="table-grid table-grid-cols-2 table-grid-conrete">
				<div class="table-grid-cell">
					<p class="text-1 color-2"><?php echo $this->_('Total') ?></p>
				</div>
				<div class="table-grid-cell">
					<p class="text-1 color-2 tright">
						<?php echo \Currency\Helper\Format::format_convert($total, $shop_currency_code, \Currency\Helper\Format::setCode()) ?>
						<?php if($shop_currency_code != \Currency\Helper\Format::setCode()) { ?>
						/ <?php echo \Currency\Helper\Format::format($total, $shop_currency_code, 1) ?>
						<?php } ?>
					</p>
				</div>
			</div>
		</div>
		<div class="form-row margin-top-20">
			<div class="table-grid">


				<!-- <div class="table-grid-cell"><button class="button button-type-1 button-color-2 button-size-3 fill event-pay"><?php echo $this->_('Pay Now') ?></button></div> -->
			</div>
		</div>

		<?php
		$menu = \Base\PermissionMenu::getMenu('StoreViewRight');
		if ($menu) {
			foreach ($menu as $widget) {
				if (!$widget->is_widget)
					continue;

				$config = [];
				if ($widget->config)
					$config = unserialize($widget->config);

				$config['instance'] = $widget;
				$config['pin'] = $pin;
				$config['module'] = $this->getRequest()->getModule();
				$config['position'] = 'storeRight';
				$config['seller_id'] = $seller->id;
				$config['cart_id'] = $this->cart;
				$config['sub_total'] = $sub_total;
				$config['total'] = &$total;

				echo $this->widget($widget->widget, $config);
			}
		}
		?>
        <div>
			<?php //var_dump(PaymentManager::getSupportedProviders(Payment::PURCHASE_SUPPORT)) ?>
			<?php echo $this->widget('store.widget.checkout', [
				'user_id' => $this->user_id,
				'seller_id' => $data[0]->seller_id,
				'items' => $data,
			]) ?>
		</div>
	</div>
</div>

#2

I’m not sure where you are confused. Just add the value.