Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

if/then for wholesale customers...

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 04-18-2011, 05:33 PM
 
upupcreative upupcreative is offline
 

Advanced Member
  
Join Date: Aug 2010
Posts: 66
 

Default 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
__________________
Version 4.4.2
Reply With Quote
  #2  
Old 04-28-2011, 05:58 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default 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.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote

The following 2 users thank qualiteam for this useful post:
manningbrothers (04-12-2012), supercanon (09-19-2011)
  #3  
Old 08-10-2011, 01:29 AM
  chamberinternet's Avatar 
chamberinternet chamberinternet is offline
 

X-Wizard
  
Join Date: Sep 2005
Location: Lancashire, UK
Posts: 1,471
 

Default 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.
__________________
Developing in 4.7.x now (Dipping into v5 - Slowly!)
Have used 4.1.x, 4.2.x, 4.4.x, 4.5.x, 4.6.x & 4.7.x
Multiple Instances of X-Cart
MySQL 5.6.37
CentOS 7.4


Chamber Internet
- Lancashire, United Kingdom
http://www.chamberelancs.co.uk
Reply With Quote
  #4  
Old 08-10-2011, 03:19 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,201
 

Default 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
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following user thanks cflsystems for this useful post:
supercanon (09-19-2011)
  #5  
Old 08-10-2011, 03:21 AM
  chamberinternet's Avatar 
chamberinternet chamberinternet is offline
 

X-Wizard
  
Join Date: Sep 2005
Location: Lancashire, UK
Posts: 1,471
 

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

Got it ... Cheers Steve!
__________________
Developing in 4.7.x now (Dipping into v5 - Slowly!)
Have used 4.1.x, 4.2.x, 4.4.x, 4.5.x, 4.6.x & 4.7.x
Multiple Instances of X-Cart
MySQL 5.6.37
CentOS 7.4


Chamber Internet
- Lancashire, United Kingdom
http://www.chamberelancs.co.uk
Reply With Quote
  #6  
Old 10-13-2011, 11:37 AM
 
jwpenn jwpenn is offline
 

Member
  
Join Date: Jul 2008
Posts: 13
 

Lightbulb 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?
__________________
X-cart Gold
Version 4.1.9
Reply With Quote
  #7  
Old 10-19-2011, 11:45 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default 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}
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote

The following user thanks qualiteam for this useful post:
jwpenn (10-20-2011)
  #8  
Old 10-20-2011, 07:27 AM
 
jwpenn jwpenn is offline
 

Member
  
Join Date: Jul 2008
Posts: 13
 

Default 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}
__________________
X-cart Gold
Version 4.1.9
Reply With Quote
  #9  
Old 10-24-2011, 10:47 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default 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.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #10  
Old 10-25-2011, 04:56 AM
 
jwpenn jwpenn is offline
 

Member
  
Join Date: Jul 2008
Posts: 13
 

Default 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
__________________
X-cart Gold
Version 4.1.9
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 06:59 AM.

   

 
X-Cart forums © 2001-2020