Page 3 of 13 FirstFirst 12345 ... LastLast
Results 21 to 30 of 125
  1. #21
    Join Date
    May 2006
    Posts
    23
    Plugin Contributions
    0

    Default Re: Selling software licences

    I'm not saying that I'm necessarily going to be able to help here, but since I started this...

    What are the problems with the code I previously posted - does it work as far as it goes but not go far enough, or is it broken?

    What I think we currently have is:
    • the ability to send a licence code within the order complete email.


    what is missing is:
    • any backend functionality to manage the facility
    • any way to use the code with offline payment facilities (the codes get sent when the order complete email gets sent, which might be before payment has cleared)
    • some way to auto-generate the codes, or to link into an external system to generate them


    Is that a fair summary?

    How much demand is there for this?

    My original need for this functionality has gone, but I can see that I might be able to use it in future, so I'm interested in at least following progress on this. Unfortunately I'm not sure I have the time to donate to doing this and I doubt there's enough desire to pay for the work to allow me to move other paying work out of the way. But a clear spec might at least allow others to step in.

  2. #22
    Join Date
    Jun 2007
    Posts
    3
    Plugin Contributions
    0

    Default Re: Selling software licences

    Hi,

    Sorry for the delay in response. You summed it up pretty well - except that I have no need for:

    - some way to auto-generate the codes, or to link into an external system to generate them

    All that needs to be fixed is:

    - any way to use the code with offline payment facilities (the codes get sent when the order complete email gets sent, which might be before payment has cleared)

    - any backend functionality to manage the facility

    I am happy doing this manually or via backend :)

    Thanks for replying ^^

    Best wishes

    GameCardsDirect
    *Instant* Pre-Paid MMORPG Game Time Cards and Game Keys sent via SMS and E-Mail! E-Gold and Credit Cards accepted.

  3. #23
    Join Date
    May 2006
    Posts
    28
    Plugin Contributions
    0

    cart error Re: Selling software licences

    Hi Guys,
    I am going for a slightly different approach and have hit a snag.

    Let me lay out some background. I decided that instead of creating another table I would add the fields I needed to the existing Zen Cart tables. So I added a "products_code" field to "zen_products" table. This field holds a unique code for each product. It is a GUID type field because it is used later on to generate the registration codes.
    I then added a "products_reg_key" field to the "zen_orders_products" table. This will be dynamically populated when the customer buys some games from my site.
    At the point of successful sale, the registration key generator takes the customer's email address and the unique products_code and using some algorithms generates a unique products_reg_key. This products_reg_key is then emailed to the customer as part of the usual email notification system.

    Ok the snag is that at the point of inserting the products_reg_key into the zen_orders_products table it seems to reuse the first one it generated. Most the changes take place in order.php as follows...



    In function query()...

    PHP Code:
    $orders_products_query "select orders_products_id, products_id, products_name,
                                     products_model, products_price, products_tax,
                                     products_quantity, final_price,
                                     onetime_charges,
                                     products_priced_by_attribute, product_is_free, products_discount_type,
                                     products_discount_type_from, [B]products_reg_key[/B]
                                      from " 
    TABLE_ORDERS_PRODUCTS "
                                      where orders_id = '" 
    . (int)$order_id "'";

        
    $orders_products $db->Execute($orders_products_query); 
    and

    PHP Code:
    $this->products[$index] = array('qty' => $new_qty,
                                          
    'id' => $orders_products->fields['products_id'],
                                          
    'name' => $orders_products->fields['products_name'],
                                          
    'model' => $orders_products->fields['products_model'],
                                          
    'tax' => $orders_products->fields['products_tax'],
                                          
    'price' => $orders_products->fields['products_price'],
                                          
    'final_price' => $orders_products->fields['final_price'],
                                          
    'onetime_charges' => $orders_products->fields['onetime_charges'],
                                          
    'products_priced_by_attribute' => $orders_products->fields['products_priced_by_attribute'],
                                          
    'product_is_free' => $orders_products->fields['product_is_free'],
                                          
    'products_discount_type' => $orders_products->fields['products_discount_type'],
                                          
    'products_discount_type_from' => $orders_products->fields['products_discount_type_from'],
                                          
    'products_reg_key' => $orders_products->fields['products_reg_key'] ); 

    In function cart() is where I think it is not generating a unique code even though it is using the $i loop variable. But I can't see why it is not working. Here is the code...

    PHP Code:
    $this->products[$index] = array('qty' => $products[$i]['quantity'],
                                          
    'name' => $products[$i]['name'],
                                          
    'model' => $products[$i]['model'],
                                          
    'tax' => zen_get_tax_rate($products[$i]['tax_class_id'], $tax_address->fields['entry_country_id'], $tax_address->fields['entry_zone_id']),
                                          
    'tax_description' => zen_get_tax_description($products[$i]['tax_class_id'], $tax_address->fields['entry_country_id'], $tax_address->fields['entry_zone_id']),
                                          
    'price' => $products[$i]['price'],
                                          
    'final_price' => $products[$i]['price'] + $_SESSION['cart']->attributes_price($products[$i]['id']),
                                          
    'onetime_charges' => $_SESSION['cart']->attributes_price_onetime_charges($products[$i]['id'], $products[$i]['quantity']),
                                          
    'weight' => $products[$i]['weight'],
                                          
    'products_priced_by_attribute' => $products[$i]['products_priced_by_attribute'],
                                          
    'product_is_free' => $products[$i]['product_is_free'],
                                          
    'products_discount_type' => $products[$i]['products_discount_type'],
                                          
    'products_discount_type_from' => $products[$i]['products_discount_type_from'],
                                          
    'id' => $products[$i]['id'],
                                          
    'products_code' => $products[$i]['products_code'],
                                          
    'products_reg_key' => generatecode$this->customer['email_address'], $this->products[$i]['products_code'] ),
                                          
    'rowClass' => $rowClass); 
    Then in function create_add_products() is where it then saves the reg_keys to the zen_orders_products table...

    PHP Code:
    $sql_data_array = array('orders_id' => $zf_insert_id,
                                  
    'products_id' => zen_get_prid($this->products[$i]['id']),
                                  
    'products_model' => $this->products[$i]['model'],
                                  
    'products_name' => $this->products[$i]['name'],
                                  
    'products_price' => $this->products[$i]['price'],
                                  
    'final_price' => $this->products[$i]['final_price'],
                                  
    'onetime_charges' => $this->products[$i]['onetime_charges'],
                                  
    'products_tax' => $this->products[$i]['tax'],
                                  
    'products_quantity' => $this->products[$i]['qty'],
                                  
    'products_priced_by_attribute' => $this->products[$i]['products_priced_by_attribute'],
                                  
    'product_is_free' => $this->products[$i]['product_is_free'],
                                  
    'products_discount_type' => $this->products[$i]['products_discount_type'],
                                  
    'products_discount_type_from' => $this->products[$i]['products_discount_type_from'],
                                  
    'products_prid' => $this->products[$i]['id'],
                                  
    'products_reg_key' => $this->products[$i]['products_reg_key'] );
          
    zen_db_perform(TABLE_ORDERS_PRODUCTS$sql_data_array); 
    And lastly, this is how I send the information to the customer...

    PHP Code:
    // build output for email notification
          
    $this->products_ordered .=  $this->products[$i]['qty'] . ' x ' $this->products[$i]['name'] . ($this->products[$i]['model'] != '' ' (' $this->products[$i]['model'] . ')' '') . ' = ' .
          
    $currencies->display_price($this->products[$i]['final_price'], $this->products[$i]['tax'], $this->products[$i]['qty']) .
          (
    $this->products[$i]['onetime_charges'] !="\n" TEXT_ONETIME_CHARGES_EMAIL $currencies->display_price($this->products[$i]['onetime_charges'], $this->products[$i]['tax'], 1) : '') .
          
    $this->products_ordered_attributes "\n" .
          
    ' REG CODE : ' $this->products[$i]['products_reg_key'] . "\n"
    The last change that is required if

    As I said, it all basically works if you only have 1 product in the basket that is bought. But it's when it the customer buys more than one is when the problem manifests itself.

    Can any Zen-Cart gurus point out where I have gone wrong with the PHP code above. If you search through the code for "reg_code" you will see all the areas where I added registration specific PHP code.

    Any suggestions welcome.

  4. #24
    Join Date
    May 2006
    Posts
    28
    Plugin Contributions
    0

    Default Re: Selling software licences

    Quote Originally Posted by savage View Post
    Can any Zen-Cart gurus point out where I have gone wrong with the PHP code above. If you search through the code for "reg_code" you will see all the areas where I added registration specific PHP code.
    Oops, that should says "reg_key".

  5. #25
    Join Date
    May 2005
    Location
    Bath, Somerset
    Posts
    1,053
    Plugin Contributions
    3

    Default Re: Selling software licences

    Not to put too finer point on it, but there are a few errors in the script, and actually bug fixing this is something which I would rather do looking at the original code, rather than a few posts.

    Firstly, you need to cosider what happens if your customer buys 3 copies of the same software to install on 3 machines, all at the same time. Currently, he would receive 1 registration for all of the copies, meaning that there is a large hole in your security. To bypass this, you need to store the registration numbers in a different table to the order products, so that you can have a one-to-many relationship. This will also reduce redunancy if you are selling products without licences, and so not slow your database down.

    Next, where you are generating the code, you refer back to $this->customer['email_address']. Here you are in fact mixing classes. The customer array is actually only available to the order class, rather than the shopping_cart class, as you have currently. You can get round this by eiterh using the $_SESSION['customer_id'], or using the $order->customer['email_address'] variables, however, this won't work if your customer is NOT logged in.

    Personally, I would place the generate licence code in the order class, so that the codes are only created once the customer is about to buy. Why waste resources creating a code each time the customer returns to the store, picks a product, when you only really need to do it once?

    Let me know if you need further assistance.

    Absolute

  6. #26
    Join Date
    May 2006
    Posts
    28
    Plugin Contributions
    0

    cart error Re: Selling software licences

    Hi Absolute, thanks for your feedback.

    Since my last post I have reworked the way registration codes are generated and have taken into account the possibility of a customer buying multiple copies of same software. Our generatecode() will take care of that. It now also only generates codes when you have bought them.

    By no means do I say that this system is perfect, but it currently works for us. We may very well have to tweak it some more later on.

    So based on my earlier post, the orders.php file now looks like this...

    PHP Code:
    $this->products[$index] = array('qty' => $products[$i]['quantity'],
                                          
    'name' => $products[$i]['name'],
                                          
    'model' => $products[$i]['model'],
                                          
    'tax' => zen_get_tax_rate($products[$i]['tax_class_id'], $tax_address->fields['entry_country_id'], $tax_address->fields['entry_zone_id']),
                                          
    'tax_description' => zen_get_tax_description($products[$i]['tax_class_id'], $tax_address->fields['entry_country_id'], $tax_address->fields['entry_zone_id']),
                                          
    'price' => $products[$i]['price'],
                                          
    'final_price' => $products[$i]['price'] + $_SESSION['cart']->attributes_price($products[$i]['id']),
                                          
    'onetime_charges' => $_SESSION['cart']->attributes_price_onetime_charges($products[$i]['id'], $products[$i]['quantity']),
                                          
    'weight' => $products[$i]['weight'],
                                          
    'products_priced_by_attribute' => $products[$i]['products_priced_by_attribute'],
                                          
    'product_is_free' => $products[$i]['product_is_free'],
                                          
    'products_discount_type' => $products[$i]['products_discount_type'],
                                          
    'products_discount_type_from' => $products[$i]['products_discount_type_from'],
                                          
    'id' => $products[$i]['id'],
                                          
    'products_code' => $products[$i]['products_code'], // NEW CODE
                                          
    'rowClass' => $rowClass); 
    PHP Code:
    $sql_data_array = array('orders_id' => $zf_insert_id,
                                  
    'products_id' => zen_get_prid($this->products[$i]['id']),
                                  
    'products_model' => $this->products[$i]['model'],
                                  
    'products_name' => $this->products[$i]['name'],
                                  
    'products_price' => $this->products[$i]['price'],
                                  
    'final_price' => $this->products[$i]['final_price'],
                                  
    'onetime_charges' => $this->products[$i]['onetime_charges'],
                                  
    'products_tax' => $this->products[$i]['tax'],
                                  
    'products_quantity' => $this->products[$i]['qty'],
                                  
    'products_priced_by_attribute' => $this->products[$i]['products_priced_by_attribute'],
                                  
    'product_is_free' => $this->products[$i]['product_is_free'],
                                  
    'products_discount_type' => $this->products[$i]['products_discount_type'],
                                  
    'products_discount_type_from' => $this->products[$i]['products_discount_type_from'],
                                  
    'products_prid' => $this->products[$i]['id'],
                                  
    'products_reg_key' => generatecode$this->customer['email_address'], $this->products[$i]['products_code'] ) ); // NEW CODE
          
    zen_db_perform(TABLE_ORDERS_PRODUCTS$sql_data_array); 
    PHP Code:
    $products_reg_key_query "select products_reg_key from " TABLE_ORDERS_PRODUCTS "
                                   where orders_id = '" 
    . (int)$zf_insert_id "'
                                   and orders_products_id = '" 
    . (int)$order_products_id "'"// NEW CODE

          
    $products_reg_key_result $db->Execute($products_reg_key_query); // NEW CODE
        

          // build output for email notification
          
    $this->products_ordered .=  $this->products[$i]['qty'] . ' x ' $this->products[$i]['name'] . ($this->products[$i]['model'] != '' ' (' $this->products[$i]['model'] . ')' '') . ' = ' .
          
    $currencies->display_price($this->products[$i]['final_price'], $this->products[$i]['tax'], $this->products[$i]['qty']) .
          (
    $this->products[$i]['onetime_charges'] !="\n" TEXT_ONETIME_CHARGES_EMAIL $currencies->display_price($this->products[$i]['onetime_charges'], $this->products[$i]['tax'], 1) : '') .
          
    $this->products_ordered_attributes "\n" .
          
    ' Registration Code : ' $products_reg_key_result->fields['products_reg_key'] . "\n" 'This code will be needed to register the game.' "\n\n" // NEW CODE 
    I have indicated each bit of new code with a comment of "// NEW CODE" above if you want to see what I have added.

    I hope I have not missed anything.

  7. #27
    Join Date
    May 2005
    Location
    Bath, Somerset
    Posts
    1,053
    Plugin Contributions
    3

    Default Re: Selling software licences

    Is this system now working for you? It certainly looks like you are well on the way with it. If you need any further advice - let us know. Absolute

  8. #28
    Join Date
    May 2006
    Posts
    28
    Plugin Contributions
    0

    Default Re: Selling software licences

    From the tests we have performed it seems to be working for us.

    I have some zen_mail code that is not working, but that is not related to this.

    We just have to tweak/customise the site a bit more as well now.

  9. #29
    Join Date
    Jun 2006
    Location
    Boston, MA
    Posts
    84
    Plugin Contributions
    0

    Default Re: Selling software licences

    I have a similar need and am wondering if somehting exists for zen-cart or if anyone can recommend a different solution that works.

    We sell prepaid phones and phone cards, the prepaid pin is similar to a software liense or key in that it is unique and when a customer buys it - it should not be available to anyoone else.

    The pin numbers come from the carriers though so it is not something we can generate or auto-generate. I would need the ability load pin numbers associated with a certain product in the admin area.
    i.e. Load pins for a $20 pin into the admin for product XYZ Wirless $20 pin.

    I need it so that the customer will recieve the pin automatically only after successfully checking out, int he case of a payment gateway they would get the pin right away and then maybe also emailed to them.


    Any help or suggestions is appreciated!!!

  10. #30
    Join Date
    Feb 2008
    Posts
    11
    Plugin Contributions
    0

    Default Re: Selling software licences

    Hi, Have you managed to write an admin section for this? Like I'm using this code modified to sell Telephone Calling cards, but I'm getting stuck on how to enter the bulk of EPIN numbers for each card. Is there some code like easy populate for this? Thanks.

 

 
Page 3 of 13 FirstFirst 12345 ... LastLast

Similar Threads

  1. Selling downloadable software
    By bazfr in forum General Questions
    Replies: 5
    Last Post: 4 Mar 2010, 10:13 AM
  2. Possible? Selling items in groups of 10 while selling other items as singles
    By alanekilauea in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 11 Feb 2008, 07:47 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR