SiteKickr Web Development

WP e-Commerce Product Reviews

WP e-Commerce  is a pretty full featured WordPress plugin for creating an online store. But, if you're reading this post, you already know about WP-ecommerce, and are more interested in extending it's product review capabilities. Currently, a user can assign a star rating to any given WP-eCommerce product, but what about an actual review?

While I've implemented solutions in the past, they were highly customized, so I will instead give a high level overview of the process I used to add product reviews to the existing star rating system:

  1. Add another column to the existing wp_wpsc_product_rating database table for the actual product review.

    alter table wp_wpsc_product_rating add column review text after rated;
     

  2. Create your own form for submitting a product rating and a review. This should be placed in the wpsc-single_product.php
    template.
     
  3. Create the form processing script, which creates a new record in the wp_wpsc_product_rating table. The SQL might look something like:

    INSERT INTO wp_wpsc_product_rating
            (
                ipnum,
                productid,
                rated,
                review,
                time
            )
            VALUES
            (
            '{$_SERVER['REMOTE_ADDR']}',
            {$_REQUEST['productid']},
            {$_REQUEST['rated']},
            '{$_REQUEST['review']}',       
            UNIX_TIMESTAMP()
            );

     

With this procedure, you will tie into the existing WP e-Commerce rating system, creating a more seamless integration with the product.