- Posts: 2
- Thank you received: 1
Any questions about Documents Sellers, post it here .
[MOD] - how to add prices and total to cart module
- Richard
- Topic Author
- Offline
- New Member
Less
More
12 years 5 months ago #16946
by Richard
[MOD] - how to add prices and total to cart module was created by Richard
I wanted to add the prices of items and a running total to the mini cart module.
Just wanted to share in case anyone else wanted to do the same...
Adding the price of individual items is easy:
In root/modules/mod_dms_cart/tmpl/default.php at around line 23 you should see
simply add
straight after so the whole line reads:
You will want to change the "£" to your own currency symbol.
For the running total, I'm using jQuery Calculation Plug-in from here which is released under MIT and GPL licence.
Whilst you're on the cart page, add this code just above the checkout button table row:
This will be where the running total displays.
You will need to add the .js file and code to the <head> section of your main template page rather than the cart module page...
I'm using a yootheme template, so I added it to templates/yoo_theme/layouts/template.php
So add a reference to the js file
to the head section.
Then add the following to your own document ready chain or as javascript block in the head section:
And now my cart displays like this:
Just wanted to share in case anyone else wanted to do the same...
Adding the price of individual items is easy:
In root/modules/mod_dms_cart/tmpl/default.php at around line 23 you should see
Code:
<a href="<?php echo $link; ?>"><?php echo $doc->title ; ?></a>
simply add
Code:
<span style="float:right;" id="ind_price">£<?php echo $doc->price ; ?></span>
Code:
<a href="<?php echo $link; ?>"><?php echo $doc->title ; ?></a> <span style="float:right;" id="ind_price">£<?php echo $doc->price ; ?></span>
You will want to change the "£" to your own currency symbol.
For the running total, I'm using jQuery Calculation Plug-in from here which is released under MIT and GPL licence.
Whilst you're on the cart page, add this code just above the checkout button table row:
Code:
<tr>
<td style="padding-top:8px;">
<span style="float:left;">Total:</span><span style="float:right;" id="total_price"></span>
</td>
</tr>
This will be where the running total displays.
You will need to add the .js file and code to the <head> section of your main template page rather than the cart module page...
I'm using a yootheme template, so I added it to templates/yoo_theme/layouts/template.php
So add a reference to the js file
Code:
<scr ipt type="text/javascript" src="/templates/yoo_theme/js/jquery.calculation.min.js"></sc ript>
Then add the following to your own document ready chain or as javascript block in the head section:
Code:
//cart total
var sum = $("[id^=ind_price]").sum();
$("#total_price").html("£" + sum.toFixed(2));
And now my cart displays like this:
The following user(s) said Thank You: alryalls
Please Log in or Create an account to join the conversation.
- alryalls
- Offline
- New Member
Less
More
- Posts: 12
- Thank you received: 0
12 years 4 months ago #18134
by alryalls
Replied by alryalls on topic Re: [MOD] - how to add prices and total to cart module
awesome Richard!
I haven't tried it out yet, but this might just be what I'm looking for
Cheers mate
I haven't tried it out yet, but this might just be what I'm looking for
Cheers mate
Please Log in or Create an account to join the conversation.
- Tuan Pham Ngoc
- Offline
- Administrator
12 years 4 months ago #18189
by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Re: [MOD] - how to add prices and total to cart module
Thanks Richard for sharing the modification. Could you please upload the modified file here so that in case someone needs it, they can simply download the file and upload it to server ?
Regards,
Tuan
Regards,
Tuan
Please Log in or Create an account to join the conversation.
Support
Documentation
Information
Copyright © 2024 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.