Ecoshop
Sophomore
Just Getting Started
Member Likes (0)
Hi
How can a give a certain product category an image. When I create one, there is no place to assign one. I want my categories and subcategories to display in a more graphic way (grid way), rather than just with text.
Thanks
Responses (6)
WPMU DEV Fanatic (joined October 2009) Likes (0)
Hello Ecoshop,
We're currently working on implementing a grid type of display for the products themselves but I'm not so sure about the categories. And I'm not so sure regarding category icons as well. Those are great ideas for a feature suggestion, though!
http://premium.wpmudev.org/forums/forum/feature-suggestions
I'd love to see what others around here have used for solutions in these types of cases, as most people using Wordpress eventually come across the need for grid-based category displays.
Cheers,
David
Member (joined May 2011) Likes (0)
Hi,
This is possible in a number of steps. Requires some programming ability.
1) Install the Wordpress plugin "Category Icons Lite"
2) update this plugin. File: caticonslite.php line 173.
Add the code
taxonomy' => 'product_category',to the array.Full array:
array = wp_dropdown_categories(array('taxonomy' => 'product_category', 'hide_empty' => 0, 'name' => 'categoryiconliteid', 'echo' => 0, 'orderby' => 'name', 'selected' => $category_id, 'hierarchical' => true, 'show_option_none' => __('None')));This allows you to assign an image to a product category using the Media menu in Wordpress admin
3) Use the following code to display all of your top level categories with their images and descriptions
Member (joined April 2011) Likes (0)
This is awesome, thanks for sharing!
I have a couple questions. Where does the code in step 3 go? And what do I have to use a specific path for this:
echo '<img src="path/to/images/placeholder.gif" alt="" />'Or do I leave it as you have it?
Thanks again!
Ach Crivvens (joined August 2011) Likes (1)Liked by: 
Acht crivvens! Yer codes a wee bit scunnered ya ken!
@Dana I managed to get this working and here is how:
1) Install the Wordpress plugin "Category Icons Lite"
2) Update this plugin. File: caticonslite.php line 173.
Add the code:
taxonomy' => 'product_category', to the array.It should now look like this:
$array = wp_dropdown_categories(array('taxonomy' => 'product_category', 'hide_empty' => 0, 'name' => 'categoryiconliteid', 'echo' => 0, 'orderby' => 'name', 'selected' => $category_id, 'hierarchical' => true, 'show_option_none' => __('None')));3) Now what I did was to create a custom store front template you do this buy creating a file call mp_store.php in YOUR theme directory. For more info see: Themeing_MarketPress.txt in plugins/marketpress/marketpress-includes/themes
In your mp_store.php add this code (probably within your #content div):
Ive even added some CSS so it goes grid-like.
PLEASE NOTE: I have used
get_bloginfo('url') . '/shop/products/category/'as my stores url as I changed this in the MP settings you will probably want:get_bloginfo('url') . '/store/products/category/'Could we use
mp_store_link(false, true)here I wonder to failsafe it.......However Im wondering if an expert here can explain the
src="'. $image->guid . '"is there a better way of getting the image, perhaps a custom thumbnail?Hope this helps you Dana and others. I think this functionality should be added to the MP core. Only I would like to add a category image on the "add category" page within the products menu.
Ach Crivvens (joined August 2011) Likes (0)
Crivvens I forgot to attach the placeholder image which you put in your themes image folder (check the url is correct in code though)
Member (joined October 2011) Likes (0)
Works great! Thanks a bunch for pointing in the right direction. Took me a bit to figure out how to use it all but in the end it works perfect.
WordPress Questions?
We've got answers!
Find out more »