VirtueMart Forum

VirtueMart 2 + 3 + 4 => Frontend Modules => Topic started by: Matt_Ginn on October 07, 2014, 13:58:13 PM

Title: Mini-Cart
Post by: Matt_Ginn on October 07, 2014, 13:58:13 PM
I'm trying to make some changes to the VM Shopping Cart module that I display on all pages of my site http://www.signdoctor.co.uk. What I want to dipaly is the total number of products and the total price without tax (UK VAT). I can get the total number as '$data->totalProductTxt' easily but can't seem to get the correct price total! The only value that seems to be populated is '$data->billTotal' and this includes tax. Anyone know if this is possible??
Title: Re: Mini-Cart
Post by: Matt_Ginn on October 14, 2014, 09:40:36 AM
Does no-one know the answer to this?????
Title: Re: Mini-Cart
Post by: AH on October 14, 2014, 10:42:20 AM
I am now working with 2.9.9 but this should be very similare for your version (although you have not stated what that is, which is why you have few replies!!!)

The data is prepared by

function
   function prepareAjaxData($checkAutomaticSelected=true){

in
components\com_virtuemart\helpers\cart.php


Looks like  have to do a core adjustment, this will get overwritten when you upgrade (Not sure why both VAT and ex_vat are not passed to the template as it provides both at a product level


        $data->billTotal = $currencyDisplay->priceDisplay( $this->cartPrices['billTotal'] );
//Provide ex-vat price as well
        $data->billTotal_net = $currencyDisplay->priceDisplay( $this->cartPrices['discountedPriceWithoutTax'] );



Now you can now create a template override for your mini cart For the cart total

'billtotal_net'

<?php echo $data->billTotal_net; ?>



Title: Re: Mini-Cart
Post by: Matt_Ginn on October 14, 2014, 12:41:41 PM
Unfortunately this breaks my site (Joomla 2.5.27; VM 2.6.10)  :(
Title: Re: Mini-Cart
Post by: Matt_Ginn on October 14, 2014, 13:29:40 PM
OK, fixed it now  :D

If anyone else needs it, the working code for VM 2.6.10 is:

$this->data->billTotal = $currency->priceDisplay( $this->pricesUnformatted['billTotal'] );
//Provide ex-vat price as well
        $this->data->billTotal_net = $currency->priceDisplay( $this->pricesUnformatted['discountedPriceWithoutTax'] );
Title: Re: Mini-Cart
Post by: AH on October 14, 2014, 18:34:16 PM
Good to know you got it working for 2.6.10

I did not have the time to look into the exact coding for that version - but thanks for letting others know your solution