on 10-27-2015 4:08 PM
Currently when creating a serial / promotional voucher code through HMC, user can enter the code as maximum of 3 character alphanumeric.
We can change it by modifying the hmc.xml of the voucher extension. But is it advisable to do so ? Why the code length is restricted to 3 characters ?
Hello,
For SerialVoucher you have to override the jalo class 'SerialVoucher' to remove the condition to check the size of the attribute.
Best Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Did anyone got a solution for this?
Thanks in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Vova,
Thanks for the response. Yes we tested the same and it works for Promotional vouchers and not for Serial ones.
Do you have an idea that for Promotional vouchers if we increase the code length, what are the implications of that? We tested the voucher redeem and release functionality and it works.
Not sure why Hybris has put this restriction if nothing gets broken by increasing the code length.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bhaskar,
According to Generating Voucher Codes section voucher code will be used as the first group of generated voucher code XXX-YYYY-YYYY-YYYY
.
Nothing stops you from overriding hmc restriction, just add following snippet into hmc.xml from your core extension
<type name="PromotionVoucher" icon="ext/voucher/images/e_voucher.gif" mode="append">
<organizer>
<editor>
<essentials mode="replace">
<listlayout>
<text name="text.promotionvoucher.common" width="353"/>
<attribute name="code"/>
<attribute name="name"/>
</listlayout>
</essentials>
</editor>
</organizer>
</type>
<type name="SerialVoucher" icon="ext/voucher/images/e_serialvoucher.gif" mode="append">
<organizer>
<editor>
<essentials mode="replace">
<listlayout>
<text name="text.serialvoucher.common" width="353"/>
<attribute name="code"/>
<attribute name="name"/>
</listlayout>
</essentials>
</editor>
</organizer>
</type>
However, there's also server side validation during item creation de.hybris.platform.voucher.jalo.SerialVoucher.createItem(SessionContext, ComposedType, ItemAttributeMap)
, I'm not sure why but the behavior is different for de.hybris.platform.voucher.jalo.PromotionVoucher.createItem(SessionContext, ComposedType, ItemAttributeMap)
.
Anyway you would also need to override this logic as well if you want to get rid of this restriction.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.