Announcement

Collapse
No announcement yet.

Grapping permutation prices

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

    Grapping permutation prices

    Hi,

    I want to dynamically update the price display according to the permutation choice. So, I need to be able, when the user picks a given choice, to grab the price of the corresponding permutation. All permutations are set to Associated Product Price. There is such a variable (PermutationPrice) in the library, but each time I attempt to use it I get an error saying that said variable is used out of context.
    There is a related problem in this regards. The products and their respective components were imported from v5. Contrary to v8, v5 could not associate a layout to a components and permuations. Therefore, I don't have any layouts for my products' components, which is a possible explanation to the permutationprice variable's being out of context. Assigning a layout to a component involves creating a new component and refill the permutation list... kind of tedious

    Any solution??

    #2
    that's GRABBING not grapping

    sorry for the typo

    Comment


      #3
      permutation id?

      ok, the permutation drop down list only works correctly if there's only one attribute. Most products, however, have 2 attributes: a size and a color. I can write a script to record the current state of attribute1 and that of attribute2 by recording user input. This information corresponds to a permutation, right? So, I need to grab this permutation's price. Am I correct in guessing that each permutation must have an id of some kind (or be held in some variable)? If I could get that, then I could get the corresponding price?

      Comment


        #4
        Henri,

        This can be done using Actinic, If you have a component and two attributes that have the choices for 'size' and 'colour'. On the component you will then find a tab called 'permutations' this will have a button called 'Fill List', clicking the button will fill the list will all available permutations, you can then assign prices to them by choosing the override option. Now if you select a choice of colour and size and add to cart you should get the assigned price appearing in the basket.

        If this is not happening can you tell me what exactly you are trying to do with 'PermutationPrice'? This variable will only display the value you enter for the particular permutation as entered in the 'Price' field on the 'Permutation' tab of the component.

        Kind regards,
        Bruce King
        SellerDeck

        Comment


          #5
          Mefinx he's wanting a dynamically displayed "running total" of the permutations.

          EG: Select your permutations, and the SUM of the permutations is displayed at the bottom of the product, so that the total price is displayed BEFORE adding to cart...

          I'd be interested in a solution for the same myself... I know KustomPCs.co.uk managed to do this succesfully with Actinic v7, along with dynamically changing images according to the permutations chosen within the dropdown boxes, but it was a very lengthy PHP exercise that also involved upscaling the Products table to their MySQL server and running it all in tandem... very tricky. I never got my head round it unfortunately, and Graeme wasn't willing to share how it'd been done...
          Cheers!
          Marci - <a href="http://www.Over-Clock.co.uk" target="_blank">www.Over-Clock.co.uk</a>

          Comment


            #6
            I solved the problem although it took me some time to figure out and implement, but it works. You just have to use the permutation list layout in addition to the attribute list layout. The latter displays your attributes with their respective drop down menu. The former displays a drop down of all permutations alogn with their prices. The trick is to make a custom version of the permutation list layout (and of its sublayouts) and, instead of letting output the dropdown, use php to grab first the permutation string and then the price string and put them in an array. At the end of the list you'll have an array of permutations and prices. Now, you have to transfer this array into a javascript array (which is necessary because you need it to interact with the onchange event to you are going to assign to the attribute dropdowns). You use php to echo the array as in:

            echo '<script>;
            foreach (...) {
            echo 'PermArray["$permutation"] = "$permutationprice";
            }
            echo '</script>';

            Of course this a little trickier but you get the idea. Note that you are in fact creating an associative array. As the user chooses the attributes using the dropdowns, an onchage event grabs the selected text, makes a permutation string and uses it to get the corresponding price string. Finally, the price display is updated via the innerhtml method. For that, you need to embed the price in a div with a specific id that you can refer to with the getelementbyid method.

            Of course, this method is generalized to enable me to track permutation prices of more than one products displayed on the same page. To each product, use its reference to name both the price div and the name of the permutation javascript associative array. Since arrays are created dynamically, you need to create a global array that'll be used as an array of arrays.

            It seems a little complicated but it does the job. You can even indicate that a given permutation is out of stock (price = 0.00) or invalid (permutation string not in array)

            Lazyeye

            Comment


              #7
              You lost me there fella... could you post / email more explicit instructions (marci@ domain name in me sig)?? PHP isn't my forte sadly...

              It's something I've wanted to implement for This Product for a long time...
              Cheers!
              Marci - <a href="http://www.Over-Clock.co.uk" target="_blank">www.Over-Clock.co.uk</a>

              Comment


                #8
                Your case is different but it's doable. However, it involves doing live recalculation of the price according to the options the user picks. And you have many possible options. The trick is to be able to track user input and use this input to get the price figure then update the overall price accordingly. It's a lot a javascript. Put your mind to it; it always pays off.

                Comment

                Working...
                X