I applied for an account to upload the module into the csv, but i haven't had any reply.. i would just like to contribute this to the community, so everyone can enjoy it.

This is a module sponsored by Democratic Media Holdings (Namibia), which was developed because we needed a system where ubercart with paygate integration should be able to sell tickets, similar to a lottery.

Admin sections needs more work but this will allow you sell tickets.

Only issue i have at the moment is that all users can see the tickets on their profile tabs :(

Documentation is as follows:
Here is the lottery ubercart module, which is based on the Product keys module.

Install the files and enable the module.
Then go to Store Administration >> Products >> Lottery Tickets
You can add a lottery here, this will add the name of the lottery to the list. The module has the potential to generate lottery tickets but I have not built a module to do that, you can import a list of tickets by going to “Import Tickets”. Below in the attachments there is a file called sample.keys.txt (rename that to sample.keys) which contains 100 ticket numbers for a lottery called 'fifa world cup'.
In order to stop more tickets being sold than there are ticket numbers you should enable Ubercart stock module and click the Stock tab under Lottery Tickets, then enable “Use the Ubercart stock system to track lottery tickets?”

In order to allow unregistered people to purchase you need to go to store/settings/checkout/edit/basic and enable the following:

Enable anonymous checkout (users can checkout without logging in).
Login users when new customer accounts are created at checkout.

Ubercart then checks the email used in the checkout process against user accounts and creates an account if no match is found.

You then create a product in Ubercart, under the Lottery Ticket section you select the Lottery that you want to associate with that product. It is advisable to create one product per lottery.
When the user then purchases that product they will be assigned a number of ticket numbers according to the quantity that they have purchase.

Then you can use this module http://drupal.org/project/uc_out_of_stock to control that nothing gets sold without a ticket number.

It is also possible to unpublish a product if all the stock or tickets have been used up, you have to do the following to get this working:
1) Go to Store Administration >> Conditional Actions
2) Add a new predicate that triggers when the customers complete checkout
3) Set the weight of this new predicate to 1 since the weight for the predicate that reduces the stock is set to 0
4) There is no need to add conditions to this predicate so go ahead and click on the Actions tab
5) Select System >> Execute custom PHP code
6) Paste the following code:
foreach ($order->products as $product) {
if ((uc_stock_level($product->model) - $product->qty) <= 0) {
$node = node_load($param = $product->nid, $revision = NULL, $reset = NULL);
node_unpublish_action($node);
node_save($node);
}
}
5) Save the predicate and you are done

Comments

tr’s picture

Status: Needs review » Closed (won't fix)

Thank you for your contribution. The CVS applications forum, where you've already posted this, is indeed the the correct place to submit contributions. Sometimes it takes a while to get reviews there. If you want, you could always post this on ubercart.org under the contributions section. But CVS on drupal.org is the best place.

aurelien85’s picture

Category: task » bug
Priority: Normal » Major
Status: Closed (won't fix) » Active

Hi, great module you've worked on. Works perfectly.... BUT it has a leak in permissions :

An authenticated user can view everyone's lottery tickets ! When i try to set up this permission only for admin i get following error :

"An illegal choice has been detected. Please contact the site administrator."

And permission settings for this line gets all unchecked.. And authenticated user can still view everyone's tickets..

Any fix, help ?

Thank you all

baxterjones’s picture

The module was developed by a freelancer and i unfortunately can't write any php.

So it's up to the community to develop this further.
It's actually the reason why i submitted the code, so it can move faster towards something more robust, and of course to find all those bugs quicker.

Sorry i couldn't be more help.
i simply disabled the permissions to view tickets altogether. not ideal way though.

tr’s picture

Category: bug » task
Priority: Major » Normal
Status: Active » Closed (won't fix)

This is NOT the place to discuss non-Ubercart modules.