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.
Pages: 1
For the checkout, in Backlight 1, my custom php code is the following code, but what is the right new code for Backlight 2:
<?php function page_match($gallery) {
if (substr($_SERVER["REQUEST_URI"], 0, strlen($gallery)) == $gallery) {
return 1;
} else {
return 0;
}
}
function ttg_scripts($style, $path) {
echo'
<script>
function moveNumbers(number){
document.getElementsByName("paiement")[0].value=number;
}
</script>
';
if ( page_match('/backlight/cart') ) {
echo '
<script>
$("input[name=paiement]").before(\'<br>Veuillez sélectionner votre méthode de règlement:<br><input type="radio" name="no" value="Virement" onclick="moveNumbers(this.value)"> Virement<br> <input type="radio" name="no" value="Cheque" onclick="moveNumbers(this.value)"> Chèque (Chèque d'un établissement bancaire situé sur le territoire français uniquement)<br> <input type="radio" name="no" value="Mandat" onclick="moveNumbers(this.value)"> Mandat Administratif (France Uniquement)<br> <input type="radio" name="no" value="Devis" onclick="moveNumbers(this.value)"> Je souhaites recevoir un devis (Pour les commande en quantité ou établir un bon de commande)\');
$("input[name=paiement]").hide();
</script>
';
}
echo '
<a href="#top" class="btn-scroll-to-top" title="Top of page" ><i class="fa fa-arrow-up fa-lg"></i></a>
<script>
$(document).ready(function() {
$(".btn-scroll-to-top").click(function() {
$("html, body").animate({ scrollTop: 0 }, "slow");
return false;
});
$(window).scroll(function() {
if ($(this).scrollTop() > 200) {
$(".btn-scroll-to-top").fadeIn();
} else {
$(".btn-scroll-to-top").fadeOut();
}
});
});
</script>
';
echo '
<script>
$("<div class=\'cart-instructions\'><p>Note:</p></div>").insertBefore("form#cart #cart-buttons");
</script>
';
echo '<script>
$( "<div class=\'my-cart-message\'><p>Vous pourrez vérifier votre commande avant de finaliser votre achat. / You will be able to review your order before you complete your purchase</p></div>" ).insertBefore( "form#cart #cart-buttons" );
</script>
';
echo '<script>
var acc = document.getElementsByClassName("accordion");
var i;
for (i = 0; i < acc.length; i++) {
acc[i].addEventListener("click", function() {
this.classList.toggle("active");
var panel = this.nextElementSibling;
if (panel.style.maxHeight){
panel.style.maxHeight = null;
} else {
panel.style.maxHeight = panel.scrollHeight + "px";
}
});
}
</script>
';
return false;
}
?>
I try to put that at the beginning, and a } at the end, but nothing happen:
<?php
class PHPlugins extends APHPlugins
{
And replace:
function ttg_scripts($style, $path) {
by
function scripts() {
Last edited by Nico3939 (2019-05-28 07:07:21)
Offline
Phplugins has changed in BL2.
You need to start with the phplugins-pangolin-sample.php file found in the backlight/custom/phplugins/ folder of your BL2 download.
You’ll see that the function names have changed.
Also see this sticky post from Daniel: http://community.theturninggate.net/vie … hp?id=8966
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
ok I'm moving slowly
is this function:
if ( page_match('/backlight/cart') ) {
replaced by this one?
if( preg_match( '/^BACKLIGHT-PANGOLIN(.*)$/', $this->style ) ) {
Offline
Matt, Ben, or maybe Daniel will know
Rod
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site
Offline
I finally find the right code:
<?php
/*
* TTG Core Elements "PHPlugins" User Hooks v1.2 - initialization mainline
*
* developed by john bishop images (http://johnbishopimages.com)
* for Matthew Campagna of The Turning Gate (http://theturninggate.net)
*
*/
function user_load($style, $path) {
$g_tsvrl = explode(' ', $style); // Extract gallery type
define ('G_STYLE', strtoupper($g_tsvrl[1])); // and set global for later
$g_path = str_ireplace('\\','/',$path); // change \ to /
$chunks = explode('/',$g_path); // and put into array
define ('G_PATH', strtoupper($chunks[count($chunks)-2])); // gallery folder name is second to last
//define ( 'TTG_SITE', ''); // set new site root for navigation, resources, etc.
}
if (defined('BACKLIGHT_HOOK')) {
require_once(realpath(BACKLIGHT_HOOK).'/modules/module-designer/application/helpers/APHPlugins.php');
}
class PHPlugins extends APHPlugins
{
function page_match($gallery) {
if (substr($_SERVER["REQUEST_URI"], 0, strlen($gallery)) == $gallery) {
return 1;
} else {
return 0;
}
}
function scripts() {
echo '
<script>
function moveNumbers(number){
document.getElementsByName("paiement")[0].value=number;
}
</script>
';
if ( $this->page_match('/backlight/cart') ) {
echo '
<script>
$("input[name=paiement]").before(\'<br>Veuillez sélectionner votre méthode de règlement:<br><input type="radio" name="no" value="Virement" onclick="moveNumbers(this.value)"> Virement<br> <input type="radio" name="no" value="Cheque" onclick="moveNumbers(this.value)"> Chèque (Chèque d'un établissement bancaire situé sur le territoire français uniquement)<br> <input type="radio" name="no" value="Mandat" onclick="moveNumbers(this.value)"> Mandat Administratif (France Uniquement)<br> <input type="radio" name="no" value="Devis" onclick="moveNumbers(this.value)"> Je souhaites recevoir un devis (Pour les commande en quantité ou établir un bon de commande)\');
$("input[name=paiement]").hide();
</script>
';
}
echo '
<a href="#top" class="btn-scroll-to-top" title="Top of page" ><i class="fa fa-arrow-up fa-lg"></i></a>
<script>
$(document).ready(function() {
$(".btn-scroll-to-top").click(function() {
$("html, body").animate({ scrollTop: 0 }, "slow");
return false;
});
$(window).scroll(function() {
if ($(this).scrollTop() > 200) {
$(".btn-scroll-to-top").fadeIn();
} else {
$(".btn-scroll-to-top").fadeOut();
}
});
});
</script>
';
echo '
<script>
$("<div class=\'cart-instructions\'><p>Note:</p></div>").insertBefore("form#cart #cart-buttons");
</script>
';
echo '<script>
$( "<div class=\'my-cart-message\'><p>Vous pourrez vérifier votre commande avant de finaliser votre achat. / You will be able to review your order before you complete your purchase</p></div>" ).insertBefore( "form#cart #cart-buttons" );
</script>
';
echo '<script>
var acc = document.getElementsByClassName("accordion");
var i;
for (i = 0; i < acc.length; i++) {
acc[i].addEventListener("click", function() {
this.classList.toggle("active");
var panel = this.nextElementSibling;
if (panel.style.maxHeight){
panel.style.maxHeight = null;
} else {
panel.style.maxHeight = panel.scrollHeight + "px";
}
});
}
</script>
';
return false;
}
}
?>
Thanks for all Rod
Offline
ok I'm moving slowly
is this function:
if ( page_match('/backlight/cart') ) {
replaced by this one?
if( preg_match( '/^BACKLIGHT-PANGOLIN(.*)$/', $this->style ) ) {
You could use
if ($this->page_match('/backlight/cart')) {
corrected according to next post
Daniel Leu | Photography
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com
Offline
Thanks Daniel,
with another ")"
if ( $this->page_match('/backlight/cart') ) {
Offline
This is what happens when opening the computer before the first coffee....
Daniel Leu | Photography
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com
Offline
Pages: 1