Support » Plugin: WP eCommerce » [Plugin: WP e-Commerce] display categories name

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Justin Sainton

    (@justinsainton)

    If you’re displaying a specific categorical listing on a page or post via shortcode, you can simply type the name of the category above that shortcode.

    can you send me example of short code plz..

    Plugin Author Justin Sainton

    (@justinsainton)

    Give the docs a read – http://docs.getshopped.org/documentation/shortcodes-categories/

    There is more info there than I could possibly communicate here.

    If you want to display the category NAME not the product listing… You would need to edit your template file: wpsc-category-list.php

    By default the [showcategories] shortcode shows the category image grid ( regardless of your presentation settings ) . See the original code below:

    <?php
    /**
     * wpsc-category-shortcode is the code trigered by using the [showcategories] shortcode
     * @package wp-e-commerce
     * @since 3.8
     */
    ?>
    <div class="wpsc_categories wpsc_category_grid group">
    	<?php wpsc_start_category_query(array('category_group'=> get_option('wpsc_default_category'), 'show_thumbnails'=> 1)); ?>
    		<a href="<?php wpsc_print_category_url();?>" class="wpsc_category_grid_item  <?php wpsc_print_category_classes_section(); ?>" title="<?php wpsc_print_category_name(); ?>">
    			<?php wpsc_print_category_image(get_option('category_image_width'),get_option('category_image_height')); ?>
    		</a>
    		<?php wpsc_print_subcategory("", ""); ?>
    	<?php wpsc_end_category_query(); ?>
    
    </div><!--close wpsc_categories-->
    
    <?php
    ?>

    I updated the link class to wpsc_category_link and changed the wpsc_print_category_image to wpsc_print_category_name:

    <?php
    /**
     * wpsc-category-shortcode is the code trigered by using the [showcategories] shortcode
     * @package wp-e-commerce
     * @since 3.8
     */
    ?>
    <div class="wpsc_categories wpsc_category_grid group">
    	<?php wpsc_start_category_query(array('category_group'=> get_option('wpsc_default_category'), 'show_thumbnails'=> 1)); ?>
    		<a href="<?php wpsc_print_category_url();?>" class="wpsc_category_link  <?php wpsc_print_category_classes_section(); ?>" title="<?php wpsc_print_category_name(); ?>">
    			<?php //Print Category Name
                              wpsc_print_category_name();
                              ?>
    		</a>
    		<?php wpsc_print_subcategory("", ""); ?>
    	<?php wpsc_end_category_query(); ?>
    
    </div><!--close wpsc_categories-->
    
    <?php
    ?>

    I also was able to print only the sub categories of a particular parent category in my taxonomy template files ( taxonomy-wpsc_product_category-CATEGORY SLUG.php ) by indicating the parent category ID. In this case my product category ID is 27.

    <ul class="wpsc_categories">
    <?php wpsc_start_category_query(array('parent_category_id'=> 27, 'show_thumbnails'=> 1)); ?>
        <li><a href="<?php wpsc_print_category_url();?>" class="wpsc_category_link" title="<?php wpsc_print_category_name(); ?>">
            <?php wpsc_print_category_name(); ?>
        </a></li>
    
        <?php wpsc_print_subcategory("", ""); ?>
    <?php wpsc_end_category_query(); ?>
    </ul>

    How to I style the way the boxes appear, specifically how do I add more spacing if I do <?php wpsc_print_category_name(); ?> under the <?php wpsc_print_category_image(); ?>? Since it’s an array if I put <br> tag in it just adds multiple breaks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: WP e-Commerce] display categories name’ is closed to new replies.