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)
-   -   How to disable Wish List redirect (https://forum.x-cart.com/showthread.php?t=42245)

wayfarer 09-08-2008 02:48 PM

How to disable Wish List redirect
 
Hi all,

I am trying to work out how to make Add to Wish List work more like Buy Now in the sense that the item is added, without the customer being redirected to the Wish List each time...

I'm thinking it must be reasonably simple and have tried to compare how the Buy Now is coded with how the Wish List is, but haven't had any realisations. I've searched this forum and haven't come across anything on the subject...

Can anyone point out where to make a code adjustment?

Yurij 09-09-2008 06:30 AM

Re: How to disable Wish List redirect
 
I am not sure, but try to do so:

open file "modules/Wishlist/wishlist.php" and find next lines:

PHP Code:

if (!empty($active_modules['SnS_connector']))
        
func_generate_sns_action("AddToWishList");

    
func_header_location("cart.php?mode=wishlist"); 


and replace this code by this:

PHP Code:

if (!empty($active_modules['SnS_connector']))
        
func_generate_sns_action("AddToWishList");

    
    
func_header_location($_SERVER["HTTP_REFERER"]);
//    func_header_location("cart.php?mode=wishlist"); 


After clicking on button "Add to wish list" the customer will stay on the this page.

wayfarer 09-09-2008 04:52 PM

Re: How to disable Wish List redirect
 
Beautiful! Thankyou very much for the fast reply and simple solution - works brilliantly...

wayfarer 09-09-2008 06:14 PM

Re: How to disable Wish List redirect
 
Actually... no it doesn't work. It will only work if a section of button.tpl is commented out. This section here:

{if $js_to_href ne 'Y'}
{assign var="onclick" value=$href}
{assign var="href" value="javascript: void(0);"}
{/if}

HOWEVER, if I do that then this small mod (http://forum.x-cart.com/showthread.php?t=40022), which is supposed to show the number of items in the customer's wish list every time something is added, doesn't update the number of items - until the page is refreshed by clicking on another page or actually going to the wish list page...

I have included the full text of my button.tpl - what is the significance of that piece of code and how can make a change that will allow the disabling of the wish list to work, as well as have the number of items updating correctly?




{* $Id: button.tpl,v 1.25.2.2 2006/06/16 10:47:41 max Exp $ *}
{if $config.Adaptives.platform eq 'MacPPC' && $config.Adaptives.browser eq 'NN'}
{assign var="js_to_href" value="Y"}
{/if}
{if $type eq 'input'}
{assign var="img_type" value='input class="InputNoBorder" type="image"'}
{else}
{assign var="img_type" value='img'}
{/if}
{assign var="js_link" value=$href|regex_replace:"/^\s*javascript\s*:/Si":""}
{if $js_link eq $href}
{assign var="js_link" value="javascript: self.location='"|cat:$href|amp|cat:"';"}
{else}
{assign var="js_link" value=$href}
{if $js_to_href ne 'Y'}
{assign var="onclick" value=$href}
{assign var="href" value="javascript: void(0);"}
{/if}
{/if}

{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}
{strip}
<table cellspacing="0" class="SimpleButton">
<tr>
{if $button_title ne ''}
<td>
<a class="VertMenuItemsLight" href="{$href|amp}"
{if $onclick ne ''} onclick="{$onclick}"{/if}
{if $title ne ''} title="{$title|escape}"{/if}
{if $target ne ''} target="{$target}"{/if}>
<font class="VertMenuItemsLight">{$button_title}</font>
</a>
</td>
{/if}
<td>
{if $img_type eq 'img'}
<a class="VertMenuItemsLight" href="{$href|amp}"
{if $onclick ne ''} onclick="{$onclick}"{/if}
{if $title ne ''} title="{$title|escape}"{/if}
{if $target ne ''} target="{$target}"{/if}>
{/if}
<{$img_type} {include file="buttons/go_image_menu.tpl"} />
{if $img_type eq 'img'}
</a>
{/if}
</td>
</tr>
</table>
{/strip}
{else}
{strip}
<table cellspacing="0" class="SimpleButton">
<tr>
{if $button_title ne ''}
<td>
<a class="Button" href="{$href|amp}"
{if $onclick ne ''} onclick="{$onclick}"{/if}
{if $title ne ''} title="{$title|escape}"{/if}
{if $target ne ''} target="{$target}"{/if}>
{$button_title}
</a>
</td>
{/if}
<td>
{if $img_type eq 'img'}
<a class="Button" href="{$href|amp}"
{if $onclick ne ''} onclick="{$onclick}"{/if}
{if $title ne ''} title="{$title|escape}"{/if}
{if $target ne ''} target="{$target}"{/if}>
{/if}
<{$img_type} {include file="buttons/go_image.tpl" full_url='Y'} />
{if $img_type eq 'img'}
</a>
{/if}
</td>
</tr>
</table>
{/strip}
{/if}


All times are GMT -8. The time now is 02:01 AM.

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