Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2007
    Posts
    3
    Plugin Contributions
    0

    red flag How to add custom keys like license/security etc ?

    I am writing some custom code to handle our digital downloads because they come from a different server. When setting up a product, you simple enter the link and password and it stores it in the database. What i am trying to accomplish, is to have that link and password sent in the confirmation email. I believe the email is setup correctly, as well as the part with setting up the product. The link and password are getting stored in the database like they are supposed to, but that information is not getting sent over to the orders_products table. I am sure i missed something in order.php, but where exactly does the information get sent from products table to the order_products table in the database.

    Thanks in advance.

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Database Question

    This is not that simple as Zen Cart maintains this on an order basis and you can then set individual order allowable # of downloads or days.

    It is not a generic link + pass and is tied to an order
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: Database Question

    Quote Originally Posted by cheapdevotion View Post
    I am sure i missed something in order.php, but where exactly does the information get sent from products table to the order_products table in the database.
    Instead of storing it in order_products, why not just insert it as if it were attribute info related to products on the confirmation email.

    In the order.php class, the $this->products_ordered and $this->products_ordered_html variables are populated with that information. You could intercept the loop that builds that data and insert what you need there.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    Jul 2007
    Posts
    3
    Plugin Contributions
    0

    Default Re: Database Question

    Thanks for the help DrByte, but i am not exactly sure how to do this. I did see the chunk of code that prepares the output e-mail, but how can i get it to pull that information on a per products basic? I was thinking something like $this->products_info['products_link'], would that do the trick?

  5. #5
    Join Date
    Jan 2004
    Posts
    66,444
    Plugin Contributions
    279

    Default Re: Database Question

    You could try this:

    Find the lines in the order.php class that say this (around 845):
    Code:
          //------eof: insert customer-chosen options ----
    
          // update totals counters
    insert custom code between those two lines, like this:
    Code:
          //------eof: insert customer-chosen options ----
    
    
    // START: ADD MY CUSTOM DETAILS
          $my_custom_data = $db->Execute("SELECT product_link, product_password from  " . TABLE_PRODUCTS . " where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'");
          $this->products_ordered_attributes .= "\n\t" . 'Download Link: ' . $my_custom_data->fields['product_link'] . "\n\t" . 'Password: ' . $my_custom_data->fields['product_password'];
    // END: ADD MY CUSTOM DETAILS
    
          // update totals counters
    The assumption in the above example was that your new fields are in the "products" table and named "product_link" and "product_password".

    The details will be added to individual product line-items in the emails as part of the normal attribute information details.



    Another approach has also been discussed in this thread:
    http://www.zen-cart.com/forum/showthread.php?p=408334
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #6
    Join Date
    Jul 2007
    Posts
    3
    Plugin Contributions
    0

    Default Re: Database Question

    Thank you so much DrByte, that worked like a charm. It is always something simple if you spend too much time on it ;) Next week you will have a cup of coffee on me!

 

 

Similar Threads

  1. v153 Selling License Keys
    By VintageOrton in forum General Questions
    Replies: 4
    Last Post: 11 Aug 2014, 04:55 AM
  2. Add Custom Shipping Options, like Store Pickup
    By minneapolis_dan in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 12 Jun 2009, 04:36 PM
  3. Replies: 3
    Last Post: 5 Feb 2008, 01:04 AM
  4. Software Products With License Keys?
    By Rodzilla in forum General Questions
    Replies: 2
    Last Post: 30 Jan 2006, 02:37 AM

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