Documentation You are here: start » v » 0.7.2 » categories

Product Categories

What Product Categories Are

Categories offer a way to give products additional behaviors that cannot be accomplished by product options alone. While it's probably best to take a look at the category settings in your admin, we'll briefly discuss the functionality that categories offer.

  • Email Receipts. Email receipts can be generated on a per category basis, and different emails can be configured for customers and for admins. So, if you had a conference registration category but also sold books and CDs, you might want a transaction that included a conference registration to send an email to a store admin (the conference registrar); or to send an extra email to the customer with a schedule and link to the hotel; or to send both emails (as they can be configured independently).
  • Default Weight Values. These default values can be overridden by explicitly setting the weight product option, but if you have a category for “Shirts” you could set the default weight to 0.5, while you have another category for “Paperweights” with a default weight of 3. That way you wouldn't have to explicitly set the weight on every product's add-to-cart link or form.
  • Taxes. Taxes must be set at the category level. This allows you to have certain products taxed differently from others, which can be useful in a variety of situations.
  • Shipping and Handling Fees. Categories can set specific handling fees, as well as shipping methods.
  • Customs Values. Customs values (used in shipping calculations) can only be set at the category level.
  • Quantity Discounts. While individual products can have quantity discounts, they can also be applied for all products in the cart in a given category.
  • Coupon Codes. Coupons can be restricted per category, though this is done on the coupon code admin section, not the category admin section.
  • Downloadables. Downloadable products must be added to a category where the shipping method is set to “Downloaded by the customer”.

How Product Categories Work

Using product categories is fairly straightforward if you already understand how FoxyCart's products function. Simply:

  1. Create a category in your store's admin.
  2. Assign that category to the product in your add-to-cart link or form, where the “category code” (as configured in the admin) is set in the product's category option. So, something like this:
    <a href="https://YOURDOMAIN.foxycart.com/cart?name=A great product&price=5&category=YOUR_CATEGORY_CODE">
    	Buy this Great Product!
    </a>
    <form action="https://YOURDOMAIN.foxycart.com/cart" method="post">
    	<input type="hidden" name="name" value="A great product" />
    	<input type="hidden" name="price" value="5.00" />
    	<input type="hidden" name="category" value="YOUR_CATEGORY_CODE" />
    	<select name="size">
    		<option value="small">Small</option>
    		<option value="medium">Medium</option>
    		<option value="large">Large</option>
    	</select>
    	<input type="submit" value="Buy It Now!" />
    </form>

The Default Category

You'll notice that the category product parameter is optional. If you don't specify a category, the DEFAULT category will be used.

Creating New Categories

It may not be immediately evident, but if you use the select box at the top of your Category page (in the “Select a Category” fieldset) in your store's admin you'll see an option to add a new category. Doing so will actually make a copy of the category you're currently editing.

Site Tools