Author Topic: Sending serial number by e-mail  (Read 51972 times)

Alejandro

  • Beginner
  • *
  • Posts: 14
Sending serial number by e-mail
« on: September 30, 2004, 10:12:04 am »
I would like to be able to send serial numbers when a downloadble product is purchased, rather than sending a password. The serial numbers would be stored in a table, together with the product ID and I would populate this data manually.

I believe the file I need to modify is ps_order.php

I know I have to take one row with a serial number for the particular product and build the email with that, then delete the row. Would someone with a big heart please help me with the PHP code! To get started I could just replace the current download functionality, then I could try to figure out how to implement both by having a flag in the admin that determines whether serial numbers or download passwords are used for that particular product.

Thank you.

DAvid Bates

  • Beginner
  • *
  • Posts: 5
Re:Sending serial number by e-mail
« Reply #1 on: September 30, 2004, 20:46:53 pm »
Sure .. email me at dabates77@gmail.com and we'll talk.. :)

Alejandro

  • Beginner
  • *
  • Posts: 14
Re:Sending serial number by e-mail
« Reply #2 on: October 01, 2004, 07:33:57 am »
Norman wrote:
Quote
Sure .. email me at dabates77@gmail.com and we'll talk.. :)


Thanks Norman, I was actually able to figure it out. I got it to send the serial/PIN  from a new table, based on product ID and then delete the corresponding row. I just need to make some final tweaking now.

Ideally, the serials should be assigned/sent based on SKU, because those are manual inputs and not assigned, but  for now I can just look at the tables in the db to determine what product ID belongs to each SKU.

Can someone tell me how to add a new menu item in the backend? I would use it to update the new table with the serial numbers rather than doing it through phpmyadmin.

Soeren

  • Administrator
  • Sr. Member
  • *
  • Posts: 3106
  • VirtueMart Starter
    • virtuemart.net
Re:Sending serial number by e-mail
« Reply #3 on: October 01, 2004, 16:42:33 pm »
You will have to add a new module in \"Admin\" -> \"Modules\" to show it in the Top Menu. You can call it \"serials\". Now you can add a List File and a Form File -> serials.serial_list.php, serials.serial_form.php to /html/ which let you control the serial  product xref.
Finally add the module to the file \"header.php\" so JSCookMenu displays it.

ciao, soeren
The future of eCommerce: VirtueMart & Joomla!
http://virtuemart.net

Alejandro

  • Beginner
  • *
  • Posts: 14
Re:Sending serial number by e-mail
« Reply #4 on: October 02, 2004, 01:41:24 am »
soeren wrote:
Quote
You will have to add a new module in \"Admin\" -> \"Modules\" to show it in the Top Menu. You can call it \"serials\". Now you can add a List File and a Form File -> serials.serial_list.php, serials.serial_form.php to /html/ which let you control the serial  product xref.
Finally add the module to the file \"header.php\" so JSCookMenu displays it.

ciao, soeren


Thank you Soeren. I have another question. Would it be easy to eliminate the possibility of purchasing more than one item of a downloadable product?  In other words, the quantity purchased of a particular product must be 1 in that session. If you could point me in the right direction I would greatly appreciate it.

Alejo

marcus

  • Beginner
  • *
  • Posts: 1
Re:Sending serial number by e-mail
« Reply #5 on: October 16, 2004, 17:05:10 pm »
Hi ,

i habe the same problem . I have to send serialnumbers  for different software products - so far i found no way to solve this.

someone who can help me ?

Thx
marcus

Alejandro

  • Beginner
  • *
  • Posts: 14
Re:Sending serial number by e-mail
« Reply #6 on: October 16, 2004, 21:40:48 pm »
marcus wrote:
Quote
Hi ,

i habe the same problem . I have to send serialnumbers  for different software products - so far i found no way to solve this.

someone who can help me ?

Thx
marcus


Marcus:

I changed some files to have a serial number sent out whenever a downloadable product is purchased. The problem however is that I eliminated the download functionality in the process since I did not need it. However, I am sure you can just add my modifications rather than substitute them and it should work with some additional changes on your part. I am not a programmer and don't know PHP very well, but if you are interested, PM me and I will e-mail you the files I changed with some explanation.

Alejo

GK31200

  • Beginner
  • *
  • Posts: 4
Re: Sending serial number by e-mail
« Reply #7 on: June 28, 2005, 07:52:45 am »
Hi,

I am just starting of to build my site for selling softwares. I just wanted to know what changes i have to make to my files so that the customer can download and get the serial number by email. Someone please help me.

Gauty

esteve

  • Jr. Member
  • **
  • Posts: 65
Re: Sending serial number by e-mail
« Reply #8 on: July 04, 2005, 13:27:58 pm »
Hi,

if anybody is interested in selling product serials, 2 month ago I added this feature to phpshop.
(creating/sending/logging serials, show them on admin page, etc)

Code and tables were sent to Soeren, but he decided not to integrate it (it is too special feature). :)

If I have time I will merge it into newest (cvs) version.

Steve

esteve

  • Jr. Member
  • **
  • Posts: 65
Re: Sending serial number by e-mail
« Reply #9 on: July 22, 2005, 10:52:57 am »
Hi,

now I had time to create a "Contribution Package", which contains product serial feature. It was merged to cvs version (today).

Details:
-it has an admin surface: global settings: on/off, when send serials, etc,
-each product may be "product serial" (at tab "Product Dimensions and Weight"), and some parameters to that
-main parameter is "robot email text", which will be sent to customer (it can be multilanguage with mambelfish)
-creating serials take place in ps_product_serial.php (function create_product_serial)
-serials are showed always for vendors, for customers only if it is allowed (default is "confirmed")

Good luck!
Steve


[attachment deleted by admin]

GK31200

  • Beginner
  • *
  • Posts: 4
Re: Sending serial number by e-mail
« Reply #10 on: July 24, 2005, 16:00:23 pm »
Could you please further explain how to make this feature work since I have tried to configure it but I am not able to display or send the serial number to the customer after they have purchased the product?

Thanks.

Gauty

esteve

  • Jr. Member
  • **
  • Posts: 65
Re: Sending serial number by e-mail
« Reply #11 on: July 25, 2005, 09:10:35 am »
Hi Gauty,

if customer has payed, and his order's state will be "confirmed" (from "pending"), then an email is sent to him with the product serial(s). Be careful, that the product's "robot email text" should be filled. (at tab "Product Dimensions and Weight", robot email text property, an example will be filled, if you press example link.)
Customer can see his serials also visiting his orders (depends on state), and vendor is always able to see them.
I suggest you to check:
-create a product which is only serial (fill some property on admin)
-buy a product serial
-check on admin (at Orders/List orders) the created serial(s), if you see it, great!
-set its order state to "confirmed", and email should be sent to customer (with the help of "robot email text": {product name}, {licence}, {product serial} will be changed to current values)
I wonder which step is failed...

Steve


GK31200

  • Beginner
  • *
  • Posts: 4
Re: Sending serial number by e-mail
« Reply #12 on: July 27, 2005, 04:37:02 am »
Thanks esteve for your help now it is working fine. Nice job  ;)

Gauty

John.Kain

  • Beginner
  • *
  • Posts: 11
Re: Sending serial number by e-mail
« Reply #13 on: July 27, 2005, 08:58:34 am »
Hi esteve

I was just wondering if you can help me a bit I installed the files and codes, its working fine.  What i am trying to do is to have the same product with different product codes. The problem is that the product code varies within the same product line. Like in case of calling cards where the serial number of the product will be different each time the customer buys the item. I was trying to add  the following code so that the serial or keycode will be different each time. But i am doing something wrong since it is giving me an error please help.

Code: [Select]
<?php
function multiply($alpha$beta// Sets multiply function for more than one of the same product
{
$product $alpha $beta;
return 
$product;
}
   
$unissued "unissued" ;
   
$keycode ;
   
$to_issue2 ;
   
$to_issue_time ;
if (
$keycode '1') {
    
$kcode ;
    
$orders_queryacj tep_db_query("select orders_id from " TABLE_ORDERS " where customers_id = '" $customer_id "' order by date_purchased desc limit 1");
    
$ordersacj tep_db_fetch_array($orders_queryacj);
    
$acjoid $ordersacj['orders_id'] ;
    
$products_arrayacj = array();
    
$products_queryacj tep_db_query("select products_id, products_quantity from " TABLE_ORDERS_PRODUCTS " where orders_id = " $ordersacj['orders_id']);
    while (
$productsacj tep_db_fetch_array($products_queryacj)) {
    
$qty $productsacj["products_quantity"];
    
$id $productsacj["products_id"];
    
$code_queryacj tep_db_query("select keycode_id from " TABLE_PRODUCTS " where products_id = " $id );
    
$row mysql_fetch_array($code_queryacj);
    
$kcode $row["keycode_id"];
    
$keyid2 ;
    
$keyidtime "T" ;
    if (
$kcode == $keyid2 )  {
    
$one ;
    
$answer multiply($qty,$one);
    
$to_issue2 = ($to_issue2 $answer);
    }
    if (
$kcode == $keyidtime )  {
    
$one ;
    
$answer multiply($qty,$one);
    
$to_issue_time = ($to_issue_time $answer);
    }
    }
    }
    
$lastiss "999" ;
    
$key_query tep_db_query("select last from " TABLE_KEYCODES " where keycode = '" $lastiss "'");
    
$last mysql_fetch_array($key_query);
    
$last_issued $last["last"];


    if (
$last_issued $acjoid) {

    
tep_db_query("update " TABLE_KEYCODES " set order_id = ".$acjoid." where order_id = 0 LIMIT ".$to_issue2."");
    
tep_db_query("update " TABLE_KEYCODES " set last = ".$acjoid." where keycode = "$lastiss ."");
    }
    if (
$to_issue2 <> 0) {

    echo 
"<h4><font color= \"#ff0000\"> Your Product 1 Keycode(s) are listed below <br></h4></font>";
    echo 
"<h3><font color= \"#ff0000\">" ;
    }

    
$key_array = array();
    
$key_query tep_db_query("select keycode from " TABLE_KEYCODES " where order_id = '" $acjoid "'");
    while (
$key tep_db_fetch_array($key_query)) {
      
$key_array[] = array('key' => $key['keycode']);
    }


$key_displayed = array();
    for (
$k=0$k<$to_issue2$k++) {
      if (!
in_array($key_array[$k]['key'], $key_displayed)) {
        echo 
""$key_array[$k]['key'] ." <br>";
        
$key_displayed[] = $key_array[$k]['key'];

      }
    }
        echo 
"</h3></font>";


    
$lastiss "999" ;
    
$key_query tep_db_query("select last from " TABLE_KEYCODES_TIME " where keycode = '" $lastiss "'");
    
$last mysql_fetch_array($key_query);
    
$last_issued $last["last"];


    if (
$last_issued $acjoid) {

    
tep_db_query("update " TABLE_KEYCODES_TIME " set order_id = ".$acjoid." where order_id = 0 LIMIT ".$to_issue_time."");
    
tep_db_query("update " TABLE_KEYCODES_TIME " set last = ".$acjoid." where keycode = "$lastiss ."");
    }
    if (
$to_issue_time <> 0) {

    echo 
"<h4><font color= \"#ff0000\"> Your Product 2 Keycode(s) are listed below <br></h4></font>";
    echo 
"<h3><font color= \"#ff0000\">" ;
    }

    
$key_array = array();
    
$key_query tep_db_query("select keycode from " TABLE_KEYCODES_TIME " where order_id = '" $acjoid "'");
    while (
$key tep_db_fetch_array($key_query)) {
      
$key_array[] = array('key' => $key['keycode']);
    }


$key_displayed = array();
    for (
$k=0$k<$to_issue_time$k++) {
      if (!
in_array($key_array[$k]['key'], $key_displayed)) {
        echo 
""$key_array[$k]['key'] ." <br>";
        
$key_displayed[] = $key_array[$k]['key'];

      }
    }
        echo 
"</h3></font>";
?>



Cheers

John

esteve

  • Jr. Member
  • **
  • Posts: 65
Re: Sending serial number by e-mail
« Reply #14 on: July 28, 2005, 10:50:40 am »
Hi John,

i don't exactly understand what you want to do.
To have more product codes in 1 product => create child product (as hammer in sample shop data: metal, wood(=more types of the same product), each child product may have different product code.
Or do you want something like hop-counter? Or should p.code change each order of the same customer?

Each request has solution, i choose last one:
pseudo code of ps_product_serial.php::create_product_serial:
Code: [Select]
function create_product_serial($product_code, $nusers, $duration, $custom_attribute){

 get somehow the user_id and order_id
 if (check in your own table whether he got already such a product serial) {
  $product_code = use another
 }
 
 create product serial number, based on product code
 }

Sorry to say I can't try out your code, because i don't know where to use it, and what are the table names (and the tables behind them, for example TABLE_KEYCODES)... :(

Steve