PDA

View Full Version : Add "Custom Pro Pricing Photo" to your < photo tools >


Nimai
Oct-11-2007, 08:14 AM
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.

devbobo
Oct-11-2007, 01:20 PM
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

Nimai
Oct-11-2007, 02:50 PM
Nimai,

This is very cool, but you can rewrite like this... :bowWhoah... must get more familiar with the YUI stuff! Very nice.

hydro
Oct-12-2007, 12:21 PM
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.

bkatz
Oct-25-2007, 05:46 PM
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.