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)
-   -   Change link based on member type (https://forum.x-cart.com/showthread.php?t=46847)

Group Imaging 04-08-2009 02:57 PM

Change link based on member type
 
Forgive me if someone has asked this already but I wasn't sure what to search for but hopefully someone can help. Here's what I want to do:

I want to post a link (to our catalog pdf) on the shopping cart which is easy, however when the customer logs in with a different membership type (non-profit) I want the link to download the non-profit version of the pdf rather than the retail.

Is this possible?

Thanks for any help in advance.

alec.thomas 04-08-2009 03:27 PM

Re: Change link based on member type
 
couldnt you just do something like this?
Code:


<a href={if $userinfo.membershipid eq "customer"}"/files/catalog.pdf"{else}"/files/non-profit.pdf"{/if}>


depending on what your membership names are, and where you're files are you'll have to edit it how you want it.

Group Imaging 04-13-2009 07:20 AM

Re: Change link based on member type
 
Thanks for the starting point, here is what I ended up with:

I found an old post by B00MER that mentioned having to add the following line of code into include/check_useraccount.php.

Code:

$smarty->assign("user_membership",$user_account["membership"]);

and then for the actual line that changes directories/files I used:

Code:

<a href={if $user_membership eq "Non-Profit"}"/files/non-profit.pdf"{else}"/files/catalog.pdf"{/if}</a>

alec.thomas 04-13-2009 09:46 AM

Re: Change link based on member type
 
I'm not sure if you had to add a new variable... I think that xcart already has one that checks membership type, but I'm glad to hear that you have it working now.


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

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