Notice: Undefined variable: s_offline in /homepages/6/d168803796/htdocs/officetrio.com/o3/o3start.php on line 314
OfficeTrio: List Items - User Manual OfficeTrio: The Integrated ECommerce Solution OfficeTrio: The Integrated ECommerce Solution OfficeTrio: Features OfficeTrio: User Manual OfficeTrio: Testimonials OfficeTrio: The Demo is Offline! OfficeTrio: Order O3 Now
EWS is no longer available


Notice: Undefined variable: us_name in /homepages/6/d168803796/htdocs/officetrio.com/right-menu.php on line 35

Notice: Undefined variable: us_email in /homepages/6/d168803796/htdocs/officetrio.com/right-menu.php on line 35
U:
P:

Login Page

Introduction
Payments
Users
Login
Access
Categories
Products
Downloads
Deliveries
Containers
Catalog
Cart
Search
Orders
Emails
IPN
Stats

Modules
Affiliates
Content
Types
List Items
Image Upload
Scheduler
File Browser
Stock Control

Appendices
Settings
Functions
Actions
Caching



Forums
Members Area
Customers Area
Affiliates

Contribute
Installation
Contact Details
Terms
FAQ
Testimonials

Free Tutorials
Free EBooks
Free Scripts

PayPal - Accept Credit Cards Online

StormPay - Accept Credit Cards Online

PHP: Open-Source Server-Side Scripting Language

MySQL: Fast Relational Database



O3 comes with a full 30-day, no-quibble money back guarantee.



Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover.
    Mark Twain




User-Defined Types

Introduction | Definition | Settings | Forms | Advanced Search

Introduction

The types module allows you to add your user-defined fields to users, products, items, schedules and events. The most obvious application is to have Types of product - with fields specific to that type - giving the website's customers more information about the products. For example an electricals website could have a type for 'television' with fields like 'screensize', 'nicam', 'freeview'.

Products or Items with type data can be compared in a Compare List (which is simply the shopping cart displayed in a different container) in which all the features for all things in the basket are shown in a big table for comparison. O3 comes with an example Compare container.

Users can have a type - in which case their extra data can be used like a profile, and can contain search preferences and any other data.

Related Modules

The Types module is required for the List Items module.

The Scheduler module can use types to give more depth to schedules and events.

Defining Your Types

You define your Types in the Types Manager. It allows you to create, update delete and copy types, and add columns (fields) to them. It gives you a lot of control over how the database implements the table - with indexing & uniqueness.

Type data is stored in database table of the name o3_ty_TypeName

Types have these fields:

Name & DescriptionName & Description. Name must be lowercase.
Update FormForm used to update items of this type. This overrides the general settings.
Image Update FormForm used to update images in this type. This overrides the general settings.
ContainerContainer used to display items this type. This overrides the general settings.
LimitNumber of items of this type that can be created.
Per User?Is the Limit per-user?

Type Columns have these fields:

Name & DescriptionName & Description. Name must be lowercase.
Data TypeMySQL data type. Usually one of: CHAR(1) for a checkbox, VARCHAR(up to 255) for text, DATETIME for dates, TEXT for 64Kb of text, INT / INT UNSIGNED / FLOAT / DOUBLE for numbers.
Default ValueDefault value for the field.
Validation RuleReular expression defining valid input for this field. Examples: 'Y|N', 'House|Chalet|Flat'
Index?Create an index on this field. This can be useful to speed up queries if there's a lot of data, and you're searching by this field.
Unique?Values in this column must all be unique.

Settings

There is only 1 setting for types: The User-Type. If set - this defines the type data that is associated with the website's users. Users can edit this data in the login page, or you can build forms to display / update their details easily.


Forms

The types module includes the Forms Manager. This is primarily designed to allows you to define forms to manipulate items, but they work with all O3 things...

You can include a form in most containers using the SHOW-FORM# macro, or by using the show_form('FormName') function.

Forms are type-data aware, and will fill in select and checkboxes for you if you set up the Validation Rule for the type-data column. For example: a validation rule of 'Y|N' is assumed to be a checkbox, and a rule of pipe delimited strings (like 'House|Chalet|Flat') is assumed to be a select list.

Forms have these fields:

Name & DescriptionName & Description.
EncodingLeave blank unless this is for image upload - in which case use 'multipart/form-data'.
URLLeave blank for the default 'Update Page' as set in the settings. Use SELF to submit the form the the same page, or use a URL.
HTMLThe form HTML with macros.
Form VisibleThis shows the form roughly as it'll appear on the website - the CSS will be different so it won't be the same, but it's still useful.

Form Macros

The following macros can be used in forms:

MacroReplaced By
COUNTRY-SELECTA country select box. Contains all countries in the world
CATEGORY-SELECTA category select box. Contains all categories in the database
O3VARfield#The value of the field variable.

O3 comes with examples of forms for common actions like creating, updating and deleting items, user preferences etc...


Advanced Search

O3's standard display functions surpass many website's 'Advanced' serach options, but O3 can go even deeper - into the type data - to give you a totally flexible advanced search. You do have to write a bit of SQL to do it - though there are examples and it's not that hard.

The advanced search is displayed in the catalog page by passing in the as parameter, i.e. catalog.php?as=MySearch&options.... The parameter value is used as the script name to look for, so this example would look for 'o3/as/MySearch.php'.

The options for the search can be passed in the command line, or better, taken from the user's type data - that way their serach preferences are always stored - a nice user-friendly feature.

The advanced search scripts are held in the directory 'o3/as'. They must return the search results by generating the SQL needed in the WHERE clause, setting the ORDER BY clause, and calling the appropriate show_...() function. They take this form (example - a search by country):


// Set to order by premium listings first!
$_REQUEST['ord']= 'it_type DESC ';

// If user has an ordering preference...
if (strlen($GLOBALS['uorder'])>0) {
  $_REQUEST['ord'].= ", o3_ty_premiumlisting.$GLOBALS[uorder], o3_ty_freelisting.$GLOBALS[uorder] ";
  }

// If no parameter - just get all items
if(!isset($_REQUEST['country'])) $tmp='';

// Else build the SQL to get by country
else $tmp= " AND (o3_ty_freelisting.country='$_REQUEST[country]' OR o3_ty_premiumlisting.country='$_REQUEST[country]')";

// Show the items
$scr_out.=show_items('', '', '', 'premiumlisting|freelisting', '', $_REQUEST['ord'], $tmp);

In this example there are 2 possible item listing types free, and premium listings. The more types there are, the longer these two clauses will be as you need to include all the combinations for the query to work.




Powered By OfficeTrio