2

I need to change the frontend price of a product when two custom options dropdowns are selected. I have found some code in this question, but where do I put the files? change price

UPDATE1:

added below codeto the options file and nothing happens when I adjust the quantity ?

$('#qty').keyup(function(){
alert('test');
});

UPDATE2

jQuery.noConflict();
 $('#qty').keyup(function(){
    alert('test');
    });

but now report 'Function expected'

UPDATE 3 I have the test code working now, Thanks. The real code doesnt work as expected, I want to update the price on the product page. This should equal the value of the dropdown multiplied x 4. Currently the code updates the price by adding 50 to it.

jQuery('#select_3').removeAttr('onchange').change(function(){
price=50;
optionsPrice.chagePrice('opConfig',price);
optionsPrice.reload();
8
  • You can put the javascript in template/catalog/product/view/options.phtml – eetzen Jul 29 '15 at 9:36
  • doesnt appear to work, see updated answer pls. – Orange Juice Jones Jul 29 '15 at 9:58
  • Beware for this is clearly jQuery, you should not use "$" which is reserved to prototype. Consider api.jquery.com/jquery.noconflict – nicolallias Jul 29 '15 at 10:00
  • Do you have any error/warning in javascript console? – nicolallias Jul 29 '15 at 10:01
  • yes error occured so changed code, now a new error 'Function expected' – Orange Juice Jones Jul 29 '15 at 10:24
1

About your code, I sppose you meant

jQuery('#select_3').removeAttr('onchange').change(function(){
    var price=50; //add var declaration
    optionsPrice.changePrice('opConfig',price);
    optionsPrice.reload();
}); //close the change binding

But where does optionsPrice come from? Pay a closer attention to the answers, I won't explain them here: your topic would be marked as 'duplicate' and you should ask for explanations on the original topic.

7

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.