I just started developing in WordPress, specifically with the WP-eCommerce plugin and I’ve run into several issues. One of the primary issues is the ability to query specific products based on it’s existence within two (or more) categories. In this instance, I would like the only products returned to be those that exist in both categories but not just one or the other.
I understand that this can be done on my own (raw php) or with just wp_query (or something alike this). However, I would like to stay within the WP-eCommerce framework as much as possible so as to limit the amount of styling and redundant code required.
For some clarification, an example of this situation would be as such:
query string sent to url – http://example.com/?wpsc_product_category=cat1&wpsc_product_category=cat2
This then gets sent and processed by WP-eCommerce but only takes the most recent wpsc_product_category query, and as a result only returns products that exist within cat2.
So, in conclusion my two primary questions are:
-
What sort of options are available to me within the WP-eCommerce framework that would allow me to make a query and return a product that exists in both and not just one of the categories.
- if that isn’t possible, what sort of wordpress options are available to me
- what about creating my own function?
-
What exactly is the query process within WP-eCommerce. In the least, I could possibly access the file that formats the query string and get it to query both categories.
This was solved with the significant help of a colleague of mine.
Basically, as wpecommerce is structured, it designs the
WP-Queryto only really manage one variable to search by. In order to circumvent this you need to override the$wp_queryvariable either in your own function, the file you wish to have multiple queries, etc.This was done by utilizing code found from the wordpress codex here
Excerpt:
With some modification this allowed me to access the different taxonomy variable relationships directly and string together multiple search variables.