When wp-e-commerce 3.8 went across to custom posts types one of the features that was lost was the display of prices in the sidebar widget. To be honest with you I can not remember if the prices were there before or whether I had modified the file to show them.
Displaying price in the wp ecommerce widget.
Wp ecommerce 3.8 does not display the prices in the widget so I thought I ‘d have a go at hacking the latest products widget file and introduce them. After spending most of yesterday afternoon and evening trying to hack the file I had no joy.
I tried to track down all the possible hooks and tried to call the prices using the meta information tags and hooks but I really had very little look. At best I called a price of 0.00 in the normal WordPress part of the site and I got a call of the individual product price when within the store rather than calling the actual price of each product in the list.
So it was a case of sleeping on the problem and having another go this morning. And what a difference sleeping on a problem can make.
Use standard WordPress hooks to display latest products with prices.
I settled down this morning to have another crack at it and opened up the latest_product_widget.php file in the wpsc-widgets folder. I took a quick sip of my coffee got hit by the caffeine and thought over my honey on toast – What am I doing?
Why spend more wasted hours trying to hack a core file of wp e-commerce which would need to be replaced again every time I update the plugin when normal WordPress functionality can let me do exactly what I want which is to display in the sidebar a thumbnail of the product, the product title and link and the current price.
So 20 minutes later I had put the script together and done the basic styling that I wanted to do to display the latest products with prices.
If you need to display prices in your list of latest products in your sidebar then you can buy the script I used and just cut and paste it into your wp ecommerce 3.8 store sidebar. The prices is just £20.00.
Tested and works in WordPress 3.3.1 and WPEC 3.8.7.6.2.
Dowload the latest products with prices hack for £20.00.






can you change the number of items that you display or is it only 5?
Hi Isam
it’s pretty straight forward to change the number of items displayed just change the number=5 to whatever you want when you paste the code into the sidebar text box.
kevin
Can we use this code to populate a grid view page?
We already have the latest products widget on the footer but it’d be nice to have a page of latest products too!
Hi Ed.
You should be able to set this as a grid view page. Just set the number of products to the number you want to display and then set the grid using css styling.
It’s basically the same script I’m using on the front page of the phonelingo.co.uk web site. I’ve just added a category selection to separate the smartphones from the tablets.
To set the grid you would use css like:
.latestprods {list-style-type: none; width:650px; margin-bottom: 50px;}
.lpthumb {float:left;}
.latestprods ul li{font-size: 11px; margin-left: 10px; display: inline; float: left;
width: 135px; height: 200px; vertical-align: top; margin-bottom: 10px; }
#latestpro {font-size: 11px; font-weight: bold; text-align: center; }
.pricedisplay {text-align: center;}
That css would work if the content cell of your page is 650 pixels wide ( set in the main div) and you wanted 4 rows (set by the width css for ul li items) You may also need to set the height of each cell of the grid (this example is 200px)
Be aware that I have not yet tested this code with WordPress 3.3
I am still working my way through the list. There are some issues with WP ecommerce and wp3.3 in setting featured thumbnails or images when you add new products. If you can not set a featured thumbnail in manage images then there may be issues. This is why the code is cheap at the moment.
If you’re like me and still on wp 3.2 for most of your ecommerce sites then this code does work ok.
Thanks
Kevin