Anything about a module release for this or of something similar?
I have little knowledge of PHP, so any help is appreciated.
-Thanks!
Anything about a module release for this or of something similar?
I have little knowledge of PHP, so any help is appreciated.
-Thanks!
Where do I edit the tables to input keys per product ID?
Hi,
Hope I'm asking this in the right forum topic...
I'd like to assign people Serial numbers for software downloads, so they could then visit our registration system and register the software they've purchased.
If there was a way to upload a list of serials that would get assigned when someone purchases, that would be mighty handy.
Thanks,
LBravo
Hi more-solutions (and everyone else),
Thanks for the code. I bow to your coding expertise, I'm somewhat of a noob. I followed your instructions and made the mods, but now when I get to the order confirmation page, it's blank!
I'm not quite sure what to do with that new table - do I just populate the licences_code field with the license number I want to sell? or do I do something with the other fields? Should I create a new attribute to attach to my licensed product in admin? How do I attach it - what "type" is it?
Also, I've just got one product that I need a license number for. All my others are either shipped products or downloads with no license key required. I have a feeling this mod sends an email with a license number to everyone who orders any product. Maybe I'm wrong. If not, how would I go about setting that up?
Sorry so many questions, and it's been a while since this issue was active, but I'm hoping someone can help. This is something my company really needs right now.
Thanks in advance,
LBravo
Last edited by lbravo; 30 May 2008 at 11:01 PM.
FAQ on troubleshooting the coding problems causing your blank page: http://tutorials.zen-cart.com/index.php?article=82
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donations always welcome: www.zen-cart.com/donate
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.
Thanks so much DrByte!
I downloaded the error logging utility and ran my problem page - this is the error I got:
PHP Fatal error: Call to a member function Execute() on a non-object in /home/www/dev/zencart/includes/classes/order.php on line 899.
Here's the offending section of code:
// 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++) {
->>>LINE 899: $db->Execute('UPDATE products_licences SET orders_id='.$zf_insert_id
. ' WHERE products_id='.$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='.$this->products[$i]['id']
. ' AND orders_id='.$zf_insert_id
);
while(!$dbres->EOF) {
$this->licences_html .= '<p>'.$this->products[$i]['name'].':<br><span class=licences_code>'.$dbres->fields['licences_code'].'</span></p>';
$this->licences_text .= $this->products[$i]['name'].":\n".$dbres->fields['licences_code']."\n\n";
$licences[$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
Any ideas? I'm a PHP noob -- I can write basic stuff, but have never done anything quite like this.
Thanks again!
LBravo
Good Lordy!
I solved that problem -- a line of missing code ABOVE that quoted section... but now it appears I've got a new one...
I get an SQL error...
1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':7b8c4c37c00e45716db5456927e5ca75 AND orders_id IS NULL LIMIT 1' at line 1
in:
[UPDATE products_licences SET orders_id=23 WHERE products_id=12:7b8c4c37c00e45716db5456927e5ca75 AND orders_id IS NULL LIMIT 1]
Yeah, whatever. I don't know where that long string came from or why it's there. I guess it's $zf_insert_id that's being appended to the order number?
Thanks
LBravo
Change your WHERE products_id='.$this->products[$i]['id'] to WHERE products_id=' . (int)$this->products[$i]['id']
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donations always welcome: www.zen-cart.com/donate
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.
By golly DrByte, we're getting closer!
Thanks again for your help. That got us past the MySQL errors. I had to insert (int) in a few other places, but I got your drift.
Now, I'm getting a PHP error:
PHP Fatal error: Call to a member function notify() on a non-object in dir/path/order.php on line 1038
1038 is the line that starts with:Code:// include copyright $email_order .= "\n-----\n" . EMAIL_FOOTER_COPYRIGHT . "\n\n"; while (strstr($email_order, ' ')) $email_order = str_replace(' ', ' ', $email_order); $html_msg['EMAIL_FIRST_NAME'] = $this->customer['firstname']; $html_msg['EMAIL_LAST_NAME'] = $this->customer['lastname']; // $html_msg['EMAIL_TEXT_HEADER'] = EMAIL_TEXT_HEADER; $html_msg['EXTRA_INFO'] = ''; $zco_notifier->notify('NOTIFY_ORDER_INVOICE_CONTENT_READY_TO_SEND', array('zf_insert_id' => $zf_insert_id, 'text_email' => $email_order, 'html_email' => $html_msg)); zen_mail($this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order, STORE_NAME, EMAIL_FROM, $html_msg, 'checkout', $this->attachArray);
$zco_notifier->(NOTIFY_ORDER_INVOICE-CONTENT_READY_TO_SEND'...
Any ideas?
Thank you so MUCH for your help!
LBravo
That means you're operating inside a function that doesn't know about $zco_notifier.
If you're needing to use the notifier, then you'll have to global that object first.
If you're not needing notifiers, just remove that line from your customized code.
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donations always welcome: www.zen-cart.com/donate
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.
Bookmarks