Forums / General Questions / Selling software licences

Selling software licences

Started by more_solutions on 22 May 2006, 3:56 PM · Views: 51,385

Results 121 to 131 of 131
10 Apr 2012, 3:35 PM
#121
cburgoyne avatar

cburgoyne

New Zenner

Join Date:
Oct 2010
Posts:
3
Plugin Contributions:
0

Selling software licences

Does any one have updated code for this in version 1.5.0?
I copied More-solutions (on page 2 ) and get a blank screen on check out.

10 Apr 2012, 5:01 PM
#122
davep avatar

davep

New Zenner

Join Date:
Feb 2008
Location:
Peoria, IL USA
Posts:
25
Plugin Contributions:
0

Re: Selling software licences

Here is an updated version that I am currently using with the latest Zen Cart:

 // START: MSL - Licences Mod 
     $licences = array(); 
    //$db->Execute('UPDATE products_licences SET orders_id=NULL');    // DEBUG!!! 
      $this->licences_html = $this->licences_text = ''; 
      for ($i=0, $n=sizeof($this->products); $i<$n; $i++) { 
          $db->Execute('UPDATE products_licences SET orders_id='.$zf_insert_id 
                       . ' WHERE products_id='.(int)$this->products[$i]['id']
                           . ' AND orders_id IS NULL' 
                           . ' LIMIT '.$this->products[$i]['qty'] 
                       ); 
          $dbres = $db->Execute('SELECT licences_code FROM products_licences' 
                       . ' WHERE products_id='.(int)$this->products[$i]['id'] 
                           . ' AND orders_id='.$zf_insert_id 
                       ); 
        while(!$dbres->EOF) { 
            $this->licences_html .= '<p>'.(int)$this->products[$i]['id'].':<br><span class=licences_code>'.$dbres->fields['licences_code'].'</span></p>';		
            $this->licences_text .= "Here is the Serial Number for your program "."\n".$this->products[$i]['name'].":\n".$dbres->fields['licences_code']."\n\n"; 
            $licences[(int)$this->products[$i]['id']][] = $dbres->fields['licences_code']; 
            $dbres->MoveNext(); 
        } 


		
        // Update licences stock level 
        //  $dbres = $db->Execute('SELECT count(*) AS count FROM products_licences' 
       //                . ' WHERE products_id='.$this->products[$i]['id'].' AND orders_id IS NULL' 
       //                ); 
       // $db->Execute('UPDATE products SET products_quantity='.$dbres->fields['count'].' WHERE products_id='.$this->products[$i]['id']); 
      }
// END: MSL - Licences Mod 
10 Apr 2012, 11:04 PM
#123
cburgoyne avatar

cburgoyne

New Zenner

Join Date:
Oct 2010
Posts:
3
Plugin Contributions:
0

Re: Selling software licences

Im still getting the blank check out success page. Any ideas on what to look for?

devshop/index.php?main_page=checkout_process

I have followed more-solutions code edits

is there any other pages that need to be edited for this to work?

11 Apr 2012, 1:44 AM
#124
drbyte avatar

drbyte

Sensei

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

Re: Selling software licences

As with any blank-page situation, it's caused by having PHP errors. Details in the most popular FAQ article we have, quickly found by searching the FAQs area for "blank page": https://www.zen-cart.com/tutorials/index.php?article=82

.
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.

12 Apr 2012, 12:57 AM
#125
cburgoyne avatar

cburgoyne

New Zenner

Join Date:
Oct 2010
Posts:
3
Plugin Contributions:
0

Re: Selling software licences

Ok so I have the updated code but I'm getting this error message
Call to a member function Execute() on a non-object in /home/content/87/8933687/html/devshop/includes/classes/order.php on line 940

which is this line

$db->Execute('UPDATE products_licences SET orders_id='.$zf_insert_id

I have verified that the DB is updated and has stock

Anything else I can look at or update? :dontgetit

12 Apr 2012, 1:56 AM
#126
drbyte avatar

drbyte

Sensei

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

Re: Selling software licences

You can't run $db->Execute() without first declaring $db in the method where you're calling it.
Further, you should not be editing the order.php class file directly.

.
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.

24 Apr 2012, 6:27 PM
#127
daviator avatar

daviator

New Zenner

Join Date:
Mar 2012
Posts:
26
Plugin Contributions:
0

Re: Selling software licences

I'm in the same boat. I too followed the steps in page 2 of this thread and instructions from DaveP but am getting the same blank page.

Could it be that we have to pre-load the software keys in the new table? If so, is that the only field we need to add data into?

Sorry for the noobish questions.

24 Apr 2012, 6:45 PM
#128
davep avatar

davep

New Zenner

Join Date:
Feb 2008
Location:
Peoria, IL USA
Posts:
25
Plugin Contributions:
0

Re: Selling software licences

Daviator:

I'm in the same boat. I too followed the steps in page 2 of this thread and instructions from DaveP but am getting the same blank page.

Could it be that we have to pre-load the software keys in the new table? If so, is that the only field we need to add data into?

Sorry for the noobish questions.

license_id should be numbered in consecutive order.

products_id is a number that you assign and fill in to the table (it is the same number that Zen cart uses to identify the product).

products_attributes_id (I have this set to NULL, I do not use it).

licences_code is a code that you assign and fill in to the table.

orders_id should be set to NULL (the program will write the order number here when it assigns the licence code).

26 Apr 2012, 11:34 PM
#129
daviator avatar

daviator

New Zenner

Join Date:
Mar 2012
Posts:
26
Plugin Contributions:
0

Re: Selling software licences

I've got to be close but I'm still getting an error when confirming the order. "WARNING: An Error occurred, please refresh the page and try again."

I have a fresh install of zencart 1.5 and edited the classes/orders.php file and the email/email_template_checkout.html file exactly as written on page 2 of this thread. I have only one product setup with no attributes and a product id of 2000.

Here are some screenshots of the table and sample data if that helps anyone help me to make sense of this. Thanks for any feedback anyone might have!

Attachment 10386Attachment 10387

9 Nov 2015, 4:14 AM
#131
farrahscreations avatar

farrahscreations

Zen Follower

Join Date:
Feb 2008
Posts:
129
Plugin Contributions:
0

Re: Selling software licences

I think this is what I need but I'm not exactly sure and I honestly don't know where to begin. I need to be able to give my customers downloadable license when they purchase specific products that are also downloadable. There are a bunch of different products that require a license but each customer will only need one and each customers license needs to be different. Can someone help me with that please?