WordPress.org

Support

Support » Plugins and Hacks » WP ecommerce product category title also shows as first product title

WP ecommerce product category title also shows as first product title

  • Hi, I had a similar issue in a test version of an e-commerce site I am working on and thought I had found a fix on gasolicious.com, but here’s what happened.
    After a fresh install of wordpress, craftycart theme (theme originally chosen by client a while ago) and wp e-commerce plugin, the category pages that showed all the products in that category were showing the last product’s name as the page title.
    Gasolicious had noticed this bug and provided code that for page.php that worked a little too well. Now product category pages are showing the name of the product category at the top (which is what I wanted), but the first product listed is showing the category title as well and not the product’s name! If you have found a fix for this, please share what worked for you!

Viewing 15 replies - 1 through 15 (of 16 total)
  • I’m guessing you probably have fixed or given up on this, but I managed to find a fix looking around.

    Apparently some people get a problem where the first product has no title instead of the category name glitch. The fix is to add an extra call of the product title to the while loop on wpsc-products_page.php

    Details are here:

    http://code.google.com/p/wp-e-commerce/issues/detail?id=681

    I did what the guy in the first post has done, and it’s worked perfectly. Hope this helps 🙂

    Hi jeemer – thanks so much. I had this issue and found your post straight away. My problem was in the list display – the category name was showing as the first product name. I did the same fix in wpsc-list_view.php and all good.

    Thanks so much for this! I was having the same problem and this was the most promising google result, and it paid off. 🙂

    Hi guys!

    I am having the same problem – first product name is overwritten by the category name.

    So i took a look at the link proposed by jeemer…

    As far as i can understand, i should paste this code…

    <?php
    // Just call the function but don’t output it
    $current_title = wpsc_the_product_title();
    // Now output it
    wpsc_the_product_title();
    ?>

    …in either wpsc-products_page.php, or wpsc-list_view.php, or both, right?

    But where exactly?

    So far I tried pasting it at the end of both files but it didnt work.

    Heyya linkfr – don’t paste it at the beginning or end of the file, rather paste it at the end of your php loop call like so 🙂 calling this with the loop seems to foce it to work.

    Your normal product loop would look like this:
    <?php while (wpsc_have_products()) : wpsc_the_product(); ?>

    Take that line and replace it with this:

    <?php while (wpsc_have_products()) : wpsc_the_product(); wpsc_the_product_title();?>

    Hi chairbeat, thanks for your answer!

    I just found this precise line: <?php while (wpsc_have_products()) : wpsc_the_product(); ?>

    And replace it with this one: <?php while (wpsc_have_products()) : wpsc_the_product(); wpsc_the_product_title();?>

    But it didnt make any change…

    I also added this…:
    <?php
    // Just call the function but don’t output it
    $current_title = wpsc_the_product_title();
    ?>

    … After this:
    <?php while (wpsc_have_products()) : wpsc_the_product(); ?>

    And still got no changes even if I emptied the cache every time.

    Any clues of what i may be doing wrong? I’m a full newbie as you may imagine, thanks again!

    Try this – http://gasolicious.com/commerce-product-category-pages/

    it helped me to work out this issue.

    can anyone tell me how to pass product category in this loop to display product in custom template

    Hi I am using WP 3.4.1 (Twenty Eleven theme) and WP e-Commerce 3.8.8.5 and the category title on the single category page is getting replaced with the title of the last (alphabetically) product in that category. I’ve tried what has been suggested above but I didn’t manage to fix the issue.

    Someone claimed that this bug has something to do with how you post your product images / thumbnails into the product page. When I created a new product with exactly the same way as others before it, the category title was printed out as supposed (instead the product name).

    So there is a difference between these two types of products that I’ve managed to create and I believe I could modify my old products in the database to be the same way as the new one but do you have any suggestions where to start looking from?

    Or does anyone have any ideas how to fix this issue?

    I filed a bug report about this: http://code.google.com/p/wp-e-commerce/issues/detail?id=1159

    If you are certain how to reproduce the issue, please let the developers know by making a comment in Google Code. This way it is more probable that the bug will get a proper fix someday.

    To quote from another post I did on this:

    There is a bug in WPEC where on Category pages, a product title appears at the top (eg “Blue Dress”) instead of the Category name (“Dress”). The fix seems to be to edit your theme’s page.php file.

    (I would have thought that fixing the bug in WPEC would have been easier than editing every damn theme out there, but hey, that’s probably only from a customer POV rather than a WPEC one).

    Anyway, not all themes have a simple page.php. Suffusion doesn’t. So here’s what to do for it:

    http://aquoid.com/forum/viewtopic.php?f=2&t=7133

    Hope that helps someone.

    Lesson number one: Don’t try to fix anything with tired eyes and mind 🙂

    After a revisit to here http://gasolicious.com/commerce-product-category-pages/ I managed to fix the issue for Twenty Eleven with the following:

    In content-page.php replace the following code:

    <h1 class=”entry-title”><?php if ( ! is_front_page() ) { the_title(); } ?></h1>

    with this one:

    <h1 class=”entry-title”>
    <?php
    if (‘wpsc-product’ == get_post_type() && !is_single())
    {
    $category_name= wpsc_category_name();
    echo $category_name;
    }
    else { the_title(); }
    ?>
    </h1>

    Hi I have a problem to show the product category name as a page title even there is no item under the category.
    WP ecommerce’s default, it is showing as “Products Page” if there is no item.
    So how I can get category title when there is no item under the category.

    As originally posted here: http://code.google.com/p/wp-e-commerce/issues/detail?id=681 – To remove the category title so that your first product title shows instead, go to your child theme and edit the wpsc_products_page.php (not too far down from the top you’ll find it):

    *after:
    <?php while (wpsc_have_products()) : wpsc_the_product(); ?>

    *add the following:

    <?php
    // Just call the function but don’t output it
    $current_title = wpsc_the_product_title();
    ?>

    – this worked perfectly for me on a 2011 child theme.

    Also, for anyone trying to remove ALL page titles that appear directly above your page content (not the nav menu bar titles -the actual page content titles) go here for the fix:

    http://wordpress.org/support/topic/remove-page-title-1

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘WP ecommerce product category title also shows as first product title’ is closed to new replies.
Skip to toolbar