Page 1 of 1

Need to show Shopping Cart Total in Navbar

Posted: Sat Jan 01, 2022 3:46 am
by Tanya
I would like to change the default display of shopping cart in Navbar from show the cart-count to show the cart-value with currency.

How can I do this?

Re: Need to show Shopping Cart Total in Navbar

Posted: Sat Jan 01, 2022 1:22 pm
by burt
Drop a copy of

/includes/modules/navbar/templates/tpl_nb_shopping_cart.php

into (assuming you are using "override" template);

/templates/override/includes/modules/navbar/tpl_nb_shopping_cart.php

You have now over-ridden the output of the module.

In that new file, change this line:

Code: Select all

<?php printf(MODULE_NAVBAR_SHOPPING_CART_CONTENTS, $_SESSION['cart']->count_contents()); ?>
To

Code: Select all

<?php printf(MODULE_NAVBAR_SHOPPING_CART_CONTENTS, $GLOBALS['currencies']->format($_SESSION['cart']->show_total())); ?>
In the language file;

/includes/languages/english/modules/navbar/templates/nb_shopping_cart.php

change this line appropriately;

Code: Select all

const MODULE_NAVBAR_SHOPPING_CART_CONTENTS = '<i title="Shopping Cart" class="fas fa-shopping-cart fa-fw"></i><span class="d-inline d-sm-none d-md-inline"> <span class="cart-count">%1$s</span> item(s)</span> <span class="caret"></span>';
Eg to:

Code: Select all

const MODULE_NAVBAR_SHOPPING_CART_CONTENTS = '<i title="Shopping Cart" class="fas fa-shopping-cart fa-fw"></i><span class="d-inline d-sm-none d-md-inline"> <span class="cart-count">%1$s</span> </span> <span class="caret"></span>';
--

This type of indepth help is not usually available from the Core Coders, only within the Supporters VIP lounge. Please consider becoming a Supporter of this Project, to keep the project moving forwards we need as many users of Phoenix as possible to step up and support. Thank You.

Re: Need to show Shopping Cart Total in Navbar

Posted: Sun Jan 02, 2022 9:37 am
by Tanya
Thank you @burt

I have sent you PM about Go Pro.

Re: Need to show Shopping Cart Total in Navbar

Posted: Sun Jan 02, 2022 11:10 am
by admin
Tanya wrote: Sun Jan 02, 2022 9:37 am Thank you @burt

I have sent you PM about Go Pro.
Any queries about GO PRO should go to @admin