Forums

If condition on product category with Wp-Ecommerce (16 posts)

  1. tomasi514
    Member
    Posted 3 years ago #

    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?

  2. Ivaylo Draganov
    Member
    Posted 3 years ago #

    bump

    I am looking for the same thing

  3. Lriggle
    Member
    Posted 3 years ago #

    Bump

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

  4. sulaeman
    Member
    Posted 3 years ago #

    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 . '';
  5. tomasi514
    Member
    Posted 3 years ago #

    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.

  6. tomasi514
    Member
    Posted 3 years ago #

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

  7. dmatranga
    Member
    Posted 3 years ago #

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

  8. stanyboy
    Member
    Posted 3 years ago #

    I would reall like to use this as well

  9. merlinox
    Member
    Posted 3 years ago #

    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)

  10. Lee Willis (leewillis77)
    Member
    Posted 3 years ago #

    @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; ?>
  11. merlinox
    Member
    Posted 3 years ago #

    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!

  12. sulaeman
    Member
    Posted 3 years ago #

    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 ^_^

  13. merlinox
    Member
    Posted 3 years ago #

    @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.

  14. merlinox
    Member
    Posted 3 years ago #

    @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.

  15. merlinox
    Member
    Posted 3 years ago #

    [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).

  16. Ethan Shaw
    Member
    Posted 3 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic