X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Modifying the Buy Now Button (https://forum.x-cart.com/showthread.php?t=53471)

minfinger 04-26-2010 07:22 PM

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.

Shamun 04-26-2010 07:50 PM

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

minfinger 04-26-2010 07:52 PM

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'}

Shamun 04-26-2010 07:54 PM

Re: Modifying the Buy Now Button
 
Eh, I'll mess around with it on mine. That was mostly a copy+paste in :P

Shamun 04-26-2010 08:18 PM

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 ><

gb2world 04-26-2010 10:15 PM

Re: Modifying the Buy Now Button
 
try:
button_title='Adopt '|cat:$product.productcode

minfinger 04-27-2010 03:43 AM

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.

cflsystems 04-27-2010 03:45 AM

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'}

minfinger 04-27-2010 04:10 AM

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

minfinger 04-27-2010 04:11 AM

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.


All times are GMT -8. The time now is 10:13 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.