WordPress.org

Ready to get started?Download WordPress

Forums

Also Bought - No Image (1 post)

  1. FGoldwyn
    Member
    Posted 2 years ago #

    I am using WP e-commerce Version 3.8.7.6.2.
    My website is: http://www.greenhillsoaps.com

    In Settings>Store>Marketing I have selected "Display Cross Sales"

    When I go to an individual product page, just below the product image and description, I see:

    "People who have bought this have also bought"

    And below that are three boxes with images, product title, and product price. The problem is that where there should be an image, there is a place holder stating No Image.

    Using Firebug, I can see the url for the image. The problem is that it is different from all other image url's.

    All of the other images on my site are from the following url:
    http://greenhillsoaps.com/wp-content/uploads/2012/03

    However the "also bought" image is:

    http://greenhillsoaps.com/wp-content/plugins/wp-e-commerce/wpsc-core/images/

    After a fair amount of research, it seems that the code governing the "also bought" is in the display.functions.php file. The specific code looks as follows:

    [code moderated - please use the pastebin for any code over 10 lines]

    The individual product page calls this function when it loads.

    I have found some comments that the following section of the code is not correct:

    if ( get_option( 'show_thumbnails' ) == 1 ) {
    				if ( $also_bought_data['image'] != null ) {
    					$output .= "<a href='" . get_permalink($also_bought_data['ID']) . "' class='preview_link'  rel='" . str_replace( " ", "_", get_the_title($also_bought_data['ID']) ) . "'>";
    					$image_path = "index.php?productid=" . $also_bought_data['ID'] . "&width=" . $image_display_width . "&height=" . $image_display_height . "";
    
    					$output .= "<img src='$image_path' id='product_image_" . $also_bought_data['ID'] . "' class='product_image' style='margin-top: " . $margin_top . "px'/>";
    					$output .= "</a>";

    And should read as follows:

    if ( get_option( 'show_thumbnails' ) == 1 ) {
    				if ( wpsc_the_product_thumbnail( null, null, $also_bought_data['ID'] ) ) {
    					$output .= "<a href='" . get_permalink($also_bought_data['ID']) . "' class='preview_link'  rel='" . str_replace( " ", "_", get_the_title($also_bought_data['ID']) ) . "'>";
    					$image_path = wpsc_the_product_thumbnail( $image_display_width, $image_display_height, $also_bought_data['ID'] );
    
    					$output .= "<img src='$image_path' id='product_image_" . $also_bought_data['ID'] . "' class='product_image' style='margin-top: " . $margin_top . "px'/>";
    					$output .= "</a>";

    So I copied the display.functions.php file to my child theme and changed the code as advised with exactly zero effect.

    Again, I refreshed my page and checked with firebug and the URL being referred is not the same one as all the other images on the site. I have tried to find out how to change the rogue URL generated by the src='$image_path', but nothing seems to work.

    I thought perhaps it might be easier to find the referring file in the rogue URL. After doing some digging I found it and copied all my images from the file in the first URL to the image file in the rogue URL. Still, no effect. Then I put them in a sub directory named 2012 in the same file. If you click on the rogue URL above you can see the sub directory and if you click on that you can see the images.

    I then decided to write the rogue URL on a piece of paper and stand on the roof of my house and try to see Russia from there. My dog thought that was a bad idea.

    So I am asking, no begging, for someone to help me fix this problem. I am sure the solution is quite simple. It's probably just standing on my roof, trying to see Russia.

Topic Closed

This topic has been closed to new replies.

About this Topic