0

In my magento store my products have several custom options which alter the price of the product. I also need to add in a custom function which shows or hides particular content when this event triggers.

I can see that the following is called when any option ever changes:

opConfig.reloadPrice();

but i am unsure what file this actually sits in so i can add an extra function onto the event.

0

mine is defined in confiugrable.js and looks something like:

reloadPrice: function(){
    if (this.config.disablePriceReload) {
        return;
    }
    var price    = 0;
    var oldPrice = 0;
    for(var i=this.settings.length-1;i>=0;i--){
        var selected = this.settings[i].options[this.settings[i].selectedIndex];
        if(selected.config){
            price    += parseFloat(selected.config.price);
            oldPrice += parseFloat(selected.config.oldPrice);
        }
    }

    optionsPrice.changePrice('config', {'price': price, 'oldPrice': oldPrice});
    optionsPrice.reload();

    return price;

    if($('product-price-'+this.config.productId)){
        $('product-price-'+this.config.productId).innerHTML = price;
    }
    this.reloadOldPrice();
}
0

I have an issue with the Magento changePrice function. The price is calculating correctly when sent to the console, but once it is passed to the changePrice function it is no longer correct.

optionsPrice.changePrice('bundle', this.price.toFixed(2));

I cannot find any documentation on this function.

else if (this.findRush ) {
    // If Rush
    this.price = this.finalPrice;       
    console.log("this.price= " +  this.price);
    // Send Price to Pricing Objects
    optionsPrice.changePrice('bundle', this.price.toFixed(2));
    //alert(this.price);
    opConfig.reloadPrice();
    updateFormPrice();
}

Here is the site and a product example: https://www.envelopeink.com/sun-yellow-1423. If you select these options

  • fixed Quantity > 50 QTY
  • Printed envelopes
  • rush this order option on last step

The price should be 206.35 as seen in the console, but $247.95 is returned.

Any help on this would be greatly appreciated.

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.