Announcement

Collapse
No announcement yet.

Updating price with options

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

  • Updating price with options

    Hello forums.

    In the listing_x.html template, there is a bit of code that automatically updates model # and price when you select a product option.

    I'm assuming the code below, toward the end of the template, is what is responsible (this is part of function check_stock(what,partnum)):

    Code:
        for(i=0;i<inventoryarray[catalogid].length;i++) 
                        {
                                soption=inventoryarray[catalogid][i];
                                field_array=soption.split("-");
                                //Dynamic Part for advanced options
                                if (typeof((idarray[catalogid])) != "undefined")
                                {
                                        soptionid=idarray[catalogid][i]; 
                                        aoprice=aopricearray[catalogid][i]; 
                                        if (field_array[0]==partnum)
                                        {
                                                if (soptionid != '')
                                                        changeid(soptionid); 
                                                if (aoprice != '0')
                                                        changeprice(aoprice);
                                        }
                                }
    What I'm trying to do is add a condition to the changeprice(aoprice) bit, but it doesn't seem to be working at all. More specifically, I'm trying to reference a geolocation function from a separate script, and only execute the changeprice() function if it returns true.

    I'm already using the geolocation function successfully in other parts of the listing template, in its own script, but trying to access it from within the above script is giving me nothing but trouble.

    Any ideas?

  • #2
    This sounds like it should be simple, but hard to give specific advice without access to your site and the geolocation script, because it'll take some trial and error.

    I assume the geolocation script is being loaded BEFORE this script? Have you tried setting a variable and seeing it if you can access it in this 3dcart script segment?

    Comment


    • #3
      Hi,

      Yes, the other script is being loaded before this one. I'll try setting a variable and see if that works... thanks!

      Update: well, upon further investigation, it appears I may have been mistaken about that block of code... even if I remove it entirely, the price still updates on option selection.

      So... now to find the actual section of code responsible, I guess.
      Last edited by kgarvey; 08-14-2013, 04:07 PM.

      Comment

      Working...
      X