Announcement

Collapse
No announcement yet.

attribute pricing script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    attribute pricing script

    Hello, I created a MVT if statement for my product prices, where is the price was 0 to call for the price. It works well in old stores and in category views that do not use dynamic prices. However, in the product view where the attributes are setting the prices based on inventory variants I can not seem to get the If statement to work. is there a javascript script running to create the display price? If so, where is it, I could write my simple code there.

    Thanks,
    Marshall
    http://www.hmcdisplay.com
    http://www.churchonwheels.com

    #2
    Re: attribute pricing script

    Hi Marshall -

    When attribute machine changes the price dynamically based on the attributes selected it is doing it via JavaScript. Your template logic is being overwritten by the JavaScript. You can still do what you need but it will have to be written in JS.

    Attribute Machnie has a "hook" so you can call your own functions when a new variant is selected.

    Code:
    MivaEvents.SubscribeToEvent('variant_changed', function(data){
    
    
    	var price = $('#price-value');
    	if (price.html() == "$0.00"){
    		price.html("Please Call Us For Pricing");
    	}
    	
    });
    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment


      #3
      Re: attribute pricing script

      Cool Thanks, I figured that was happening and I know JS will overwrite the Miva script. Now my big question is where on the server is that JS file... I have found many JS files but not one that is calling the pricing. I ran a tool to find them on the webpage but they look like they are being generated on the client machine...
      Marshall
      http://www.hmcdisplay.com
      http://www.churchonwheels.com

      Comment


        #4
        Re: attribute pricing script

        All the JS on the front end is generated by Miva and not editable.

        However, the code I provided can go anywhere on the page (or in its own file) as long as it is in a document.ready function.
        Brennan Heyde
        VP Product
        Miva, Inc.
        [email protected]
        https://www.miva.com

        Comment


          #5
          Re: attribute pricing script

          Awesome, I figured that was happening. I was digging around MIVA files trying to find where it was creating the js files. It looks like there are about 5 different script files that miva generates for the end user to make all this work.

          Thank you!
          Marshall
          http://www.hmcdisplay.com
          http://www.churchonwheels.com

          Comment

          Working...
          X