tags:

views:

36

answers:

1

Hi,

When you submit the newsletter subscription form (subscribe.phtml), the form actions aclls a php file. Does anyone know where it is located?

EDIT: And how can I send the form action to a custom php which does the mail sending bit? for example, I want the form handling to be done by a file called sendmail.php

i'm trying to have something like this - instead if the default action getUrl('newsletter/subscriber/new') ?>">

thanks

+1  A: 

Magento is locked into an MVC framework, so replacing the framework code with an arbitrary PHP file is going to be difficult. If you give more details on what you would like to do differently than the core code, we can help you figure out what changes to make.

Thanks, Joe


Shooting from the hip, take a look at this tutorial on how to create a controller. Generally, what you'll be doing here is to create an action that will receive your form post, then execute whatever code you need.

So you'll be defining http://mystore.com/somecontroller/something by creating MyModule_controllers_Somecontroller with a method called somethingAction. With some more detail, I can find you more specific examples.

Joseph Mastey
thanks for that. i'm trying to have something like this - <form action="sendmail.php"> instead if the default action <form action="<?php echo $this->getUrl('newsletter/subscriber/new') ?>">
pixeltocode
You're missing the point of what Joseph was helping you with. It would be particularly bad practice to have the form submit to a random php file. To change the behaviour of the newsletter subscribe action, you will need to override the `newAction` function within the `subscriberController` within the `Mage_Newsletter` block. There are tutorials on the web to help with this process. Alternatively, you could bind an Observer to the `customer_save_after` Event and perform an action then.
Jonathan Day
i'm trying to collect form data from a static block. how would i do that?
pixeltocode
Okay, so you have a form on a page, and the user submits it, at which point it does exactly what?
Joseph Mastey