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

Show Wholesale Products

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 03-19-2008, 09:25 PM
 
deffe deffe is offline
 

Member
  
Join Date: Oct 2007
Posts: 27
 

Default Show Wholesale Products

Currently any product that is flagged as wholesale only is hidden from customers not logged in. I'm trying to find the script that sets the template to hide the wholesale only products. I would like all products shown regardless how it is flagged.

Any ideas?
__________________
Version 4.3.2
Reply With Quote
  #2  
Old 03-19-2008, 10:15 PM
 
deffe deffe is offline
 

Member
  
Join Date: Oct 2007
Posts: 27
 

Default Re: Show Wholesale Products

Found the category listing code. In /include/search.php, ~line 398, comment if else statement and replace with:

Code:
$where[] = "($sql_tbl[category_memberships].membershipid IS NULL OR $sql_tbl[category_memberships].membershipid = '2')"; $where[] = "($sql_tbl[product_memberships].membershipid IS NULL OR $sql_tbl[product_memberships].membershipid = '2')";

This is obviously only for the default wholesale membership but you get the idea.
__________________
Version 4.3.2
Reply With Quote
  #3  
Old 03-19-2008, 10:34 PM
 
deffe deffe is offline
 

Member
  
Join Date: Oct 2007
Posts: 27
 

Default Re: Show Wholesale Products

And here is the allowed product listing. In /include/func/func.product.php, ~line 668, comment all three SQL condition variables and replace with:

Code:
$membershipid_condition = " AND ($sql_tbl[category_memberships].membershipid = '2' OR $sql_tbl[category_memberships].membershipid IS NULL) "; $p_membershipid_condition = " AND ($sql_tbl[product_memberships].membershipid = '2' OR $sql_tbl[product_memberships].membershipid IS NULL) "; $price_condition = " AND $sql_tbl[quick_prices].membershipid ".((empty($membershipid) || empty($active_modules['Wholesale_Trading'])) ? "= '0'" : "IN ('$membershipid', '0')")." AND $sql_tbl[quick_prices].priceid = $sql_tbl[pricing].priceid";

Love it when I answer my own questions.
__________________
Version 4.3.2
Reply With Quote
  #4  
Old 04-02-2008, 02:19 PM
 
MACWIllo MACWIllo is offline
 

Member
  
Join Date: Nov 2006
Posts: 17
 

Default Re: Show Wholesale Products

Hi there,

Does this mod make it so that a customer not logged in will see all products, but when they are logged in they see their membership specific products? Or does it make all products and categories available to all membership levels at all times...

I want my not-logged-in customers to see everything, and also when they log in (as a "Retail" membership). However I want the wholesale memberships to only see the wholesale specific products and categories.

Cheers, Pete.
__________________
X-cart 4.1.8
www.mooo.com.au
Reply With Quote
  #5  
Old 04-02-2008, 07:18 PM
 
deffe deffe is offline
 

Member
  
Join Date: Oct 2007
Posts: 27
 

Default Re: Show Wholesale Products

It will show products flagged as wholesale only to all customers.
__________________
Version 4.3.2
Reply With Quote
  #6  
Old 04-10-2008, 02:55 PM
 
MACWIllo MACWIllo is offline
 

Member
  
Join Date: Nov 2006
Posts: 17
 

Default Re: Show Wholesale Products

great! thats exactly what i am looking for, thanks a bunch!
__________________
X-cart 4.1.8
www.mooo.com.au
Reply With Quote
  #7  
Old 04-10-2008, 03:25 PM
 
MACWIllo MACWIllo is offline
 

Member
  
Join Date: Nov 2006
Posts: 17
 

Default Re: Show Wholesale Products

Hmm. Can't seem to get it to work. My "Retail" membership is membershipid '9', and so I replaced your default wholesale value of '2' to my '9' in the hope that this would display any products available to "Retail" memberships to anyone not logged in.

This is my search.php code:

Code:
if ($current_area == 'C') { /*if ($user_account['membershipid'] == 0) { $where[] = "$sql_tbl[category_memberships].membershipid IS NULL AND $sql_tbl[product_memberships].membershipid IS NULL"; } else { $where[] = "($sql_tbl[category_memberships].membershipid IS NULL OR $sql_tbl[category_memberships].membershipid = '$user_account[membershipid]')"; $where[] = "($sql_tbl[product_memberships].membershipid IS NULL OR $sql_tbl[product_memberships].membershipid = '$user_account[membershipid]')"; }*/ $where[] = "($sql_tbl[category_memberships].membershipid IS NULL OR $sql_tbl[category_memberships].membershipid = '9')"; $where[] = "($sql_tbl[product_memberships].membershipid IS NULL OR $sql_tbl[product_memberships].membershipid = '9')"; $where[] = "$sql_tbl[categories].avail = 'Y'"; }

I've also done the changes to the func.product.php:

Code:
if ($current_area == "C") { /*$membershipid_condition = " AND ($sql_tbl[category_memberships].membershipid = '$membershipid' OR $sql_tbl[category_memberships].membershipid IS NULL) "; $p_membershipid_condition = " AND ($sql_tbl[product_memberships].membershipid = '$membershipid' OR $sql_tbl[product_memberships].membershipid IS NULL) "; $price_condition = " AND $sql_tbl[quick_prices].membershipid ".((empty($membershipid) || empty($active_modules['Wholesale_Trading'])) ? "= 0" : "IN ('$membershipid', 0)")." AND $sql_tbl[quick_prices].priceid = $sql_tbl[pricing].priceid";*/ $membershipid_condition = " AND ($sql_tbl[category_memberships].membershipid = '9' OR $sql_tbl[category_memberships].membershipid IS NULL) "; $p_membershipid_condition = " AND ($sql_tbl[product_memberships].membershipid = '9' OR $sql_tbl[product_memberships].membershipid IS NULL) "; $price_condition = " AND $sql_tbl[quick_prices].membershipid ".((empty($membershipid) || empty($active_modules['Wholesale_Trading'])) ? "= '0'" : "IN ('$membershipid', '0')")." AND $sql_tbl[quick_prices].priceid = $sql_tbl[pricing].priceid"; } else {

Any ideas why it wouldn't be working?
__________________
X-cart 4.1.8
www.mooo.com.au
Reply With Quote
  #8  
Old 04-12-2008, 02:01 PM
 
deffe deffe is offline
 

Member
  
Join Date: Oct 2007
Posts: 27
 

Default Re: Show Wholesale Products

Did you add wholesale pricing to the product? Only selecting the wholesale option in the product details will not set the membershipid in the xcart_pricing table.
__________________
Version 4.3.2
Reply With Quote
  #9  
Old 04-14-2008, 02:51 PM
 
MACWIllo MACWIllo is offline
 

Member
  
Join Date: Nov 2006
Posts: 17
 

Default Re: Show Wholesale Products

ok i've got the product working now, but how do you apply that to the category showing?
__________________
X-cart 4.1.8
www.mooo.com.au
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 11:47 AM.

   

 
X-Cart forums © 2001-2020