Jump to content

A few simple coding questions.


Recommended Posts

1) On a products page, what code should I use to have a "Back to products list" button? I have tried using a javascript one which forces it to go back a page, but it won't work if the product was linked from somewhere else.

2) What is the code for an IF ELSE statement to check if you're logged in or not?
e.g. if logged in then alertbox (product added to wish list) else alertbox (not logged in), redirect to login page

That's all I ask for now, thanks a lot.

Link to comment
Share on other sites

Your solution to use Javascript to go back is best, since it will return the customer to where they clicked on to get to the product. There are many different places that could have been clicked. To force the customer back to the product listing page would be counterintuitive.

For the wishlist question, change modules/blockwishlist/blockwishlist-extra.tpl to:


<a href="{if $logged}[removed];{else}{$base_dir}authentication.php{/if}" class="button"{if $logged} onclick="[removed]WishlistCart('wishlist_block_list', 'add', '{$id_product|intval}', $('#idCombination').val(), document.getElementById('quantity_wanted').value); alert('Product successfully added to wishlist');"{/if}>{l s='Add to my wishlist' mod='blockwishlist'}



Change the first [removed] to javascript and the second [removed] with javascript followed by a :

This will pop up a box that says "Product successfully added to wishlist" after the "Add to wishlist" button is clicked or redirect to authentication.php if not logged in.

Link to comment
Share on other sites

×
×
  • Create New...