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)
-   -   if/then for wholesale customers... (https://forum.x-cart.com/showthread.php?t=58960)

upupcreative 04-18-2011 05:33 PM

if/then for wholesale customers...
 
I'd like to make it so that the products list (products.tpl I think, right?) shows the price for regular customers but DOES NOT show the price on that page for signed-in wholesale customers.

It seems like a simple enough if/then but I am having trouble with it. Any help?

(my reasoning: for wholesale customers, there's a minimum quantity to get the wholesale price, so the products list shows the retail price instead of the price per piece if buying the minimum. so a product that retails at $4 and sells wholesale for $2 with a minimum order of 10 items looks on the products list like it costs $4, which is confusing for my wholesale customers. so i'd rather avoid that. alternately, I could add something that says "retail price per piece" if i can't make it go away completely.)

Thank you,
Julie

qualiteam 04-28-2011 05:58 AM

Re: if/then for wholesale customers...
 
Add
Code:

$smarty->assign('user_account', @$user_account);
right before this
Code:

func_display('customer/home.tpl', $smarty);
in the "<xcart_dir>/home.php" script.

After surround the price code in products.tpl template with e.g.:
Code:

{if $user_account.membershipid eq 0}
...
{/if}


this will show the price only for customers without any membership level.

chamberinternet 08-10-2011 01:29 AM

Re: if/then for wholesale customers...
 
Hi Alex,

I've tried adding this piece of code to home.php, but the smarty variable is only available on the homepage and not any of the other pages.

Is there a way to get around this?

I have a catalog page only available to users with a membership level which is linked from one of the main menus, so it needs to be available at all times once they are logged in.

Many Thanks

*UPDATE* Think I got around this by adding the code to auth.php. Not sure if that's the best place, but it seems to work ok.

cflsystems 08-10-2011 03:19 AM

Re: if/then for wholesale customers...
 
You can also add to include/common.php (categories.php before 4.4.x), I thing is better then messing up with auth.php

chamberinternet 08-10-2011 03:21 AM

Re: if/then for wholesale customers...
 
Got it ... Cheers Steve!

jwpenn 10-13-2011 11:37 AM

Re: if/then for wholesale customers...
 
Is there a way to get the {$user_account.membershipid} to show a specific welcome text on the welcome.tpl template?

qualiteam 10-19-2011 11:45 PM

Re: if/then for wholesale customers...
 
You should use conditions in the welcome.tpl template.

Code:

{if $user_account.membershipid eq ID1}
 {$lng.txt_message1}
{elseif $user_account.membershipid eq ID2}
 {$lng.txt_message2}
{/if}


jwpenn 10-20-2011 07:27 AM

Re: if/then for wholesale customers...
 
Thank you for the reply. I tried the code similar to your with ids of 9 but it seems it still would not work. :(


HTML Code:

{if $user_account.membershipid eq 9}
{$lng.txt_welcometest} Test here
{else}
{$lng.txt_welcome} Regular
{/if}





I noticed in the menu.tpl it iterated over them do I have to do this for the ids here?



HTML Code:

{* $Id: menu_manufacturers.tpl,v 1.5 2005/11/17 06:55:47 max Exp $ *}
{if $manufacturers_menu ne ''}
{capture name=menu}
{section name=mid loop=$manufacturers_menu}
<a href="manufacturers.php?manufacturerid={$manufacturers_menu[mid].manufacturerid}" class="VertMenuItems">{$manufacturers_menu[mid].manufacturer}</a><br />
{/section}
{if $show_other_manufacturers}
<br />
<a href="manufacturers.php" class="VertMenuItems">{$lng.lbl_other_manufacturers}</a><br />
{/if}
{/capture}
{include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_manufacturers menu_content=$smarty.capture.menu}
<br />
{/if}


qualiteam 10-24-2011 10:47 PM

Re: if/then for wholesale customers...
 
Not sure what exactly you mean. Since I've used memberships in the sample and you refer the manufacturers in yours.

These are completely different entities in X-Cart.

jwpenn 10-25-2011 04:56 AM

Re: if/then for wholesale customers...
 
Sorry for the confusion. The goal is to get the "membershipid" on the welcome.tpl also note that I am running X-cart version 4.1.9

qualiteam 10-26-2011 12:20 AM

Re: if/then for wholesale customers...
 
In this case you should use the instructions from my post -> http://forum.x-cart.com/showpost.php?p=315987&postcount=2

In the welcome.tpl you can use something like:

Code:

{if $user_account.membershipid eq 0}
... no membership ...
{elseif $user_account.membershipid eq 9}
... specific membership ...
{/if}


jwpenn 10-26-2011 06:06 AM

Re: if/then for wholesale customers...
 
Quote:

Originally Posted by qualiteam
Add
Code:

$smarty->assign('user_account', @$user_account);
right before this
Code:

func_display('customer/home.tpl', $smarty);
in the "<xcart_dir>/home.php" script.

After surround the price code in products.tpl template with e.g.:
Code:

{if $user_account.membershipid eq 0}
...
{/if}


this will show the price only for customers without any membership level.



Thanks this worked! :D/

smek 12-27-2011 09:49 PM

Re: if/then for wholesale customers...
 
this is great stuff...and

{if $user_account.membershipid eq 0}
... no membership ...
{elseif $user_account.membershipid eq 9}
... specific membership ...
{/if}

works on product pages but when on homepage the
$user_account.membershipid
doesnt exist when looking at the variables in webmaster mode.

I've spent hours on this already...can't seem to get a module to ONLY SHOW if a user is logged in with a membership level.

Please help, i'm using 4.4.3

chiactivate 02-14-2013 05:58 PM

Re: if/then for wholesale customers...
 
it doesn't work on the welcome page either.

I tried to change this file:

/2-columns/customer/main/welcome.tpl

Quote:

{if $user_account.membershipid eq 0}
... no membership ...
{elseif $user_account.membershipid eq 9}
... specific membership ...
{/if}

Please help! Using 4.4

chiactivate 02-14-2013 06:13 PM

Re: if/then for wholesale customers...
 
can anybody whether this condition is correct?

{if $user_account.membershipid eq 0}

It doesn't recognize the condition.

I even tried:

{if $user_account.membershipid eq '0'}

and

{if $user_account.membershipid eq "0"}

They all don't work.

If want to show welcome message A to pending user with:

Sign up for membership ; Wholesale
Membership : Not member


and show welcome message B to activated user :

Sign up for membership ; Wholesale
Membership : Wholesale


All times are GMT -8. The time now is 03:21 AM.

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