Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Discounts Not Showing On New Added Product


Teamjr

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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++) {

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...