57
User beware! I am no programmer and the only PHP I know is reading the Welling & Thomson PHP & MySQL book (that too not halfway through to book!). I believed I have 'fixed' the print to shutterfly that doesn't print when you click on it. It only seems to bring you back to the top of the page.
After looking through pages and pages of Gallery forums and XOOPS I found zip so looking into the code, I found that in view_photo.php the form to submit the 'order' so to speak is not there and a couple of things. I don't know if this is going to create problems elsewhere but this is what I did.
Open
xoopsgallery/view_photo.php around line 219 look for this
if (strcmp($gallery->album->fields["print_photos"],"none")) {
if (strlen($adminCommands) > 0) {
$adminCommands .="<br>";
}
$adminCommands .= "<a href=# onClick="document.sflyc4p.returl.value=document.location; document.sflyc4p.submit();return false">[print this photo on Shutterfly]</a>";
}
and change it to this:
if (strcmp($gallery->album->fields["print_photos"],"none") &&
!$gallery->session->offline &&
!$gallery->album->isMovie($id)) {
$photo = $gallery->album->getPhoto($GLOBALS["index"]);
$photoPath = $gallery->album->getAlbumDirURL("full");
$rawImage = $photoPath . "/" . $photo->image->name . "." . $photo->image->type;
$thumbImage= $photoPath . "/";
if ($photo->thumbnail) {
$thumbImage .= $photo->image->name . "." . "thumb" . "." . $photo->image->type;
} else if ($photo->image->resizedName) {
$thumbImage .= $photo->image->name . "." . "sized" . "." . $photo->image->type;
} else {
$thumbImage .= $photo->image->name . "." . $photo->image->type;
}
list($imageWidth, $imageHeight) = $photo->image->getRawDimensions();
if (strlen($adminCommands) > 0) {
$adminCommands .="<br>";
}
$printService = $gallery->album->fields["print_photos"];
if (!strncmp($printService, "shutterfly", 10)) {
$adminCommands .= "<a href=# onClick="document.sflyc4p.returl.value=document.location; document.sflyc4p.submit();return false">[print this photo on Shutterfly]</a>";
$printShutterflyForm = 1;}}
In the very same file scroll down to about line 291 add this
if (isset($printShutterflyForm)) { ?>
<form name="sflyc4p" action="http://www.shutterfly.com/c4p/UpdateCart.jsp" method="post">
<input type=hidden name=addim value="1">
<input type=hidden name=protocol value="SFP,100">
<?php if ($gallery->album->fields["print_photos"] == "shutterfly without donation") { ?>
<input type=hidden name=pid value="C4P">
<input type=hidden name=psid value="AFFL">
<?php } else { ?>
<input type=hidden name=pid value="C4PP">
<input type=hidden name=psid value="GALL">
<?php } ?>
<input type=hidden name=referid value="gallery">
<input type=hidden name=returl value="this-gets-set-by-javascript-in-onClick">
<input type=hidden name=imraw-1 value="<?php echo $rawImage ?>">
<input type=hidden name=imrawheight-1 value="<?php echo $imageHeight ?>">
<input type=hidden name=imrawwidth-1 value="<?php echo $imageWidth ?>">
<input type=hidden name=imthumb-1 value="<?php echo $thumbImage ?>">
<?php
/* Print the caption on back of photo. If no caption,
* then print the URL to this page. Shutterfly cuts
* the message off at 80 characters. */
$imbkprnt = $gallery->album->getCaption($index);
if (empty($imbkprnt)) {
$imbkprnt = makeAlbumUrl($gallery->session->albumName, $id);
}
?>
<input type=hidden name=imbkprnta-1 value="<?php echo strip_tags($imbkprnt) ?>">
</form>
<?php }
. Be aware there are a few things <!php opening and ?> closing tags that you might need to delete or add in. It works for me (www.search-www.com - I'm moving servers and transfering domains so give this link about 2-3 days for it to work) good luck!