Options

Add "Custom Pro Pricing Photo" to your < photo tools >

NimaiNimai Registered Users Posts: 564 Major grins
Some (many?) have related frustrating stories of reseting their entire galleries prices when they intended to set some custom pricing options for an individual photo. I do this enough that I made some javascript to add an option right to the gallery photo tools to take me directly to the pricing for the current photo - no risk of forgetting to click image on the next page!
function imageToolsEx() {
   var photoTools = document.getElementById('tools');
   if( photoTools.options[photoTools.selectedIndex].id == 'proPricingPhotoChoice' )
      document.getElementsByName('Type')[0].value = '';
   imageTools();
}

function addProPricingPhoto() {
   if (YD.hasClass(document.body,"galleryPage") && YD.hasClass(document.body,"loggedIn")) {
      var photoTools = document.getElementById('tools');
      var proPricingPhoto = document.createElement('option');
      proPricingPhoto.text = 'Pro Pricing Photo';
      proPricingPhoto.value = 'proprices';
      proPricingPhoto.class = 'nonMovieTool';
      proPricingPhoto.id = 'proPricingPhotoChoice';
      photoTools.add( proPricingPhoto, photoTools.options[3] );
      photoTools.setAttribute( 'onChange', 'imageToolsEx();' );
   }
}

YE.on(window, "load", addProPricingPhoto);
Just add the above code to your javascript section in Customization.

Comments

  • Options
    devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited October 11, 2007
    Nimai,

    This is very cool, but you can rewrite like this...
    function imageToolsEx() {
       var photoTools = YD.get('tools');
       if( photoTools.options[photoTools.selectedIndex].id == 'proPricingPhotoChoice' )
          document.getElementsByName('Type')[0].value = '';
       imageTools();
    }
    
    function addProPricingPhoto() {
       var proPricingPhoto = document.createElement('option');
       proPricingPhoto.text = 'Pro Pricing Photo';
       proPricingPhoto.value = 'proprices';
       proPricingPhoto.class = 'nonMovieTool';
       proPricingPhoto.id = 'proPricingPhotoChoice';
       this.add( proPricingPhoto, photoTools.options[3] );
       this.setAttribute( 'onChange', 'imageToolsEx();' );
    }
    
    YE.onContenReady("tools", addProPricingPhoto);
    

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • Options
    NimaiNimai Registered Users Posts: 564 Major grins
    edited October 11, 2007
    devbobo wrote:
    Nimai,

    This is very cool, but you can rewrite like this...
    bowdown.gifWhoah... must get more familiar with the YUI stuff! Very nice.
  • Options
    hydrohydro Registered Users Posts: 11 Big grins
    edited October 12, 2007
    I didn't try the code posted by devbobo, but the OPs code did generate a javascript error in IE7 (didn't seem to affect FF2) that caused the slideshow on my homepage not to load.

    I didn't play around with it at all to determine might have been the problem. I just removed that bit of javascript, and all was well with the world again.
  • Options
    bkatzbkatz Registered Users Posts: 286 Major grins
    edited October 25, 2007
    Ruins my vanity URLS
    hydro wrote:
    I didn't try the code posted by devbobo, but the OPs code did generate a javascript error in IE7 (didn't seem to affect FF2) that caused the slideshow on my homepage not to load.

    I didn't play around with it at all to determine might have been the problem. I just removed that bit of javascript, and all was well with the world again.

    I was having trouble with my image pricing so I pasted bit the original code and Dev Bobo's code but my Vanity URLs died and I immediately removed it. As much as I need to price by image a few photos I can't lose my Vanity URLs since I just posted 4 galleries.

    Any help would be greatly appreciated.
Sign In or Register to comment.