Adding coupons using ajax

Discussion in 'Coupons & Deals Script' started by jgiovanni, Dec 5, 2013.

  1. jgiovanni

    jgiovanni New Member

    I am trying to add coupons using ajax. Instead of modifying manage.php completely, I created another page and using the code to get the form data. Though at this point:
    $fields = $iaField -> filter($couponEntry, $iaCoupon -> getItemName());        
                list($data, $error, $messages) = $iaField -> parsePost($fields, $couponEntry);
    $fields returns nothing so $data will return nothing, are these fields only accessible during when:
    iaView::REQUEST_HTML == $iaView->getRequestType()
    or am I missing something simple?

    EDIT: btw this is the front end and I am building a solution for users who buy shop owner plans to create their own shop, and add coupons/deals to their shop(only).
  2. Gleb_S.

    Gleb_S. Subrion Designer Staff Member

    Hello @jgiovanni!

    First of all, please make sure $couponEntry is array and is not empty.
    Second, check if $iaCoupon is defined. Probably you should use this code to initialize the class:

    $iaCoupon = $iaCore->factoryPackage('coupon', 'coupons');
    If non of these suggestions works, please PM me the php file you created. I will check it.

Share This Page