A A A
Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 4 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
How to add additional product thumbnails
June 16, 2010
1:39 pm
Avatar
Admin
Forum Posts: 5862
Member Since:
March 16, 2008
sp_UserOfflineSmall Offline

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/project.....epad-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.        

September 22, 2010
7:44 pm
Avatar
DerekH
Member
Members
Forum Posts: 4
Member Since:
September 22, 2010
sp_UserOfflineSmall Offline

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

September 23, 2010
3:54 pm
Avatar
Admin
Forum Posts: 5862
Member Since:
March 16, 2008
sp_UserOfflineSmall Offline

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.

September 24, 2010
8:20 pm
Avatar
DerekH
Member
Members
Forum Posts: 4
Member Since:
September 22, 2010
sp_UserOfflineSmall Offline

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?

September 27, 2010
2:09 pm
Avatar
Admin
Forum Posts: 5862
Member Since:
March 16, 2008
sp_UserOfflineSmall Offline

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

March 10, 2012
10:47 pm
Avatar
Jaicyb
Member
Members
Forum Posts: 19
Member Since:
February 2, 2012
sp_UserOfflineSmall Offline

Hi.

 

i  am new here. I just bought your theme two week ago and i am having issue with this solutions your a giving.

 

maybe because the last reference is around 2008 and no one have ask about this situation but the instructions i am reading is just wrong. I just want to say before i continue, that i have triple check all the symbol and i am familliar with the PHP.

ok here we go : 

 

$pix3 = get_post_meta($post->ID, 'pix3', $single = true); is  around line 4201 not the 1840 )

 

$pix3 = stripslashes($_POST["pix3"]); it at two place now ( line 4652 and 4770 ) witch one is the good one ? There are two time the same line code on the fonctions.php

 

I have  tried the both of them but when i refresh it just giving me a server error. it just dont load

 

 It seem that your are guessing that the upload/index.php is no needed anymore but i cant find anywhere your instructions about what was supossed added.

 

Could you please give us a update ? It something that the client want really bad and i cant seem to make it work.

 

thanks you for you fast reply.

March 12, 2012
8:42 pm
Avatar
Admin
Forum Posts: 5862
Member Since:
March 16, 2008
sp_UserOfflineSmall Offline

The last reference was actually 2010.  (I think you were reading the "member since" date.)

Many changes have been made to the theme since, so the line numbers are going to be off for sure.

 

I'll take a look and see what I can offer.

March 12, 2012
9:01 pm
Avatar
Admin
Forum Posts: 5862
Member Since:
March 16, 2008
sp_UserOfflineSmall Offline

I just tried pasting the code into a test install, and it worked with only 1 small change.

 

I noticed that there was a comment that should have been formatted differently in the 4th code box in post #1 above.

The one that said:

"//This line forces the new thumbnails onto a second line to prevent the page's format from being disturbed"

This comment is incorrectly formatted, and so it should just be left out.  So, leave out all of the text between the quotes from what you paste in.

 

I copied everything from the "Raw Code" box.  If you still have problems, you may have a simple syntax error somewhere.

Forum Timezone: UTC 0

Most Users Ever Online: 213

Currently Online:
2 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

icy1: 2636

wreed06: 175

laurie390: 169

boutiqueelliette: 156

StitchTek Services, LLC: 144

yiorgos: 127

Member Stats:

Guest Posters: 457

Members: 2471

Moderators: 1

Admins: 1

Forum Stats:

Groups: 1

Forums: 4

Topics: 4078

Posts: 18978

Newest Members: teddy1, raycrean, tseibt55, aceman, peteryoung320@gmail.com, JdsCentral

Moderators: Market Admin: 5862

Administrators: Market Admin: 5862

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