ante_bj__rk
Sophomore
Just Getting Started
Member Likes (0)
hi.
1) i have a custom shopping cart in the header.php where i use mp_items_count_in_cart() to display number of items in cart. when clicking add to cart this does not update. it updates only after page refresh. i really need some help getting this to work with ajax or something.
2) is there anyway to display the subtotal outside the cart?
3) im very dissapointed by the lack of documentation of marketpress. is there even any kind of documentation? all i could find where basic videos.
please, save my day and try answearing me on all the above questions.
thanks.
/andreas

Responses (10)
Member (joined April 2009) Likes (0)
Hiya andreas,
You're only wanting to show the number of items in the header section? Is this your own custom theme?
An easy way to have the shopping cart appear anywhere would be to use the shopping cart widget and create widgetized ares in your theme to correspond to this.
I assume you've already reviewed the template-functions.php file and the Themeing_Marketpress.txt files found within the plugin? We have inline documentation there to assist with the basics of customizing the product.
Additionally, you may want to check out our FrameMarket and GridMarket themes which are meant to show how MarketPress functions can be used within a theme:
http://premium.wpmudev.org/project/frame-market-theme/
Let us know if you need anything further. If you have a link to the site and more information on the theme we may be able to provide more specific directions.
Thanks!
Member (joined June 2012) Likes (0)
ok.
I'm trying to insert a snippet into the header.php file that displays the cart's subtotal at the top of the page next to a shopping cart icon. Usually I can track down the code that is calling it but I'm new to Marketpress and haven't been able to find it.
Does anyone know how to do this?
Member (joined April 2009) Likes (0)
Hiya ante_bj_rk,
Let me ask a developer to assist with this. In most of our themes we use the function:
mp_show_cart('widget');But that displays the entirety of the cart, not the subtotal or number of items. You could probably "hack" around it by adding display:none to the elements you don't want to show. The function itself outputs a table.
As I said, I've flagged a developer to get you a more complete answer.
Thanks!
Member (joined June 2012) Likes (0)
thanks masonjames, really appreciate it.
Developer (joined January 2012) Likes (0)
Hi ante_bj__rk,
I don't think there is a single function call in Market Press I can point you to that will return the cart total. But let me see if I can provide you a custom function you can add to your theme to determine the subtotal value. Will reply back shortly.
Developer (joined January 2012) Likes (0)
Ok. Here is the quick function. I've tested this locally. Just some notes this functions does not include coupons, taxes, shipping total. Just the subtotal of cart product items.
The function accepts an argument true or false to control the output format. If true the subtotal will be formatted for currency like $1,095.23. If false you will get the raw unformatted number like 1095.23. You will need to format this yourself. The default it true
You should be able to just add this function to your theme's functions.php file. Then call the function from your header.php
Let me know if this doesn't work.
Developer (joined January 2012) Likes (0)
Here is a link to a dropbox file. Might be easier to get the code instead of copying from here. https://dl.dropbox.com/u/2616987/WPMUDev/marketpress_get_cart_subtotal.php
Member (joined June 2012) Likes (0)
wow! PaulM, thats great! thanks alot!
will try this asap.
Member (joined June 2012) Likes (0)
thanks! it worked out fine.
Member (joined January 2012) Likes (0)
Where in the header.php file did you add the code?
Become a member