0

I have searched almost all question but didn't get any hint how can i add coupon code from module...?

I have created module and from front side that is 'catalog\controller\module\mycoupon' i want to add coupon code auto on database, for adding i use this code

$this->model_sale_coupon->addCoupon($this->request->post);

but for that i need to load model 'sale/coupon' but which is located in admin controller so how can i call that model into catalog module ?

Or do i need to add that via DB model directly on database?

$this->db->query();

I am getting this error "Notice: Error: Could not load model checkout/cart!" because its outside catalog right how to call that?

My aim is to create coupon code directly on fly when someone click on submit.

  • What is creating a coupon on frontend good for? Is it meant that me as a customer can come to Your site, fill in a shopping cart and then create my own coupon which gives me 95% sale (to be not so big pig and pay you at least something)? Or am I missing an idea here? – shadyyx Oct 02 '13 at 08:03

1 Answers1

0

Copy the addCoupon method from admin/model/sale/coupon into catalog/model/checkout/cart and then you will be able to call the method from the front side. You may need to adjust the method.

If you don't wish to modify core files, simply create a new model and load that so that your changes won't be overwritten on upgrade.

secondman
  • 3,233
  • 6
  • 43
  • 66
  • Ohh.. great i am also thinking same but i did little changes instead of adding code on catalog/model/checkout/cart i added that into my module and its working ... one more request can u also suggest me how to apply that coupon? – user739346 Sep 23 '13 at 06:59