You must be logged in to post


Register? | Lost Your Password?

Search Forums:


 






Wildcard Usage:
*    matches any number of characters
%    matches exactly one character

How to add additional product thumbnails

UserPost

1:39 pm
June 16, 2010


Market Admin

Admin

posts 4756

1

Post edited 5:48 pm – June 16, 2010 by Market Admin
Post edited 10:31 am – May 20, 2011 by Market Admin
Post edited 10:34 am – May 20, 2011 by Market Admin


There have been a few requests asking how to provide additional product thumbnails on the Product Details page of Market.

One of our members (ValCowle) was gracious enough to take the time to share the code changes he did, and we have provided them here for your convenience.

 

I HIGHLY RECOMMEND YOU MAKE A BACKUP OF YOUR FILES FIRST!

If you happen to make a mistake, you will be glad you did.

============================================================

 

>>>>>>>>>READ ALL OF THIS HEADER FIRST TO AVOID CONFUSION<<<<<<<<

I'll try to keep this simple to avoid mistakes.

If you don't have some sort of source code editor I would recommend downloading Notepad++ as it is free and makes editing code much easier.

You can find the program here:    http://sourceforge.net/projects/notepad-plus/

Once you have installed and run it, it will most likely want to update. Do so.

Now that that's done, open a new document in Notepad++ the copy the source code you are editing from the browser into it.

(To copy the source code; click in the code's text window within your browser then hit CTRL-A to select it, then CTRL-C to copy it, then go to Notepad++ and hit CTRL-V to paste it. Repeat this to move the code back when you're done but start in Notepad++.)

Go to the Language menu at the top of the screen in Notepad++ and select "PHP" under the "P" category.

Save a back up. Once you have your back up "Save as" immediately with a different name.

ie. single – edited.php

This will ensure you don't accidentally hit the save button and overwrite the original just in case you need to undo what you've done.

I have split the "fix" into sections. There are 3 separate files that need to be altered "functions.php", "single.php" (both located in the Market Theme root folder), and "upload/index.php" located in the "upload/" folder off of the theme root folder.

(Make sure you replace the correct index.php file when your're done – the one located in the "upload/" folder NOT the one in the Market Theme base root folder.)

Within each section you will see "LOCATE THIS" and "ADD THIS" notations. I have done it this way since line numbers become inaccurate once you start adding new lines. With Notepad++ you can simple hit CTRL+F to open the find menu and type in a portion of the text to locate it quickly.

Pay careful attention to the brackets in the code sections. If you add the code on the wrong side of a bracket it won't work correctly, if at all.

Obviously, if you wish to add more than the additional 3 thumbnails that I have added simply copy the same code again while continuing the count.

Once you are done editing your code. Simply copy it back into your browser window to replace the original code.

Don't forget to hit "update file" button. When you go to your webpage to view the changes force a refresh by hitting the "F5" key.

Good luck.

Your Friendly Neighborhood Spiderman

 

//***********************************************************************

 single.php – Located in Menu area Appearance -> Editor

//***********************************************************************

 

// LOCATE THIS <<<<<<<<

 

$thumb3 = get_post_meta($post->ID, 'pi3', $single = true); // check for product thumbs

// ADD THIS IMMEDIATELY AFTER

 

$thumb4 = get_post_meta($post->ID, 'pi4', $single = true); // check for product thumbs
$thumb5 = get_post_meta($post->ID, 'pi5', $single = true); // check for product thumbs
$thumb6 = get_post_meta($post->ID, 'pi6', $single = true); // check for product thumbs

 

// LOCATE THIS <<<<<<<<<

 

<?php 
// if there's a first thumbnail
    if($thumb !== '') {
        market_display_pd_thumbs($thumb);
    }    
// if there's a second thumbnail
    if($thumb2 !== '') {
        market_display_pd_thumbs($thumb2);
    }
// if there's a third thumbnail
    if($thumb3 !== '') { 
        market_display_pd_thumbs($thumb3);
    }
?>

// ADD THIS IMMEDIATELY AFTER

 

<br /> //This line forces the new thumbnails onto a second line to prevent the page's format from being disturbed
<?php
// if there's a fourth thumbnail
    if($thumb4 !== '') { 
        market_display_pd_thumbs($thumb4);
    }    
// if there's a fifth thumbnail
    if($thumb5 !== '') { 
        market_display_pd_thumbs($thumb5);
    }    
// if there's a sixth thumbnail
    if($thumb6 !== '') { 
        market_display_pd_thumbs($thumb6);
    }    
?>

 

Save the file.

 

***********************************************************************************

functions.php — Located in Menu area Appearance -> Editor

***********************************************************************************

 

// LOCATE THIS (somewhere around line #1840) <<<<<

 

$pix3 = get_post_meta($post->ID, 'pix3', $single = true);

// ADD THIS IMMEDIATELY AFTER

    $pix4 = get_post_meta($post->ID, 'pix4', $single = true);
    $pix5 = get_post_meta($post->ID, 'pix5', $single = true);
    $pix6 = get_post_meta($post->ID, 'pix6', $single = true);

 

// LOCATE THIS (somewhere around line #2017) <<<<<<<<<<<

           <table> 
            <tr>             
           <td><input tabindex="1" type="text" size="50" name="pix3" id="pix3" value="<?php echo $pix3; ?>"  ><p style="margin-top: 0px;"><?php echo mkt_ADMIN_ADD_PRODUCT_IMAGE_UPLOAD_DESC; ?></p></td><td valign="top"><a style="cursor: pointer;" onclick="toggle('pix3up');"><img src="<?php echo $plugin_path.'imgs/upload.gif'; ?>" /></a></td></tr>  
              <table><tr><td><p style="margin-left: -15px; margin-top: -10px; display: none;" id="pix3up">
                      <iframe name="pix3frame" style="border: none; width: 550px; height: 115px;" scrolling="no" src="<?php echo $plugin_path.'upload/index.php?img=pix3&nonce='.$nonce; ?>" ></iframe>
                      </p> </td></tr> </table>
          </tr></table>

          

          

// ADD THIS IMMEDIATELY AFTER

 

<table>
             <tr>          

           <td><input tabindex="1" type="text" size="50" name="pix4" id="pix4" value="<?php echo $pix4; ?>"  ><p style="margin-top: 0px;"><?php echo mkt_ADMIN_ADD_PRODUCT_IMAGE_UPLOAD_DESC; ?></p></td><td valign="top"><a style="cursor: pointer;" onclick="toggle('pix4up');"><img src="<?php echo $plugin_path.'imgs/upload.gif'; ?>" /></a></td></tr>  
              <table><tr><td><p style="margin-left: -15px; margin-top: -10px; display: none;" id="pix4up">
                      <iframe name="pix4frame" style="border: none; width: 550px; height: 115px;" scrolling="no" src="<?php echo $plugin_path.'upload/index.php?img=pix4&nonce='.$nonce; ?>" ></iframe>
                      </p> </td></tr> </table>
          </tr></table>

           <table>
            <tr>          
           <td><input tabindex="1" type="text" size="50" name="pix5" id="pix5" value="<?php echo $pix5; ?>"  ><p style="margin-top: 0px;"><?php echo mkt_ADMIN_ADD_PRODUCT_IMAGE_UPLOAD_DESC; ?></p></td><td valign="top"><a style="cursor: pointer;" onclick="toggle('pix5up');"><img src="<?php echo $plugin_path.'imgs/upload.gif'; ?>" /></a></td></tr>  
              <table><tr><td><p style="margin-left: -15px; margin-top: -10px; display: none;" id="pix5up">
                      <iframe name="pix5frame" style="border: none; width: 550px; height: 115px;" scrolling="no" src="<?php echo $plugin_path.'upload/index.php?img=pix5&nonce='.$nonce; ?>" ></iframe>
                      </p> </td></tr> </table>
          </tr></table>

           <table>
            <tr>          
           <td><input tabindex="1" type="text" size="50" name="pix6" id="pix6" value="<?php echo $pix6; ?>"  ><p style="margin-top: 0px;"><?php echo mkt_ADMIN_ADD_PRODUCT_IMAGE_UPLOAD_DESC; ?></p></td><td valign="top"><a style="cursor: pointer;" onclick="toggle('pix6up');"><img src="<?php echo $plugin_path.'imgs/upload.gif'; ?>" /></a></td></tr>  
              <table><tr><td><p style="margin-left: -15px; margin-top: -10px; display: none;" id="pix6up">
                      <iframe name="pix6frame" style="border: none; width: 550px; height: 115px;" scrolling="no" src="<?php echo $plugin_path.'upload/index.php?img=pix6&nonce='.$nonce; ?>" ></iframe>
                      </p> </td></tr> </table>
          </tr></table>

 

// LOCATE THIS (somewhere around line #2071)<<<<<<<<<<

$pix3 = stripslashes($_POST["pix3"]);

    

// ADD THIS IMMEDIATELY AFTER

    $pix4 = stripslashes($_POST["pix4"]);
    $pix5 = stripslashes($_POST["pix5"]);
    $pix6 = stripslashes($_POST["pix6"]);

   

// LOCATE THIS (somewhere around line #2100) <<<<<<<<<<

    delete_post_meta($id, 'pi3');
    delete_post_meta($id, 'pix3');

   

// ADD THIS IMMEDIATELY AFTER

    delete_post_meta($id, 'pi4');
    delete_post_meta($id, 'pix4');
    delete_post_meta($id, 'pi5');
    delete_post_meta($id, 'pix5');
    delete_post_meta($id, 'pi6');
    delete_post_meta($id, 'pix6');

    

// LOCATE THIS (somewhere around line #2040) <<<<<<<<<<

if(isset($pix3) && !empty($pix3)){
    $pix3 = stripslashes($_POST["pix3"]);
    add_post_meta($id, 'pix3', $pix3);  //adds the straight HTML link to the image
      $pix3 = '<a href="'.$pix3.'"><img src="' . $plugin_path . '/phpthumb/phpThumb.php?src='.$pix3.'&w=100&h=100&q=100&zc=1" /></a>';
    add_post_meta($id, 'pi3', $pix3);
    }

// ADD THIS IMMEDIATELY AFTER

 

      if(isset($pix4) && !empty($pix4)){
    $pix4 = stripslashes($_POST["pix4"]);
    add_post_meta($id, 'pix4', $pix4);  //adds the straight HTML link to the image
      $pix4 = '<a href="'.$pix4.'"><img src="' . $plugin_path . '/phpthumb/phpThumb.php?src='.$pix4.'&w=100&h=100&q=100&zc=1" /></a>';
    add_post_meta($id, 'pi4', $pix4);
    }
    
      if(isset($pix5) && !empty($pix5)){
    $pix5 = stripslashes($_POST["pix5"]);
    add_post_meta($id, 'pix5', $pix5);  //adds the straight HTML link to the image
      $pix5 = '<a href="'.$pix5.'"><img src="' . $plugin_path . '/phpthumb/phpThumb.php?src='.$pix5.'&w=100&h=100&q=100&zc=1" /></a>';
    add_post_meta($id, 'pi5', $pix5);
    }
    
      if(isset($pix6) && !empty($pix6)){
    $pix6 = stripslashes($_POST["pix6"]);
    add_post_meta($id, 'pix6', $pix6);  //adds the straight HTML link to the image
      $pix6 = '<a href="'.$pix6.'"><img src="' . $plugin_path . '/phpthumb/phpThumb.php?src='.$pix6.'&w=100&h=100&q=100&zc=1" /></a>';
    add_post_meta($id, 'pi6', $pix6);
    }

 

// LOCATE THIS (somewhere around line #2300) <<<<<<<<<<<

 

$pix3 = get_post_meta($post_id, 'pix3', true);

      

// ADD THIS IMMEDIATELY AFTER

$pix4 = get_post_meta($post_id, 'pix4', true);
$pix5 = get_post_meta($post_id, 'pix5', true);
$pix6 = get_post_meta($post_id, 'pix6', true);

   

      

      

      

// LOCATE THIS (just a little way down from previous step) <<<<<<<<<

if (!empty($pix3)){
         echo ' <a href="'.$pix3.'" target="_blank"><img src="'.$plugin_path.'imgs/check.gif" title="'.mkt_ADMIN_MANAGE_PRODUCTS_IMAGE_VIEW.'" /></a>';
          }
          else { echo $error; }

 

// ADD THIS IMMEDIATELY AFTER

 

      if (!empty($pix4)){
         echo ' <a href="'.$pix4.'" target="_blank"><img src="'.$plugin_path.'imgs/check.gif" title="'.mkt_ADMIN_MANAGE_PRODUCTS_IMAGE_VIEW.'" /></a>';
          }
          else { echo $error; } 
      if (!empty($pix5)){
         echo ' <a href="'.$pix5.'" target="_blank"><img src="'.$plugin_path.'imgs/check.gif" title="'.mkt_ADMIN_MANAGE_PRODUCTS_IMAGE_VIEW.'" /></a>';
          }
          else { echo $error; } 
      if (!empty($pix6)){
         echo ' <a href="'.$pix6.'" target="_blank"><img src="'.$plugin_path.'imgs/check.gif" title="'.mkt_ADMIN_MANAGE_PRODUCTS_IMAGE_VIEW.'" /></a>';
          }
          else { echo $error; }

 

Save the file.

 

I believe that should do it.  If you find any errors, please reply to this post.        

7:44 pm
September 22, 2010


DerekH

Member

posts 4

2

Post edited 11:44 pm – September 22, 2010 by DerekH


I can't seem to find the marketproductmanager.php file. Has this been changed in the latest version?

3:54 pm
September 23, 2010


Market Admin

Admin

posts 4756

3

Yes it has.  The plugin is now integrated within the Market Theme itself.

The "marketproductmanager.php" file is now part of "functions.php"

There is also now a folder in the Market Theme files area named "upload".

In that folder, you will find the "upload.php" file referenced above.

8:20 pm
September 24, 2010


DerekH

Member

posts 4

4

Thanks for the update. Although I can't find the code specified in the file upload.php or index.php. Has that been added elsewhere?

2:09 pm
September 27, 2010


Market Admin

Admin

posts 4756

5

I don't think the reference to "upload/index.php" is needed anymore.



 

Market takes e-commerce to the next level with an easy to use, quick setup platform. Learn more or take the tour.