Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add % to each customer price.


nikita

Recommended Posts

Posted

I thought about price in the shop.

Decided that there is an opportunity to add to "currencies.php" class another value to calculate the price for each customer.

 

1. I have made a new collumn in 'customers' table named 'customers_percentage';

 

2. In 'application_top.php' I have added the request which will give me the value:

$percent_query = tep_db_query("select customers_percentage from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customer_id . "'");$percent = tep_db_fetch_array($percent_query);

3. Opened class 'includes/classes/currencies.php' and decided to correct the line:

$format_string = $this->currencies[$currency_type]['symbol_left'] . number_format(tep_round($number * $rate, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right'];

4. By adding another calculation based on my new cell value in customers table (... * ($percent['customers_percentage']) ...), and the line become the following:

$format_string = $this->currencies[$currency_type]['symbol_left'] . number_format(tep_round($number * $rate * ($percent['customers_percentage']), $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right'];

Finally, the prices in my shop become zeros! Mistake!

Than I decided to change my value to simple number. For example: +2, -4 (... number_format(tep_round($number * $rate * (-4) ...). The result was great - I mean all the calculation works for now, but only with number, but I need it to work wih my value! :(

And so, why I can't give the value when I put my request -> $percent['customers_percentage'] in a class?

 

I hope there are lot cool coders which could give me examples, corrections and comments on my post?

Thanks a lot for all our community members. It's amazing that we are together and we have opportunity to help each oher.

Posted

use sppc.

 

Creates customer groups and prices are based on customer groups.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Posted
use sppc.

 

Creates customer groups and prices are based on customer groups.

 

Satish

SPSC is to hard for my needs. It gives abilities that I don't really need at all. But I'm interested in simple method on how to give each customer his own percent!

Does anybody thinks anything else?

Thanks a lot for all our community members. It's amazing that we are together and we have opportunity to help each oher.

Posted

Make sure that this: $percent['customers_percentage']

 

is an integer greater than zero. It is possible that the SQL is returning no result, hence the calculation is being multiplied by zero - leading to zero prices.

Posted

There is no contribution available to My idea.

 

 

You create an additional field customer_price_percentage.

 

Then in Your price formater code apply this percentage so price is customer based.

 

Its easier integrating an existing contribution rather then creating one.

 

So I still recommend sppc as it has few features.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...