Bernd
|
Posted: 05/28/2004, 11:36 AM |
|
Hi all,
need to figure out how to create a single page with one button on it that will, once clicked, update a variable on all the products.
Take the bookshop example of CCS. I've added an new filed to the products table called "pricep", created a new table called "exchange".
I now need to create a button on (prefrably the sdmin home page) that once clicked will change all the values in filed "price" of the products with the formula price=pricep*exch+1.1 this answer must be stored in field "price" for every product.
Any clues for me ?
|
|
|
Anothersledhead
Posts: 44
|
Posted: 05/28/2004, 12:32 PM |
|
I am assuming that you want to modify prices dynamically to figure out exchange rates. Have the button or link set a cookie with your exchange rate. Dynamically modify your price through SQL code something to this effect ---- SELECT pricep( {exch}+1.1) AS price FROM products ---- make sure and retrieve the cookie that was saved when the button was clicked for this to work.
Just a thought!
|
|
|
Georg
|
Posted: 05/28/2004, 12:35 PM |
|
Yes for Exchange rastes is correct. Have the exchange rate in field "exchange" which is being updated daily by a provider, just need to "FORCE" the new changes to filed "price"
|
|
|
RonB
Posts: 228
|
Posted: 06/04/2004, 7:54 AM |
|
Do you just want to update the prices as shown on the page or the actual prices in the database?
If you already store the exchange rate in the db yoou can use it in the sql statement when you select the data for the grid ie:
select product, (price * exchange +1.1) as price from products, exhange_tabel
That way you do not have to update all prices . As a plus, the database will do this faster then anything in php.
|
|
|
Walter Kempees
|
Posted: 06/06/2004, 1:49 PM |
|
this is a beauty, and the way to go!
"RonB" <RonB@forum.codecharge> schreef in bericht
news:540c08d0842f7f@news.codecharge.com...
> Do you just want to update the prices as shown on the page or the actual
prices
> in the database?
>
> If you already store the exchange rate in the db yoou can use it in the
sql
> statement when you select the data for the grid ie:
>
> select product, (price * exchange +1.1) as price from products,
exhange_tabel
>
> That way you do not have to update all prices . As a plus, the database
will do
> this faster then anything in php.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
|