• I want to use a “If” condition with Wp-Ecomerce.
    I want to say something like :

    If product is part of this category:
    do this,
    else:
    do that

    Does anyone can help me here?

Viewing 15 replies - 1 through 15 (of 15 total)
  • bump

    I am looking for the same thing

    Bump

    A reference for WP-ECommerce conditional tags would be suuuuuuuuuuuper handy!

    how about this :

    $wpsc_query = new WPSC_Query(array('category_id' => <the category id>));
    <?php while (wpsc_have_products()) :  wpsc_the_product(); ?>
    <-- BLA BLA BLA -->
    <?php endwhile; ?>

    or using this query :

    $sql = 'SELECT ' . WPSC_TABLE_PRODUCT_CATEGORIES . '.id, name FROM '. WPSC_TABLE_PRODUCT_ORDER . ' ';
    	$sql .= 'LEFT JOIN ' . WPSC_TABLE_PRODUCT_CATEGORIES . ' ON ' . WPSC_TABLE_PRODUCT_ORDER . '.category_id = ' . WPSC_TABLE_PRODUCT_CATEGORIES . '.id ';
    	$sql .= 'WHERE product_id = ' . $product_id . '';
    Thread Starter tomasi514

    (@tomasi514)

    Hi Guys, hi Sulaeman, thanks for the feedback!

    I tried your code in a page (content0.php), it goes like this:

    <?php
    $wpsc_query = new wpsc_query(array('category_id' => 8));
    while (wpsc_have_products()) :  wpsc_the_product(); ?>
    TRalala
    <?php endwhile; ?>

    Is this all right?

    Here is the error message I have:
    Fatal error: Class 'wpsc_query' not found in ...\wp-content\themes\default\content0.php on line 113

    Again, thanks.

    Thread Starter tomasi514

    (@tomasi514)

    We’d love to close this topic guys, nobody can answer please?

    I’d like to know the answer to this one also. The WP E-commerce documentation is very insufficient.

    I would reall like to use this as well

    I need to use that plugin but I’m really afraid. Documentation is really lacking and support forum hasn’t directly partecipation of plugin programmer.

    I’m trying to translate base products_page.php loop, but it’s not so easy. Moreover I check a bug that we can’t add custom template for plugin 🙁

    (version 3.7.5.3)

    @tomasi514

    WPSC_Query not wpsc_query, so

    <?php
    $my_wpsc_query = new WPSC_Query(array('category_id' => 8));
    while (wpsc_have_products()) :  wpsc_the_product(); ?>
    TRalala
    <?php endwhile; ?>

    I’ve to little questions for you, my saviors. I’ve wp ecommerce with gold cart.

    • how may I print all subcategories of a selected category?
    • how may I print all products of a selected category and all its subcategories

    Thank you very much!

    you can get all thoose code that you need at iCreativeLabs latest released wordpress free theme for wp-e-commerce at here http://bit.ly/dnU4Ky, which is developed by me.

    it’s not a promotion, but i’m quite lazy to show the code ^_^

    @sulaeman: it’s one of best thing I see for wp e-commerce, now I’ll try to check script I need. Now I can’t change theme, ’cause a graphic team is still working in it. I need only script for subcategories and query for list all products of a categories and its subcategories.

    Thanks.

    @sulaeman: hei man, thank you very much to address me to that template. I’m studying it and many of my troubles become features.
    On little note: function libraries inside wp template are not very good. Can’t move them on plugin folder or plugin template folder?

    Thanks.Thanks.Thanks.

    [fix] In icl_utility.php I replace:
    $new_prefix = sprintf($prefix, get_option('siteurl').'/products-page/'.$this->get_category_nicename($category['id'], TRUE))$;
    with
    $new_prefix = sprintf($prefix, wpsc_category_url($category['id'], TRUE));
    so I can mantain the permalink (with subcategories structure).

    If you are looking for a single product conditional tag try this: http://getshopped.org/forums/topic.php?id=8531.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘If condition on product category with Wp-Ecommerce’ is closed to new replies.