Setting Up Custom User Types
Did you know that users on Convergence can view "secure" pages? They can also update different Item Lists on your site, as well as view their Order History and Subscription information (for sites with E-commerce). By understanding the power and flexibility of Custom User Types, you'll be able to provide complex functionality by following a few easy steps.
An Example: Wholesale Users on an E-commerce Site
Let's use a fairly common example: setting up wholesale users on an e-commerce site. Our goal is to allow certain users to have special pricing for items in your store, and having them fill out a few Application details in the process.
Step 1: Add the User Type
Login to your site and click USERS. Now click the User Types tab and click Add New User Type. Call it "Wholesale" and Save. Now you'll see some options for your new User Type. Click the check next to "Users have special pricing for products in your store" and SAVE CHANGES.
Step 2: Add an Item List
Now click ITEM LISTS in the admin bar up top. Click the Item Lists tab and click Add New Item List. Let's call it "Wholesaler Info" and click Save. Now click Wholesaler Info settings... on the right pane of your screen. You must first make this Item List a favorite (this will help us in Step 4). Then scroll down to click Add Field. Let's add a field called "Number of Employees" as a "Single Line Text Box". Then click "SAVE CHANGES".
Step 3: Add a Product (if your site has E-commerce)
If your site has E-commerce enabled, let's click STORE up top. Now click the products tab and click "Add New Product". Let's call our product "Coffee Bag". Now we can edit the settings for the product, click the blue "Edit Product Variants" link to set some pricing. When the window appears, give the product a sku of CBAG, a weight of 1, a qty of 99, a price of $10, and a "Wholesale Price" of $5. This "Wholesale Price" column was automatically added in step 1 above, pretty cool eh? Now close the window and all your changes will save automatically.
Step 4: Link the User Type to your Item List
Now let's go to "USERS" up top again, and click the "User Types" tab. Choose "Wholesale" to edit the settings. Next click the check next to "Users can update specific Item Lists" and select "Wholesaler Info". The dropdown shows they can only update 1 item which is what we want, so let's "SAVE CHANGES".
Step 5: Add the Layout Files
You'll need to create an "account.html" layout file and a "user.html" layout file. In the Account Layout, simply place the user field="login" canregister="true" usertype="wholesale" token. On the User Layout file, you'll need:
- user field="menu"
- user field="personal"
- user field="orders"
- user field="billing"
- user field="item-lists"
More about User tokens is here. Great! Now that those tokens are in we can test out the system.
Step 6: Test it out!
Logout of your site, then navigate to http://YOURSITE.convergencecms.co/account - follow the instructions to create a new account (use a different login than when you login to make edits on the system). You should see your account is created and you can update your personal info as well as your Wholesaler Info. Lastly, navigate to http://YOURSITE.convergencecms.co/product-coffee-bag and you'll see the Wholesale pricing on your product.