WP eCommerce
Price range widget not working (7 posts)

  1. KitC
    Posted 2 years ago #

    Store URL: None yet
    WordPress version: 3.8
    WP e-Commerce version:
    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.


  2. whitelamp
    Posted 2 years ago #


    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
    Posted 2 years ago #

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

  4. whitelamp
    Posted 2 years ago #

    The code is here:

  5. whitelamp
    Posted 2 years 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
    Plugin Author

    Posted 2 years ago #

    @whitelamp can you post your code fixes here:


  7. KitC
    Posted 2 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic