-- HikaShop version -- : 2.3.5
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.4
I would like to display the number of cart items in a div that shows a shopping basket graphic (see top right of my website)
In an earlier post I was told I could get the number of cart items using the code below. But this variable is showing double the actual number of items in the cart. In the side menu I have a minicart which shows the correct number so presumably I just need to use the variable for the minicart.
Please could you let me know what the variable is I need.
Thanks
<span style="font-family: courier new, courier, monospace;">
<?php
require_once('/home/dwrftp/diywetroom.pigeontech.co.uk/administrator/components/com_hikashop/helpers/helper.php');
$class = hikashop::get('class.cart');
$rows = $class->get();
$qty = 0;
if(!empty($rows)){
foreach($rows as $k =>$row){
$qty += $row->cart_product_quantity;
}
}
echo $qty;
?>
</span>