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

How to add "View details" button instead of "Add to wishlist" in products.tpl?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 03-01-2009, 07:10 PM
  acidon's Avatar 
acidon acidon is offline
 

Senior Member
  
Join Date: Feb 2008
Posts: 139
 

Unhappy How to add "View details" button instead of "Add to wishlist" in products.tpl?

Hi I want to add a "View details" button to "customer/main/products.tpl"

Yeah, I know that there are already 3 + links to details page from every product in products.tpl, but I want to make it even more obvious.

In my store, as of right now, I have "Buy now" enabled along with "Wishlist". Those are the only 2 buttons I have in there at the moment, sitting right under the "Select quantity" box. What I would love to have is a button " View Details" instead of "Add to wishlist" button in my products list, when clicked it should bring my customer to that product details page.

I noticed that in products.tpl Wishlist button included as a part of "customer/main/buy_now.tpl, but on product details page it included as separate template.

I decided to create a duplicate templates "customer/main/buy_now.tpl" and ""buttons/add_to_wishlist.tpl" (I called them "customer/main/buy_now1.tpl" and "buttons/add_to_wishlist1.tpl") to test thing out before making changes. I don't mind having wishlist button in products details page, but I don't need wishlist button in products.tpl and want to have View details" button instead.

I figured easiest way to achieve it, is to create 2 separate templates "buttons/add_to_wishlist.tpl"(original) and buttons/add_to_wishlist1.tpl"(duplicate); original one for product.tpl and duplicate one for products.tpl.
Here is how I modified them :

customer/main/buy_now1.tpl :

Code:
{* $Id: buy_now1.tpl,v 1.30.2.12 2008/07/22 07:58:28 ferz Exp $ *} {if $product.price gt 0 or ($active_modules.Special_Offers ne "" and $product.use_special_price ne "")} {if $config.Product_Options.buynow_with_options_enabled eq 'Y' || ($product.avail eq 0 && $product.variantid && $product.product_type ne 'C')} {assign var="buynow_enabled" value=false} {else} {assign var="buynow_enabled" value=true} {/if} <form name="orderform_{$product.productid}_{$product.add_date}" method="post" action="{if $product.is_product_options eq 'Y' && !$buynow_enabled}product.php?productid={$product.productid}{else}cart.php?mode=add{/if}"> <input type="hidden" name="productid" value="{$product.productid}" /> <input type="hidden" name="cat" value="{$smarty.get.cat|escape:"html"}" /> <input type="hidden" name="page" value="{$smarty.get.page|escape:"html"}" /> {/if} <table width="100%" cellpadding="0" cellspacing="0"> {if $product.price eq 0 and not ($active_modules.Special_Offers ne "" and $product.use_special_price ne "")} <tr> <td height="25"> {assign var="button_href" value=$smarty.get.page|escape:"html"} {include file="buttons/buy_now.tpl" style="button" href="product.php?productid=`$product.productid`&cat=`$cat`&page=`$button_href`"} </td> </tr> {else} {if $product.is_product_options ne 'Y' || $buynow_enabled || $product.variantid} <tr> {if $config.General.unlimited_products ne "Y" && ($product.avail le 0 or $product.avail lt $product.min_amount) && $product.variantid} <td class="BuyNowQuantity">{$lng.lbl_quantity}</td> <td width="20%" nowrap="nowrap"><b>{$lng.txt_out_of_stock}</b></td> {elseif $product.distribution eq "" && !($active_modules.Subscriptions ne "" and $products[product].catalogprice)} <td class="BuyNowQuantity">{$lng.lbl_quantity}</td> <td width="20%" nowrap="nowrap"> {if $config.General.unlimited_products ne "Y" && ($product.avail le 0 or $product.avail lt $product.min_amount)} <b>{$lng.txt_out_of_stock}</b> {else} {if $config.General.unlimited_products eq "Y"} {assign var="mq" value=$config.Appearance.max_select_quantity} {else} {math equation="x/y" x=$config.Appearance.max_select_quantity y=$product.min_amount assign="tmp"} {if $tmp<2} {assign var="minamount" value=$product.min_amount} {else} {assign var="minamount" value=1} {/if} {math equation="min(maxquantity+minamount, productquantity+1)" assign="mq" maxquantity=$config.Appearance.max_select_quantity minamount=$minamount productquantity=$product.avail} {/if} {if $product.min_amount le 1} {assign var="start_quantity" value=1} {else} {assign var="start_quantity" value=$product.min_amount} {/if} {if $config.General.unlimited_products eq "Y"} {math equation="x+y" assign="mq" x=$mq y=$start_quantity} {/if} <select name="amount"> {section name=quantity loop=$mq start=$start_quantity} <option value="{%quantity.index%}"{if $smarty.get.quantity eq %quantity.index%} selected="selected"{/if}>{%quantity.index%}</option> {/section} </select> {/if} </td> {else} <td style="display: none;"><input type="hidden" name="amount" value="1" /></td> {/if} <td class="BuyNowPrices"> <input type="hidden" name="mode" value="add" /> {include file="customer/main/product_prices.tpl" no_span=true} </td> </tr> {elseif $product.distribution eq "" && !($active_modules.Subscriptions ne "" and $products[product].catalogprice) && $config.General.unlimited_products ne "Y" && ($product.avail le 0 or $product.avail lt $product.min_amount) && !$product.variantid} <tr> <td colspan="3" height="25"><b>{$lng.txt_out_of_stock}</b></td> </tr> {/if} <tr> <td colspan="3"> {if $config.General.unlimited_products eq "Y" || ($product.avail gt 0 and $product.avail ge $product.min_amount) || ($product.variantid and $product.avail gt 0)} <br /> <table cellpadding="0" cellspacing="0"> <tr> {if $js_enabled} {if $special_offers_add_to_cart eq 'Y'} <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(); return false;"}</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_wishlist1.tpl" style="button" href="product.php?productid={$products[product].productid}"} </td> {/if} {else} <td>{include file="submit_wo_js.tpl" value=$lng.lbl_buy_now}</td> {/if} </tr> </table> {/if} </td> </tr> {if $product.min_amount gt 1} <tr> <td colspan="3"><font class="ProductDetailsTitle">{$lng.txt_need_min_amount|substitute:"items":$product.min_amount}</font></td> </tr> {/if} {/if} </table> {if $product.price gt 0 or ($active_modules.Special_Offers ne "" and $product.use_special_price ne "")} </form> {/if}


buttons/add_to_wishlist1.tpl :

Code:
{include file="buttons/button.tpl" button_title="View Details" href=$href title=$title style=$style}

Last thing I did, I replaced buy_now.tpl with my test buy_now1.tpl in "customer/main/products.tpl", and crossed my fingers hoping it will do it.

It didnt quiet work, its now showing me a desired button "View details" but also it placeed " "} " after button itself in my products list. also when I push the new button it prings me to access denied page without login option.

I am giving up.. can anyone tell me what is the right way to achieve my goal? I am sure there is a much simpler, correct way to do it.

Please help!!!
__________________
Version 4.7.6 X-cart Gold
Reply With Quote
  #2  
Old 03-01-2009, 10:38 PM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: How to add "View details" button instead of "Add to wishlist" in products.tpl?

this was very simple in 4.1.11 havn't tried it with 4.2, I'll see what I can do.

There is always the very simple way of just using the images that are used for the buttons and making a simple button with out using the button.tpl.
__________________
xcart 5.1.2
Reply With Quote
  #3  
Old 03-03-2009, 08:03 AM
  acidon's Avatar 
acidon acidon is offline
 

Senior Member
  
Join Date: Feb 2008
Posts: 139
 

Default Re: How to add "View details" button instead of "Add to wishlist" in products.tpl?

Mighty X-Wizard Ashley, you are my only hope, since noone else answered me, you the best!

Please enlight me with your wisdom, I would appretiate it so much!!!

In my customer/main/buy_now.tpl I found if statements related to wishlist button:

Code:
{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> {/if} {else} <td>{include file="submit_wo_js.tpl" value=$lng.lbl_buy_now}</td> {/if}

I know i am getting very close, btw I have 4.1.11
__________________
Version 4.7.6 X-cart Gold
Reply With Quote
  #4  
Old 03-04-2009, 06:11 AM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: How to add "View details" button instead of "Add to wishlist" in products.tpl?

oh it 4.1.11.... your very first idea should have worked.
__________________
xcart 5.1.2
Reply With Quote
  #5  
Old 03-04-2009, 06:20 AM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: How to add "View details" button instead of "Add to wishlist" in products.tpl?

{if $js_enabled}
{if $special_offers_add_to_cart eq 'Y'}
<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(); return false;"}</td>
{/if}

<td>
&nbsp;&nbsp;&nbsp;&nbsp;
</td>
<td>
<table cellpadding="0" cellspacing="0">
<tr>
<td><img src="{$ImagesDir}/but1.gif" alt="" /></td>
<td class="Button"><a href="product.php?productid={$products[product].productid}&amp;cat={$cat}&amp;page={$navigation_p age}{if $featured eq 'Y'}&amp;featured{/if}" class="white">More Info</a></td>
<td><img src="{$ImagesDir}/but2.gif" alt="" /></td>
</tr>
</table>

</td>
__________________
xcart 5.1.2
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 02:09 AM.

   

 
X-Cart forums © 2001-2020