Community @ The Turning Gate

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.

  • New user registrations are disabled.
  • Users cannot create new topics.
  • Users cannot reply to existing topics.

You are not logged in.

#26 Backlight 2 Customization » SinglePage.php not calling plugin copy_top() function » 2019-04-03 03:23:16

mad
Replies: 5

While using SinglePage.php I expected that the plugin copy_top() function would be called but it is not calling it.  It is Calling the scripts() function in plugins but I have a need for it to call to the other plugin functions.  Am I forgetting something or is it suppose to work this way.  I need it to call copy_top and copy_bottom functions.

Michael

#27 Re: Backlight 2 Support » Select Image Question » 2019-04-03 00:03:50

mad

I have thought of using sessions information just hadn't coded it yet; but it is something that I would do as I start coding for the new Cart.  I eventually want to migrate from using fotomoto cart to a non-cost cart.

BTW, I have another question about adding a couple of additional buttons to the  xxxxx-single.php (toolbar fancy-box for the cart) for my new cart as I code it.  Is there a quick way to add those buttons since backlight controls the display of the single.php for the slideshow?  I was wondering if there was a function call that I could use to do those adds or be able to pass it in as part of when you construct the slideshow.  If not then I guess I will have to write that part of it as well.  I just hate reinventing the wheel though. lol!!!

#28 Re: Backlight 2 Support » Updating documentation » 2019-04-02 20:27:41

mad

Matt,

On the Client Response, I think it would be beneficial to discuss the login/logout aspect of the CRG, a real-world example of how to use function plugin for login/logout with the menu.  Also, I think that when this is describe that for the Managed (Private) Gallery then a discussion to use this shortSiteURL().'backlight/clients/logout'; in the code which is much better for logouts for a Managed Gallery.

Just a thought since I had seen many discussions on how to code this in the plugins but the example in the plugins is not very useful!!!  So, maybe a discussion on which functions can be called like shortSiteURL() and exactly what it returns.  I figured this all out since I know how to write code I think it will be a useful documentation for non-coders if they have a real world example.

One more thought, I think it would be beneficial to people to show a few examples of how to setup a Client Response Gallery in LR or Backlight.  Since in most cases You will have to set up a Managed and UnManaged Gallery for any one client.  This means that you need to take care and how this is presented to clients.  For example, in my case I found that I have the client enter in their album name which is part of the name of the album in LR/Backlight Gallery - then I create a dynamic menu item for them to access that album. Then show them their Album Set for the Client showing all of their albums (Their photos album, managed albums, shared albums, etc.) then they can login to any of their albums but the added benefit is that no other client or user can see their albums nor can they guess at the clients album name but even if they did they are all protected by login.  But, there are other examples of how to set this up as I have tried a few; but I think this is a useful discussion in the documentation.



Thanks,
Michael

#29 Re: Backlight 2 Support » Highlight Selected Menu Item while selected » 2019-04-02 20:18:01

mad

For the children on your site you need to change this section of the code to how your galleries and its children are set up.
This is particular to my system.  My children are exactly 10 chars plus the leading '/' which makes 11 chars to strip; so it looks like this /galleries/mychildno1 and after the strip it looks like this /mychildno1 if you have something like /galleries/catalogs/mychildno1/ then you need to strip from the back your slug length characters minus the last '/' in my case something like this var parname = pname.substr(-1,11)                   // instead of the strip of below  a negative number uses it as a character index from the end of the string remember 0 is the first character in this case the last '/'.

            if (pname.indexOf("galleries/") == 1)                        // if Top-level Gallery
            {   
                var pname = pname.substr(10, 11);                        // Strip off the actual Page 
            }    // Otherwise it is a normal Page (meaning non-gallery)

#30 Re: Backlight 2 Support » Select Image Question » 2019-04-02 05:30:58

mad

Hi Ben,

When I built the album in the plugins (album_top function) I added code to create/write data to a sql DB and then set a query string on the image as it was built.  So when an image is selected I know the image # and can then access that on another page after getting the information I needed from the DB.   I also use a similar technique to pass the category(item_pricing) between pages.  I am currently in the process to fix my problem of Shipping using the backlight cart; but I may build my own cart to bypass the limitations of the backlight cart based on what we talked about in our email exchange. Currently, I turned off the backlight cart in Production environment replacing it with fotomoto my previous cart until I get the cart replaced; I only had to update my plugins file.

Michael

#31 Re: Backlight 2 Support » Cart Pop-up/Cart Edit Item Page Question » 2019-04-02 02:29:47

mad

I have solved this so no response is needed.

#32 Re: Backlight 2 Support » Select Image Question » 2019-04-02 02:28:39

mad

I have solved this so no worries.  I wanted to know the selected item when I was on another page.

#33 Re: Backlight 2 Support » Highlight Selected Menu Item while selected » 2019-04-02 02:25:01

mad

I have the solution for this as follows for children as well additionally this simple example also has the added support of if you wanted to highlight the menus even for galleries.

    echo '
        <style type="text/css">
            .selected
            {
                background-color: red !important; 
                color: yellow !important;
            }
        </style>
       <script>
       $(function()
       {
            var pname = window.location.pathname;                        // Get the Pathname
            if (pname.indexOf("galleries/") == 1)                        // if Top-level Gallery
            {   
                var pname = pname.substr(10, 11);                        // Strip off the actual Page
            }    // Otherwise it is a normal Page (meaning non-gallery)
            // populate the menu and children
            $("ul.menu a[href=\'" + pname + "\']")
              .parentsUntil(".menu", "li")
              .addClass("selected").parents("li").children("a").addClass("selected");
         });       
        </script>
        ';

This is working on my website [fully tested] and it works with search results as well.  I put this in my scripts function plugin but you can use it the way you code it.

One more thing this piece of the code above depends on your system and how your galleries are setup.
            if (pname.indexOf("galleries/") == 1)                        // if Top-level Gallery
            {   
                var pname = pname.substr(10, 11);                        // Strip off the actual Page
            }    // Otherwise it is a normal Page (meaning non-gallery)

#34 Backlight 2 Support » Select Image Question » 2019-03-29 00:58:19

mad
Replies: 7

Is there a function call that will return the photo that was selected.  For example a function like getSelectedPhoto?  I am looking to see if there is a function call that will tell me which photo on the page was selected.

#35 Backlight 2 Support » Cart Pop-up/Cart Edit Item Page Question » 2019-03-28 23:27:32

mad
Replies: 1

Is there a way to go directly to the Cart Edit item Page rather than having the Cart Pop-up Page?  If not I would like this to be added as a possibility or at least let me know the best way to do this.

#36 Re: Backlight 2 Support » Discount codes/Bands question » 2019-03-28 05:56:04

mad

Hi,

Here is what I did first I added code to the Scripts function in the phplugins file based on the page that was being shown (i.e. ImageCart).

Example:
function scripts
{
// Determine what page you are on this can be done in many ways I chose to do it with a functions call to get the URL then determine the Page
    switch ($page)
   {
       case 'ImageCartPage':                             // whatever your page is called  [I use a variable though]
              showDiscount($page);                      // a function that I put in the plugin file above the class sets a cookie with yes or no
              break;
       case 'cart':                                             // this is the backlight cart page
              if(isset($_COOKIE[$cookie_cart_discount]))
            {
                if ($_COOKIE[$cookie_cart_discount] == 'no')         // I use yes or no from the showDiscount function
                {    // if no then I hide the discount entry field when the Cart pop-up shows
                    echo '
                        <style type="text/css">
                            .discount-entry
                            {
                                display:none;
                            }
                        </style>
                        ';
                }       
            }       
            break;
   }
}

// here is an example of the showDiscount function I use - mine is more involved
function showDiscount($page)
{
         $cookie_cart_discount = 'cartdiscount';                //  Set up a cookie name
   
    switch($page)
    {
        case 'glryimgcrt':                                // My Gallery img cart name(slug)
        case 'lmtdimgcrt':                                // My Limited Fine Art cart Name(slug)
        case 'imgcrtglry':                                // My Clients Cart Name(slug)
            $myCategory = getMyCategory();                // This is my function to get the Pricing scheme store on the MetaData Category called 'itempricing'
            if ($myCategory != '')                    // There are a few ways to get the Pricing Schemes but I added a querystring '?category='xxxxxx' where xxxx is the // pricing scheme.  But you could also read the backlight Database too or some other mechanism
            {   
                if ($page == 'glryimgcrt')               
                {        // Used an array of all the Pricing Schemes and set to yes or no depending on when I want a discount applied = yes
                    $schemes = array("Digital Downloads Multi Pricing"=>"no","Photographic Prints Pricing"=>"no","Photographic Dream Prints Pricing"=>"no","Photographic Fine Art Pricing"=>"no","Acrylic Block Pricing"=>"no","Acrylic Face Mounted Small Pricing"=>"no",...etc...etc...etc);
                }
                elseif ($page == 'lmtdimgcrt')   
                {
                    $schemes = array("Lmtd Art Print Canvas Pricing"=>"no","Lmtd Acrylic Metal Print Pricing"=>"no","Lmtd Metal Print Pricing"=>"no","Lmtd Fine Art Print Pricing"=>"no"....etc....etc...etc);
                } // etc..
                foreach($schemes as $catkey => $catvalue)
                {
                    if ($myCategory == $catkey)
                    {    // find the pricing scheme = to what is in my array and set the cookie so when the Cart pop-up is called then it can be shown or not shown
                        if ($catvalue == 'yes')
                        {
                            setcookie($cookie_cart_discount, 'yes', 0 , "/","EXAMPLE.COM",true); 
                            return true;
                        }
                        else
                        {
                            setcookie($cookie_cart_discount, 'no', 0 , "/","EXAMPLE.COM",true);
                            return false;
                        }       
                    }
                }
            }
            setcookie($cookie_cart_discount, 'no', 0 , "/","EXAMPLE.COM",true);
            break;
        default:
            break;
    }
}

If you need help with the URL or getPage functions let me know you can reach me via my site https://keylightphotography.us/contact

Hope this helps.. let me know  Using it this way I only need to change the showDiscounts function to turn on or off the Pricing schemes and republish the plugin file no other changes are required.  Makes it fast and easy.

#37 Re: Backlight 2 Support » Discount codes/Bands question » 2019-03-28 03:24:39

mad

Since there was no reply here, I found a solution to only have discount codes apply to a specific product and not have it displayed every time if a product does not have a discount associated with it. Let me know if anyone wants to know how I did this and I will gladly share it.

#38 Backlight 2 Support » Problem with Shipping in Backlight Admin » 2019-03-28 00:56:16

mad
Replies: 0

I added some new products, pricing schemes in my test environment but when I went to shipping and added the shipping costs for these products in Admin it allows me to add them when I save them and the shipping is no longer incomplete.  But, when I go back into the shipping the data is no longer there.

BTW, the database is also showing it is null values.  This means that Backlight Admin Cart Pricing Shipping is not saving it even though I did save it several times.
Here are the database fields.

Edit
Delete
54
31
3
NULL
NULL
NULL
2019-03-26 11:20:35
NULL

Edit
Delete
55
32
3
NULL
NULL
NULL
2019-03-26 11:34:38
NULL

Edit
Delete
56
33
3
NULL
NULL
NULL
2019-03-26 11:45:10
NULL

Edit
Delete
57
34
3
NULL
NULL
NULL
2019-03-26 16:18:08
NULL

Edit
Delete
58
35
3
NULL
NULL
NULL
2019-03-27 13:14:09
NULL


Haven't heard from anyone on this problem.  I need to have this fixed so that I can put this in my production environment!!!!

#39 Re: Backlight 2 Customization » How to Set an Album in plugins » 2019-03-28 00:46:16

mad

Not a good answer, I just need to know how to call the constructor class and the members of the class on my own to create the album.  It is not complicated just want to use it the way I want.  Nonetheless, I have found a way around the problem (which is now running in my prod environment) but I would prefer to just know how the album is constructed in the first place so that I can do what I need to do without having to hide what backlight album include is showing which by the way is not constructing it correctly anyway.  It should be there to expose the album class constructor I would prefer not to look through the backlight code to find the answer.

#40 Re: Backlight 2 Customization » How to Set an Album in plugins » 2019-03-20 22:02:36

mad

Let me explain:  I have a album_top function which is my own flavor of how I want and plan on displaying photos in an album; as I have plans to do things with the photos that backlight does not support.  Basically, I am enhancing how and when I want photos to display.  Doing this requires that I also taking control of the Page and showing the album the way I want.  So, under designer in backlight I have the Page that is being called and it includes the Album; however this is not the default behavior I want; I want the Page using the Base Page Template I set up but then I can modify the page by including the album using the dispatch('album_top') function when the page is called to display the way I want the photos within the album to display.  I do have future plans to add some things to the photos specific to the individual photos; therefore, I need control of the individual photos of the album.  I already do this partially with the Shop Galleries on my site; just looking for more control.

However, the Page with the include to the album is not what I want displayed.  I just want the page and I then want to construct/include my own code for the album to display.  However, as soon as I remove the include from the Designer->Page for the album.  I have no way to construct the album so I can call the dispatch->('album_top') to run through the code I developed for the purposes I want to do.  I need a way to call a class constructor for the album before I call the dispatch->('album_top').  Obviously, there is a way to do this as the Designer->Page include Album is already doing this but I do not see where it is constructing this include; I do not want this include to happen; I want to construct my own include and then process through my own code.  I just need to bypass the Designer->Page Album include.  I have this working but as I said it shows my album and then the Backlight Designer-Page Album include.

One Possible way around this problem is that I could include a dummy Gallery Album with no photos as the include on the Page but to me that is just inefficient but it will work as it will only show what I want it to show.  I would prefer how to include my own Album to the Page rather than directly through backlight designer->page which limits what I can do in the future.

My code to what I am wanting is to large to include here but safe to say it does work the way I want with all my galleries (CRG, cart, etc..) with the possibility of my future additions on a per photo basis in an Album.

Hope this explains it better.

#41 Backlight 2 Customization » How to Set an Album in plugins » 2019-03-20 07:31:56

mad
Replies: 4

I have a Page that I am loading by calling my version of album_top in plugins by using the $this-->dispatch('album_top') and it is working correctly.  However, when I remove the Page include Album the Album is no longer set and the $this-> pointers no longer exists since there is no album.  So right now I have two different versions of the album loading one that is mine and the other is backlight which is loading after mine.  How can I set the album from a page directly so that I can call $this-->dispatch('album_top') and not get a duplicate album being loaded by backlight [meaning not to include it from backlight->designer->album]; how to supress.

I do not see any functions in ABHPlugins class to set the album specific to my needs.

Any suggestions?

#43 Re: Backlight 2 Customization » Error in user load function in phplugins - how to fix?? » 2019-03-20 04:15:22

mad

Well that is not what I want to do. user_load is a public function so it should work.

#44 Backlight 2 Customization » Error in user load function in phplugins - how to fix?? » 2019-03-20 02:48:45

mad
Replies: 7

Here is the error:
Something went wrong

Unexpected error: Undefined offset: 1 in kp-plugins.php on line 13

Please report error at http://community.theturninggate.net

Here is the function in plugins file
By the way this is the first time I am using this function which I have not changed from the default sample file.  I have the latest Sample file also.

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.
}

Here is my calling function from copy_top()
user_load($this->style, $this->path);
Here is the values of style and path that is being passed
Path=/galleries/landscapes
Style=BACKLIGHT-PANGOLIN

Any Suggestions???

#45 Re: Backlight 2 Support » How to access Metadata Category field in php plugin » 2019-03-19 23:34:31

mad

Thanks Ben that helps since I am retrieving the Category field for mixed pricing when album_top plugin is called. Appreciate it!!

#46 Re: Backlight 2 Support » Help with Menu Highlighting » 2019-03-12 03:00:01

mad

Well it did not work for me until I used it on the sample script with the escape.  Also, the children code that I posted I had works as well.  But, it did not highlight everything I am looking at why some menu items did not get highlighted when selected.  I think it is because of the window location pathname.

#47 Re: Backlight 2 Support » Help with Menu Highlighting » 2019-03-12 02:45:47

mad

ok thanks, I will play around with it.

#48 Re: Backlight 2 Support » Help with Menu Highlighting » 2019-03-12 02:43:27

mad

I tried the one in the sample script but it also gives me the same error. I will try the escape char.  What about the item I have for the children and parent to both be highlighted?  Will it work as well or did I miss something?

#49 Backlight 2 Support » Help with Menu Highlighting » 2019-03-12 02:17:07

mad
Replies: 6

Hi the code I am using is below in the scripts plugin file but I keep getting an error when I implement; I think it is correct but my eyes could be deceiving me. I need a second pair of eyes to see what I am not seeing. 

    echo '
            <style type="text/css">
                .selected
                {
                    background-color: red !important;
                    color: black !important;
                }
            </style>
           <script>
                $(function()
                {
                    $("ul.menu a[href='" + window.location.pathname + "']")
                        .parentsUntil(".menu", "li")
                        .addClass("selected");
                });       
            </script>
        ';   
Here is the error I am getting when I run this:
Something went wrong

Unexpected error: syntax error, unexpected '" + window.location.pathname +' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ';' in kp-plugins.php on line 371

Please report error at http://community.theturninggate.net

Also, I would like to add the effect to also be on the both the parent & children and I think this should work but let me know this as well.
                    $("ul.menu a[href='" + window.location.pathname + "']")
                        .parentsUntil(".menu", "li")
                        .addClass("selected").parents("li").children("a").addClass("selected");

#50 Re: Backlight 2 Support » Very slow upload - any help? » 2019-03-11 21:02:29

mad

Hi, How is the speed between your SSD device and your Surface Pro 4 (transfer files to your drive)?  If it is slow then check which type of USB-A you have i.e. Standard Type A USB 2.0 or Standard Type A USB 3.0; to tell the difference the Type A end for USB 3.0 will have the blue slide if 2.0 will be white/other color than blue.  Also, can your SSD do wireless if so than you should be able to connect it with the wireless (GB ethernet through your Surface Pro 4 bypassing the cables).  I have done this and it works fine if you consider that I live in a rural community where the upload speed is only 1mb and that I have a Toshiba laptop 7 year old gen 3 I7 processor. I also run LR, TTG and everything though my wireless GB ethernet without any issues.  So I would suspect that you may have configuration issues with your Surface Pro 4 or the cables themselves.  One more thing to check in your Surface Pro 4 configuration does your ethernet/wireless (wi-fi) connection have or is type 802.11n or is your connection type 802.11abg? abg is typically slower than type n. Hope this helps!!!!

Board footer

Powered by FluxBB