Selling Classifieds

Overview

Selling classifieds in CartThrob is essentially, selling an entry id to a customer. There are 2 primary methods you can use to sell an entry to the customer.

  1. Allow the user to create/publish an entry using Channel Forms

  2. When an item is added to the cart, add item_option data. This data can be output later.

Using Channel Forms generated entries.

Using Channel Forms is the most flexible and robust method for selling entries. And it's the more difficult option. When you use this method you can sell multiple different types of entries, with different content structure, channnels, and you can add files as well, which is critical if you are allowing customers to sell items, or post ads with visual content.

To sell an entry with Channel Forms:

  1. Setup Channel Forms. It's part of EE, and available with your EE download.

  2. Create a front-end based publish form for your classifieds channel. Allow the customer to add content, make sure to set the status of the item as "closed" (or something that will keep it from displaying automatically)

  3. When the item has been created, give the customer the ability to add it (using the new entry_id) to the cart using the add_to_cart_form

  4. Here's the tricky part. You either need to convert the new entry's status upon completion of checkout using an extension (see sample below) OR check past orders to see if the entry_id has been previously purchased. Either way it takes a bit more work, but you have much more flexibility.

Initial sample code for the entry status change extension is here, though note it may require customization for your use. Feel free to contact us for help customizing it!

Using Purchased_Items entries

The simpler method is to capture customer data at the time the item is added to their cart. NOTE: If you are selling multiple types of classified adds, or mixing ads with other types of items, you will have to come up with a scheme to separate them as needed to fit your structure, as all of these items will be lumped in as "purchased_items"

To sell an entry with option data:

  1. Create an add to cart form

  2. add item options that will be displayed later as the classifieds entry data. In the following example we're adding a car classified

    {exp:cartthrob:add_to_cart_form return=""}
        <input type="text" value="" name="item_options[car_make]" />
        <input type="text" value="" name="item_options[car_model]" />
        <input type="text" value="" name="item_options[car_year]" />
        <input type="text" value="" name="item_options[car_color]" />
        <input type="submit" value="Add to Cart" />
    {/exp:cartthrob:add_to_cart_form}
  3. When the item is sold, the data will be stored as standard order_item data and can be output using the order items tag, or a standard EE channel entries tag