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.

#1 2015-01-18 07:30:54

gaufde
Member
From: Ojai, CA
Registered: 2014-07-11
Posts: 72
Website

Digital Downloads on Separate Servers

Hi,
Basically what I would like is to automatically serve digital downloads from a sub domain with a cart on the main domain. Here is my set up and background:
I have been setting up three different sites with the TTG blog and galleries bundle along with the cart. One site (gracesonaufderheide.com) is my blog and info about me as well as a portal to get to my other sites. One of the other sites is for my photography and one if for my jewelry work. Both of these other two sites are on sub domains (photography.gra..., and goldsmith.gra...). I have made these sites fairly interconnected, because I want it to feel like one site with different sections for the different things I do. Because of this, I have my shopping cart set up at gracesonaufderheide.com/ttg-be/cart, and all three sites point to this location for the cart. I have my photo galleries set up at photography.gracesonaufderheide.com/galleries/. These image galleries are managed by a publisher install at photography.gracesonaufderheide.com/ttg-be/publisher. I want to sell digital downloads from these galleries (I have publisher uploading photos-for-download for me), but it's not working across servers. I know that I am supposed to have the cart and the galleries on the same server, and I also know that I can use the offline digital download feature to upload each file individually if i have to, but I would like to be able to use the files publisher created automatically. I'm not entirely sure if this is possible (I know very little about websites as I only started when I began my sites a couple weeks ago), but it seems to me like I should be able to point the cart to the location of my galleries using phplugins, the cart config file, phpliteadmin, or something else to tell the program where to go for these files.
Thanks,
Graceson


Graceson Aufderheide
gracesonaufderheide.com

Offline

#2 2015-01-18 08:29:31

Ben
Moderator
From: Melbourne, Australia
Registered: 2012-09-29
Posts: 4,399

Re: Digital Downloads on Separate Servers

I covered all options in my email reply.  The cart can not locate digital purchases on a different subdomain or site.  There is no work-around via config, php plugins or phpliteadmin.
You have the option of using offline digital purchases, or installing and running TTG BE and the Cart on the sub-domain that the galleries reside on.

Offline

#3 2015-01-18 08:38:55

gaufde
Member
From: Ojai, CA
Registered: 2014-07-11
Posts: 72
Website

Re: Digital Downloads on Separate Servers

Hi Ben,
I didn't realize that it wasn't possible from your e-mail because it sounded like you weren't sure. I guess that I'll just stick to the offline digital purchase option for now then.
Thanks for your help,
Graceson


Graceson Aufderheide
gracesonaufderheide.com

Offline

#4 2015-01-18 08:49:32

Ben
Moderator
From: Melbourne, Australia
Registered: 2012-09-29
Posts: 4,399

Re: Digital Downloads on Separate Servers

Sorry, my email meant that if it didn't work then it wouldn't work, if that makes sense.

If you're happy to experiment, the following changes may do what you need.

1. Replace the pathForDownload function in ttg-be/cart/application/helpers/ApplicationHelper.php with the following:

    static function pathForDownload($photoPath, $downloadDirectory='photos-for-purchase')
    {
        $photosPos = strrpos($photoPath, '/photos/');
        $downloadURL = substr($photoPath, 0, $photosPos).'/'.$downloadDirectory.'/'.substr($photoPath, $photosPos+8);
        
        if (defined('REAL_PATH_OF_PHOTOS_SITE')) {
            $parsedURL = parse_url($downloadURL);
            $realPath = REAL_PATH_OF_PHOTOS_SITE.$parsedURL['path'];
            
            try {
                if (is_file($realPath)) {
                    return $realPath;
                }
            } catch (Exception $ex) {
                return false;
            }
        }
        
        $realPath = CartHelper::realPathOfFile($downloadURL);

        return $realPath;
    }

2. Add a line to ttg-be/cart/index.php, so that the top of the file looks something like this:

<?php
define('REAL_PATH_OF_PHOTOS_SITE', '/home/photog83/public_html/photography');

//$start = microtime(true);

I'm assuming that /home/photog83/public_html/photography is the correct path to the top of your http://photography.gracesonaufderheide.com/ sub-domain.  You may need to change this.

If this works I will include this code in the next Cart update, so you won't need to edit the files again.  You would want to check that the downloads are available for purchase, and that the correct copies of the images download after purchase.

Offline

#5 2015-01-18 10:38:29

gaufde
Member
From: Ojai, CA
Registered: 2014-07-11
Posts: 72
Website

Re: Digital Downloads on Separate Servers

Hi Ben,
I just inserted the code, and it works! I tested it out in a couple different galleries and went through the entire process of ordering, approving, and downloading. I haven't noticed anything weird, and I got the right files when I downloaded them. Thank you for your help, and I really appreciate you including this into the next cart update to make it easier for me to use.

Graceson


Graceson Aufderheide
gracesonaufderheide.com

Offline

#6 2015-01-18 15:08:34

Ben
Moderator
From: Melbourne, Australia
Registered: 2012-09-29
Posts: 4,399

Re: Digital Downloads on Separate Servers

Hi Graceson, that's great.  Thanks for confirming.

Offline

Board footer

Powered by FluxBB