Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Catalog Mode: How to get 'buy now' link to open new window? Rate Topic   - - - - -

 
  • MEvans
  • Member
  • Members
  • Join Date: 12-Nov 13
  • 20 posts

Posted 03 December 2013 - 04:03 PM #1

My store is in catalog mode. The the user clicks the buy now button, it takes them to the url that I set. I would that link to open in a new window.

This is the code in the add-on/catalog_mode/hooks/buttons/add-to-cart-override.tpl :

{if ''|fn_catalog_mode_enabled == 'Y'}
{if $product.buy_now_url != ''}
{include file="buttons/button.tpl" but_id=$but_id but_text=_("buy now") but_href=$product.buy_now_url but_role=$but_role|default:"text" but_name=""}
{elseif $addons.catalog_mode.add_to_cart_empty_buy_now_url != 'Y'}
 
{/if}
{/if}



I don't know where (if this is the place) to modify. I know the html will be target="_blank" Do you know where I place it - or how to accomplish goal? Thanks

 
  • cscartrocks
  • Member
  • Members
  • Join Date: 24-Jan 11
  • 1763 posts

Posted 03 December 2013 - 04:08 PM #2

This is the file buttons/button.tpl under the template folder depends on your cs-cart version.

One Step Checkout Addon - The ultimate checkout experience
Best CS-Cart SEO addon - CS-Cart SEO Ultimate Addon
PM for quality custom work/project


 
  • MEvans
  • Member
  • Members
  • Join Date: 12-Nov 13
  • 20 posts

Posted 03 December 2013 - 04:27 PM #3

This is the file buttons/button.tpl under the template folder depends on your cs-cart version.


I took a look at that too... any help on where I put the code? ( target="_blank" )
Here is the buttons/button.tpl code for reference:

{if $but_role == "action"}
{assign var="suffix" value="-action"}
{assign var="file_prefix" value="action_"}
{elseif $but_role == "act"}
{assign var="suffix" value="-act"}
{assign var="file_prefix" value="action_"}
{elseif $but_role == "disabled_big"}
{assign var="suffix" value="-disabled-big"}
{elseif $but_role == "big"}
{assign var="suffix" value="-big"}
{elseif $but_role == "delete"}
{assign var="suffix" value="-delete"}
{elseif $but_role == "tool"}
{assign var="suffix" value="-tool"}
{else}
{assign var="suffix" value=""}
{/if}

{if $but_name && $but_role != "text" && $but_role != "act" && $but_role != "delete"} {* SUBMIT BUTTON *}
<span {$but_extra} {if $but_id}id="wrap_{$but_id}"{/if} {if $but_css}style="{$but_css}"{/if} class="button-submit{$suffix} button-wrap-left"><span {if $but_css}style="{$but_css}"{/if} class="button-submit{$suffix} button-wrap-right"><input {if $but_id}id="{$but_id}"{/if} {if $but_meta}class="{$but_meta}"{/if} type="submit" name="{$but_name}" {if $but_onclick}onclick="{$but_onclick}"{/if} value="{$but_text}" /></span></span>

{elseif $but_role == "text" || $but_role == "act" || $but_role == "edit"} {* TEXT STYLE *}
<a {$but_extra} class="{if $but_meta}{$but_meta} {/if}{if $but_name}cm-submit {/if}text-button{$suffix}"{if $but_id} id="{$but_id}"{/if}{if $but_name} data-ca-dispatch="{$but_name}"{/if}{if $but_href} href="{$but_href|fn_url}"{/if}{if $but_onclick} onclick="{$but_onclick} return false;"{/if}{if $but_target} target="{$but_target}"{/if}{if $but_rel} rel="{$but_rel}"{/if}{if $but_external_click_id} data-ca-external-click-id="{$but_external_click_id}"{/if}{if $but_target_form} data-ca-target-form="{$but_target_form}"{/if}{if $but_target_id} data-ca-target-id="{$but_target_id}"{/if}>{$but_text}</a>

{elseif $but_role == "delete"}

<a {$but_extra} {if $but_id}id="{$but_id}"{/if}{if $but_name} data-ca-dispatch="{$but_name}"{/if} {if $but_href}href="{$but_href|fn_url}"{/if}{if $but_onclick} onclick="{$but_onclick} return false;"{/if}{if $but_meta} class="{$but_meta}"{/if}{if $but_target} target="{$but_target}"{/if}{if $but_rel} rel="{$but_rel}"{/if}{if $but_external_click_id} data-ca-external-click-id="{$but_external_click_id}"{/if}{if $but_target_form} data-ca-target-form="{$but_target_form}"{/if}{if $but_target_id} data-ca-target-id="{$but_target_id}"{/if}><i title="{__("delete")}" class="icon-cancel-circle"></i></a>

{elseif $but_role == "icon"} {* LINK WITH ICON *}
<a {$but_extra} {if $but_id}id="{$but_id}"{/if}{if $but_href} href="{$but_href|fn_url}"{/if} {if $but_onclick}onclick="{$but_onclick};{if !$allow_href} return false;{/if}"{/if} {if $but_target}target="{$but_target}"{/if} {if $but_rel} rel="{$but_rel}"{/if}{if $but_external_click_id} data-ca-external-click-id="{$but_external_click_id}"{/if}{if $but_target_form} data-ca-target-form="{$but_target_form}"{/if}{if $but_target_id} data-ca-target-id="{$but_target_id}"{/if} class="{if $but_meta}{$but_meta}{/if}">{$but_text}</a>

{else} {* BUTTON STYLE *}

<span {$but_extra} class="button{$suffix} button-wrap-left" {if $but_id}id="{$but_id}"{/if}><span class="button{$suffix} button-wrap-right"><a {if $but_href}href="{$but_href|fn_url}"{/if}{if $but_onclick} onclick="{$but_onclick} return false;"{/if} {if $but_target}target="{$but_target}"{/if} class="{if $but_meta}{$but_meta} {/if}" {if $but_rel} rel="{$but_rel}"{/if}{if $but_external_click_id} data-ca-external-click-id="{$but_external_click_id}"{/if}{if $but_target_form} data-ca-target-form="{$but_target_form}"{/if}{if $but_target_id} data-ca-target-id="{$but_target_id}"{/if}>{$but_text}</a></span></span>
{/if}



Thanks

 
  • Hungryweb
  • Senior Member
  • Authorized Reseller
  • Join Date: 10-Feb 12
  • 1249 posts

Posted 03 December 2013 - 06:35 PM #4

Hi,
You need to edit file design/themes/[THEME_NAME]/templates/addons/catalog_mode/hooks/buttons/add_to_cart.override.tpl, add but_target="_blank" into {include file="buttons/button.tpl" ....}

Final code
{if ''|fn_catalog_mode_enabled == 'Y'}
    {if $product.buy_now_url != ''}
	    {include file="buttons/button.tpl" but_id=$but_id but_text=__("buy_now") but_href=$product.buy_now_url but_role=$but_role|default:"text" but_name="" but_target="_blank"}
    {elseif $addons.catalog_mode.add_to_cart_empty_buy_now_url != 'Y'}
  &nbsp;
    {/if}
{/if}

I hope that helps,

---
Valentin
part of hungryweb.net

 
  • MEvans
  • Member
  • Members
  • Join Date: 12-Nov 13
  • 20 posts

Posted 03 December 2013 - 06:49 PM #5

Thank you so much Valentin! Its works perfectly :)

 
  • Hungryweb
  • Senior Member
  • Authorized Reseller
  • Join Date: 10-Feb 12
  • 1249 posts

Posted 03 December 2013 - 07:56 PM #6

You are welcome!