Announcement

Collapse
No announcement yet.

Questions about credit card and payment selection (radio buttons)

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

    Questions about credit card and payment selection (radio buttons)

    Hello all,

    I have used this code taken from a different thread to add radio button credit card selection to my site:

    Code:
    <mvt:foreach array="paymentmethods" iterator="method">
        <mvt:if expr="l.settings:method:code EQ 'AmerExp' OR l.settings:method:code EQ 'American Express'">
            <span class="payment-option"><input type="radio" name="PaymentMethod" value="&mvte:method:module;:&mvte:method:code;" id="payment_&mvte:method:code;" class="inputRadio" checked="checked" /><label for="payment_&mvte:method:code;"><img src="/mm5/graphics/mmui/amex-icon.jpg" alt="&mvte:method:name;" /></label></span>
        <mvt:elseif expr="l.settings:method:code EQ 'Discover'">
            <span class="payment-option"><input type="radio" name="PaymentMethod" value="&mvte:method:module;:&mvte:method:code;" id="payment_&mvte:method:code;" class="inputRadio" /><label for="payment_&mvte:method:code;"><img src="/mm5/graphics/mmui/discover-icon.jpg" alt="&mvte:method:name;" /></label></span>
        <mvt:elseif expr="l.settings:method:code EQ 'MasterCard'">
            <span class="payment-option"><input type="radio" name="PaymentMethod" value="&mvte:method:module;:&mvte:method:code;" id="payment_&mvte:method:code;" class="inputRadio" /><label for="payment_&mvte:method:code;"><img src="/mm5/graphics/mmui/mastercard-icon.jpg" alt="&mvte:method:name;" /></label></span>
        <mvt:elseif expr="l.settings:method:code EQ 'Visa'">
            <span class="payment-option"><input type="radio" name="PaymentMethod" value="&mvte:method:module;:&mvte:method:code;" id="payment_&mvte:method:code;" class="inputRadio" /><label for="payment_&mvte:method:code;"><img src="/mm5/graphics/mmui/visa-icon.jpg" alt="&mvte:method:name;" /></label></span>
        <mvt:else>
            <span class="payment-option"><input type="radio" name="PaymentMethod" value="&mvte:method:module;:&mvte:method:code;" id="payment_&mvte:method:code;" class="inputRadio" /><label for="payment_&mvte:method:code;"><img src="/mm5/graphics/mmui/paypal-icon.jpg" alt=&mvte:method:name;</label></span>
        </mvt:if>
    </mvt:foreach>
    My questions are:

    1) How do I force the customer to "select one" and not have one selected by default? We want it to give a warning if a CC was not selected (like say "You did not select a credit card").

    2) How do I change the order of the credit cards? I tried just moving the code around, but the Amex was always first. I want Amex second to last (before PayPal).

    You can view the site at http://www.speakerrepair.com/mm5/merchant.mvc - we have not gone live yet and are converting from 4 to 5.5.

    Thanks for any help!

    Eric

    #2
    Re: Questions about credit card and payment selection (radio buttons)

    1) Without JavaScript, you can't. If the customer does not select one, they get a fatal error. When Miva Merchant was written, they did a poor job at handling these types of errors (IMO). They ALWAYS assume that a selection is made and just validate that. They never go so far as to think a customer would *gasp* skip a step.


    What we do (and that was my code btw :D) is default Visa since it is the most common type of credit card for us.

    2) There isn't an easy way to re-order the payment options. If you know exactly what your payment options are, you can hard code the template, but you need to be careful if you go that route.
    Last edited by Brandon MUS; 07-08-09, 11:41 AM.

    Comment


      #3
      Re: Questions about credit card and payment selection (radio buttons)

      Hi Brandon,

      Thanks for your help. We use simple CC validation, so I was able to sort of trick it by adding the 5, 4, 6011, etc. to the Amex options so if they accidentally pick Amex and type in their Visa/Mastercard/Discover number it will still take it.

      And thanks for the code too! :)

      Eric

      Comment


        #4
        Re: Questions about credit card and payment selection (radio buttons)

        Very smart. Glad I could help :D

        Comment


          #5
          Re: Questions about credit card and payment selection (radio buttons)

          Here is an extra simplified version of the radio button version of the payment options. This can be used for shipping as well with slight modifications. This will convert the payment selection drop down to radio buttons and automatically tick the last radio button.
          You would edit the OSEL page and replace this original Miva code:
          Code:
          			<select name="PaymentMethod">
          			<mvt:foreach array="paymentmethods" iterator="method">
          				<option value="&mvte:method:module;:&mvte:method:code;">&mvt:method:name;</option>
          			</mvt:foreach>
          			</select>
          With this code
          Code:
          			
          <mvt:foreach array="paymentmethods" iterator="method">
          	<input name="PaymentMethod" type="radio" value="&mvte:method:module;:&mvte:method:code;" checked>&mvt:method:name;<br>
          </mvt:foreach>

          Comment


            #6
            Re: Questions about credit card and payment selection (radio buttons)

            We accept all major credit cards as well as Paypal. Paypal is the last one selected below Visa. With your code (thanks a ton, it worked awesome!!) it selects the last one which is Paypal, is there a way we could have it default select Visa (second to last) instead?
            Last edited by Gamelord; 08-26-09, 10:05 PM.
            Kent
            www.awindofchange.com

            ~~Once you take flight your eyes will forever be turned skyward~~

            Comment


              #7
              Re: Questions about credit card and payment selection (radio buttons)

              Code:
              <mvt:foreach array="paymentmethods" iterator="method">
                <mvt:if expr="'visa' CIN l.settings:paymentmethods:code">
                <input name="PaymentMethod" type="radio" value="&mvte:method:module;:&mvte:method:code;" checked>&mvt:method:name;<br>
                <mvelse>
                <input name="PaymentMethod" type="radio" value="&mvte:method:module;:&mvte:method:code;" >&mvt:method:name;<br>
                </mvt:if>
              </mvt:foreach>
              I would also BOLD the selected option to make it more obvious that one is already selected.
              Bruce Golub
              Phosphor Media - "Your Success is our Business"

              Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
              phosphormedia.com

              Comment


                #8
                Re: Questions about credit card and payment selection (radio buttons)

                Bumping this back up, as I'm looking to do the same thing, but without success. We have the radio buttons for payment method in place, and it's defaulting to American Express. I'd like to have that default to VISA. However, when I try the code above, it simply removes all payment options from the form. The area is just left blank. Any ideas what I'm doing wrong?

                Here's the code I have currently in place that I need to override:

                <mvt:foreach array="paymentmethods" iterator="method">
                <mvt:if expr="pos1 EQ 1">
                <input type="radio" name="PaymentMethod" value="&mvte:method:module;:&mvte:method:code;" checked>&mvt:method:name;<br>
                <mvt:else>
                <input type="radio" name="PaymentMethod" value="&mvte:method:module;:&mvte:method:code;">&m vt:method:name;<br>
                </mvt:if>
                </mvt:foreach>

                I'm assuming it's the "pos1 EQ 1" that's affecting it.

                Comment


                  #9
                  Re: Questions about credit card and payment selection (radio buttons)

                  Use this instead:

                  <mvt:foreach array="paymentmethods" iterator="method">
                  <mvt:if expr="'visa' CIN l.settings:paymentmethods:code">
                  <input name="PaymentMethod" type="radio" value="&mvte:method:module;:&mvte:method:code;" checked>&mvt:method:name;<br>
                  <mvelse>
                  <input name="PaymentMethod" type="radio" value="&mvte:method:module;:&mvte:method:code;" >&mvt:method:name;<br>
                  </mvt:if>
                  </mvt:foreach>
                  Bruce Golub
                  Phosphor Media - "Your Success is our Business"

                  Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                  phosphormedia.com

                  Comment


                    #10
                    Re: Questions about credit card and payment selection (radio buttons)

                    I still get a blank area where the radio options should be. I tried switching <mvelse> as listed above to <mvt:else> just to see what happened. When I do that, Amex shows up, but nothing else.

                    Comment


                      #11
                      Re: Questions about credit card and payment selection (radio buttons)

                      yea, sorry about that, mvelse should be mvt:else...
                      Bruce Golub
                      Phosphor Media - "Your Success is our Business"

                      Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                      phosphormedia.com

                      Comment


                        #12
                        Re: Questions about credit card and payment selection (radio buttons)

                        Okay, I thought that might be issue, but it's still just showing me American Express after making that change. The other buttons don't appear on the page. I'll keep digging through the code to see if I can what's causing that.

                        Comment


                          #13
                          Re: Questions about credit card and payment selection (radio buttons)

                          This code is great! It seems that however it leaves the dropdown box blank in there. Is there something else I should be changing?

                          Thanks!
                          Brad
                          Brad Barnett
                          E-Commerce Coordinator
                          NBDelaware.com
                          302-230-3068 x 203
                          [email protected]
                          http://www.nbdelaware.com

                          Comment


                            #14
                            Re: Questions about credit card and payment selection (radio buttons)

                            I never could get this code to work. When using it, I see only American Express; the other options are replaced with black white space. So, my client now wants to try switching back to the dropdown selector, with hopes that we can have "Select One" appear by default. Is that possible. Below is my current code...what would have to be changed?

                            <mvt:item name="fonts" param="body_font"><br>
                            <mvt:foreach array="paymentmethods" iterator="method">
                            <mvt:if expr="pos1 EQ 1">
                            <input type="radio" name="PaymentMethod" value="&mvte:method:module;:&mvte:method:code;" checked>&mvt:method:name;<br>
                            <mvt:else>
                            <input type="radio" name="PaymentMethod" value="&mvte:method:module;:&mvte:method:code;">&m vt:method:name;<br>
                            </mvt:if>
                            </mvt:foreach>
                            </mvt:item>

                            Comment

                            Working...
                            X