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

Modifying the Buy Now Button

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 04-26-2010, 07:22 PM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Modifying the Buy Now Button

I'm building a site for a guy that sells puppies. And the SKU name is the puppy's name. I figured out how to change the text of the button to say "Adopt", but I'd like it to say "Adopt Junior" Junior = SKU

Here's my code from the /customer/buttons/buy_now.tpl
Code:
{* $Id: buy_now.tpl,v 1.2 2009/05/29 13:19:08 max Exp $ vim: set ts=2 sw=2 sts=2 et: *} {include file="customer/buttons/button.tpl" button_title="Adopt" additional_button_class=$additional_button_class|cat:' add-to-cart-button'}

I'd also like to do the same thing in the Details view.
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #2  
Old 04-26-2010, 07:50 PM
 
Shamun Shamun is offline
 

X-Adept
  
Join Date: Jun 2009
Location: North Carolina
Posts: 841
 

Default Re: Modifying the Buy Now Button

{include file="customer/buttons/button.tpl" button_title="Adopt {$product.productcode|escape}" additional_button_class=$additional_button_class|c at:' add-to-cart-button'}


Try that
__________________
- Shane Munroe
Reply With Quote
  #3  
Old 04-26-2010, 07:52 PM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Re: Modifying the Buy Now Button

Error: Smarty error: [in customer/buttons/buy_now.tpl line 5]: syntax error: invalid attribute name: '{$product.productcode|escape' (Smarty_Compiler.class.php, line 1550) in /home/minfinge/public_html/littlepuppiesonline.com/include/lib/smarty/Smarty.class.php on line 1093
Adopt " additional_button_class=$additional_button_class|c at:' add-to-cart-button'}
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #4  
Old 04-26-2010, 07:54 PM
 
Shamun Shamun is offline
 

X-Adept
  
Join Date: Jun 2009
Location: North Carolina
Posts: 841
 

Default Re: Modifying the Buy Now Button

Eh, I'll mess around with it on mine. That was mostly a copy+paste in :P
__________________
- Shane Munroe
Reply With Quote
  #5  
Old 04-26-2010, 08:18 PM
 
Shamun Shamun is offline
 

X-Adept
  
Join Date: Jun 2009
Location: North Carolina
Posts: 841
 

Default Re: Modifying the Buy Now Button

So far I can't find out how to get it to have other characters.

{include file="customer/buttons/button.tpl" button_title=$product.productcode|escape additional_button_class=$additional_button_class|c at:' add-to-cart-button'}

That will display only the sku. Trying to add the text in before it breaks it. Perhaps someone else with more knowledge of smarty will be able to help ><
__________________
- Shane Munroe
Reply With Quote
  #6  
Old 04-26-2010, 10:15 PM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default Re: Modifying the Buy Now Button

try:
button_title='Adopt '|cat:$product.productcode
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote

The following user thanks gb2world for this useful post:
minfinger (04-27-2010)
  #7  
Old 04-27-2010, 03:43 AM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Re: Modifying the Buy Now Button

Sorry about the previous post that did it perfectly!!!

Full TPL Code:

Code:
{* $Id: buy_now.tpl,v 1.2 2009/05/29 13:19:08 max Exp $ vim: set ts=2 sw=2 sts=2 et: *} {include file="customer/buttons/button.tpl" button_title='Adopt '|cat:$product.productcode additional_button_class=$additional_button_class|cat:' add-to-cart-button'}


Another question is that I want the customer to be taken to the details page instead of the button adding it to the cart. I know this is simple, but I haven't had a chance to look into it. There are options in the Details Page that are required to be completed before adding the dog to the cart.
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #8  
Old 04-27-2010, 03:45 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Modifying the Buy Now Button

{include file="customer/buttons/button.tpl" button_title="Adopt `$product.productcode`" additional_button_class=$additional_button_class|c at:' add-to-cart-button'}
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following 2 users thank cflsystems for this useful post:
minfinger (04-27-2010), Steel (03-18-2012)
  #9  
Old 04-27-2010, 04:10 AM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Re: Modifying the Buy Now Button

I think I found the code I need to change in the


Code:
<div class="button{if $additional_button_class} {$additional_button_class}{/if}" title="{$title|default:$button_title|escape}" onclick="{$div_link}"> <a href="{$href}" onclick="{if $js_link}{$js_link};{else}javascript:{/if} if (event) event.cancelBubble = true;"{$reading_direction_tag}>{$button_title|amp}</a> </div>

I think the <a href...> needs to be changed to <a href="{$url}" class="see-details">

But that didn't work either lol
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #10  
Old 04-27-2010, 04:11 AM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default Re: Modifying the Buy Now Button

Quote:
Originally Posted by cflsystems
{include file="customer/buttons/button.tpl" button_title="Adopt `$product.productcode`" additional_button_class=$additional_button_class|c at:' add-to-cart-button'}
cflsystems, thanks gb2world's suggestion got it, I was just hasty in my reply.
__________________
X-Cart 4.3
Joomla
Among other things
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 05:06 PM.

   

 
X-Cart forums © 2001-2020