Hi,
I am trying to create a search function for my online shopping system . I have the following tables:
CREATE TABLE `product` (
`product_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(11) unsigned NOT NULL,
`brand_id` int(11) unsigned NOT NULL,
`model_id` int(11) unsigned NOT NULL,
`category_id` int(11) unsigned NOT NULL,
`name` varchar(255) NOT NULL DEFAULT '',
`description` text NOT NULL,
`serial` varchar(255) NOT NULL DEFAULT '',
`total_images` tinyint(3) unsigned NOT NULL DEFAULT '0',
`total_views` int(11) unsigned NOT NULL DEFAULT '0',
`cover` int(11) unsigned NOT NULL DEFAULT '0',
`status` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`product_id`)
);
CREATE TABLE product_categories (
category_id int(11) unsigned NOT NULL AUTO_INCREMENT,
parent_id int(11) unsigned NOT NULL DEFAULT '0',
name varchar(100) NOT NULL,
description text NOT NULL,
slug varchar(100) NOT NULL,
ext varchar(4) NOT NULL DEFAULT '',
total_products int(11) unsigned NOT NULL DEFAULT '0',
status tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`category_id`),
UNIQUE KEY `slug` (`slug`)
);
CREATE TABLE product_brands` (
brand_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
name varchar(100) NOT NULL,
slug varchar(100) NOT NULL DEFAULT '',
ext varchar(4) NOT NULL DEFAULT '',
total_products int(11) unsigned NOT NULL,
updated tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`brand_id`)
);
CREATE TABLE product (
model_id int(11) unsigned NOT NULL AUTO_INCREMENT,
category_id int(11) unsigned NOT NULL DEFAULT '0',
brand_id int(11) unsigned NOT NULL DEFAULT '0',
name varchar(100) NOT NULL,
slug varchar(100) NOT NULL DEFAULT '',
total_products` int(11) unsigned NOT NULL,
PRIMARY KEY (`model_id`)
);
What i'm trying to achieve is a autocomplete features that works something
like: category brand product. A few examples:
apple -> apple iphone, apple ipad, apple ipod..
iphone -> iphone 5s, iphone 5, iphone 6..
apple iphone -> apple iphone 5s, apple iphone 6s...
please suggest me how to implement these type of functionality ?