Email cart module

ftaghn

Joined: 2006-03-16
Posts: 1
Posted: Thu, 2006-03-16 10:08

I'm developing a cart extension which send an e-mail to gallery owner with some information about the pics in the cart (title, filename, description and keyword)
I choose to develop a new module and not to use checkout (wich is great) because it has to much features and it will be more complex to cut out rather than create a new one script (and to the hell i want to learn how to write a module).

Now my doubt is on the flow of gallery2.

Quote:
I wrote my module.inc:
function MailCartModule() {
function performFactoryRegistrations() {
function getItemLinks($items, $wantsDetailedLinks, $permissions) {

the idea was to put a link "Send an e-mail" in the drop-down cart menù and on a click send the data to a controller (MailCartController.inc).
The controller perform some format operation on the text and redirect to a view (MailCartView.inc) wich has a prefilled form with the data and were you can add your email and some comment, then again to a controller wich send email and redirect on the main page.

To do this I wrote

Quote:
array('text' => $this->translate('Send e-mail with Mailcart'),
'params' => array('controller' => 'mailcart.MailCartController',
'itemId' => $itemId, 'returnUrl' => '%CURRENT_URL%'));

in module.inc and i wrote a function

Quote:
function handleRequest($form) {
//some foo & bar
$results['redirect']['view'] = 'mailcart.MailCartView';
$results['status'] = array();
$results['error'] = array();

return array(null, $results);
}

in the class MailCartController in MailCartController.inc.
this in my wretched vision of gallery2 should activate my form page

What the point now?
My module do nothing.
in debug mode I can see that:
http://foo/bar/main.php?g2_view=cart.ViewCart&g2_statusId=xbd597df1&g2_navId=xb2be081c
This make me think that cart module will have always control of "operation" with the obviously end that i found my cart empty and nothing done from my module.

To my justification I can say that if I wrote the module.inc to speak directly with MailCartPlugin.class and recall a function in here ia can do almost everything also redirect me to a page with a form wich will send the email, but we are no more in gallery2 there.
And outside gallery2 there are lions and shoggot.

I tried to be clean and detailed, if you can help me with quick suggestion and some advice on where to find an explanation I'll be grateful.
I'd also read almost all of the documentation on codex.gallery2.org and affiliate.
Thanks again