Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Selling / Issuing Keycodes


Johno

Recommended Posts

Morning All,

 

Does anyone know of an easy way to do this?

At the moment I have a thousand or so keycodes in a spreadsheet, and whenever anyone purchases one, I have a little routine in Access which gets the next keycode from the spreadsheet and emails it to the customer.

 

I haven't seen a contribution which would do this & I don't yet know enough about PHP to do it myself.

 

Any help would be greatly appreciated.

 

Cheers,

Link to comment
Share on other sites

I've added a couple of tables into ORDERS_PRODUCTS & used the following code at the bottom of CHECKOUT_SUCCESS.

 

UPDATE orders_products SET KeyCounter =  KeyCounter + 1

WHERE ((products_model Like "SSPCREG" Or products_model Like "SSMACREG") AND (KCAllocated)=0);





UPDATE orders_products SET KCAllocated = 1

WHERE (((KCAllocated)=0) AND ((products_model) Like "SSPCREG" Or (products_model) Like "SSMACREG"));

 

SSPCREG & SSMACREG are the products which need a keycode allocating.

KeyCounter will keep a running total & KCAllocated if a flag that will be set to one when a code is issued to this particular sale.

 

The above code works when pasted into PHPMYADMIN but not in CHECKOUT_SUCCESS.

 

Any Ideas?

Link to comment
Share on other sites

You could make a table: keycodes

 

Fields products_id orders_id keycodes

 

Update the quantity needed with the orders_id where orders_id is blank

 

This locks the keycodes from being used more than once.

 

Select the keycodes where the orders_id = current orders_id

 

This gets your keycodes for this order.

 

Now include those in the order sent to the customer and if you have fields to fill in on the order for the product to show the keycodes do that too.

Link to comment
Share on other sites

Hi Linda,

 

Thanks for that, it sounds like just what I need. However.............

 

Being but a novice to this whole PHP thing, I'm not sure how to go about doing it.

 

I'm fairly sure I could add the allocated keycode to an email or an invoice, but, I can't work out how to allocate the keycodes.

 

Any help you could offer would earn you a virtual Beer.

 

 

Cheers,

 

Johno

Link to comment
Share on other sites

give her 30 minutes and she will write it :lol: :lol:

 

at least she will put it on her every growing overpopulated list of things to do - she can't resist a challenge 8)

 

and she's the best on the forum :wink:

Link to comment
Share on other sites

give her 30 minutes and she will write it :lol: :lol:

 

at least she will put it on her every growing overpopulated list of things to do - she can't resist a challenge 8)

 

and she's the best on the forum :wink:

 

Have to go on the To Do List ... I need to get the current SEC project out and am working on it like crazy to finish ... but those silly clients keep calling for my attention ... go figure?! :roll:

 

But then I guess as they help feed my cat, makes it tough to say no when they call. :D

 

But it is getting there ... there is a light flickering out there in the dark.

Link to comment
Share on other sites

  • 1 month later...

Greetings All,

 

I think I've just about done this, however, I need a little help.

 

I have a table " KEYCODES " And I need to update " $to_issue2 " number of records ( i.e. set the " order_id " field ) with the order id ($acjoid) .

 

What I am using is below, this keeps giving me a Parse error.

 

I'd be grateful if someone could help me with the syntax here.

 

tep_db_query("update" . TABLE_KEYCODES . " set order_id = " $acjoid " where order_id = NULL LIMIT " $to_issue2);

 

Cheers,

 

Johno

Link to comment
Share on other sites

  • 1 month later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...