user3240544
user3240544

Reputation: 267

Hybris promotion priority

I have a custom requirement where I need create a new type of Promotion that has to come with custom priority number. As you know the default priority is 1000, but I need my promotion to have a higher one on initialization, so that the user does not have to interract with the field and change it manually - so basically it would be great to know how to make it 1001 for example by default only for this promotion. Does anyone has an idea how to do that? Maybe I need to use the setPriority method but from where to get it?

EDIT (Fixed): // I've found the attribute via the HMC and set its default value there.

Thanks!

Upvotes: 0

Views: 1178

Answers (2)

enem.dev
enem.dev

Reputation: 124

You can always set a default value to the typesystem (extension-items.xml), eg:

<attribute qualifier="myPriority" autocreate="true" type="java.lang.Integer">
   <persistence type="property" />
   <modifiers read="true" write="true" search="false" optional="false" />

   <defaultvalue>1001</defaultvalue>

</attribute>

edit: For setting a default value for one instance can be achieved via impex like my predeccesor told you.

Upvotes: 2

Juan
Juan

Reputation: 1794

You can change that in the HMC, but as Stretch said if you initialize you will lose your modifications, so you are not really modifying the "default" value. You should look for the impex file defining that promotion and modify that file with your new priority. Also, bare in mind that the maximum priority is 1000, so that whatever is higher than 1000 would be understood as the same and you might get unexpected behaviours, I would recommend you to reduce the other promotion's priority if you can.

Upvotes: 2

Related Questions