Below code will give you total product quantities added in the cart. You just need to place it at right place in /catalog/view/theme/your_theme/template/checkout/checkout.tpl
<?php
$product_count=0;
if(count($this->cart->getProducts())){
foreach($this->cart->getProducts() as $cart_products){
$product_count+=$cart_products['quantity'];
}
echo '<span style="cursor:pointer !important;" id="header_product_count" class="count">'.$product_count.'</span>';
}
?>
<?php
$product_count=0;
if(count($this->cart->getProducts())){
foreach($this->cart->getProducts() as $cart_products){
$product_count+=$cart_products['quantity'];
}
echo '<span style="cursor:pointer !important;" id="header_product_count" class="count">'.$product_count.'</span>';
}
?>
Regards,
Knowband Team
Opencart Plugins: Knowband Store
Email: support@knowband.com
Hello , this is the confirm.tpl in /catalog/view/theme/My_template/template/checkout :
where can i place the code you mentioned please ?
Code: Select all
<?php if (!isset($redirect)) { ?>
<div class="table-responsive">
<table class="table table-bordered table-hover">
<thead>
<tr>
<td class="text-left"><?php echo $column_name; ?></td>
<!--<td class="text-left"><?php echo $column_model; ?></td>-->
<td class="text-right"><?php echo $column_sku; ?></td>
<td class="text-right"><?php echo $column_quantity; ?></td>
<td class="text-right"><?php echo $column_price; ?></td>
<td class="text-right"><?php echo $column_total; ?></td>
</tr>
</thead>
<tbody>
<?php foreach ($products as $product) { ?>
<tr>
<td class="text-left"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a>
<?php foreach ($product['option'] as $option) { ?>
<br />
<small> - <?php echo $option['name']; ?>: <?php echo $option['value']; ?></small>
<?php } ?>
<?php if($product['recurring']) { ?>
<br />
<span class="label label-info"><?php echo $text_recurring_item; ?></span> <small><?php echo $product['recurring']; ?></small>
<?php } ?></td>
<!-- <td class="text-left"><?php echo $product['model']; ?></td>-->
<td class="text-right"><?php echo $product['sku']; ?></td>
<td class="text-right"><?php echo $product['quantity']; ?></td>
<td class="text-right"><?php echo $product['price']; ?></td>
<td class="text-right"><?php echo $product['total']; ?></td>
</tr>
<?php } ?>
<?php foreach ($vouchers as $voucher) { ?>
<tr>
<td class="text-left"><?php echo $voucher['description']; ?></td>
<td class="text-left"></td>
<td class="text-right">1</td>
<td class="text-right"><?php echo $voucher['amount']; ?></td>
<td class="text-right"><?php echo $voucher['amount']; ?></td>
</tr>
<?php } ?>
</tbody>
<tfoot>
<?php foreach ($totals as $total) { ?>
<tr>
<td colspan="4" class="text-right"><strong><?php echo $total['title']; ?>:</strong></td>
<td class="text-right"><?php echo $total['text']; ?></td>
</tr>
<?php } ?>
</tfoot>
</table>
</div>
<?php echo $payment; ?>
<?php } else { ?>
<script type="text/javascript"><!--
location = '<?php echo $redirect; ?>';
//--></script>
<?php } ?>
In your confirm.tpl
search for
<?php foreach ($totals as $total) { ?>
and add below code after it.
<?php if($total['title'] == 'Sub-Total'){
$product_count=0;
if(count($this->cart->getProducts())){
foreach($this->cart->getProducts() as $cart_products){
$product_count+=$cart_products['quantity'];
}
}
?>
<tr>
<td colspan="4" class="text-right"><strong>Total Product Quantity:</strong></td>
<td class="text-right"><?php echo $product_count; ?></td>
</tr>
<?php } ?>
Let us know if it doesn't work.
search for
<?php foreach ($totals as $total) { ?>
and add below code after it.
<?php if($total['title'] == 'Sub-Total'){
$product_count=0;
if(count($this->cart->getProducts())){
foreach($this->cart->getProducts() as $cart_products){
$product_count+=$cart_products['quantity'];
}
}
?>
<tr>
<td colspan="4" class="text-right"><strong>Total Product Quantity:</strong></td>
<td class="text-right"><?php echo $product_count; ?></td>
</tr>
<?php } ?>
Let us know if it doesn't work.
Regards,
Knowband Team
Opencart Plugins: Knowband Store
Email: support@knowband.com
technically, it works in the OC v.1.5.6.5 confirmation Section (OC-2 like Custom Theme, slightly modified checkout section, therefore, unmodified installed as it comes, a little misplaced on the image), but in my OC v.2.2 Default, it produces an error, as shown in the image.
---
LINE 45: if(count($this->cart->getProducts())){
---
Ernie
PS. I just had to change the colspan-value, for my modified OC v.1.5.6.5, to get it placed correctly, just to mention it.
---
LINE 45: if(count($this->cart->getProducts())){
Code: Select all
2016-09-27 18:36:23 - PHP Notice: Undefined property: Template\Basic::$cart in /home/jacobch/www/bigmax_ch/oc22/catalog/view/theme/default/template/checkout/confirm.tpl on line 45
2016-09-27 18:45:29 - PHP Notice: Undefined property: Template\Basic::$cart in /home/jacobch/www/bigmax_ch/oc22/catalog/view/theme/default/template/checkout/confirm.tpl on line 45
Ernie
PS. I just had to change the colspan-value, for my modified OC v.1.5.6.5, to get it placed correctly, just to mention it.

Attachments
total_products_in_checkout.jpg (94.51 KiB) Viewed 873 times
I don't use Forum Mail, to reach me, contact: jti@jacob.ch
-
Server Q & A Basic Information on Code + Settings
http://www.everyauction.info/serverinfo.html
Demoversion OpenCart LIGHT v.1.5.6.5
http://www.jti.li/shop/
1'400+ FREE OC Extensions - from OC v.1.5.x up,
on the world's largest OC-related Github Site: https://github.com/IP-CAM
-
Who is online
Users browsing this forum: No registered users and 6 guests