View Single Post
  #1  
Old 05-13-2011, 06:14 PM
Nathan D.'s Avatar
Nathan D. Nathan D. is offline
Junior Member
 
Join Date: Apr 2011
Posts: 3
Default Product catalog, wholesale and WordPress

Hi All,

I am working on a website for a client that sells wholesale products, but also wants a product catalog without prices or the ability to purchase from the site.

So to break it down:
  • Anyone can view the products, by default without price or purchasing option
  • Wholesale members must be approved prior to being able to purchase or view prices
  • Once approved, wholesale members can see prices and purchase products

After researching these forums and considering how to do this, this is what I came up with:
  1. Install a WordPress membership plugin, I used s2member
  2. Create a Catalog page to display all products, paste Ecwid code on this page
  3. Create Wholesale Catalog page, requiring an approved membership level to view using s2member settings, paste Ecwid code on this page

This sets the base for controlling who can see or do what.

Next, I wanted to change the CSS so that certain portions were hidden, but doing so in the Ecwid theme would mean that it would cause both the open Catalog and the Wholesale Catalog to appear the same.

So using some of WordPress's features, I used the following code (either in the header.php or page.php file):

PHP Code:
<?php
    
if ( is_user_logged_in() ) {
    echo 
'';?>
<!-- Don't do anything -->
    <?php
    
} else {
    echo 
'';?>
    <style type="text/css">
/* Remove the Login/Signup box */
    div.ecwid-productBrowser-auth {
    display: none;
    }
/* Remove the SKU, Price and Add to Bag section */
    div.ecwid-productBrowser-backgroundedPanel {
    display: none;
    }
/*Hide the Product price */
    div.ecwid-productBrowser-price {
    display: none;
    }
    </style>
    <?php 
    
}
?>
This turns the open Catalog into a bare-bones product description and image, unless the user is logged in - then they can use it just like a normal store. I understand that there may not be a use for a separate Wholesale Catalog section since the regular catalog would function exactly the same, but we chose to make the wholesale customers feel like they had a special privilege

In addition, we decided to use the following code in the sidebar to either show an "Apply for wholesale membership" or the Mini Cart widget:

PHP Code:
<?php
                
if ( is_user_logged_in() ) {
                echo 
'';?>
                <div>
                <script type="text/javascript" src="http://app.ecwid.com/script.js?379195" charset="utf-8"></script>
                <!-- remove layout parameter if you want to position minicart yourself -->
                <script type="text/javascript"> xMinicart("style=","layout=attachToCategories"); </script>
                </div>
                <?php
                
} else {
                echo 
'';?><li class="widget-container widget_text">
                <div class="textwidget"><h3 class="widget-title"><a href="<?php echo home_url'/' ); ?>wp-login.php?action=register">Apply For A Wholesale Account</a></h3>
                </div>
            </li><?php 
                
}
?>
So far, this is working for us but I'd be interested to see what others have come up with or if anyone has any other methods that may be superior.