Forum OpenACS Q&A: Re: Want to make a new callback registry, details below...

Hi Jim,

I'm fairly certain ecommerce has the basis of this use-case built in.

Each product is assigned shippable_p. 0 means item is a service or downloadable item.

Each item purchased is assigned a unique id in ec_items. For example, if quantity 5 of an item is purchased, there will be 5 items created in ec_items.

Parameter CartMaxToAdd sets the upper limit for quantities added to the shopping basket --helps prevent service interruptions when a large quantity is added to a cart.

A simplified case should be possible without assigning a certificate, given ec_items id mapping and custom attributes handled via ec_custom_product_fields and ec_custom_product_fields_values. If the certificate number is important, look at adding the package ec-serial-numbers which assigns and tracks serial numbers to specific items in an order --I don't have any experience with ec-serial-numbers.

cheers,

Torben

Collapse
Posted by Jim Lynch on
Heya Torbin,

I ended up making these cert things as part of my app, and they're tested: they allow access starting at a certain timestamp, and begin denying access at another. Works great, getting ecommerce to create the cert is the last step.

I feel I have a coupla choices, one, is I would add code specific to my app that just creates the cert... the problems here being that nothing else could benefit,

The other choice would be a more general solution as outlined in my original message, the only problem I see is I don't know yet how to do it.

First cut on my thoughts on it... two levels of callbacks, one fires any time an ec_item is created, and that in turn fires a callback to "clients" who register for a specific type of ec_item (maybe product id?), then I register as a client of the second callback for the type of item represented by my app.

Bottom line: I need for ecommerce to create the cert object.

-Jim

Hi Jim,

Take a look at the ecommerce doc page: /doc/ecommerce/ecommerce-operation

There are multiple ways to handle this.

I wouldn't worry too much about a general solution. Ecommerce package is very much web 1.0 technology. A new version is in development --been going on what.. 10 years now? Anyway.. when it's beta, a message will be posted in the forum here. cheers!

Collapse
Posted by Jim Lynch on
Thanks for your time and effort, Torbin. My needs are pretty simple, people buy, an object is created, so I'm not going to wait for ec2.

To all: I'm still looking for something general I can apply to any package or table, that looks like:

- an insert or update trigger identifies the insert or update, such that a list of ID column values, is seen in a plpgsql trigger func

- this list of IDs and an indication of what happened about them (insert? or update?) made available thru a tcl callback

and the way I would apply that, is an insert trigger on ec_items for a specific product_id would cause an object in my app, an object completely independent from ecommerce -- once created, access to pages in my app are granted according to terms stored in the object.

Right now the (sub)problem I want to solve is how I can get an indication when a product of a specific type is pu8rchased, either in a tcl func or a db stored proc.