Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Functionality lost with simple style button links in IE

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 09-08-2008, 05:50 AM
 
wayfarer wayfarer is offline
 

Advanced Member
  
Join Date: Apr 2003
Posts: 56
 

Default Functionality lost with simple style button links in IE

Hi all,

I am trying to convert the Buy Now and Add to Wish List button/links on the product/thumbnail list to small icon-like graphics. I figured the first thing to do is to convert the buttons to simple style (I had previously changed them to style="button") and then move on to change the label to be blank, just leaving the graphic link. However, when I change the relevant code pertaining to the button links in /customer/main/buy_now.tpl to style="simple" like in the following example

from:

Code:
<td>{include file="buttons/add_to_cart.tpl" style="button" href="javascript: document.orderform_`$product.productid`_`$product.add_date`.submit();"}</td> {else} <td>{include file="buttons/buy_now.tpl" style="button" href="javascript: document.orderform_`$product.productid`_`$product.add_date`.submit();"}</td> {/if} {if ($login ne "" || $config.Wishlist.add2wl_unlogged_user eq 'Y') && $active_modules.Wishlist ne "" && $special_offers_add_to_cart eq "" && ($product.is_product_options ne 'Y' || $buynow_enabled)} <td style="padding-left: 20px;"> {include file="buttons/add_to_wishlist.tpl" style="button" href="javascript:document.orderform_`$product.productid`_`$product.add_date`.mode.value='add2wl'; document.orderform_`$product.productid`_`$product.add_date`.submit()"} </td>

to:

Code:
<td>{include file="buttons/add_to_cart.tpl" style="simple" href="javascript: document.orderform_`$product.productid`_`$product.add_date`.submit();"}</td> {else} <td>{include file="buttons/buy_now.tpl" style="simple" href="javascript: document.orderform_`$product.productid`_`$product.add_date`.submit();"}</td> {/if} {if ($login ne "" || $config.Wishlist.add2wl_unlogged_user eq 'Y') && $active_modules.Wishlist ne "" && $special_offers_add_to_cart eq "" && ($product.is_product_options ne 'Y' || $buynow_enabled)} <td style="padding-left: 20px;"> {include file="buttons/add_to_wishlist.tpl" style="simple" href="javascript:document.orderform_`$product.productid`_`$product.add_date`.mode.value='add2wl'; document.orderform_`$product.productid`_`$product.add_date`.submit()"} </td>

The style changes fine, showing the text link and go button next to it, but, clicking on the link does not add the product to the cart and when I hover my mouse over the text label or the go button image, the status bar of my browser (lefthand bottom) displays: javascript: void(0);

If I change the button style back (this is the only change being made), the product is added to the cart as expected, and everything works as it should...

I have discovered that this only appears to be the case in Internet Explorer. Firefox works just fine...

Can anyone shed any light on why the functionality stops working when changing the button style? Any help would be much appreciated...
__________________
X Cart Pro
v. 4.1.9
Download Expander (from Altered Cart)
X-Magnifier
Dynamic Preview (from BCS Engineering)
Customer Rewards Points (BCSE), used as credit purchasing system
Reply With Quote
  #2  
Old 09-08-2008, 01:48 PM
 
wayfarer wayfarer is offline
 

Advanced Member
  
Join Date: Apr 2003
Posts: 56
 

Default Re: Functionality lost with simple style button links in IE

OK, I have a couple of clues... I think this is linked to a section of button.tpl:

Code:
{* $Id: button.tpl,v 1.25.2.2 2006/06/16 10:47:41 max Exp $ *} {if $config.Adaptives.platform eq 'MacPPC' && $config.Adaptives.browser eq 'NN'} {assign var="js_to_href" value="Y"} {/if} {if $type eq 'input'} {assign var="img_type" value='input class="InputNoBorder" type="image"'} {else} {assign var="img_type" value='img'} {/if} {assign var="js_link" value=$href|regex_replace:"/^\s*javascript\s*:/Si":""} {if $js_link eq $href} {assign var="js_link" value="javascript: self.location='"|cat:$href|amp|cat:"';"} {else} {assign var="js_link" value=$href} {if $js_to_href ne 'Y'} {assign var="onclick" value=$href} {assign var="href" value="javascript: void(0);"} {/if} {/if}

I can comment out this...

Code:
{if $js_to_href ne 'Y'} {assign var="onclick" value=$href} {assign var="href" value="javascript: void(0);"} {/if}

And the functionality now works in IE. But I'm not sure if there are any implications of doing this that may affect the original reason it's in the code...

Also, with the above commented out, when I mouseover the link, instead of javascript: void(0); I now get this in the status bar:

Code:
javascript: document.orderform_16194_1220758753.submit();
whereas normally an add to cart link would not show anything in the status bar...

Can anyone shed some light?
__________________
X Cart Pro
v. 4.1.9
Download Expander (from Altered Cart)
X-Magnifier
Dynamic Preview (from BCS Engineering)
Customer Rewards Points (BCSE), used as credit purchasing system
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 12:02 PM.

   

 
X-Cart forums © 2001-2020