alanpace Posted December 13, 2002 Share Posted December 13, 2002 I think my problem is probably simple to someone with an understanding of SQL. I installed the Seperate pricing per customer 3.2 contribution on a site I'm developing (Gourmet International.com), and everything seemed to be working correctly after I added a wholesale price to one product. Currently, there are just two customers, with two price levels (Retail, Wholesale), in the database. but when I attempted to add a wholesale price to a second product, the error below was generated: -------------------------------------------------------------------- 1062 - Duplicate entry '1' for key 1 insert into products_groups (products_id, products_price, customers_group_id, customers_group_price) values ('1099', '21.6200', '1', '18.80') [TEP STOP] ----------------------------------------------------------------------- My guess is that I didn't set up my SQL table correctly. With other mods, I've simply imported the SQL changes by copying and pasting queries into PHPMyAdmin, but the documentation for this one didn't include importable code. The instructions read as follows: Database Changes: Add to the customers table: customers_group_name (char 27) Default value: Retail customers_group_id (int 11) Default value: 0 Create products_groups table Add to the products_groups table: customers_group_id (int 11) customers_group_price (decimal 15, 4) products_id (int 11) products_price (decimal 15,4) Based on the above instructions, I created and imported SQL queries, but I think I did something wrong, possibly in the KEY variables for the products_groups table. I've tried it several different ways, and I always get the same error. Here's the my latest attempt: First I submitted this: ALTER TABLE `customers` ADD `customers_group_name` CHAR(27) DEFAULT 'Retail' NOT NULL; Then I submitted this: ALTER TABLE `customers` ADD `customers_group_id` int(11) DEFAULT '0' NOT NULL; And then I submitted this: CREATE TABLE products_groups ( customers_group_id int(11) NOT NULL auto_increment, customers_group_price decimal(15, 4) NOT NULL default '0.00', products_id int(11) NOT NULL default '00', products_price decimal(15, 4) NOT NULL default '0.00', PRIMARY KEY (customers_group_id), KEY customers_group_id (customers_group_id) ) TYPE=MyISAM; I can see that nobody in the forum seems to have had the issues that I'm having. I'm hoping that someone who has this contribution working would please tell me how to properlly set up the SQL using PHPMyAdmin. .... by the way... I also have the latest Gift Voucher and Coupon mods installed on this site. It occurred to me that my problems might be due to conflicts, but since I don't know what I'm doing with the SQL, I'm figuring that the SQL tables are probably the problem. THANK YOU in advance... Quote Alan Pace Link to comment Share on other sites More sharing options...
alanpace Posted December 14, 2002 Author Share Posted December 14, 2002 I'm glad nobody responded to my post. I figured out the solution to the problem I created all by myself. Now I can have a feeling of accomplishment instead of embarrassment. As I'd expected, the solution was painfully simple. In case anybody else tends to overthink things and runs in to the problem I had, here's the query: CREATE TABLE products_groups ( customers_group_id int(11), customers_group_price decimal(15,4), products_id int(11), products_price decimal(15,4) ) TYPE=MyISAM; Quote Alan Pace Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.