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)
-   -   Show Wholesale Products (https://forum.x-cart.com/showthread.php?t=38461)

deffe 03-19-2008 09:25 PM

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?

deffe 03-19-2008 10:15 PM

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.

deffe 03-19-2008 10:34 PM

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.

MACWIllo 04-02-2008 02:19 PM

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.

deffe 04-02-2008 07:18 PM

Re: Show Wholesale Products
 
It will show products flagged as wholesale only to all customers.

MACWIllo 04-10-2008 02:55 PM

Re: Show Wholesale Products
 
great! thats exactly what i am looking for, thanks a bunch!

MACWIllo 04-10-2008 03:25 PM

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?

deffe 04-12-2008 02:01 PM

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.

MACWIllo 04-14-2008 02:51 PM

Re: Show Wholesale Products
 
ok i've got the product working now, but how do you apply that to the category showing?


All times are GMT -8. The time now is 11:47 PM.

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