Announcement

Collapse
No announcement yet.

Using submit buttons in the shopping cart

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

    Using submit buttons in the shopping cart

    In the quest for an accessible Actinic site I've discovered why most have the default image buttons in the shopping cart: hacking around with perl scripts. Ugh. Anyway here's how to change them to input submits.

    Go to the design library and edit all the shopping cart buttons to input type="submit". The alt attribute becomes value.
    Open your site's CartManager.pl and locate the following code
    Code:
    	if(!defined $::g_InputHash{"ACTION"})
    		{
    		if(defined $::g_InputHash{"ACTION_UPDATE.x"})
    			{
    			$::g_InputHash{"ACTION"} = $::g_sUpdateCartLabel;
    			}
    		elsif(defined $::g_InputHash{"ACTION_SAVE.x"})
    			{
    			$::g_InputHash{"ACTION"} = $::g_sSaveShoppingListLabel;
    			}
    		elsif(defined $::g_InputHash{"ACTION_GET.x"})
    			{
    			$::g_InputHash{"ACTION"} = $::g_sGetShoppingListLabel;
    			}
    		elsif(defined $::g_InputHash{"ACTION_BUYNOW.x"})
    			{
    			$::g_InputHash{"ACTION"} = $::g_sCheckoutNowLabel;
    			}			
    		elsif(defined $::g_InputHash{"ACTION_CONTINUE.x"})
    			{
    			$::g_InputHash{"ACTION"} = $::g_sContinueShoppingLabel;
    			}				
    		elsif(defined $::g_InputHash{"ACTION_SEND.x"})
    			{
    			$::g_InputHash{"ACTION"} = $::g_sSendCouponLabel;
    			}			
    		}
    	}
    Remove the .x from each string.
    Upload.

    Now you can style your buttons more or less sitewide properly with CSS, and they'll scale when users choose a different font size. If you want image buttons back, use CSS to do it.

    Disclaimer: I'm a perl and cgi noob. This technique is probably fundamentally flawed, but I think it fits with the whole Actinic ethos

    #2
    Thank you for your post simonc, this confirmed why my changes weren't working! Looking into this further, and not wishing to alter the perl files, I found that by changing the name of the submit buttons to include .x at the end of the name also worked. This validated with the w3 validator under xhtml as I was concerned about having a period in the element name.
    www.1pcs.co.uk - Web Design and Search Engine Optimisation
    Web Design Northampton

    Comment


      #3
      Andrew - your solution is neat and simple and you won't have to remember to re-patch the Perl whenever you update Actinic.

      Don't worry about the periods in the name attribute. Actinic allows you to use periods in your product references -and these references are used when generating the site's assorted form field names.
      Norman - www.drillpine.biz
      Edinburgh, U K / Bitez, Turkey

      Comment


        #4
        Can anyone confirm whether this is still relevant to v11.0.2?

        I have changed the buttons to submits, and the alts to values and removed the src attribute, for each button (including the disabled alternatives, which I guess the Perl script uses when it needs to).

        This seems to work on its own now, unless I'm missing something. So I haven't renamed the submit buttons to add ".x". Has the Perl handling changed, or ought I still add the ".x"?

        ---update
        Hmm, the Update, Save and Retrieve functionality works, but the Continue Shopping, and Checkout Now buttons result in getting stuck on cm000001.pl

        --update
        Yes indeed, the ".x" is required for continue and checkout. I'll stop talking to myself in public now
        Last edited by dandelion; 16-Oct-2012, 09:19 AM. Reason: added info
        adaptive-image.co.uk

        Comment


          #5
          Keep talking to yourself I say, you answered my question!
          Dave

          Comment

          Working...
          X