Teamjr Posted August 5, 2007 Share Posted August 5, 2007 Hello, I am using SSP v4.16, and all seems to work fine but one issue. I am using a discount percentage on a group and not set pricing. My group is called distributors and I have done the following commands as stated in another posting to the database, which will give 50% off the set retail pricing to distributor clients. First: delete from products_groups where customers_group_id = '1'; Second: insert into products_groups select '1' as customers_group_id, (0.5 * p.products_price) as customers_group_price, p.products_id from products p This issue is, if I add any products to the system after running the above statements, the item does not reflect the discount on those current items?? I currently have to run the above statements every time I add new product. Did I mis something in the installation? Once I run the statements after adding product, it works correctly. Thanks JR Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted August 5, 2007 Share Posted August 5, 2007 I currently have to run the above statements every time I add new product. Did I mis something in the installation? At the least you missed the support thread for SPPC. In admin/categories.php when you edit a product you should have a part below the drop down wiwth tax class, product price net, product price gross, also with a light blue blackground with a checkbox, "distributors" and an input field. The input field is for the group price. You could even write a small piece of JavaScript (modelled after function updateGross on that page) that takes the retail price of the product and on changing the price there updates the group price if it is always that percentage. The sql you mention of for quickly filling the database with group prices in case SPPC is an afterthought and you already added a large amounts of product and product prices. Quote Link to comment Share on other sites More sharing options...
gaspower Posted August 6, 2007 Share Posted August 6, 2007 Hello JanZ, Thank you for the response. I do understand the fields in the admin/categories, but I guess my question is, can there be a way of just having a percentage discount, so if product is added, the pricing on the site will always be based on the discount off the retail? Again, thank you and a fantastic contribution. Thanks JR Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted August 6, 2007 Share Posted August 6, 2007 I guess my question is, can there be a way of just having a percentage discount, so if product is added, the pricing on the site will always be based on the discount off the retail? As said you could use a bit of JavaScript. In the end it took me a couple of hours to get it working because I started out using the function updateGross to also update the group prices. I kept getting the error that elements['sppcprice[1]'] did not have a value. Much, much later I found that the cause of that is because the input field was below the bit of JavaScript that calls that function: <script language="javascript"><!-- updateGross(); //--></script> Anyway, here is the example for two groups, group 1 with 20% discount and group 2 with 25% discount. This JavaScript function can be added after the function updateNet. function updateGroupPrices() { var retailPrice = document.forms["new_product"].products_price.value; var group_price_1 = retailPrice; var group_price_2 = retailPrice; var cust_gr_1_fraction = 0.8; var cust_gr_2_fraction = 0.75; group_price_1 = retailPrice * cust_gr_1_fraction; group_price_2 = retailPrice * cust_gr_2_fraction; document.forms["new_product"].elements['sppcprice[1]'].value = doRound(group_price_1, 4); document.forms["new_product"].elements['sppcprice[2]'].value = doRound(group_price_2, 4); } After the light blue field with group prices and checkboxes I added a button (see below with some surrounding code to see where it is placed). If you click it will update/fill the group prices using the retail price that was entered or has been changed. <?php } // end while ($customers_group = tep_db_fetch_array($customers_group_query)) ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> <td><input type="button" name="update_gr_prices" value=" Update Group Price(s) " onClick='updateGroupPrices()' style="background-color: darkblue; color: white; font-weight: bold; margin-left: 27px; margin-top: 10px;" /></td> </tr> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <!-- EOF Separate Pricing Per Customer --> <?php for ($i=0, $n=sizeof($languages); $i<$n; $i++) { Quote Link to comment Share on other sites More sharing options...
gaspower Posted August 7, 2007 Share Posted August 7, 2007 Hello JanZ, First thank you for the effort and reply, very much appreciated. I tried the above to the admin/categories, but when the button is pressed nothing happens? Thanks JR Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted August 8, 2007 Share Posted August 8, 2007 I tried the above to the admin/categories, but when the button is pressed nothing happens? So what do you want me to say? It works fine for me. I can't see from here if there is a JavaScript error or what. Try Firefox. I don't know if the JavaScript error console comes standard, but it does come in handy once in a while. Quote Link to comment Share on other sites More sharing options...
gaspower Posted August 8, 2007 Share Posted August 8, 2007 Thank you, I will check it in Firefox and see if there is an error. Thank you Quote 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.