Support community for TTG plugins and products.
NOTICE
The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.
This forum is now closed, and exists here as a read-only archive.
You are not logged in.
Thanks Dan,
Updated button now as below:
echo '
<div align="center">
<button class="add-to-cart" data-item="'.$photo->getFilename().'" data-name="'.$photo->getMetadata(Photo::$PHOTO_TITLE).'" data-price="TasmanianPhotos Pricing Scheme Default" data-thumbnail="'.$photo->getThumbnailURL().'"> Buy this Photo</button>
</div>
';
Thanks Ben,
Did some more playing around - have it all working now. Think I had an echo or ' out of order somewhere.
Working code below - thank you again very much.
Cheers,
Chumby
function single_bottom(){
// support for left/right arrow key and esc key navigation
$photo = $this->photo;
$album = $this->album;
echo' <script>
function checkKey(e) {
switch(e.which) {
case 37: ';
if ($album->getPreviousPhoto($photo)) {
echo 'location.href=$("li.single_image_prev a").attr("href");';
}
echo 'break;
case 39:';
if ($album->getNextPhoto($photo)) {
echo 'location.href=$("li.single_image_next a").attr("href");';
}
echo 'break;
case 27:';
echo 'location.href=$("li.single_image_back a").attr("href");';
echo 'break;
default: return;
}
e.preventDefault();
}
document.onkeydown = checkKey;
</script>';
// Bottom of Footer Information
// Pay Now Button
echo '
<div align="center">
<button class="add-to-cart" data-item="'.$photo->getFilename().'" data-name="data-item" data-price="TasmanianPhotos Pricing Scheme Default" data-thumbnail="'.$photo->getThumbnailURL().'"> Buy this Photo</button>
</div>
';
//Summary Information under the single image
echo'
<div class="bold-red">Image Information</div>
<div class="single-image-footer-content">
Images are downloadable as JPEGs and are available in three sizes: <br />
</div>
<div class="single-image-footer-content">
<ul>
<li><strong>Large:</strong> (As per original size - approximate file size = 10-15 Mb). Suitable for print (posters and pictures).
<li><strong>Medium:</strong> (1200px longest edge - approximate file size = 1-1.5 Mb). Sutiable for small print & web applications.
<li><strong>Small:</strong> (600px longest edge - approximate file size 500 Kb file). Suitable for web applications.
</ul>
<p>The originally RAW rendered TIF files (Size > 50 Mb) may be sourced on request. These images are suitable for very large print such as banners or larger pictures. </p>
</div>
<div class="bold-red">About Tasmania</div>
<div class="single-image-footer-content">
<p>Tasmania is an Island State situated to the south of mainland Australia. Tasmania is 64,519 km squared in size and has a number of smaller islands surrouding it. It is a natural state with approximatley 40% of land protected including a large 15,800 km squarded area known as the Tasmanian Wilderness which is World Heritage listed.</p></div>
<div class="single-image-footer-content">
<p>The population of Tasmania (as of 2020) is approximately 520,000 people with approximately 225,000 living in the south in and around the capital city, Hobart.</p></div>
<div class="single-image-footer-content">
<p>Tasmanians enjoy a relaxed lifestyle and produce such as fruit, seafood and whiskey is produced to the highest standards in the world.</p></div>
';
}
Sorry Ben,
Was missing hte } after the first script. Put that in and the first error message now gone...
Now an error message comes up on the echo' line of the button...
Unexpected error: syntax error, unexpected 'echo' (T_ECHO), expecting function (T_FUNCTION) or const (T_CONST) in my-phplugins.php on line 1631
Cheers
Chumby
Thanks for helping out, Ben.
Didn't quite work...
"Unexpected error: syntax error, unexpected '<' in my-phplugins.php on line 1633"
My entire single_bottom function looks like: (not sure if this helps)
function single_bottom(){
// support for left/right arrow key and esc key navigation
$photo = $this->photo;
$album = $this->album;
echo' <script>
function checkKey(e) {
switch(e.which) {
case 37: ';
if ($album->getPreviousPhoto($photo)) {
echo 'location.href=$("li.single_image_prev a").attr("href");';
}
echo 'break;
case 39:';
if ($album->getNextPhoto($photo)) {
echo 'location.href=$("li.single_image_next a").attr("href");';
}
echo 'break;
case 27:';
echo 'location.href=$("li.single_image_back a").attr("href");';
echo 'break;
default: return;
}
e.preventDefault();
}
document.onkeydown = checkKey;
</script>';
// Bottom of Footer Information
echo'
<button class="add-to-cart" data-item="'.$photo->getFilename().'" data-name="data-item" data-price="digitalphoto" data-thumbnail="'.$photo->getThumbnailURL().'">Buy this Photo</button>';
<div class="bold-red">Image Information</div>
<div class="single-image-footer-content">
Images are downloadable as JPEGs and are available in three sizes: <br />
</div>
<div class="single-image-footer-content">
<ul>
<li><strong>Large:</strong> (As per original size - approximate file size = 10-15 Mb). Suitable for print (posters and pictures).
<li><strong>Medium:</strong> (1200px longest edge - approximate file size = 1-1.5 Mb). Sutiable for small print & web applications.
<li><strong>Small:</strong> (600px longest edge - approximate file size 500 Kb file). Suitable for web applications.
</ul>
<p>The originally RAW rendered TIF files (Size > 50 Mb) may be sourced on request. These images are suitable for very large print such as banners or larger pictures. </p>
</div>
<div class="bold-red">About Tasmania</div>
<div class="single-image-footer-content">
<p>Tasmania is an Island State situated to the south of mainland Australia. Tasmania is 64,519 km squared in size and has a number of smaller islands surrouding it. It is a natural state with approximatley 40% of land protected including a large 15,800 km squarded area known as the Tasmanian Wilderness which is World Heritage listed.</p></div>
<div class="single-image-footer-content">
<p>The population of Tasmania (as of 2020) is approximately 520,000 people with approximately 225,000 living in the south in and around the capital city, Hobart.</p></div>
<div class="single-image-footer-content">
<p>Tasmanians enjoy a relaxed lifestyle and produce such as fruit, seafood and whiskey is produced to the highest standards in the world.</p></div>
';
}
Cheers
Chumby
Thanks Daniel,
So I should be good to go with:
function single_bottom(){
$photo = $this->photo;
$album = $this->album;
echo'
<button class="add-to-cart" data-item=$photo->getFilename(); data-name=data-item data-price="digitalphoto" data-thumbnail=data-item;>Buy this Photo</button>
';
}
Cheers,
Chumby
Great, thanks Rod.
Found them now. Have tested the sandbox and all seems to be working so should be able to flick to live soon.
Cheers
Chumby
Hi there,
Just setting up my cart for the first time.
At the moment I just have digital downloads but later down the track I want to sell prints. What's the best way to set the cart up with this in mind (invoicing or not).
Also have set up a paypal business account, but can't seem to locate the api credentials. The paypal interface looks ike it has changed. Any pointers here?
Appreciate that.
Cheers,
Chumby
Hi Daniel,
Been playing around this morning but, till not quite sure of the code for the button function here...I'm trying below but it is not working.
function single_bottom(){
$photo = $this->photo;
$album = $this->album;
data-item = $photo->getFilename();
echo'
<button class="add-to-cart" data-item=data-item data-name=data-item data-price="digitalphoto" data-thumbnail=data-item;>Buy this Photo</button>
';
}
Am I remotely on track here?
Thanks
Chumby
Thanks Daniel,
That is great. I'll see if you can get the pay button working.
I see what you mean about the filesize. I wonder if you can interegate the download folder path?
Cheers
Chumby
Ok thanks Rod and Daniel,
Would definately not be hacking any code! Even if I wanted, my skill level would stop me
I'm not using lightroom so will investigate if I can actual image size written at the IPTC / metadata level for each image as it is exported. Don't know if this is possible though... Thanks for the lightroom tip also.
Cheers,
Martin
Thanks Daniel,
Looks good but how do you link this code up to your "But Image" button?
Also, is Filesize include in the photos info? If not - how do I integrate further javascript in my-php-plugins to find this out?
Thank you as always.
Cheers
Chumby
Syntax is all wrong, but theorectically something like...??
// Buy now button
function single_bottom(){
$photo = $this->photo;
echo' <script>
<button class="add-to-cart" data-item=$photo data-name=$photo data-price="digitalphoto" data-thumbnail=$photo>Buy
this Photo</button>
</script>
Cheers
Chumby
Hi all,
I have read the tutorial about creating a Write in Purchase Button at:
http://backlight.theturninggate.net/doc … se_buttons
I would like to include (if possible) and buy now button on a single image page above the text which I include in the single_bottom hook.
The button appears ok if I add the code:
<button class="add-to-cart" data-item="ebook-0001-litportraiture" data-name="Better Portraits with Portable Strobes" data-price="ebook" data-thumbnail="litportraiture-cover.jpg">Buy My New eBook</button>
but I need to include a unique filename for "data-item" (instead of the static example as per above).
Is there anyway I can use some php script to extract the current filename on a single image page and include that name in the data-item field for the button?
Hope that makes sense.
Cheers,
Chumby
Hi Rod,
The description box is at:
Backlight - Cart - Products - (My product name) - Edit
then you can put in a description for a product. So in the box I would like to include image specific detaiils.
Thanks
Chumby
Hi Rod,
Thanks for that...
In the cart itself - in the descripton box. I notice that you can use (md) in here but was thinking we could add javascript {script} and tokens {} as well to work out filesize, dimensionsand other information. (perhaps dpi?)
Cheers
Chumby
Hi there,
I notice the item name or "Filename" is passed through to the cart.
Is there anyway I can access this name (via a {} token for instance) in orfer to use the filename in some javascript located in the desciption box to ascertain other properties of the file such as size etc?
Or is there another way to present the files dimensions, size etc in the cart?
Cheers,
Chumby.
Hi all,
Apologies if I have missed this somewhere....
Is it possible for users to automatically download different versions of your image. ie set up a number of folders under root for say:
- Small Images
- Medium Images
etc
From what I can tell it seems that you can have only the one download folder in your site???
Cheers
Chumby
Thanks Matthew,
All sorted. Yes was a DIV issue.
Cheers
Chumby
Hi all,
Is there a way I can include some html at the bottom of a single image page - ie:
https://www.tasmanianphotos.com/tasmani … single.php
I am using using the single_bottom function as per below in my php_plugins for navigation.
Can I just add html in here or is there something else I need to do?
function single_bottom(){
// support for left/right arrow key and esc key navigation
$photo = $this->photo;
$album = $this->album;
echo' <script>
function checkKey(e) {
switch(e.which) {
case 37: ';
if ($album->getPreviousPhoto($photo)) {
echo 'location.href=$("li.single_image_prev a").attr("href");';
}
echo 'break;
case 39:';
if ($album->getNextPhoto($photo)) {
echo 'location.href=$("li.single_image_next a").attr("href");';
}
echo 'break;
case 27:';
echo 'location.href=$("li.single_image_back a").attr("href");';
echo 'break;
default: return;
}
e.preventDefault();
}
document.onkeydown = checkKey;
</script>';
}
Appreciate the help as always.
Cheers,
Chumby
Cheers Rod
Hi Rod,
Just to confirm - can you add more than one script in the scripts() hook function or are you limited to only only script bein able to be run in there...
Cheers,
Chumby
Hi Rod,
I am thinking about the web user being able to filter the order via a publicly viewed drop down or the like on the album.
Not admins that have access to backlight or lightroom... just thinking about user customization here. All good if not available.. just a thought...
Cheers
Chumby
That's good to know, Daniel.
If you had more than one script, Daniel, can you load them all into that one function? And then they will work for all pages?
Cheers
Chumby
Hi rod,
Yep got that one... I was talking about something a user may be able to use on the album homepage - not something in he backlight admin there.
I dont think that is possible at the moment?
Cheers
Chumby
Ok, nice one. Where is that option, Rod?
Cheers
Chumby