Details

Related Products for WP e-Commerce uses information available within the Single Product template to display related Products that belong to the same Product Category.

WP e-Commerce Compatibility

  • WP e-Commerce 3.7 ready (up to 3.7.8)
  • WP e-Commerce 3.8 ready (up to 3.8.14.*)

Updates

The latest release can be downloaded from your My Account page.

Documentation

Looking for support, a copy of the readme, Plugin updates, Ideas or usage instructions? Check out our Documentation for Related Products.

146 thoughts on “Related Products

  1. Hi Michael

    Apologies if this message if duplicated – my browser timed out when submitting it.

    I’m very interested in this product, but I use Pages and a shortcode to display the cart features for WP e-commerce.

    First of all, is this a plugin that displays a widget? Could I create a sidebar and drop the widget in, allowing to display the related products? How does it know what’s related and what is not?

    Have you got a plugin that does something similar; i.e. Others bought…

      • Dear Visser. We bought this plugin time ago. Now I want to upgrade since qe upgrade the WP E-comemrce version (to the last one) but I can’t access the download area with the right SessionID … so please, i hae wrote you like 3 times with no answer, please we need the upgrade because the version we got simply is not working… Thanks in advance!

  2. Hey, the plugin works GREAT! Thank you :)

    I have a new feature request: I would like to show Related Products on the shopping cart page, for all products in that cart. Is that possible?

  3. Along with the “Add To Wishlist” plugin, this plugin also has significant functionality issues with the latest stable WPEC release. Specifically for this, the related products all link to the same page. As a paid customer, I really hope we can get support for these issues soon.

    • Solved a few issues.

      Thanks to jackharrybill’s suggestion for fixing update problems in the “Add To Wishlist” plugins, I’ve found that there is a similar cause for issues in this plugin.

      This should fix issues with all related products linking to the same page.

      Change all instances of lowercase “->id” to uppercase “->ID” in the template file of focus. In my case it was the “…/templates/store/wpsc-single_product_related_table-horizontal.php” file.

      Hope this helps.

  4. I am having some issues with this plugin. First, upon install, I got an error for “undefined call array2obj in line 28 of release_3.8.php. When i got deleted that array2obj line, the plugin started working. I am not sure what I deleted.

    Second, now I am seeing the related product on a single product page (i.e., http://apartmentprinter.com/products-page/print-products/temlum-business-cards/) but the links for the products don’t go to the related product page, it just links right back to the same product the customer is on.

    Third, if I set it for more than 2 products to show, the layout goes haywire, primarily I think because the product titles are showing to the right of, rather than below or above the image. How do I change that?

    Lastly, I would like to show related products of the items in the shopping cart in the checkout page ( http://apartmentprinter.com/products-page/checkout/). Is there anyway, I can get this plugin to recognize the products in the cart on the checkout page, and recommend related products?

    I appreciate any help you can give me! In fact, I wouldn’t mind subscribing to a premium support if you can help resolve these issues for me.

    • Hi Ray,

      I am having the exactly same problems. I get Fatal Error: call to array2obj and the links pointing to the same product page. Here’s how I fixed the error:

      if(!function_exists(‘array2obj’)) {
      function array2obj($array) {
      return is_array($array) ? (object) array_map(__FUNCTION__,$array) : $array;
      }
      }

      Place the above code at the bottom of your theme’s functions.php file and the error message will disappear. Also if there is an update to the plugin, this will not cause conflicts if the function already exists etc. However, this does not solve the issue of broken links!

      This should have been tested prior to release and it should simply work out of the box – the fact that it doesn’t work for more than 1 person suggests it has not been thoroughly tested and is extremely worrying to say the least, not to mention disappointing as this is a premium plugin and you have not received a (public) response after more than 2 weeks.

      There is a drop-down menu to change how the products are displayed, I.E vertical, horizontal etc. on the settings page. You may need to write some CSS to get this to display exactly as you require however.

      The shopping cart related product AFAIK is not possible with this plugin. I’d imagine this will require custom development or use of a different e-commerce plugin.

      • Hi Gavin, you’re spot on, the last Plugin update was not thoroughly tested and slipped through the net. I’ve been offline this past fortnight due to travel and haven’t been able to assist the community.

        I’m releasing an urgent Plugin update promptly including the patch above as well as a fix for broken links. I’ll be making an announcement later in the week after reviewing how to better support the community which I have taken for granted.

    • Thanks to jackharrybill’s suggestion for fixing update problems in the “Add To Wishlist” plugins, I’ve found that there is a similar cause for issues in this plugin.

      This should fix issues with all related products linking to the same page.

      Change all instances of lowercase “->id” to uppercase “->ID” in the template file of focus. In my case it was the “…/templates/store/wpsc-single_product_related_table-horizontal.php” file.

      Hope this helps.

  5. I’ve tried manually setting the width and height of the thumbnail and it appears with the right dimensions, but since the plugin calls the image using wp_get_attachment_image, it just shows a cropped version of the non-square thumbnail.

  6. Hi Michael,

    Have you ever had any issues with ‘related products’ slowing down a site? checkout this link
    http://41orchard.com/new/shop/tree-wall-decals/silhouette-branch/

    Notice It takes ages to load, but when I disable ‘related products’ it loads way faster. Also when I change the css file from the default it seem the site runs quicker also.

    This has only recently occurred and it was fine before so I’m thinking that this is conflicting with something else, but I have definitely traced that slow load time down to this plugin as the site runs completely differently when its disabled. Do you have any ideas on this?

    Thanks
    Tom

      • Hi Mate, Bit of info on this for you…

        I’ve found that the more product’s I add to my site, the slower the the single product page takes to load…this is only an issue when ‘Related Products’ plugin is activated.

        But now I have found that it is only slow to load products that have ‘Use automatic selection of Related Products’ checked. If I manually assign the related products, the single product pages load heaps quicker…not sure if its a theme/WP E-commerce or plugin thing but that’s what I’ve found…

        Tom

    • Tom,

      I am noticing the same issue you have described. I am fully up to date on this plugin, WordPress, and WP e-Commerce. I recently imported hundreds of products to test out a website I am working on. The products also have numerous custom fields via the Custom Fields plugin, which may be contributing as well. The bottom line, though, is that this plugin is single-handedly bringing my entire server down.

      Michael,

      Running “mytop” (top running MySQL queries utility), I can see that the culprit is the query on line 180 of includes/release-3_8.php:

      SELECT p.ID as ID, p.post_title as post_title
      FROM $wpdb->term_taxonomy AS tt, $wpdb->term_relationships AS tr, $wpdb->posts AS p, $wpdb->postmeta AS pm
      WHERE
      p.ID != " . wpsc_the_product_id() . "
      AND p.post_status = 'publish'
      AND p.post_type = 'wpsc-product'
      AND
      (
      (
      tt.taxonomy = 'wpsc_product_category'
      AND tt.term_taxonomy_id = tr.term_taxonomy_id
      AND tr.object_id = p.ID
      AND tt.term_id IN ( " . $category_list . " )
      )
      )
      GROUP BY tr.object_id
      LIMIT $limit;

      This query runs for hundreds of seconds on my server before finally completing (e.g., 500+ seconds). I am not an SQL expert, and indeed it took me hours to even pinpoint the problem. Can anything be done to make this more scaleable?

  7. I’ve had this issue on 2 sites where for any item i have duplicated the product them is missing the the related products section.. is this something you can fix in the plugin?

    It doesnt print the image at all.. the only code shown is the link;

  8. Hi Micha ist it possible to display related Products on a normal single Post on Frontend? Is it possible to Include the Related Product Panel on Single Post Backend?

    Thx
    Stephan

  9. Hi,

    Is it possible to order the products alphabetically in the back end?
    They appear to be listed latest first and it’s hard to find products sometimes when manually specifying which products are related.

  10. Hi Michael,

    Related Products works great, but it does not display prices correctly if a product has variations and the price has changed. See http://notforsalestore.com/store/mens/not-for-sale-tee/ and look for the link to “Free Slaves Tee” – click it and you see the price does not match what is shown in More Ideas (Related Products). The only workaround is to de-select all variations, then update the product’s price and re-select the variations. For products with lots of variations, this is not an acceptable workaround.

    The problem seems to stem from the heirarchal nature of variations. Your plugin’s wpsc_rp_product_price() function seems to only look for the parent price, whereas wpsc_the_product_price() considers variation pricing.

      • “From…” and “Show options” aren’t good alternative if all variations are the same price.

        I did some coding and came up with a workaround. In place of wpsc_rp_product_price ($product->id) ,use the following code.

        $loop = new WP_Query( array(
        ‘post_type’ => ‘wpsc-product’,
        ‘p’ => $product->id
        ) );

        while ( $loop->have_posts() ) : $loop->the_post();
        $price = wpsc_the_product_price();
        if ($price == ‘ $0.00′ ) {
        wpsc_rp_product_price ($product->id);
        }
        else echo $price;
        endwhile;

        It simply creates a new query for each related product based on $product->id and calls wpsc_the_product_price on the new query. For some reason it was returning $0.00 for the price if the product does not have variations, so I used wpsc_rp_product_price () as a fallback

          • I did some additional testing and found that in some cases it was still displaying the old pricing, while at other times the same product would display the right pricing! So I tried using the wpsc_have_products () loop rather than the WP loop and it fixed things. This required using the $wp_query object so this code temporarily backs up, rewrite, then restores it for each product. This also eliminated the problem of $0.00 pricing that required wpsc_rp_product_price () as a fallback.

            So at the beginning of the Related Products template

            <?php if( $products ) {
            global $wp_query;
            $temp_query = clone $wp_query; //Backup of original Query

            Then in places of wpsc_rp_product_price ():

            $wp_query = null; //reset the query results
            $wp_query = new WP_Query( array(
            ‘post_type’ => ‘wpsc-product’,
            ‘p’ => $product->id
            ) );

            while ( wpsc_have_products () ) : wpsc_the_product ();
            echo wpsc_the_product_price();
            endwhile;

            Then at the very end –

            $wp_query = $temp_query; // reset to original query
            wp_reset_postdata();
            } ?>

  11. This is exactly what I was looking for, can I see it in action?

    Do you have an example site to show it working? Maybe someone has a site they would like to show off? :)

    • Hi James, I haven’t set up any test sites for Related Products yet. With almost 300 sales of this Plugin alone I’m confident there’s a ‘few’ sites in the wild. Store owners feel free to link up!

      I just went over past e-mails and couldn’t find any refund requests for Related Products which has to be a good indication too. Hope this helps. :)

  12. I’m building a store using WPEC 3.8.6 and WPML 2.3.x (latest). But it seems your plugins don’t play nice with WPML.

    Even though the translated product names do show up in the list of ‘related products’, when I click them, my selection doesn’t stick and it’s the original language (English) product which remains.

    I know many developers (and WPEC) now include hooks to ‘play nice’ with WPML, and only show the current language items. Can we expect your plugins to follow WPEC on this?

    Thanks

    (else, any suggestion on how to make this work?)

  13. im wondring if this plugin can fit my needs, or be tweaked to do so :)

    i want to put it in the ajax popup that shows after an item has been added to cart (“continue shopping | checkout). i dont have many products so i want it to be something like “youve added product A to your cart, check out product B its goes well together” then the click and go to product B’s page and add that and it says “check out Product C too!”

    i guess the second part sounds possible from manual related products feature, but can we hook into the ajax popup? im using thematic by the way.

    thanks!

  14. Michael, I was running into a problem where if I selected a single related product, it wouldn’t show on my product’s page.

    Is it possible that you forgot to add an ‘equal’ (=) sign after the ‘larger than’ (>) sign at line 153 of includes/release-3.8.php?

    Once I added that in, that solved my problem, but wanted to validate if it wouldn’t have adverse effects on other functions…

  15. Hi Michael,
    I just bought Related Products and it works great! However I was hoping there is a way to customize the output more. For example, it has options to wrap the output in a table or a list, but I don’t want these. I have a jQuery slider that needs very specific formatting to work. Is there any way to change the output without hacking the core files or complex jQuery?

  16. Hi Michael,

    I had this plugin working awesome on my test server but moved it over to my working server and it shows no related items at all. It’s look like the “foreach $product as $products” loop isn’t outputting anything.

    The main difference between the servers is that the working server is on PHP 5.1 and my test server is 5.3, the security is obviously tighter on the working server too.

    Just to give me a head start in problem finding, could you let me know if there’s some of the code that’s incompatible with PHP 5.1 please?

    Thanks, Paul.

    • Hi Paul,

      I’m sorry to hear you’re having headaches between PHP versions. I’m not aware of any incompatibility between the two versions. If you can send me login details (FTP and WP Admin) I can trap this issue and release a minor Plugin update to patch future versions of Related Products.

      • Hi Michael,

        I had abandoned this job for a while and have fixed it today. I think the problem is with the PHP version running on the server. We’re not in a position where it can be updated either.

        Anyway, I’ve edited line 224 of includes/release-3_8.php;

        From;
        $products = array2obj( $products );

        To;
        $products2 = array();
        foreach($products as $product)
        $products2[] = array2obj( $product );
        $products = $products2;

        Basically, it was failing to display anything on the frontend when it was running through the foreach ($products as $product) loop in the template file as the containing array was converted to an object. The code above keeps it as an array of objects instead of a single object with member product objects.

        I don’t suppose this could be submitted to the main code if it works ok for you?

        Thanks, Paul.

  17. Hey Michael, I’ve managed to get the price pulling in for related products by adding in this function:


    function wpsc_rp_price($product_id){
    $price_query = new WP_Query('p='.$product_id.'&post_type=wpsc-product');

    while ($price_query->have_posts()) : $price_query->the_post();
    $the_price = wpsc_the_product_price();
    endwhile;
    echo $the_price;
    }

    And in the related products theme file, calling:

    wpsc_rp_price($product->id);

    However, when on a single product page that has variations, the price is showing as ‘From: $0.00′ for all the related products.

    Any ideas how this can be fixed? Would be good to see a price option in the next release :P

  18. hi mike,

    i just buy the wish list and related product plugins, wanna ask how do take out the yellow box of notification from wishlist plugin coz shown on all my pages. and how do i resize the related product thumbnail?? can you mail me your answer??

    thanks mate

  19. I have to say, I am a little disappointed with the slow follow up to my question regarding the functionality of this plugin but I will try one more time before I move on.

    I noticed that many of the descriptions and information are about placing relative products that are in the same category. What if I wanted to place related products in different categories? An example would be that I have a website that sells building material and I have a category “Roof” and “Windows” and want to cross sell windows when someone is looking at roofs and roofs when someone is looking at windows.

    Is this possible with your plugin?

    • Hi Amel, apologies for being slow to respond, I’ve been sweating code in the form of new Plugins and Plugin updates across the suite. You can manually assign Related Products within the Add/Edit Products page, I’ll be looking to add per-Category controls to better manage the auto selected rotator.

Leave a Comment

What does this Plugin do?

Related Products is a WordPress Plugin to extend the WP e-Commerce Plugin by displaying related Products to site visitors, this provides a cross-selling opportunity to other Products available from your store.

It automatically selects related Products based on the Category that the currently displayed Product belongs to, support is also included to manual specify which related Products to display. This has the advantage of displaying? a ‘set’ of Products (e.g. Silver necklace, silver bracelet, silver watch, etc.).

Can I manually define what related Products are displayed against each Product?

Yes you can using the simple Related Products widget appearing on the Add/Edit Products page, just select the Products you wish to display and save changes. Read more about this feature on the Usage page for Related Products.

Does the current Product being displayed appear in the Related Products?

Nope, Related Products filters out the current Product from the list of available Products to display.

Can I change the positioning of Related Products on the Product detail page?

Related Products uses the standard templates ‘hooks’ that comes with WP e-Commerce to display the Related Products element. You can manage the position by the Position drop-down option within Store > Upgrades > Related Products, that’s not all, you can even use a template tag for absolute control. Read the Usage page for more information.

As the end-user you’re driving this Plugin’s future. Vote for a feature enhancement and/or suggest features in the Comments section.

Related Product Feature Roadmap

Related Products comes with a Quick Start document (readme.txt) to help with installing the Plugin. Additional support can be found from the Contact page or methods below.

Urgent Support

If you find yourself needing immediate support for your purchase use the Premium Support page or Live Support button.

Related Products Forum

If you have any problems, questions or suggestions please join the members discussion on our Related Products forum.