0
votes

my question might be lame for magento developers but I am very new to the platform. I added a new input field to my newsletter subscription called offer type as I am encouraging users to subscribe in order to get promo code.

I added the input type hidden in the static page

<input placeholder="email: [email protected]" class="email-offer-revealer" name="email" required="" autocapitalize="off" autocorrect="off" spellcheck="false" type="email">
<input name="couponName" value="first offer" type="hidden">

in app/code/core/Mage/Newsletter/controllers/SubscriberController.php I added the following line

 $offer = (string) $this->getRequest()->getPost('couponName');
 $status = Mage::getModel('newsletter/subscriber')->subscribe($email,$offer);

in app/code/core/Mage/Newsletter/Model/Subscriber.php I added the following

 public function subscribe($email, $offer){

The $offer as new argument to be inserted into the offer field in my newsletter table in the DB. I've been told that Magento will give me automatic access to getOffer and setOffer so i added the following for the same method

$this->setOffer($offer);

The problem is i can echo that value, but I can not insert it into the database only i can insert the email what is next?

Thanks

1
Have You added new field offer in newsletter_subscriber tablefaizanbeg
yes Of course I did, i added a varchar field called offer, that is why I added setOffer and getOffer in the codekhaldoun masri
By the way you should never touch the core files, you should rewrite them by extentions or copy them into local/mage/...Attoui Ramzi

1 Answers

1
votes

When you updated some value in model you can try to call save to put the new value into database.

Something like:

$quote->setCouponCode();

$quote->save();