WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Problem with WP E-commerce Function wpsc_the_category_title (3 posts)

  1. vanessaking
    Member
    Posted 1 year ago #

    I'm having an issue with the WP E-commerce wpsc_the_category_title function. I can't understand what is causing it to work when it does, and not work when it doesn't. When it works, it should be writing the single product category's name at the top of the single product's listing page; and it should write 'All Products' at the top of a list of—you guessed it—all the products.

    What it is currently doing is writing the product category name when the product has 1 item, or any number of items except 0 or 2 with the exception of two categories, or... It's maddening because it varies depending on which item is selected under Settings > Store > Presentation > Sort Product By: Name, Price, Drag & Drop, or Time Uploaded.

    There are two product categories which are always listed with their product category names, and five categories which are never listed with their product category names at the top of the page.

    The categories that always have their names written at the top of the listings page all have 1 product,the two which never have their names written have two and three products respectively, but they are not the only categories which only have two or three categories.

    The site is at http://www.pearlquest.net/PearlsPlaza, and a few of the listings are here:

    Never show product category name:
    http://www.pearlquest.net/PearlsPlaza/products-page/bears/
    http://www.pearlquest.net/PearlsPlaza/products-page/dishes/

    Shows the product category name only when 'Price' is selected on the Presentation Settings page:
    http://www.pearlquest.net/PearlsPlaza/products-page/clothing/

    Shows the product category name only when 'Name' or 'Drag & Drop' are selected on the Presentation Settings page:
    http://www.pearlquest.net/PearlsPlaza/products-page/figurines/

    I've scanned through theme.functions.php and removed filters, but that didn't change anything. I've put them all back, so it is as it was out of the box, so to speak.

    Any help would be so greatly appreciated, thanks!

  2. vanessaking
    Member
    Posted 1 year ago #

    UPDATED: I've made some of the 'fixes' I've found, but now it's doing the dreaded 'First product named after the category' thing.

    I'd found a patch, but not sure where it's meant to go or what it's meant to replace (the documentation, all the way around, is negligible). Now my problem is a dozen times worse than it was and I'm still not sure how to fix it.

  3. vanessaking
    Member
    Posted 1 year ago #

    RESOLVED: I think I've finally solved this problem which, by the way, started doing the dreaded 'Replaces the first product title with category title...' thing!

    In approximately line 1241 of theme.functions.php, in wpsc-includes, the enable page filters function:

    `function wpsc_enable_page_filters( $excerpt = '' ) {
    add_filter( 'the_content', 'add_to_cart_shortcode', 12 ); //Used for add_to_cart_button shortcode
    add_filter( 'the_content', 'wpsc_products_page', 1 );
    add_filter( 'the_content', 'wpsc_single_template',12 );
    add_filter( 'archive_template','wpsc_the_category_template');
    add_filter( 'the_title', 'wpsc_the_category_title',10,2 );
    add_filter( 'the_content', 'wpsc_place_shopping_cart', 12 );
    add_filter( 'the_content', 'wpsc_transaction_results', 12 );
    add_filter( 'the_content', 'wpsc_user_log', 12 );
    return $excerpt;
    }

    wpsc_enable_page_filters();`

    The line which applies to the category title, line 1246:

    add_filter( 'the_title', 'wpsc_the_category_title',10,2 );

    I changed the priority from 10,2 to 10,1, so that line changes to:

    add_filter( 'the_title', 'wpsc_the_category_title',10,1 );

    That solved all my troubles and I hope it can solve yours, too!

Topic Closed

This topic has been closed to new replies.

About this Topic