Tips and Tricks HQ Support

Support site for Tips and Tricks HQ premium products

  • Home
  • Contact Us
  • Documentation
  • Forum Home
    • Forum
    • Forum Search
    • Forum Login
    • Forum Registration

eStore/NextGen – Limiting downloads to specific variations and securing links

by

Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › WP eStore Tweaks › eStore/NextGen – Limiting downloads to specific variations and securing links

Tagged: Nextgen Integration, Secure Downloads, variations

  • This topic has 12 replies, 2 voices, and was last updated 12 years, 6 months ago by Hephaestus.
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • October 26, 2012 at 12:19 pm #7748
    Hephaestus
    Member

    Hi,

    I’m currently using eStore 6.9.0.2 and NextGen 1.9.6 with the single product integration method and have two queries regarding the download functionality.

    Firstly, is it possible to use the eStore_perform_save_as_file_name_massaging() function to provide a more secure, unique download URL to each customer? For example if $file_name = $file_name.".jpg"; was rewritten as $file_name = "download_" . uniqid() .".jpg";

    Are there any issues with this approach?

    Secondly, if you have a variations list on the product like “Download:5.00|Print 3×4:10.00|Print 7×8: 12.00” is it possible to only provide a download link if the first variation is selected?

    October 27, 2012 at 5:20 am #50741
    admin
    Keymaster

    Yes, the teak you intend to apply looks correct.

    No, the download with variation won’t work like that. It usually works like that when you use the “Digital Variation” option of eStore but this method of NextGen Gallery integration doesn’t have that option as the image file gets served from NextGen gallery plugin.

    October 27, 2012 at 12:54 pm #50742
    Hephaestus
    Member

    Would it not be possible for me to add a check on which variation has been selected when the confirmation email is sent out, and strip the URL and download information there? If it is, could you point me in the right direction for which files to look at?

    October 28, 2012 at 3:40 am #50743
    admin
    Keymaster

    Which payment gateway are you using?

    October 28, 2012 at 11:33 am #50744
    Hephaestus
    Member

    We’re currently using PayPal, thanks.

    October 29, 2012 at 2:57 am #50745
    admin
    Keymaster

    Okay. There is a filter that eStore applies on the outgoing email body. If you are familiar with WordPress filters then you could write a small plugin to dynamically change the email body of each sale before it is sent out. If not, look for the following line of code in “paypal.php” file:

    $body = apply_filters('eStore_notification_email_body_filter', $body, $this->ipn_data, $cart_items);

    Change the email body however you wish just before or after the above mentioned line.

    October 29, 2012 at 9:28 am #50746
    Hephaestus
    Member

    How would I access the selected variation at this point?

    October 30, 2012 at 2:40 am #50747
    admin
    Keymaster

    That information is not available there in a *selectable* way. You would have to look at the *email body* and see how you can use regex to select it and then modify it how you want. It won’t be straightforward… this is why my first response to you was that this option is not available.

    October 31, 2012 at 10:20 am #50748
    Hephaestus
    Member

    Thanks for the help. Is the best way to quickly test this just to use the manual payment method?

    November 1, 2012 at 2:42 am #50749
    admin
    Keymaster

    I would recommend you to do a PayPal checkout, that way you will get the exact expected behavior since you are using PayPal for your checkout option.

    November 1, 2012 at 11:01 am #50750
    Hephaestus
    Member

    Unfortunately you can’t pay yourself with PayPal and eStore doesn’t seem to support the PayPal Developer Sandbox for testing. Can I not just modify paypal.php to skip over the actual payment process and jump to the order email?

    November 1, 2012 at 12:18 pm #50751
    Hephaestus
    Member

    Sorry, my mistake, I didn’t realise the sandbox mode was on the General Settings rather than Payment Gateways.

    November 1, 2012 at 12:56 pm #50752
    Hephaestus
    Member

    In case anyone is wondering how to do this in the future, here are my modifications to paypal.php. Remember to mark your changes with comments so they are easy to find and reapply when upgrading eStore in the future

    After var $sandbox_mode = false; on line 26 add:

    //Hephaestus - 01/11/2012

    var $download_variation; // only provide a download link for products with this variation

    Find this code block around line 400:

    //Generate link from Nextgen gallery if PID is present.

    if(!empty($pictureID))

    {

    $download_link = eStore_get_ngg_image_url($pictureID,$cart_item_data_name);

    $pictureID = "";

    }

    else

    {

    $download_link = generate_download_link($retrieved_product,$cart_item_data_name,$this->ipn_data);

    }

    $this->debug_log('Download Link : '.$download_link,true);

    Replace this with:

    //rbearman - 01/11/2012 - START

    //Don't provide a download link if the variation is not as specified in $download_variation

    if(strpos($cart_item_data_name, '('.$this->download_variation.')') !== false)

    {

    //Generate link from Nextgen gallery if PID is present.

    if(!empty($pictureID))

    {

    $download_link = eStore_get_ngg_image_url($pictureID,$cart_item_data_name);

    $pictureID = "";

    }

    else

    {

    $download_link = generate_download_link($retrieved_product,$cart_item_data_name,$this->ipn_data);

    }

    }

    else

    {

    $download_link = "";

    }

    $this->debug_log('Download Link : '.$download_link,true);

    //rbearman - 01/11/2012 - END

  • Author
    Posts
Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.
Log In

Forum Related

  • Forum Home
  • Forum Search
  • Forum Registration
  • Forum Login

Support Related Forms

  • Contact Us
  • Customer Support
  • Request a Plugin Update
  • Request Fresh Download Links

Useful Links

  • Plugin Upgrade Instructions
  • WP eStore Documentation
  • WP eMember Documentation
  • WP Affiliate Platform Documentation
  • Tips and Tricks HQ Home Page
  • Our Projects

Quick Setup Video Tutorials

  • WP eStore Video Tutorial
  • WP eMember Video Tutorial
  • WP Affiliate Platform Video Tutorial
  • Lightbox Ultimate Video Tutorial

Our Other Plugins

  • WP Express Checkout
  • Stripe Payments Plugin
  • Simple Shopping Cart Plugin
  • Simple Download Monitor

Copyright © 2025 | Tips and Tricks HQ