News:

Support the VirtueMart project and become a member

Main Menu

Cart Icon Problem

Started by RYH Webdesign, May 04, 2013, 19:00:31 PM

Previous topic - Next topic

RYH Webdesign

Hi All,

I know this might sound like a silly question but I have hunted all over the internet and have found no help.

I would like to display a shopping basket icon on all pages that shows how many items are in the basket, I know it can be done but can't find how to do it, I am using Joomla 2.5 and Virtuemart v2.

Please can someone help.

Thanks

AH

enable the Virtuemart Shopping cart module and display in the relevant joomla position

Show product price - NO
Sho list in cart - NO
Regards
A

Joomla 4.4.5
php 8.1

AH

You will need to add some custom CSS

Look at the code:-

modules/mod_virtuemart_cart/tmpl/default.php

You can see the CSS classes and code used to build the simple cart display

<div class="total" style="float: right;">
<?php if ($data->totalProduct and $show_price) echo  $data->billTotal?>
</div>
<div class="total_products"><?php echo  $data->totalProductTxt ?></div>
<div class="show_cart">
<?php if ($data->totalProduct and $show_price) echo  $data->cart_show?>
</div>
<div style="clear:both;"></div>


The cart module is structured within a div class and id as shown <div class="vmCartModule <?php echo $params->get('moduleclass_sfx'); ?>" id="vmCartModule">

IN your main sites joomla template.css you will need to create the relevant CSS to manage the display of these elements.

Do not add the CSS to the VM css , as the main Joomla page should display an empty cart or cart icon BEFORE any VM CSS is loaded.

Get rid of the immensely annoying float right as hard coded elements and sort out using CSS
To be honest You should have an empty cart displaying even when nothing in it - so adjust this code to cater for that in order to show one cart icon when something in it and another cart icon when empty.

You should find a better position for the cart to prevent the drop down of your header.

Try an get it into the header somewhere.  Rocket themes may have a position in which it will work, if not you should create one in the template.

Note that if you modify the code - any VM AIO updates to the cart module will overwrite it so make sure you are able to apply the changes again (keep a copy!)

Alternatively you could duplicate the module, rename it and handle code changes to create your own version that will not get overwritten.
Regards
A

Joomla 4.4.5
php 8.1

AH

Rachel

It should be straightforward if you have some basic knowledge of CSS and PHP.

Make sure you have a position in the template of the cart short display.
Display the module in that position.
Adjust the cart code and CSS to get the display you would like so you can differentiate between empty and non empty cart (wrap the empty and non empty display in different divs)  - using CSS associate a different background image for empty and non-empty cart.

You could always post you request on the jobs board.
Regards
A

Joomla 4.4.5
php 8.1