TPshop 里面的商品屬性, 首先看看TPshop商品詳情中的屬性介紹, 純展示給用戶看的。
再來tpshop看看商品列表帥選頁面的屬性,可以根據屬性帥選不同的商品
再來看看tpshop后台屬性管理如果把屬性篩選關掉, 在商品列表帥選頁面將不會再出來帥選項
再來看看TPshop后台商品屬性設置, 各種屬性選擇輸入,這些屬性前提是需要先到 商品管理->商品屬性->添加屬性 里面提前添加好
下面看下TPshop 重屬性表的結構設計
1 如上圖可以看出tp_goods_type表的 id 為4 表示手機
2 tp_goods_attribute表的type_id對應的tp_goods_type表的id
3 tp_goods_attribute表68表示內存容量 69表示操作系統
4 tp_goods_attr 表的attr_id 對應 tp_goods_attribute 表的 attr_id
5 tp_goods_attr 表的 goods_id 為104表示小米手機它的 68 內存容量為 64G 它的 69操作系統為 android
6 tp_goods_attr 表的attr_val 有可能是tp_goods_attribute表的 attr_values選擇出來的, 也有可能是手工錄入,這個要看TPshop后台商品屬性管理 性值的錄入方式
-- 以下來看一下tpshop的表結構設計
-- tpshop.tp_goods_type 表
CREATE TABLE `tp_goods_type` (`id` smallint(5) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id自增',`name` varchar(60) NOT NULL DEFAULT '' COMMENT '類型名稱',PRIMARY KEY (`id`)) ENGINE=MyISAM AUTO_INCREMENT=34 DEFAULT CHARSET=utf8-- tpshop.tp_goods_attribute 表
CREATE TABLE `tp_goods_attribute` (`attr_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '屬性id',`attr_name` varchar(60) NOT NULL DEFAULT '' COMMENT '屬性名稱',`type_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '屬性分類id',`attr_index` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0不需要檢索 1關鍵字檢索 2范圍檢索',`attr_type` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0唯一屬性 1單選屬性 2復選屬性',`attr_input_type` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT ' 0 手工錄入 1從列表中選擇 2多行文本框',`attr_values` text NOT NULL COMMENT '可選值列表',`order` tinyint(3) unsigned NOT NULL DEFAULT '50' COMMENT '屬性排序',PRIMARY KEY (`attr_id`),KEY `cat_id` (`type_id`)) ENGINE=MyISAM AUTO_INCREMENT=329 DEFAULT CHARSET=utf8-- tpshop.tp_goods_attr 表
CREATE TABLE `tp_goods_attr` (`goods_attr_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '商品屬性id自增',`goods_id` mediumint(8) unsigned NOT NULL DEFAULT '0' COMMENT '商品id',`attr_id` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '屬性id',`attr_value` text NOT NULL COMMENT '屬性值',`attr_price` varchar(255) NOT NULL DEFAULT '' COMMENT '屬性價格',PRIMARY KEY (`goods_attr_id`),KEY `goods_id` (`goods_id`),KEY `attr_id` (`attr_id`)) ENGINE=MyISAM AUTO_INCREMENT=988 DEFAULT CHARSET=utf8
三張表前兩張是單純表,第三張表為復合表,將前面的物品和屬性聯合起來