你可能想看看OpenCarts數據庫。它實際上做了一個很好的工作...
本質:
創建一個表: 產品 產品選項(你的「 spcifications') 產品選項值(你的‘specvalues’)
每個產品將在上市‘產品表’,並有價格 在‘產品選項’表中,你基本上是列出不同的‘規格’來一個產品...
產品選項值表格列出了實際選項以及對基準價格(+/-)的更改...
要存儲完成的訂單,OpenCart具有基本相同的表格...訂單ID關聯)
接下來我撕掉了購物車功能來處理比賽的球員註冊...
基部「產品」是玩家的註冊 - $ 25 在「product_option」僅列出的值被存儲在所述「product_option_value」的「規範」 /「註冊類型」
對於「註冊類型」表... 他們可以註冊爲支付或支付&玩(支付&玩入迷你遊戲) 支付只是默認選項,沒有改變價格... 支付和播放增加$ 15的價格(總共$ 40)
我可以很容易地添加多個「Produc t_options「和」product_option_value「設置爲產品...每個或者從運行總計的產品中增加或減少...
至於腳本方面,它只需要幾個循環來查詢和構建帶有產品的數組陣列產品的選擇,因爲產品的子陣列和產品選項的值,每個產品的選擇陣列
的「product_option_value」表的子陣列
--
-- Table structure for table `product`
--
CREATE TABLE IF NOT EXISTS `product` (
`product_id` int(11) NOT NULL auto_increment,
`site_id` int(11) NOT NULL,
`name` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL,
`description` text character set utf8 collate utf8_unicode_ci NOT NULL,
`price` decimal(15,2) NOT NULL default '0.00',
`date_available` date NOT NULL,
`date_unavailable` date NOT NULL,
`status` int(1) NOT NULL default '0',
`date_added` datetime NOT NULL default '0000-00-00 00:00:00',
`date_modified` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`product_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=2 ;
--
-- Dumping data for table `product`
--
INSERT INTO `product` (`product_id`, `site_id`, `name`, `description`, `price`, `date_available`, `date_unavailable`, `status`, `date_added`, `date_modified`) VALUES
(1, 2, 'Player Registration', 'This year we have two options: Pay or Pay & Play.<br />Pay & Play allows you to enroll in the Flights Minigames for the weekend (Master''s Marks and Flights Doubles) and gives you twenty dollars worth of prize raffles. <br />Pay & Play is a $60.00 value and is only avalible during pre-registration.', 25.00, '2011-03-01', '2011-03-31', 1, '2011-03-01 00:00:00', '2011-03-01 00:00:00');
-- --------------------------------------------------------
--
-- Table structure for table `product_option`
--
CREATE TABLE IF NOT EXISTS `product_option` (
`product_option_id` int(11) NOT NULL auto_increment,
`product_id` int(11) NOT NULL,
`sort_order` int(3) NOT NULL default '0',
`name` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`product_option_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=2 ;
--
-- Dumping data for table `product_option`
--
INSERT INTO `product_option` (`product_option_id`, `product_id`, `sort_order`, `name`) VALUES
(1, 1, 1, 'Registration Type');
-- --------------------------------------------------------
--
-- Table structure for table `product_option_value`
--
CREATE TABLE IF NOT EXISTS `product_option_value` (
`product_option_value_id` int(11) NOT NULL auto_increment,
`product_option_id` int(11) NOT NULL,
`product_id` int(11) NOT NULL,
`price` decimal(15,2) NOT NULL,
`prefix` char(1) collate utf8_bin NOT NULL,
`sort_order` int(3) NOT NULL,
`name` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL,
PRIMARY KEY (`product_option_value_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=3 ;
--
-- Dumping data for table `product_option_value`
--
INSERT INTO `product_option_value` (`product_option_value_id`, `product_option_id`, `product_id`, `price`, `prefix`, `sort_order`, `name`) VALUES
(1, 1, 1, 15.00, '+', 1, 'Pay & Play'),
(2, 1, 1, 0.00, '', 2, 'Pay');