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

New Button

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 06-12-2009, 08:28 AM
 
swifty1 swifty1 is offline
 

eXpert
  
Join Date: Aug 2008
Location: UK
Posts: 327
 

Question New Button

Hi
I need some help on the correct sequence to create a new button that will be different from all the other buttons on my site (larger and a different background colour).

I belive the buttons are made up of three images which automatically self adjust to suit the text in the button, this process i wish to keep.

I have made three new images in Photoshop (LH/midd/RH button image) which i have uploaded to skin1/images. Do i now need to make a new style in skin1.css for example call the new style "Button1" then add all the style data below,
then in the product.tpl rename the style that i require to be displayed, for example this is the original line of code in the product.tpl of the button i wish to change

</td>
<td><div align="centre">{include file="buttons/add_to_cart.tpl" style="button" href="javascript: if(FormValidation()) document.orderform.submit();"}</div></td>
</tr>

Where the style is in red above is where i would put "Button1" the new style that i created.

Is this the correct way to do this and if i require more different button colours etc then i would repeat the above.
__________________
4.1.11 gold
x-special offers
CDSEO Pro
Reply With Quote
  #2  
Old 06-16-2009, 03:59 AM
  Victor D's Avatar 
Victor D Victor D is offline
 

X-Adept
  
Join Date: Aug 2008
Posts: 643
 

Default Re: New Button

Also you should change your buttons/button.tpl

Code:
{if $style eq 'button' && ($config.Adaptives.platform ne 'MacPPC' || $config.Adaptives.browser ne 'NN')} <table cellspacing="0" cellpadding="0" onclick="{$js_link}" class="ButtonTable"{if $title ne ''} title="{$title|escape}"{/if}> {strip} <tr> <td> <{$img_type} src="{$ImagesDir}/but1.gif" class="ButtonSide" alt="{$title|escape}" /> </td> <td class="Button"{$reading_direction_tag}> <font class="Button">{$button_title}</font> </td> <td> <img src="{$ImagesDir}/but2.gif" class="ButtonSide" alt="{$title|escape}" /> </td> </tr> {/strip} </table> {elseif $image_menu}


to
Code:
{if $style eq 'button' && ($config.Adaptives.platform ne 'MacPPC' || $config.Adaptives.browser ne 'NN')} <table cellspacing="0" cellpadding="0" onclick="{$js_link}" class="ButtonTable"{if $title ne ''} title="{$title|escape}"{/if}> {strip} <tr> <td> <{$img_type} src="{$ImagesDir}/but1.gif" class="ButtonSide" alt="{$title|escape}" /> </td> <td class="Button"{$reading_direction_tag}> <font class="Button">{$button_title}</font> </td> <td> <img src="{$ImagesDir}/but2.gif" class="ButtonSide" alt="{$title|escape}" /> </td> </tr> {/strip} </table> {elseif $style eq 'button1' && ($config.Adaptives.platform ne 'MacPPC' || $config.Adaptives.browser ne 'NN')} <table cellspacing="0" cellpadding="0" onclick="{$js_link}" class="Button1Table"{if $title ne ''} title="{$title|escape}"{/if}> {strip} <tr> <td> <{$img_type} src="{$ImagesDir}/LH.gif" class="Button1Side" alt="{$title|escape}" /> </td> <td class="Button1"{$reading_direction_tag}> <font class="Button1">{$button_title}</font> </td> <td> <img src="{$ImagesDir}/RH.gif" class="Button1Side" alt="{$title|escape}" /> </td> </tr> {/strip} </table> {elseif $image_menu}
__________________
Regards,
Victor Dubiniuk

X-Cart Skins Store
- twenty two different skins for 4.1.x and 4.2.x;
- 4.3.x compatible versions are available;
- refresh you store now!

Smart menu X-Cart add-on for 4.1.8 - 4.3.x
Featured Products Slide Show X-Cart add-on for 4.1.8 - 4.3.x
Reply With Quote
  #3  
Old 06-25-2009, 10:48 AM
 
swifty1 swifty1 is offline
 

eXpert
  
Join Date: Aug 2008
Location: UK
Posts: 327
 

Default Re: New Button

By changing the buttons/button.tpl as you suggested will do what to the button?
Please excuse my ignorance as i am a begginer, lol.
__________________
4.1.11 gold
x-special offers
CDSEO Pro
Reply With Quote
  #4  
Old 06-30-2009, 01:38 AM
  Victor D's Avatar 
Victor D Victor D is offline
 

X-Adept
  
Join Date: Aug 2008
Posts: 643
 

Default Re: New Button

button.tpl produces buttons of specified style

There is style 'button' but no 'button1'. If you specify style 'button1'
condition

if $style eq 'button'

will be false and button of default style is produced (simple text link I guess)

so I added

elseif $style eq 'button1' where you can specify your custom style used when button.tpl is invoked with $style="button1"
__________________
Regards,
Victor Dubiniuk

X-Cart Skins Store
- twenty two different skins for 4.1.x and 4.2.x;
- 4.3.x compatible versions are available;
- refresh you store now!

Smart menu X-Cart add-on for 4.1.8 - 4.3.x
Featured Products Slide Show X-Cart add-on for 4.1.8 - 4.3.x
Reply With Quote
  #5  
Old 06-30-2009, 05:16 AM
 
swifty1 swifty1 is offline
 

eXpert
  
Join Date: Aug 2008
Location: UK
Posts: 327
 

Default Re: New Button

Thanks Victor D
So every time i create a new button i have to add code to the buttons/button.tpl as your example, would this be for any type of button that i change?

Copy of your code below with the code in red which relates to the new button css and img's for that button, is this the only .tpl that has to be changed when applying a new button?

{elseif $style eq 'button1' && ($config.Adaptives.platform ne 'MacPPC' || $config.Adaptives.browser ne 'NN')}
<table cellspacing="0" cellpadding="0" onclick="{$js_link}" class="Button1Table"{if $title ne ''} title="{$title|escape}"{/if}>
{strip}
<tr>
<td>
<{$img_type} src="{$ImagesDir}/LH.gif" class="Button1Side" alt="{$title|escape}" />
</td>
<td class="Button1"{$reading_direction_tag}>
<font class="Button1">{$button_title}</font>
</td>
<td>
<img src="{$ImagesDir}/RH.gif" class="Button1Side" alt="{$title|escape}" />
</td>
</tr>
{/strip}
</table>

I have the new button on my site without the change to the buttons/button.tpl and it is working fine but i assume that to be fully correct i have to change the /button.tpl

One more thing, where is the reference to the midd img?
__________________
4.1.11 gold
x-special offers
CDSEO Pro
Reply With Quote
  #6  
Old 06-30-2009, 01:14 PM
  Victor D's Avatar 
Victor D Victor D is offline
 

X-Adept
  
Join Date: Aug 2008
Posts: 643
 

Default Re: New Button

If you need more than one custom button you can do it like this
Code:
{elseif $style eq 'button1' && ($config.Adaptives.platform ne 'MacPPC' || $config.Adaptives.browser ne 'NN')} <table cellspacing="0" cellpadding="0" onclick="{$js_link}" class="{$custom_class}"{if $title ne ''} title="{$title|escape}"{/if}> {strip} <tr> <td> <{$img_type} src="{$ImagesDir}/spacer.gif" class="{$custom_class}-l" alt="{$title|escape}" /> </td> <td class="{$custom_class}"{$reading_direction_tag}> <font class="{$custom_class}">{$button_title}</font> </td> <td> <img src="{$ImagesDir}/spacer.gif" class="{$custom_class}-r" alt="{$title|escape}" /> </td> </tr> {/strip} </table>



Now you should apply custom styles:
Code:
/*FirstButton*/ TABLE.FirstButton{ /*common first button styles*/ } img.FirstButton-l{ /*left part of the first button styles*/ } img.FirstButton-r{ /*right part of the first button styles*/ } TD.FirstButton{ /*center part of the first button styles*/ } /*SecondButton*/ TABLE.SecondButton{ /*common second button styles*/ } img.SecondButton-l{ /*left part of the second button styles*/ } img.SecondButton-r{ /*right part of the second button styles*/ } TD.SecondButton{ /*center part of the second button styles*/ } .... /*TheVeryLastButton*/ TABLE.TheVeryLastButton{ ....

Now you can include button.tpl as
{include file='button.tpl'.... style='button1' custom_class="FirstButton"}
{include file='button.tpl'.... style='button1' custom_class="SecondButton"}
....
{...}

Quote:
is this the only .tpl that has to be changed when applying a new button?

If you include button.tpl directly this tpl is the only one.

Quote:
One more thing, where is the reference to the midd img?
in CSS TD.button1 should be like this

TD.button1{
background: #fff url(images/btn-c.gif) left top repeat-x;
}
__________________
Regards,
Victor Dubiniuk

X-Cart Skins Store
- twenty two different skins for 4.1.x and 4.2.x;
- 4.3.x compatible versions are available;
- refresh you store now!

Smart menu X-Cart add-on for 4.1.8 - 4.3.x
Featured Products Slide Show X-Cart add-on for 4.1.8 - 4.3.x
Reply With Quote

The following user thanks Victor D for this useful post:
swifty1 (07-02-2009)
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 11:34 AM.

   

 
X-Cart forums © 2001-2020