Coppermine 1.4.3 Shop hack D.I.Y. instructions

Shop hack by Casper.


If you are running an un-modified version of Coppermine, or are unable to follow the instructions below, you should ignore these instructions and follow the instructions in the enclosed shop.html.

These instructions are for adding the shop hack to an already modified Coppermine Photo Gallery v1.4.3


For Coppermine credits and copyrights, see the Coppermine documentation in the official coppermine download.

Support for this hack should be asked only on the associated thread in the modifications board of the Coppermine forums.

This hack is not designed for use with Nuke or CMS versions of Coppermine, although a decent coder with knowledge of these versions should be able to make any required changes. Please do not ask for help with this on the standalone version boards.




Backing up your existing files.

Make copies of all the existing files you are about, and keep them so you can return to these if the modifications we are making cause problems with your existing modifications.



Changes to the language files.

Open your language.php file, found in the 'lang' folder. You will need to do the following changes to all languages you use on your site.

Find;

array('Path to custom footer include', 'custom_footer_path', 0, 'f=index.htm&as=admin_theme_include_path_start&ae=admin_theme_include_path_end'), //cpg1.4

Add below, in a new line, and with at least 1 line space;
'Paypal shop account email',
  array('Paypal email account', 'paypal_email', 0),
  
  
  'Shop sizes and prices',
  array('Size 1', 'size1', 0),
  array('Price size 1', 'size1_price', 0),
  array('Size 2', 'size2', 0),
  array('Price size 2', 'size2_price', 0),
  array('Size 3', 'size3', 0),
  array('Price size 3', 'size3_price', 0),
  array('Size 4', 'size4', 0),
  array('Price size 4', 'size4_price', 0),
  array('Size 5', 'size5', 0),
  array('Price size 5', 'size5_price', 0),
  array('Size 6', 'size6', 0),
  array('Price size 6', 'size6_price', 0),
  array('Size 7', 'size7', 0),
  array('Price size 7', 'size7_price', 0),
  array('Size 8', 'size8', 0),
  array('Price size 8', 'size8_price', 0),
  array('Size 9', 'size9', 0),
  array('Price size 9', 'size9_price', 0),
  array('Size 10', 'size10', 0),
  array('Price size 10', 'size10_price', 0),
  array('Size 11', 'size11', 0),
  array('Price size 11', 'size11_price', 0),
  array('Size 12', 'size12', 0),
  array('Price size 12', 'size12_price', 0),
  array('Size 13', 'size13', 0),
  array('Price size 13', 'size13_price', 0),
  array('Size 14', 'size14', 0),
  array('Price size 14', 'size14_price', 0),
  array('Size 15', 'size15', 0),
  array('Price size 15', 'size15_price', 0),
  array('Size 16', 'size16', 0),
  array('Price size 16', 'size16_price', 0),
  array('Size 17', 'size17', 0),
  array('Price size 17', 'size17_price', 0),
  array('Size 18', 'size18', 0),
  array('Price size 18', 'size18_price', 0),
  array('Size 19', 'size19', 0),
  array('Price size 19', 'size19_price', 0),
  array('Size 20', 'size20', 0),
  array('Price size 20', 'size20_price', 0),
  array('Currency symbol US$ - Can$ - £ - € - ¥', 'currency_symbol', 0),
  array('Currency USD-CAD-GBP-EUR-JPY', 'currency', 0),
  
Save and close your language files.




Changes to your theme files.

The following changes will need to be made to all themes you will be using. If you are going to use.

Open themes/your_theme/template.html, and find;

<script type="text/javascript" src="scripts.js"></script>


Add, after the above;
<script type="text/javascript">
<!--
function Dollar (val) {  // force to valid dollar amount
var str,pos,rnd=0;
  if (val < .995) rnd = 1;  // for old Netscape browsers
  str = escape (val*1.0 + 0.005001 + rnd);  // float, round, escape
  pos = str.indexOf (".");
  if (pos > 0) str = str.substring (rnd, pos + 3);
  return str;
}

function ReadForm (obj1) { // process un-named selects
var i,j,amt=0,des="",obj,pos,tok,val,
    op1a="",op1b="",op2a="",op2b="",itmn="";
var ary = new Array ();
  if (obj1.baseamt) amt  = obj1.baseamt.value*1.0;  // base amount
  if (obj1.basedes) des  = obj1.basedes.value;  // base description
  if (obj1.baseon0) op1a = obj1.baseon0.value;  // base options
  if (obj1.baseos0) op1b = obj1.baseos0.value;
  if (obj1.baseon1) op2a = obj1.baseon1.value;
  if (obj1.baseos1) op2b = obj1.baseos1.value;
  if (obj1.baseitn) itmn = obj1.baseitn.value;
  for (i=0; i<obj1.length; i++) {     // run entire form
    obj = obj1.elements[i];           // a form element
    if (obj.type == "select-one") {   // just get selects
      if (obj.name == "quantity" ||   // don't mess with these
          obj.name == "amount") continue;
      pos = obj.selectedIndex;        // which option selected
      val = obj.options[pos].value;   // selected value
      ary = val.split (" ");          // break apart
      for (j=0; j<ary.length; j++) {  // look at all items
// first we do single character tokens...
        if (ary[j].length < 2) continue;
        tok = ary[j].substring (0,1); // first character
        val = ary[j].substring (1);   // get data
        if (tok == "@") amt = val * 1.0;
        if (tok == "+") amt = amt + val*1.0;
        if (tok == "%") amt = amt + (amt * val/100.0);
        if (tok == "#") {             // record item number
          if (obj1.item_number) obj1.item_number.value = val;
          ary[j] = "";                // zap this array element
        }
// Now we do 3-character tokens...
        if (ary[j].length < 4) continue;
        tok = ary[j].substring (0,3); // first 3 chars
        val = ary[j].substring (3);   // get data
        if (tok == "s1=") {           // value for shipping
          if (obj1.shipping)  obj1.shipping.value  = val;
          ary[j] = "";                // clear it out
        }
        if (tok == "s2=") {           // value for shipping2
          if (obj1.shipping2) obj1.shipping2.value = val;
          ary[j] = "";                // clear it out
        }
      }
      val = ary.join (" ");           // rebuild val with what's left

      if (obj.name == "on0" ||        // let these go where they want
          obj.name == "os0" ||
          obj.name == "on1" ||
          obj.name == "os1") continue;

      tag = obj.name.substring (obj.name.length-2);  // get flag
      if      (tag == "1a") op1a = op1a + " " + val; // stuff data
      else if (tag == "1b") op1b = op1b + " " + val;
      else if (tag == "2a") op2a = op2a + " " + val;
      else if (tag == "2b") op2b = op2b + " " + val;
      else if (tag == "3i") itmn = itmn + " " + val;
      else if (des.length == 0) des = val;
      else des = des + ", " + val;
    }
  }
// Now summarize stuff we just processed, above
  if (op1a.length > 0) obj1.on0.value = op1a;  // stuff it away
  if (op1b.length > 0) obj1.os0.value = op1b;
  if (op2a.length > 0) obj1.on1.value = op2a;
  if (op2b.length > 0) obj1.os1.value = op2b;
  if (itmn.length > 0) obj1.item_number.value = itmn;
  obj1.item_name.value = des;
  obj1.amount.value = Dollar (amt);
  if (obj1.tot) obj1.tot.value = "$" + Dollar (amt);
}
//-->
</script>


Save and close your template.html.



Open themes/your_theme/theme.php.

Search your theme file to see if these templates or functions already exist in the file;

If any of these templates or functions already exist, they will have to be edited, as explained below. If they do not exist, simply copy and paste the following code, after any existing templates but before any existing functions;
// HTML template for title row of the thumbnail view (album title + sort options)
if (!isset($template_thumb_view_title_row))  //{THEMES}
$template_thumb_view_title_row = <<<EOT

                        <table width="100%" cellpadding="0" cellspacing="0">
                        <tr>
                                <td width="35%" class="statlink"><h2>{ALBUM_NAME}</h2></td>
                                <td><img src="images/spacer.gif" width="1" alt="" /></td>
								<td width="30%"><center><a href="thumbnails.php?album=favpics">View<br />Favourites</a></center></td>
								<td><img src="images/spacer.gif" width="1" alt="" /></td>
                                <td>
                                        Click on the thumbnails to see larger version, and to buy.
                                </td>
                        </tr>
                        </table>

EOT;


// HTML template for intermediate image display
if (!isset($template_display_media))  //{THEMES}
$template_display_media = <<<EOT
        <tr>
                <td align="center" class="display_media" nowrap="nowrap">
                        <table cellspacing="2px" cellpadding="0px" class="imageborder">
                                <tr>
                                        <td align="center">
                                                {IMAGE}

                                        </td>
                                </tr>
                        </table>
                </td></tr>
                <tr><td>
                                                <table width="100%" cellspacing="2px" cellpadding="0px" class="tableb">
                                <tr>
                                        <td align="center">

                                                {ADMIN_MENU}
                                        </td>
                                </tr>
                        </table>





<!-- BEGIN img_desc -->
                        <table cellpadding="0px" cellspacing="0px" class="tableb" width="100%">
<!-- BEGIN title -->
                                <tr>
                                        <td class="tableb"><center><b>
                                                {TITLE}
                                        </b></center></td>
                                </tr>
<!-- END title -->
<!-- BEGIN caption -->
                                <tr>
                                        <td class="tableb"><center>
                                                {CAPTION}
											
                                        </center></td>
                                </tr>
<!-- END caption -->
<!-- END img_desc -->
<tr>
                                        <td font size="-1"><center><br /><br />
                                                
	<table>		<tr><td valign="top"><form action="https://www.paypal.com/cgi-bin/webscr" method="post" 
onsubmit="this.target = 'paypal';
          ReadForm (this);">
<p>
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="add" value="1" />
<input type="hidden" name="business" value="{$CONFIG['paypal_email']}" />
<input type="hidden" name="item_name" value="Photo Name : {TITLE}" />
<input type="hidden" name="amount" value="" />
<input type="hidden" name="currency_code" value="{$CONFIG['currency']}" />


<input type="hidden" name="baseamt" value="{$CONFIG['size1_price']}" />
<input type="hidden" name="basedes" value="Photo Name, '{TITLE}', Filename, '{FILENAME}'" />

 
Select size and frame here   
<select onchange = "ReadForm (this.form);">
<option value="{$CONFIG['size1']} @{$CONFIG['size1_price']} ">{$CONFIG['size1']};    {$CONFIG['currency_symbol']}{$CONFIG['size1_price']}   </option>
<option value="{$CONFIG['size2']} @{$CONFIG['size2_price']}">{$CONFIG['size2']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size2_price']}   </option>
<option value="{$CONFIG['size3']} @{$CONFIG['size3_price']}">{$CONFIG['size3']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size3_price']}</option>
<option value="{$CONFIG['size4']} @{$CONFIG['size4_price']}">{$CONFIG['size4']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size4_price']}</option>
<option value="{$CONFIG['size5']} @{$CONFIG['size5_price']}">{$CONFIG['size5']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size5_price']}</option>
<option value="{$CONFIG['size6']} @{$CONFIG['size6_price']}">{$CONFIG['size6']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size6_price']}</option>
<option value="{$CONFIG['size7']} @{$CONFIG['size7_price']}">{$CONFIG['size7']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size7_price']}</option>
<option value="{$CONFIG['size8']} @{$CONFIG['size8_price']}">{$CONFIG['size8']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size8_price']}</option>
<option value="{$CONFIG['size9']} @{$CONFIG['size9_price']}">{$CONFIG['size9']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size9_price']}</option>
<option value="{$CONFIG['size10']} @{$CONFIG['size10_price']}">{$CONFIG['size10']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size10_price']}</option>
<option value="{$CONFIG['size11']} @{$CONFIG['size11_price']} ">{$CONFIG['size11']};    {$CONFIG['currency_symbol']}{$CONFIG['size11_price']}</option>
<option value="{$CONFIG['size12']} @{$CONFIG['size12_price']}">{$CONFIG['size12']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size12_price']}</option>
<option value="{$CONFIG['size13']} @{$CONFIG['size13_price']}">{$CONFIG['size13']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size13_price']}</option>
<option value="{$CONFIG['size14']} @{$CONFIG['size14_price']}">{$CONFIG['size14']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size14_price']}</option>
<option value="{$CONFIG['size15']} @{$CONFIG['size15_price']}">{$CONFIG['size15']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size15_price']}</option>
<option value="{$CONFIG['size16']} @{$CONFIG['size16_price']}">{$CONFIG['size16']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size16_price']}</option>

<option value="{$CONFIG['size17']} @{$CONFIG['size17_price']}">{$CONFIG['size17']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size17_price']}</option>
<option value="{$CONFIG['size18']} @{$CONFIG['size18_price']}">{$CONFIG['size18']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size18_price']}</option>
<option value="{$CONFIG['size19']} @{$CONFIG['size19_price']}">{$CONFIG['size19']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size19_price']}</option>
<option value="{$CONFIG['size20']} @{$CONFIG['size20_price']}">{$CONFIG['size20']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size20_price']}</option>
</select>
   
Paper   
<input type="hidden" name="on0" value="Paper"><select name="os0"><option value="Glossy">Glossy<option value="Matt">Matt<option value="Satin">Satin</select>
    


<input type="image" src="https://www.paypal.com/en_GB/i/btn/x-click-but22.gif" name="submit" alt="cart add" />

</p>
</form></td></tr>


		</table>	
		
		
                                        </td>
                                </tr>





                        </table>

                </td>
        </tr>

EOT;


// Displays a picture
if (!function_exists('theme_html_picture')) {  //{THEMES}
function theme_html_picture()
{
    global $CONFIG, $CURRENT_PIC_DATA, $CURRENT_ALBUM_DATA, $USER;
    global $album, $comment_date_fmt, $template_display_media;
    global $lang_display_image_php, $lang_picinfo;

    $pid = $CURRENT_PIC_DATA['pid'];
    $pic_title = '';

    if (!isset($USER['liv']) || !is_array($USER['liv'])) {
        $USER['liv'] = array();
    }
    // Add 1 to hit counter
    if (!USER_IS_ADMIN && !in_array($pid, $USER['liv']) && isset($_COOKIE[$CONFIG['cookie_name'] . '_data'])) {
        add_hit($pid);
        if (count($USER['liv']) > 4) array_shift($USER['liv']);
        array_push($USER['liv'], $pid);
    }

    if($CONFIG['thumb_use']=='ht' && $CURRENT_PIC_DATA['pheight'] > $CONFIG['picture_width'] ){ // The wierd comparision is because only picture_width is stored
      $condition = true;
    }elseif($CONFIG['thumb_use']=='wd' && $CURRENT_PIC_DATA['pwidth'] > $CONFIG['picture_width']){
      $condition = true;
    }elseif($CONFIG['thumb_use']=='any' && max($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight']) > $CONFIG['picture_width']){
      $condition = true;
    }else{
     $condition = false;
    }

    if ($CURRENT_PIC_DATA['title'] != '') {
        $pic_title .= $CURRENT_PIC_DATA['title'] . "\n";
    }
    if ($CURRENT_PIC_DATA['caption'] != '') {
        $pic_title .= $CURRENT_PIC_DATA['caption'] . "\n";
    }
    if ($CURRENT_PIC_DATA['keywords'] != '') {
        $pic_title .= $lang_picinfo['Keywords'] . ": " . $CURRENT_PIC_DATA['keywords'];
    }

    if (!$CURRENT_PIC_DATA['title'] && !$CURRENT_PIC_DATA['caption']) {
        template_extract_block($template_display_media, 'img_desc');
    } else {
        if (!$CURRENT_PIC_DATA['title']) {
            template_extract_block($template_display_media, 'title');
        }
        if (!$CURRENT_PIC_DATA['caption']) {
            template_extract_block($template_display_media, 'caption');
        }
    }

    $CURRENT_PIC_DATA['menu'] = html_picture_menu(); //((USER_ADMIN_MODE && $CURRENT_ALBUM_DATA['category'] == FIRST_USER_CAT + USER_ID) || ($CONFIG['users_can_edit_pics'] && $CURRENT_PIC_DATA['owner_id'] == USER_ID && USER_ID != 0) || GALLERY_ADMIN_MODE) ? html_picture_menu($pid) : '';

    if ($CONFIG['make_intermediate'] && $condition ) {
        $picture_url = get_pic_url($CURRENT_PIC_DATA, 'normal');
    } else {
        $picture_url = get_pic_url($CURRENT_PIC_DATA, 'fullsize');
    }

    $image_size = compute_img_size($CURRENT_PIC_DATA['pwidth'], $CURRENT_PIC_DATA['pheight'], $CONFIG['picture_width']);

    $pic_title = '';
    $mime_content = cpg_get_type($CURRENT_PIC_DATA['filename']);


    if ($mime_content['content']=='movie' || $mime_content['content']=='audio') {

        if ($CURRENT_PIC_DATA['pwidth']==0 || $CURRENT_PIC_DATA['pheight']==0) {
            $CURRENT_PIC_DATA['pwidth']  = 320; // Default width

            // Set default height; if file is a movie
            if ($mime_content['content']=='movie') {
                $CURRENT_PIC_DATA['pheight'] = 240; // Default height
            }
        }

        $ctrl_offset['mov']=15;
        $ctrl_offset['wmv']=45;
        $ctrl_offset['swf']=0;
        $ctrl_offset['rm']=0;
        $ctrl_offset_default=45;
        $ctrl_height = (isset($ctrl_offset[$mime_content['extension']]))?($ctrl_offset[$mime_content['extension']]):$ctrl_offset_default;
        $image_size['whole']='width="'.$CURRENT_PIC_DATA['pwidth'].'" height="'.($CURRENT_PIC_DATA['pheight']+$ctrl_height).'"';
    }

    if ($mime_content['content']=='image') {
        if (isset($image_size['reduced'])) {
            $winsizeX = $CURRENT_PIC_DATA['pwidth']+5;  //the +'s are the mysterious FF and IE paddings
            $winsizeY = $CURRENT_PIC_DATA['pheight']+3; //the +'s are the mysterious FF and IE paddings
            $pic_html = "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid=$pid&fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=no,status=no,resizable=yes,width=$winsizeX,height=$winsizeY')\">";
            $pic_title = $lang_display_image_php['view_fs'] . "\n==============\n" . $pic_title;
            $pic_html .= "<img src=\"" . $picture_url . "\" class=\"image\" border=\"0\" alt=\"{$lang_display_image_php['view_fs']}\" /><br />";
            $pic_html .= "</a>\n";
        } else {
            $pic_html = "<img src=\"" . $picture_url . "\" {$image_size['geom']} class=\"image\" border=\"0\" alt=\"\" /><br />\n";
        }
    } elseif ($mime_content['content']=='document') {
        $pic_thumb_url = get_pic_url($CURRENT_PIC_DATA,'thumb');
        $pic_html = "<a href=\"{$picture_url}\" target=\"_blank\" class=\"document_link\"><img src=\"".$pic_thumb_url."\" border=\"0\" class=\"image\" /></a>\n<br />";
    } else {
        $autostart = ($CONFIG['media_autostart']) ? ('true'):('false');

        $players['WMP'] = array('id' => 'MediaPlayer',
                                'clsid' => 'classid="" ',
                                'codebase' => 'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" ',
                                'mime' => 'type="application/x-mplayer2" ',
                               );
        $players['RMP'] = array('id' => 'RealPlayer',
                                'clsid' => 'classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" ',
                                'codebase' => '',
                                'mime' => 'type="audio/x-pn-realaudio-plugin" '
                               );
        $players['QT']  = array('id' => 'QuickTime',
                                'clsid' => 'classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ',
                                'codebase' => 'codebase="http://www.apple.com/qtactivex/qtplugin.cab" ',
                                'mime' => 'type="video/x-quicktime" '
                               );
        $players['SWF'] = array('id' => 'SWFlash',
                                'clsid' => ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ',
                                'codebase' => 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ',
                                'mime' => 'type="application/x-shockwave-flash" '
                               );
        $players['UNK'] = array('id' => 'DefaultPlayer',
                                'clsid' => '',
                                'codebase' => '',
                                'mime' => ''
                               );

        if (isset($_COOKIE[$CONFIG['cookie_name'].'_'.$mime_content['extension'].'player'])) {
            $user_player = $_COOKIE[$CONFIG['cookie_name'].'_'.$mime_content['extension'].'player'];
        } else {
            $user_player = $mime_content['player'];
        }

                // There isn't a player selected or user wants client-side control
        if (!$user_player) {
            $user_player = 'UNK';
        }

        $player = $players[$user_player];

        $pic_html  = '<object id="'.$player['id'].'" '.$player['clsid'].$player['codebase'].$player['mime'].$image_size['whole'].'>';
        $pic_html .= "<param name=\"autostart\" value=\"$autostart\" /><param name=\"src\" value=\"". $picture_url . "\" />";
        $pic_html .= '<embed '.$image_size['whole'].' src="'. $picture_url . '" autostart="'.$autostart.'" '.$player['mime'].'></embed>';
        $pic_html .= "</object><br />\n";
    }

    $CURRENT_PIC_DATA['html'] = $pic_html;
    $CURRENT_PIC_DATA['header'] = '';
    $CURRENT_PIC_DATA['footer'] = '';

    $CURRENT_PIC_DATA = CPGPluginAPI::filter('file_data',$CURRENT_PIC_DATA);

    $params = array('{CELL_HEIGHT}' => '100',
        '{IMAGE}' => $CURRENT_PIC_DATA['header'].$CURRENT_PIC_DATA['html'].$CURRENT_PIC_DATA['footer'],
        '{ADMIN_MENU}' => $CURRENT_PIC_DATA['menu'],
        '{TITLE}' => bb_decode($CURRENT_PIC_DATA['title']),
        '{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
		'{FILENAME}' => $CURRENT_PIC_DATA['filename'],
        );

    return template_eval($template_display_media, $params);
}
}



If these templates or functions already exist, make a backup copy of your file, then replace them with those above. That is often all that will be needed. If not, edit them as here;

  • HTML template for title row of the thumbnail view


  • Find this code;
    <td class="sortorder_cell">
                                            <table cellpadding="0" cellspacing="0">
                                            <tr>
                                                    <td class="sortorder_options">{TITLE}</td>
                                                    <td class="sortorder_options"><span class="statlink"><a href="thumbnails.php?album={AID}&page={PAGE}&sort=ta" title="{SORT_TA}"> + </a></span></td>
                                                    <td class="sortorder_options"><span class="statlink"><a href="thumbnails.php?album={AID}&page={PAGE}&sort=td" title="{SORT_TD}"> - </a></span></td>
                                            </tr>
                                            <tr>
                                                    <td class="sortorder_options">{NAME}</td>
                                                    <td class="sortorder_options"><span class="statlink"><a href="thumbnails.php?album={AID}&page={PAGE}&sort=na" title="{SORT_NA}"> + </a></span></td>
                                                    <td class="sortorder_options"><span class="statlink"><a href="thumbnails.php?album={AID}&page={PAGE}&sort=nd" title="{SORT_ND}"> - </a></span></td>
                                            </tr>
                                            <tr>
                                                    <td class="sortorder_options">{DATE}</td>
                                                    <td class="sortorder_options"><span class="statlink"><a href="thumbnails.php?album={AID}&page={PAGE}&sort=da" title="{SORT_DA}"> + </a></span></td>
                                                    <td class="sortorder_options"><span class="statlink"><a href="thumbnails.php?album={AID}&page={PAGE}&sort=dd" title="{SORT_DD}"> - </a></span></td>
                                            </tr>
                                            <tr>
                                                    <td class="sortorder_options">{POSITION}</td>
                                                    <td class="sortorder_options"><span class="statlink"><a href="thumbnails.php?album={AID}&page={PAGE}&sort=pa" title="{SORT_PA}"> + </a></span></td>
                                                    <td class="sortorder_options"><span class="statlink"><a href="thumbnails.php?album={AID}&page={PAGE}&sort=pd" title="{SORT_PD}"> - </a></span></td>
    
    And replace it with;
    <td>
                                            Click on the thumbnails to see larger version, and to buy.
                                    </td>
    


  • HTML template for intermediate image display
  • Find this code;
    </table>
    <!-- END img_desc -->
                    </td>
            </tr>
    
    EOT;


    And replace it with this code;
    <!-- END img_desc -->
    <tr>
                                            <td font size="-1"><center><br /><br />
                                                    
    	<table>		<tr><td valign="top"><form action="https://www.paypal.com/cgi-bin/webscr" method="post" 
    onsubmit="this.target = 'paypal';
              ReadForm (this);">
    <p>
    <input type="hidden" name="cmd" value="_cart" />
    <input type="hidden" name="add" value="1" />
    <input type="hidden" name="business" value="{$CONFIG['paypal_email']}" />
    <input type="hidden" name="item_name" value="Photo Name : {TITLE}" />
    <input type="hidden" name="amount" value="" />
    <input type="hidden" name="currency_code" value="{$CONFIG['currency']}" />
    
    
    <input type="hidden" name="baseamt" value="{$CONFIG['size1_price']}" />
    <input type="hidden" name="basedes" value="Photo Name, '{TITLE}', Filename, '{FILENAME}'" />
    
     
    Select size and frame here   
    <select onchange = "ReadForm (this.form);">
    <option value="{$CONFIG['size1']} @{$CONFIG['size1_price']} ">{$CONFIG['size1']};    {$CONFIG['currency_symbol']}{$CONFIG['size1_price']}   </option>
    <option value="{$CONFIG['size2']} @{$CONFIG['size2_price']}">{$CONFIG['size2']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size2_price']}   </option>
    <option value="{$CONFIG['size3']} @{$CONFIG['size3_price']}">{$CONFIG['size3']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size3_price']}</option>
    <option value="{$CONFIG['size4']} @{$CONFIG['size4_price']}">{$CONFIG['size4']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size4_price']}</option>
    <option value="{$CONFIG['size5']} @{$CONFIG['size5_price']}">{$CONFIG['size5']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size5_price']}</option>
    <option value="{$CONFIG['size6']} @{$CONFIG['size6_price']}">{$CONFIG['size6']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size6_price']}</option>
    <option value="{$CONFIG['size7']} @{$CONFIG['size7_price']}">{$CONFIG['size7']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size7_price']}</option>
    <option value="{$CONFIG['size8']} @{$CONFIG['size8_price']}">{$CONFIG['size8']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size8_price']}</option>
    <option value="{$CONFIG['size9']} @{$CONFIG['size9_price']}">{$CONFIG['size9']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size9_price']}</option>
    <option value="{$CONFIG['size10']} @{$CONFIG['size10_price']}">{$CONFIG['size10']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size10_price']}</option>
    <option value="{$CONFIG['size11']} @{$CONFIG['size11_price']} ">{$CONFIG['size11']};    {$CONFIG['currency_symbol']}{$CONFIG['size11_price']}</option>
    <option value="{$CONFIG['size12']} @{$CONFIG['size12_price']}">{$CONFIG['size12']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size12_price']}</option>
    <option value="{$CONFIG['size13']} @{$CONFIG['size13_price']}">{$CONFIG['size13']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size13_price']}</option>
    <option value="{$CONFIG['size14']} @{$CONFIG['size14_price']}">{$CONFIG['size14']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size14_price']}</option>
    <option value="{$CONFIG['size15']} @{$CONFIG['size15_price']}">{$CONFIG['size15']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size15_price']}</option>
    <option value="{$CONFIG['size16']} @{$CONFIG['size16_price']}">{$CONFIG['size16']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size16_price']}</option>
    
    <option value="{$CONFIG['size17']} @{$CONFIG['size17_price']}">{$CONFIG['size17']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size17_price']}</option>
    <option value="{$CONFIG['size18']} @{$CONFIG['size18_price']}">{$CONFIG['size18']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size18_price']}</option>
    <option value="{$CONFIG['size19']} @{$CONFIG['size19_price']}">{$CONFIG['size19']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size19_price']}</option>
    <option value="{$CONFIG['size20']} @{$CONFIG['size20_price']}">{$CONFIG['size20']} ;    {$CONFIG['currency_symbol']}{$CONFIG['size20_price']}</option>
    </select>
       
    Paper   
    <input type="hidden" name="on0" value="Paper"><select name="os0"><option value="Glossy">Glossy<option value="Matt">Matt<option value="Satin">Satin</select>
        
    
    
    <input type="image" src="https://www.paypal.com/en_GB/i/btn/x-click-but22.gif" name="submit" alt="cart add" />
    
    </p>
    </form></td></tr>
    		</table>		
                                           </td>
                                    </tr>
                            </table>
                    </td>
            </tr>
    
    EOT;
    


  • function theme_html_picture()
  • Find the following code;
    '{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
    


    And add in a new line, immediately after;
    '{FILENAME}' => $CURRENT_PIC_DATA['filename'],
    




    Customising the above code to your needs.

    The above code assumes you are going to provide your customers with a choice of 20 sizes/frames etc. If you are offering less than that, edit the paypal to remove the lines you are not using, i.e., if offering 6 choices, remove the lines for size7 to size20.

    You can edit the line for paper selection, to say what you want, for instance, change 'Satin' to 'Lustre'. You can also remove this line if not offering a choice of paper type.

    Save and close your theme files.



    Changes to displayimage.php

    Open displayimage.php, and find;

    '{IMAGE}' => $pic_html,
            '{ADMIN_MENU}' => $picture_menu,
            '{TITLE}' => $CURRENT_PIC_DATA['title'],
            '{CAPTION}' => bb_decode($CURRENT_PIC_DATA['caption']),
    


    Add after;
    '{FILENAME}' => $CURRENT_PIC_DATA['filename'],
    


    Save and close displayimage.php.


    Changes to index.php.

    These changes are not absolutely required, but remove the album info (number of files, last added etc.) from the album index page, which you may want to keep.

    Open index.php, and find, and comment out, the following lines, which are in the file 4 times;

    $alb_list[$alb_idx]['album_info'] = sprintf($lang_list_albums['n_pictures'], $count) . ($count ? sprintf($lang_list_albums['last_added'], $last_upload_date) : "");
    


    Save and close index.php




    Applying the hack to your install.

  • Upload the the hack files to your server.
  • Browse to www.your_site.com/your_gallery/update.php, and click 'continue, at the bottom of the page.
  • Log in, and go to the config page. Fill in your paypal registered email address, and the sizes/prices you have available.
  • See the enclosed shop.html for further details.
  • Start raking in the money.
  • When you've made a fortune, remember me