Topic RSS
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.
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.
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.
Most Users Ever Online: 40
Currently Online:
21 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Member Stats:
Guest Posters: 428
Members: 2252
Moderators: 1
Admins: 1
Forum Stats:
Groups: 1
Forums: 4
Topics: 2983
Posts: 16042
Newest Members: Allsed, deleteduser, shanm, slidesketch, jimharrison, vmi
Moderators: Market Admin (5051)
Administrators: Market Admin (5051)

Log In
Register
Home
Offline

