Page 2 of 12 FirstFirst 1234 ... LastLast
Results 11 to 20 of 113
  1. #11
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,488
    Plugin Contributions
    88

    Default Re: Restrict Digital Downloads [Support Thread]

    If you move that error_log statement, do you still get the log?
    Code:
    // -----
    // Part of the "Restrict Digital Downloads" plugin by Cindy Merkin ([email protected])
    // Copyright (c) 2014 Vinos de Frutas Tropicales
    //
    switch ($_GET['action']) {
      /*----
      ** If a product is being added to the cart and that product includes attributes (the $_POST['id'] array
      ** is set), then check each of the attributes being added to see if there is a download/virtual product amongst them.  If so,
      ** don't allow the duplicate download/virtual product to be added to the cart ... or just add 1 if this is the original add.
      */
      case 'add_product': {
        if ($_SESSION['is_restricted_ip'] && isset($_POST['products_id']) && $_POST['cart_quantity'] > 0 && isset($_POST['id']) && is_array($_POST['id'])) {
          error_log (__FILE__ . ':' . print_r ($_POST, true));
          foreach($_POST['id'] as $option => $value) {
            if (is_digital_download ($_POST['products_id'], $option, $value)) {
              $messageStack->add ('header', sprintf (CART_MESSAGE_DOWNLOAD_PRODUCT_RESTRICTED, zen_get_products_name ($_POST['products_id'])), 'caution');
              unset ($_GET['action']);
              break;
    
            }
          }
        }
        break;
      }
    }

  2. #12
    Join Date
    Aug 2009
    Location
    North Idaho, USA
    Posts
    2,008
    Plugin Contributions
    1

    Default Re: Restrict Digital Downloads [Support Thread]

    Quote Originally Posted by lat9 View Post
    If you move that error_log statement, do you still get the log?
    yes, the log is generated with similar content.
    Rick
    RixStix (dot) com
    aka: ChainWeavers (dot) com

  3. #13
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,488
    Plugin Contributions
    88

    Default Re: Restrict Digital Downloads [Support Thread]

    This is (obviously) kicking my bu++. How about this edit:
    Code:
    // -----
    // Part of the "Restrict Digital Downloads" plugin by Cindy Merkin ([email protected])
    // Copyright (c) 2014 Vinos de Frutas Tropicales
    //
    switch ($_GET['action']) {
      /*----
      ** If a product is being added to the cart and that product includes attributes (the $_POST['id'] array
      ** is set), then check each of the attributes being added to see if there is a download/virtual product amongst them.  If so,
      ** don't allow the duplicate download/virtual product to be added to the cart ... or just add 1 if this is the original add.
      */
      case 'add_product': {
        if ($_SESSION['is_restricted_ip'] && isset($_POST['products_id']) && $_POST['cart_quantity'] > 0 && isset($_POST['id']) && is_array($_POST['id'])) {
           foreach($_POST['id'] as $option => $value) {
            error_log ('rdd add_product:  products_id = ' . $_POST['products_id'] . ", options_id = $option, value_id = $value, is_digital_download = " . ((is_digital_download ($_POST['products_id'], $option, $value)) ? 'Yes' : 'No'));
            if (is_digital_download ($_POST['products_id'], $option, $value)) {
              $messageStack->add ('header', sprintf (CART_MESSAGE_DOWNLOAD_PRODUCT_RESTRICTED, zen_get_products_name ($_POST['products_id'])), 'caution');
              unset ($_GET['action']);
              break;
    
            }
          }
        }
        break;
      }
    }

  4. #14
    Join Date
    Aug 2009
    Location
    North Idaho, USA
    Posts
    2,008
    Plugin Contributions
    1

    Default Re: Restrict Digital Downloads [Support Thread]

    Different logfile

    Code:
    [16-Dec-2014 07:52:38 America/Los_Angeles] rdd add_product:  products_id = 776, options_id = 6, value_id = Array, is_digital_download = No
    Rick
    RixStix (dot) com
    aka: ChainWeavers (dot) com

  5. #15
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,488
    Plugin Contributions
    88

    Default Re: Restrict Digital Downloads [Support Thread]

    Arggh, I should have seen that before. Do you have a customized /includes/modules/YOUR_TEMPLATE/attributes.php? For a 'out-of-the-box' Zen Cart attributes.php, the 'id' value will come back as an array in options_id => options_values_id format, like the following:
    Code:
    [14-Dec-2014 14:56:50 America/Los_Angeles] /home/XXXXXXXX/public_html/ZEN153/includes/extra_cart_actions/restrict_digital_downloads.php:Array
    (
        [securityToken] => Not sure if it is OK to post that
        [cart_quantity] => 1
        [products_id] => 776
        [id] => Array
            (
                [6] => 61
     
            )
    
    )

  6. #16
    Join Date
    Aug 2009
    Location
    North Idaho, USA
    Posts
    2,008
    Plugin Contributions
    1

    Default Re: Restrict Digital Downloads [Support Thread]

    Quote Originally Posted by lat9 View Post
    Arggh, I should have seen that before. Do you have a customized /includes/modules/YOUR_TEMPLATE/attributes.php? For a 'out-of-the-box' Zen Cart attributes.php, the 'id' value will come back as an array in options_id => options_values_id format, like the following:
    No, I do not. Searched using Developers Took Kit and didn't find anything by that name.

    I did 'drop' the fileset into template_default instead of installing a vanilla template, did nothing on the admin side other than change template to classic_green.

    Same result.

    Work is calling my name so I'll be in and out for the next few hours.
    Rick
    RixStix (dot) com
    aka: ChainWeavers (dot) com

  7. #17
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,488
    Plugin Contributions
    88

    Default Re: Restrict Digital Downloads [Support Thread]

    There's got to be something different; I've tested this on a Zen Cart v1.5.1 and a Zen Cart v1.5.3 store and both stores log the 'id' variable as 'id'[options_id][values_id].

  8. #18
    Join Date
    Aug 2009
    Location
    North Idaho, USA
    Posts
    2,008
    Plugin Contributions
    1

    Default Re: Restrict Digital Downloads [Support Thread]

    Sorry I couldn't reply sooner. This forum does not play nice with Surface tablets which is my only access in the manufacturing room.

    I was going to suggest that I wipe the sandbox and start from scratch instead of you tracking down ghosts or other unknowns.
    Rick
    RixStix (dot) com
    aka: ChainWeavers (dot) com

  9. #19
    Join Date
    Aug 2009
    Location
    North Idaho, USA
    Posts
    2,008
    Plugin Contributions
    1

    Default Re: Restrict Digital Downloads [Support Thread]

    That is the format of the logfile prior to the last suggested edit.

    includes/modules/attributes.php default file is being used.

    It looks like your download product examples have more than a single attribute choice. Ours currently only have a single attribute. Any chance that is related?

    Quote Originally Posted by lat9 View Post
    Arggh, I should have seen that before. Do you have a customized /includes/modules/YOUR_TEMPLATE/attributes.php? For a 'out-of-the-box' Zen Cart attributes.php, the 'id' value will come back as an array in options_id => options_values_id format, like the following:
    Code:
    [14-Dec-2014 14:56:50 America/Los_Angeles] /home/XXXXXXXX/public_html/ZEN153/includes/extra_cart_actions/restrict_digital_downloads.php:Array
    (
        [securityToken] => Not sure if it is OK to post that
        [cart_quantity] => 1
        [products_id] => 776
        [id] => Array
            (
                [6] => 61
     
            )
    
    )
    Last edited by RixStix; 16 Dec 2014 at 09:14 PM.
    Rick
    RixStix (dot) com
    aka: ChainWeavers (dot) com

  10. #20
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,488
    Plugin Contributions
    88

    Default Re: Restrict Digital Downloads [Support Thread]

    Quote Originally Posted by RixStix View Post
    That is the format of the logfile prior to the last suggested edit.

    includes/modules/attributes.php default file is being used.

    It looks like your download product examples have more than a single attribute choice. Ours currently only have a single attribute. Any chance that is related?
    You nailed it! I've got this replicated now on my local test site and should have a correction by the morning. Thanks a bunch!

 

 
Page 2 of 12 FirstFirst 1234 ... LastLast

Similar Threads

  1. Hebrew Support - latest release [Support Thread]
    By eranariel in forum Addon Language Packs
    Replies: 19
    Last Post: 23 Jan 2023, 08:04 AM
  2. v151 Limit Quantities for Downloads and Virtual Products [Support Thread]
    By lat9 in forum All Other Contributions/Addons
    Replies: 47
    Last Post: 17 Jan 2016, 03:48 PM
  3. v154 Email Downloads Support Thread
    By swguy in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 17 Jun 2015, 06:41 PM
  4. Digital Downloads
    By keithck73 in forum General Questions
    Replies: 8
    Last Post: 9 Mar 2009, 06:45 PM
  5. Admin Users - Restrict Product Categories Support Thread
    By anafor in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 13 Aug 2008, 09:30 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR