Skip to Content
author's profile photo Former Member
Former Member

Create Voucher by impex

I tried to use impex to create serial vouchers(which was succeeded in hac), but when I use it in the checkout page, the system cannot create the voucher model for the code that I impexed in.

Here is my impex (where voucherCodeTest is media conllection that contain my csv file the csv file contain the code defined by myself):

INSERT_UPDATE SerialVoucher;code[unique=true];name[lang=en];description[lang=en];value;codes(catalogVersion(catalog(id),version),code); ;tst;Test serial voucher;Test serial voucher;5;hktvProductCatalog:Online:voucherCodeTest;

the content of my csv file:

10a-2GBF-AAAA-BBBB

10a-2GBF-CCCC-DDDD

10a-2GBF-EEEE-FFFF

Is that mean we cannot create serial vouchers with the code that we want? Or any things had I missed?

Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Mar 18, 2015 at 02:50 PM

    Hi Iris,

    Yes. We cannot create Serial Vouchers with the code we want. The code is generated incrementally with the specific pattern and conditions in hybris. By the way you didn't miss anything in impex as I tried the similar approach and I could insert the serial voucher with the media file assigned but could not retrieve the same. You might think about the alternative of this by using the promotion voucher which allows the code that we need as given below.

     INSERT_UPDATE PromotionVoucher;code[unique=true];value;currency(isoCode);voucherCode
     ;PV01;5;EUR;VOUCHER_CODE_GLPAD2
    

    Thanks,

    Jayahar

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 17, 2015 at 11:41 AM

    Yes. Voucher codes are mapped (by Hybris magic) to sequential integers. When you generate new codes, it only increments a single field in DB (and saves the csv file as media, but that's not relevant / required).

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 22, 2015 at 05:10 PM

    link text

    I was asked to migrate vouchers from an old system to hybris and because of this post I decided to create a new PromotionVoucher for each voucher code. As we had a big number of voucher codes I used the attached code to generate an impex. I hope this helps somebody as it may need some modification to work with your data structure.


    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 08, 2016 at 12:31 PM

    Hi Alex, Could you place the zip file again as we are not able to download it.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.