3

For custom option - text field, a "if" is used so that price update only when more than 9 characters is input.

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

It is working fine, but, when i reduce the characters to less than 10, it won't change back to original price.
Is there another "reloadPrice" function so to get back the original price; or other ways to clear the price update when characters is reduced.

Any help is appreciated! thanks!

  • you can try else option as well, as the price has been already reloaded, it's not getting back the previous price – Rahul Kumar Das Jan 28 '15 at 12:45
2

You could modify reloadPrice function. Find catalog/product/view/options.phtml file and change:

if (element.getValue().strip() != '') {
    curConfig = configOptions;
}

to this:

if (element.getValue().strip() != '' && element.getValue().strip().length > 9) {
    curConfig = configOptions;
}

But it's not verfy flexible solution as it will affect all text field custom options on all products. Also keep in mind that this change will only affect price on the frontend, you also have to take care of the PHP code when adding to cart.

| improve this answer | |
  • i checked and this is connected to many functions in numerious files, so i am unable to change it finally.. – pakicle Feb 6 '15 at 8:35

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.