WordPress.org

Ready to get started?Download WordPress

Forums

WP ecommerce product category title also shows as first product title (17 posts)

  1. jennsweb
    Member
    Posted 2 years ago #

    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!

  2. jeemer
    Member
    Posted 2 years ago #

    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 :)

  3. kwebdesi
    Member
    Posted 2 years ago #

    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.

  4. chairbeat
    Member
    Posted 2 years ago #

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

  5. linkfr
    Member
    Posted 1 year ago #

    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.

  6. chairbeat
    Member
    Posted 1 year ago #

    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();?>

  7. linkfr
    Member
    Posted 1 year ago #

    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!

  8. vykintas
    Member
    Posted 1 year ago #

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

    it helped me to work out this issue.

  9. jhaba
    Member
    Posted 1 year ago #

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

  10. bircha
    Member
    Posted 1 year ago #

    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?

  11. bircha
    Member
    Posted 1 year ago #

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

  12. bircha
    Member
    Posted 1 year ago #

    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.

  13. mintynz
    Member
    Posted 1 year ago #

    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.

  14. bircha
    Member
    Posted 1 year ago #

    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>

  15. m.murai
    Member
    Posted 1 year ago #

    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.

  16. HD1234
    Member
    Posted 1 year ago #

    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

  17. kythin
    Member
    Posted 1 year ago #

    This bug just hit me after updating to 3.8.9.1 and the 'just call it but dont output it' fix didn't work for me, however I figured out another workaround.

    Basically, the post object itself is plagued with the wrong post_title so using $post->post_title won't work either. Instead, use this:

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

    add this:
    <?php global $post; ?>

    Then where you want to use the title, use this:
    <?= get_the_title($post->ID) ?>

Topic Closed

This topic has been closed to new replies.

About this Topic