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.
New Zenner
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.
New Zenner
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
New Zenner
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?
Sensei
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.
New Zenner
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
Sensei
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.
New Zenner
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.
New Zenner
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).
New Zenner
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!
New Zenner
Is anyone still using this mod? I was until today I updated to 1.5.3 and can't get it to work anymore. Created a new thread at https://www.zen-cart.com/showthread.php?214242-licensing-mod-in-1-5-3&p=1255435 because this is a really old thread.
Please post your code or a new alternative.
Zen Follower
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?
Tell staff why this post should be reviewed.