1

In Magento 1.9,

I would like the product price to update ONLY when customer input more than 5 characters (or multiple the change-price for every 5 character added, if not too complex).
* The "price change Value" is set via the backend custom option, as below

Price Change Value

I want to add if-else to decide the onchange event, but fail to get current user input length.
file: ..\app\design\frontend\base\default\template\catalog\product\view\options\type\text.phtml

<input type="text" onchange="opConfig.reloadPrice()" id=...>

Can anyone help? Thanks in advance!

  • have you got any success to implement the such functionality – mjdevloper Jan 19 '17 at 12:03
1

Have you tried the following:

<input type="text" onchange="if(this.value.length > 5) opConfig.reloadPrice()" id=...>

For every multiple of 5 above 5:

<input type="text" onchange="if(this.value.length && this.value.length % 5 == 0) opConfig.reloadPrice()" id=...>
  • Thanks!! It is working BUT..even i change the input to less than 5 character the price do to the original price.<br> – pakicle Jan 27 '15 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.