Forums / General Questions / How to add custom keys like license/security etc ?

How to add custom keys like license/security etc ?

Locked

Views: 3,335

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
3 Jul 2007, 6:45 PM
#1
cheapdevotion avatar

cheapdevotion

New Zenner

Join Date:
Jul 2007
Posts:
3
Plugin Contributions:
0

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.

3 Jul 2007, 9:36 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: How to add custom keys like license/security etc ?

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

4 Jul 2007, 5:39 AM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: How to add custom keys like license/security etc ?

cheapdevotion:

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.

5 Jul 2007, 12:51 PM
#4
cheapdevotion avatar

cheapdevotion

New Zenner

Join Date:
Jul 2007
Posts:
3
Plugin Contributions:
0

Re: How to add custom keys like license/security etc ?

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 Jul 2007, 5:35 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: How to add custom keys like license/security etc ?

You could try this:

Find the lines in the order.php class that say this (around 845):```
//------eof: insert customer-chosen options ----

  // update totals counters

insert custom code between those two lines, like this:
//------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 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.

5 Jul 2007, 7:27 PM
#6
cheapdevotion avatar

cheapdevotion

New Zenner

Join Date:
Jul 2007
Posts:
3
Plugin Contributions:
0

Re: How to add custom keys like license/security etc ?

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!