WordPress.org

Ready to get started?Download WordPress

Forums

WP e-Commerce
Price range widget not working (7 posts)

  1. KitC
    Member
    Posted 3 months ago #

    Store URL: None yet
    WordPress version: 3.8
    WP e-Commerce version: 3.8.13.1
    Gold Cart version: None
    Theme: Twenty Fourteen

    I did this: I've created a couple of products with multiple variations. All variations have different prices. I added the price range widget to the sidebar.

    I expected WP e-Commerce to do this: I expected to see the products with variations in the chosen price range to show up when I click a range.

    Instead it did this: The products only show up in the lowest price range as if the price was 0.

    http://wordpress.org/plugins/wp-e-commerce/

  2. whitelamp
    Member
    Posted 3 months ago #

    Hi,

    This is a bug. The WHERE clauses in the widget code need re-writing to take variations into account. If you look at one of them:

    $where .= " AND $wpdb->posts.id IN ( SELECT $wpdb->posts.id FROM $wpdb->posts JOIN $wpdb->postmeta on $wpdb->postmeta.post_id = $wpdb->posts.id WHERE $wpdb->postmeta.meta_key=\"_wpsc_price\" AND $wpdb->postmeta.meta_value < " . ( $range[1] + 1 ) . ") ";

    you will see it only looks at the "main" price.

    One of my clients may be about to give me the go-ahead to fix it although it is a core-code fix and would need reapplying after updates...

  3. KitC
    Member
    Posted 3 months ago #

    in what file did you find this code?
    Please let me know if you find a solution to this problem.

  4. whitelamp
    Member
    Posted 3 months ago #

    The code is here:
    /wp-e-commerce/wpsc-components/theme-engine-v1/widgets/price_range_widget.php

  5. whitelamp
    Member
    Posted 3 months ago #

    If you add
    "AND $wpdb->postmeta.meta_value > 0 "
    then at least they will no longer show up in the WRONG place.

    Of course they still will not show up in the RIGHT place.

    This requires an extensive edit of the code - basically take the existing SELECT and add a JOIN to the posts table in such a way that we can remove any posts that have child-products (i.e. variations).
    Then UNION it with another query that gets the parent_ids of child-products in the same range.

    I've done the interesting bit - if somebody wants to get me to finish the job, I will.

  6. Mihai
    Member
    Plugin Author

    Posted 3 months ago #

    @whitelamp can you post your code fixes here:
    https://github.com/wp-e-commerce/WP-e-Commerce/issues/800

    Regards
    Mihai

  7. KitC
    Member
    Posted 3 months ago #

    Thanks whitelamp, I would be very interested to see a fix for this problem if you have time!

Reply

You must log in to post.

About this Plugin

About this Topic