Child pages
  • [in-commerce] Coupon cloning broken
Skip to end of metadata
Go to start of metadata

Imported From:

When I try to clone coupon (I'm logged-in by admin user, not "root"), then:

  • after pressing "Clone" toolbar button I got JavaScript error, that "initCalendar" function isn't defined (that could because someone, who developed it used custom form block instead of predefined one)
  • after pressing "Save" button I got PHP error: permission mapping not defined for coup:OnApplyClone event.

Related Tasks

MINC-66 - Getting issue details... STATUS


  1. Hi Alex,

    I was about to try this on my end, but came across another issues when
    adding a new Coupon and report it here -

    I guess you were adding a product to your Discount Items and the
    Entire Order, correct?


  2. That's just only 2 bugs in same section. Please proceed with independent
    testing after that other issue will be fixed.

  3. Task:

    MINC-66 - Getting issue details... STATUS

  4. Hi Alex,

    I have been lately working on this bug and have fixed 1st part with
    OnApplyClone permission, but got stock with the second one (JS due to

    It seems to be a bigger issue since if you look into
    in-commerce/admin_templates/discounts/coupon_clone_selector.tpl you can see
    that it's mainly Hard-coded form with Expiration data field processed
    without Regional settings. This rises the question how would you recommend
    approaching this:

    <td class="control-cell">
    <input type="text" name="clone_exp_date" id="clone_exp_date"
    value="<inp2:coup_DefaultExpDate />"
    datepickerIcon="<inp2:m_ProjectBase/>admin/images/ddarrow.gif" size="9">
    <span class="small">(mm.dd.yy)</span>
    <script type="text/javascript">
    initCalendar("clone_exp_date", "m.d.y");
    &nbsp;<input type="text" name="clone_exp_time" id="clone_exp_time"
    value="<inp2:coup_DefaultExpTime />" size="9"><span class="small"> (h:mm:ss



  5. If this HTML code matches "inp_edit_date_time" block code from earlier
    version of In-Portal (when "initCalendar" method was used), then you could
    just use "inp_edit_date_time" block.

    However I can see, that 2 different tags DefaultExpDate and DefaultExpTime
    are used to display value of that field. I propose to create virtual field,
    that has same default value and use that field in inp_edit_date_time block.

  6. Here is the patch.

    Also I've noticed, that same cloning problem could be with Gift

  7. Hi,

    Thanks for the patch Alex!

    I have reviewed and improved your patch a bit. Please test my version.