My supervisor wants me to create an advanced drop down based search that will search over attributes on products and categories. I suggested creating this using the attributes built into zen cart but he was against it, saying it was too slow and cited a site as example where they did it that way and failed. So he basically wants me to redo this functionality... but if there is another way to do it or if I can convince him that it will work well using attributes than I'd like to do it that way.
Here is what I have so far:
PHP Code:
class dynamic_fields(){
var $link;
function __construct(){
$this->link = mysql_connect(DB_SERVER, DB_SERVER_USERSNAME, DB_SERVER_PASSWORD);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
#echo 'Connected successfully';
mysql_query('use ' . DB_DATABASE)
}
function __destruct(){
mysql_close($this->link);
}
function admin_view_edit(){
}
function admin_view_admin(){
}
function admin_view_products_edit(){
}
function admin_products_create(){
}
function admin_categories_create(){
}
function admin_categories_delete(){
}
}
and my sql:
PHP Code:
create table products_fields (
id int unsigned not null,
type_id int unsigned not null, -- 0 = dropdown 1 = text
name varchar(35) not null,
primary key(id),
index (name)
);
create table product_cat_values (
id int unsigned not null,
products_fields_id int unsigned not null,
category_id int unsigned not null,
value varchar(35)
primary key(id),
index (value),
index (products_fields_id,category_id)
);
create table product_cat_assignment (
id int unsigned not null,
products_id int unsigned not null default 0,
category_id int unsigned not null default 0,
products_fields_id int unsigned not null,
primary key(id),
index (products_id,category_id,products_fields_id)
);
If you can let me know your thoughts and opinions so I can turn this into a usable module for the community that'd be nice. I'd like to use the db system in place. And I'd like to take at least a cursory consideration for language.
Anywho. That site he showed me was incredibly slow, and it wasn't fault of the server, so if anyone can let me know if that is because the way they developed it or it is an attributes system flaw, that'd be cool. I don't know of a better way to do it the database isn't done how i'd do it but I'd have to redo the entire schema to make that work better. And going through and editing every categories_edit etc page would be a pain, having to do it after every update even more so.
I have been looking into the auto_loader etc. But to be honest, any documentation I've been able to find still leaves unanswered questions.
Bookmarks