adz1976 Posted June 19, 2007 Posted June 19, 2007 Hi My Setup OSC MS2 SPPC v4.1 + price breaks Easy Populate v2.78 + SPPC + price breaks SQLv5.0 Hope you can help I have already left a post for this problem but nobody has left any replies. So this time I have included some code so you can see my problem. This is what I am trying to do: This code has come from Easy Populate v2.78 with SPPC + price breaks What am I trying to do ? The upload through EP of the complete customer prices all works fine BUT what I would like to do is just upload a specific customers prices. I.E. There are 5 customers but I only want to upload customer 3's prices. As you can see at the start of the code it deletes all products id & prices out of the TABLE_PRODUCTS_GROUPS before it uploads the new data, this is why when I try to upload just 1 customers prices it wipes out all the other customer prices. If I delete the following section out of the code & try to upload my prices it comes up with a duplication error // they spec'd some prices, so clear all existing entries $result = tep_db_query(' DELETE FROM '.TABLE_PRODUCTS_GROUPS.' WHERE products_id = ' . $v_products_id ); I realise it is having to delete the data out of TABLE_PRODUCTS_GROUPS before it can upload the new prices. BUT Is there a way to change the code so it will just replace the prices instead of it deleting them ? Code Below: // they spec'd some prices, so clear all existing entries $result = tep_db_query(' DELETE FROM '.TABLE_PRODUCTS_GROUPS.' WHERE products_id = ' . $v_products_id ); // and insert the new record if ($v_customer_price_1 != ''){ $result = tep_db_query(' INSERT INTO '.TABLE_PRODUCTS_GROUPS.' VALUES ( ' . $v_customer_group_id_1 . ', ' . $v_customer_price_1 . ', ' . $v_products_id . ', ' . $v_products_price1_1 . ', ' . $v_products_price2_1 . ', ' . $v_products_price3_1 . ', ' . $v_products_price4_1 . ', ' . $v_products_price5_1 . ', ' . $v_products_price6_1 . ', ' . $v_products_price7_1 . ', ' . $v_products_price8_1 . ', ' . $v_products_price1_qty_1 . ', ' . $v_products_price2_qty_1 . ', ' . $v_products_price3_qty_1 . ', ' . $v_products_price4_qty_1 . ', ' . $v_products_price5_qty_1 . ', ' . $v_products_price6_qty_1 . ', ' . $v_products_price7_qty_1 . ', ' . $v_products_price8_qty_1 . ', ' . $v_products_qty_blocks_1 . ' )' ); } if ($v_customer_price_2 != ''){ $result = tep_db_query(' INSERT INTO '.TABLE_PRODUCTS_GROUPS.' VALUES ( ' . $v_customer_group_id_2 . ', ' . $v_customer_price_2 . ', ' . $v_products_id . ', and so on..... Really hope someone can help me with this :-) Thanks Adam Quote
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.
Note: Your post will require moderator approval before it will be visible.