I'm having product duplication issues while running two loops on a single page. Is there an equivalent to wp_reset_query for wp ecommerce?

You can see the site at http://standingarmed.com/products-page

You can see the loop here since it didn't format properly on the page.

As you can see I set a variable to grab the first product only. The site only have 7 products so I didn't figure it would be a big deal to let the loop run 7 times. Of course I'd rather query for just the first product but wp ecommerce doesn't support queries like WordPress does, or at least that's what I've found. It then runs into the slider loop.

  • what's your loop like?
    – Bainternet
    Feb 23 '11 at 0:00

You can use (according to docu over @wp-ecommerce) global $wpsc_query; to modify your query.

Resetting the loop can be done with wpsc_rewind_products(); right before the second call to while (wpsc_have_products()) : wpsc_the_product();

For the final solution, pls read the comments below.

  • Have links to those? I must be pretty dense because I just spent a bunch of time looking and haven't found anything in their documentation on either. Feb 23 '11 at 2:03
  • Not exactly, but a quick google for "wp-ecommerce multiple loops" brought this link up: getshopped.org/forums/topic.php?id=13246 ... but you can also take a look directly at the core file (you already got a local copy somewhere): svn.wp-plugins.org/wp-e-commerce/trunk/wpsc-includes/… ... just a short sidenote: i know that wp-ecommerce and it's documentation are both a pain in the [...]. therefore i'd recommend "Shopp" shopplugin.net where only the documentation is worth the money, not spoken of the code which is even better... voting & checking is welcome :)
    – kaiser
    Feb 23 '11 at 3:56
  • Unfortunately Shopp has a multipage checkout which decreases conversions. At least last time I checked. I've added new query to both loops on the same page and cleared it but unfortunately we're still getting double products. In fact even if I change to the default theme I get double products on bot the live site and the development domain. My laptop install seems to be free of the error. Feb 23 '11 at 19:20
  • Last update. There is a bug with the drag and drop sorting that helped this issue along. Don't use it but the suggestion above did end up working. Feb 23 '11 at 19:41
  • Referenced to your comments in the answer and +1 for your Q.
    – kaiser
    Feb 24 '11 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.