Forums / Upgrading to 1.5.x / is there a product-licensing addon for use with my 1.5.3?

is there a product-licensing addon for use with my 1.5.3?

Started by knownonesince on 10 Aug 2014, 8:55 PM · Views: 1,250

Results 1 to 4 of 4
10 Aug 2014, 8:55 PM
#1
knownonesince avatar

knownonesince

New Zenner

Join Date:
Dec 2009
Posts:
22
Plugin Contributions:
0

is there a product-licensing addon for use with my 1.5.3?

I've been using this mod for years: http://www.zen-cart.com/showthread.php?36391
Now I updated my shop to 1.5.3 and need to edit order.php

My code:

$this->licences_html = 'Below you find the activation code for your software<p>';//empty first
$this->licences_text = 'Below you find the activation code for your software';//empty first

for ($i=0, $n=sizeof($this->products); $i<$n; $i++) { 

$dbres = $db->Execute('SELECT activation_code, products_quantity FROM products_licences' 
                       . ' WHERE products_id='.$this->products[$i]['id'] 
                           . ' AND orders_id='.$zf_insert_id 
                       ); 
                       
        while(!$dbres->EOF) { 
            $this->licences_html .= '<p><b>'.$this->products[$i]['name'].'</b><br><span class=content-line-title>Activationcode: '.$dbres->fields['activation_code'].'<br>Number of users: '.$dbres->fields['products_quantity'].'<br>User Email: '.$this->customer['email_address'].'<br>Resellerl: '.$reseller.' '. $registratieemail .'</span></p>'; 
            $this->licences_text .= $this->products[$i]['name'].":\n".$dbres->fields['activation_code']."\n\n"; 
            $licences[$this->products[$i]['id']][] = $dbres->fields['activation_code']; 
            $dbres->MoveNext(); 
        }   
} 

Is there an updated version or an alternative for this mod?
This is giving me so many problems!
Please help.

11 Aug 2014, 3:14 PM
#2
davep avatar

davep

New Zenner

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

Re: is there a product-licensing addon for use with my 1.5.3?

I am using 1.5.1, will most likely upgrade soon.

Here is a copy of the code that I am using (similar to yours).

// 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
16 Dec 2014, 4:18 AM
#4
storeowner avatar

storeowner

New Zenner

Join Date:
Jun 2014
Location:
United States
Posts:
60
Plugin Contributions:
0

Re: is there a product-licensing addon for use with my 1.5.3?

I would like to get this going to but not sure were the full download is.