Price X percentage

Locked

Started by dave71 on 22 Oct 2006, 6:37 PM · Views: 2,635

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
22 Oct 2006, 6:37 PM
#1
dave71 avatar

dave71

New Zenner

Join Date:
Oct 2006
Posts:
10
Plugin Contributions:
0

Price X percentage

I've set up a field in the products table as percentage

here's what I'm trying to achieve

i.e. (price - £10.00) x (percentage - 1.25) = price - £12.50

Is the a way to hard code this into currencies.php instead of having to go through every file & having to change to products_price*percentage?

Thanks in advance

Dave

22 Oct 2006, 7:00 PM
#2
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,725
Plugin Contributions:
0

Re: Price X percentage

Can you explain a bit more about why you are pricing this way?

Please do not PM for support issues: a private solution doesn't benefit the community.

Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

22 Oct 2006, 7:29 PM
#3
dave71 avatar

dave71

New Zenner

Join Date:
Oct 2006
Posts:
10
Plugin Contributions:
0

Re: Price X percentage

Kim:

Can you explain a bit more about why you are pricing this way?

Yes certainly ....

We have over 5000 products of which prices change hourly
We have different files that are imported into our DB via XML & CSV using navicat (https://www.navicat.com)
Every hour these files updates the cost price into products_price linked via the suppliers SKU
We set a margin for each product as a percentage so that we don't have to update the price for each product manually

22 Oct 2006, 9:19 PM
#4
dave71 avatar

dave71

New Zenner

Join Date:
Oct 2006
Posts:
10
Plugin Contributions:
0

Re: Price X percentage

Ok ...

Getting closer ... if I add a * 1.25 like below prices work fine

return $this->format(tep_add_tax($products_price*1.25, $products_tax) * $quantity);

Which query does the $products_price get called from? then I simply need to add percentage to the query so that I can change the 1.25 to $percentage

22 Oct 2006, 10:16 PM
#5
dave71 avatar

dave71

New Zenner

Join Date:
Oct 2006
Posts:
10
Plugin Contributions:
0

Re: Price X percentage

dave71:

Ok ...
return $this->format(tep_add_tax($products_price*1.25, $products_tax) * $quantity);

Sorry I'm in the process of converting an old OScommerce version to zen cart

the above should be:-

return $this->format(zen_add_tax($products_price*1.25, $products_tax) * $quantity);

22 Oct 2006, 11:57 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Price X percentage

You will run into a lot of issues attempting that ...

You are better off having a field like products_price_cost and products_price_percentage ...

Then load the new products_price_cost and then update the products_price = products_price_cost*products_price_percentage ... then run the Tools ... Store Manager ... Update Products Price Sorter ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

23 Oct 2006, 12:46 AM
#7
dave71 avatar

dave71

New Zenner

Join Date:
Oct 2006
Posts:
10
Plugin Contributions:
0

Re: Price X percentage

Ajeh:

You will run into a lot of issues attempting that ...

You are better off having a field like products_price_cost and products_price_percentage ...

Then load the new products_price_cost and then update the products_price = products_price_cost*products_price_percentage ... then run the Tools ... Store Manager ... Update Products Price Sorter ...

Hi

Thanks for your reply

So your saying to rewrite the whole of the zen files to add the products_price_cost*products_price_percentage queries?

Seams it's going to involve a lot of changes to achieve this unless i'm wrong ?

23 Oct 2006, 2:57 AM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Price X percentage

If I understand you correctly, you have a zillion products and need to increase the prices by individual percentages based on multiple changes per day ...

The only thing "fixed" is the percentage on a given product ...

So the simplest thing to do is use 2 fields unrealated to Zen Cart ... that hold your product cost and the percentage ...

When the product cost gets changed every few hours ... you can just quick update the products_price ... the field Zen Cart uses ... based on your new product cost * the fixed percentage for the given product ...

Then run the products price sorter update and all prices are updated quickly and painlessly ...

Your new prices do not break Zen Cart ... and Zen Cart reflects the new products_price as that products price cost * that products percentage ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

23 Oct 2006, 10:47 AM
#9
dave71 avatar

dave71

New Zenner

Join Date:
Oct 2006
Posts:
10
Plugin Contributions:
0

Re: Price X percentage

Linda,

Thanks
So what your saying is ....

Make 2 fields (eg on a different table prices for this example)
products_price_cost
products_price_percentage
Import the new price into each field

Then export with a select statement - (select prices.products_price_cost*prices.products_price_percentage from prices)

as a .csv for example
Then import the combined prices into products_price?