| Author |
Message |
guest
Joined: 22 Sep 2007
Posts: 4
|
Posted: Feb 11, 2008 12:20pm Post subject: Wholesale Customer Group Purchasing Specific Products |
|
|
My store offers both retail and wholesale products (not the same products, though). I have a Wholesale Customer Group who can purchase specific products available only to them.
1) Is there a way to show these products to everyone with no pricing shown unless someone is an approved wholesale customer?
2) How do I differentiate these products from the others available for retail customers? Do they need to be in their own category?
3) How do I set up registration for this wholesale group so I can manually approve and grant access to their products and pricing? Does it need a separate registration page?
I hope this is clear and posted in the right topic.
Thanks |
|
Mail Bag

Answering Your Questions Since... 9:30am
Joined: 28 Aug 2005
Posts: 198
|
Posted: Feb 11, 2008 10:00pm Post subject: |
|
|
Excellent questions! I'll do my best to answer them completely.
| Quote: | | 1) Is there a way to show these products to everyone with no pricing shown unless someone is an approved wholesale customer? |
This can be accomplished by creating several custom QuickCode Tag that will lookup the customer and check whether they're in the specified Customer Groups. QuickCode Tags are like HTML tags. When you add them to your templates they can display dynamic content or perform special actions. We're going to use them to do the "special actions" part. (Details on custom QuickCode Tags can be found on page 8 the Modular Merchant Designer's Guide (http://www.modularmerchant.com/docs/Design_Guide_MMv3.pdf).
Don't worry if this sounds daunting, it's actually quite simple if you have a little guidance. Fortunately, that's what I'm here for. Here's an example of some code that could be used in a Custom QuickCode Tag to perform this lookup.
Part One: Create Several Custom QuickCode Tags
First, open the Custom QuickCode Tag Editor in your store's administration area at: [Navigation Menu > Design > Custom QuickCode Tags]. Select "Create a new custom QuickCode Tag" from the menu and click the "Load" button. This will load a fresh copy of the QuickCode Tag editor.
Second, In the "Content for your custom QuickCode tag" field, we are going to enter a short PHP script that will lookup the customer in the database and determine if they're a member of a selected Customer Group. It will then record the results in a variable we'll call "$customer_found". | Code: | <?php
//##################################################################-
// Replace "123" below with the System ID (SID) of the Customer Group
// the customer must be a member of in order to view wholesaler-only info.
// ##################################################################
$group_sid = '123';
//##################################################################-
// Below is the database lookup. This checks to see if the customer ID (cid)
// is associated with the customer group ID (cmr_class_id).
// If a match is found, then "$customer_found" will be greater than zero.
// Don't change the code below unless you're comfortable editing PHP.
// ##################################################################
$customer_found = 0;
$sql = "SELECT COUNT(cid) FROM cmrG_cmr_assoc WHERE cid='".$_SESSION['cid']."' AND cmr_class_id='".$group_sid."'";
$fetch = mysql_query($sql);
if (!$fetch) { echo('<P>Error in MySQL query.</p>'); }
while ($result = mysql_fetch_array($fetch)) {
$customer_found = $result['COUNT(cid)'];
}
?> |
If this is the first custom QuickCode Tag I've created in my store, then the QuickCode Tag that will be assigned to it will be: {CUSTOM-1}. (This is the tag that will be used in my HTML template to perform this action.)
The "$customer_found" variable is has now been set, with a value of zero (customer is not a member of the specified Customer Group) or greater (customer is a member). With this information now available, we can proceed to the next step: creating two more custom QuickCode Tags to toggle the display of the product's price based on whether or not the customer is a member of the Customer Group.
To do this, we will create a second custom QuickCode Tag. This one will be a bit shorter. It will just need to include the following PHP code: | Code: | | <?php if($customer_found > 0) { ?> |
In PHP-language, this simply states, "If the value of the '$customer_found' variable is greater than zero, then display the HTML content that comes after the '{' character."
If this is the second custom QuickCode Tag I've created in my store, then the QuickCode Tag that will be assigned to it will be: {CUSTOM-2}.
And the final custom QuickCode Tag that's needed is shorter still, and will look like this:
In English, this translates to, "Stop checking whether the value of '$customer_found' is greater than zero."
If this is the third custom QuickCode Tag I've created in my store, then the QuickCode Tag that will be assigned to it will be: {CUSTOM-3}.
Part Two: Putting it All Together
Use these three custom QuickCode Tags in your HTML Template for the page in your store on which you want to hide the content based on whether or not the customer is a member of the specified Customer Group. For example, a simplified version of the HTML template's source code may look something like this: | Code: | {CUSTOM-1}<html>
<body>
<p>Welcome to my store.</p>
<p>Only members of Customer Group 123 will see the following:</p>
{CUSTOM-2}<p>Hello, Wholesalers!</p>{CUSTOM-3}
</body>
</html> |
By using the Custom QuickCode Tags, you can write the PHP code to perform these actions once in the QuickCode Tag Editor. You can then reuse the Tags on multiple store pages. And, if you ever need to make a change to the script powering your custom QuickCode Tag, you can change it just once in the Custom QuickCode Tag Editor; and your change will instantly be reflected in every template in your store that uses it!
##################################################################-
| Quote: | | 2) How do I differentiate these products from the others available for retail customers? Do they need to be in their own category? |
I'd think that putting the "wholesaler only" products in their own category would be the easiest way to manage them. It will be easier for your customers to find them too.
##################################################################-
| Quote: | | 3) How do I set up registration for this wholesale group so I can manually approve and grant access to their products and pricing? Does it need a separate registration page? |
This is a little trickier. I'd recommend a two-step process. First, it would probably be a good idea to create a separate registration page. (This way, all the wholesaler accounts are being added to your store records from one location.) The "{FORCE-REGISTER}" QuickCode Tag (http://www.modularmerchant.com/quickcode_details.php?qcid=726) can be used, in addition to additional form fields from the regular checkout process, to create a registration page.
Manually approving the applicant for inclusion in a wholesale group could be done several ways. The simplest way would be for the custom registration form to email the applicant's information to a store administrator and, upon approval, have the store administrator add the applicant's account to the Customer Group. That would be the "quick and dirty" way. Of course, more automated methods could be developed, but their level of difficulty would depend on how sophisticated you'd like them to be. This is the sort of thing that our developers enjoy discussing with clients, or even developing as a custom project upon request. I'll leave it up to you whether you'd like more details on some of the options they've conjured up.
I hope this information is helpful! Let us know if there's anything else we can help you with. We're happy to answer questions and solve puzzles!
Modular Merchant Mail Bag |
|
guest
Joined: 22 Sep 2007
Posts: 4
|
Posted: Feb 11, 2008 10:38pm Post subject: |
|
|
Thanks, Mail Bag
I'll give this a try when I get to doing the design. If I get lost, I know who to call on.
How about all of you other merchants. Some of you must have wholesale customers. How do you handle customer groups in your store?
Thanks again. |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|