Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to display a products price


Guest

Recommended Posts

Posted

Hi,

 

I have installed the price break contribution so know i have 4/5 prices. But i was wondering how i could also have the first unit price to be displayed.

 

At the moment my price break is in a table format stating 5 prices. Is there a simple line of code that could echo the first price?

 

Any help would be appreciated as i have searched and searched for the sollution and i am very new to php and os commerce.

 

Many thanks in advance.

Posted

I'm assuming that you want the single-quantity price. If I'm right, this should work:

echo $pf->computePrice(1);

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Posted

Jim,

 

Your a star thanks :)

 

Any idea how i could create a link that would enable a person to view products that are from the same manufacturer?

 

I have the related products contribution installed, but would be good if too had a little link that said "View Other Products by this Manufacturer/Brand" i do have on my site a drop down list with manufacturers all listed so i think it could be possible.

 

Again dont know much about php myself yet to do.

 

Many thanks anyway.

Posted

I seem to recall a contribution for something like that. I don't remember the name though. Search the contributions for "manufacturer" and see if you can find it.

 

Regrds

Jim

See my profile for a list of my addons and ways to get support.

Posted

Any idea how i can get it to just 2 decimal places its displaying for example 12.6754

 

Thanks

Posted

Try this:

echo $currencies->format ($pf->computePrice(1) );

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Posted
Try this:

echo $currencies->format ($pf->computePrice(1) );

 

Regards

Jim

 

 

You are the man, :D thanks

Posted
You are the man, :D thanks

 

 

mmm, not quite there yet, its picking the net price and not when tax is added, any idea?

 

Sorry to be a pain

Posted

I keep forgetting about tax. You'll need to get the tax rate from the price formatter as well. Let's see if I can get this right (Not tested, so beware typos.)

echo $currencies->display_price ($pf->computePrice(1), $pf->taxClass);

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Posted
I keep forgetting about tax. You'll need to get the tax rate from the price formatter as well. Let's see if I can get this right (Not tested, so beware typos.)

echo $currencies->display_price ($pf->computePrice(1), $pf->taxClass);

 

Regards

Jim

 

Hi, Jim (i am being thick)

 

what or where do i find or put the "tax rate" from the price formatter. I looked in the price_formatter file in includes/classes but dont know what or if i should be looking for anything in there.

Think i need to get a book on php :blink:

Posted

That $pf->taxClass should do the job. If it doesn't work, then I'm confused about the Price Formatter class. Which would not be all that unusual. It's not my favorite piece of code.

 

Learning PHP is not a bad idea. It took me a bit of work to wrap my head around, and I'm still learning new stuff all the time, but it's been fun. Mostly. Use whatever learning method works best for you. After a while it all starts to make sense.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Posted
That $pf->taxClass should do the job. If it doesn't work, then I'm confused about the Price Formatter class. Which would not be all that unusual. It's not my favorite piece of code.

 

Learning PHP is not a bad idea. It took me a bit of work to wrap my head around, and I'm still learning new stuff all the time, but it's been fun. Mostly. Use whatever learning method works best for you. After a while it all starts to make sense.

 

Regards

Jim

 

Hi Jim,

 

I shall keep fiddling with it to see if i can get it to work. In price formatter i can see taxClass so yes it should have picked it up. I noticed in the file there is things like $original_price and also states tep_get_tax_rate !!!!

 

It may be something in the price formatter code that it isnt liking or relating to!

 

Anyway i have taken up enough of your time. Thanks for your help

Posted

still having problems, anyone know a way of doing this its driving me nuts!

 

Thanks to Jim got the Net price to echo but not inc tax. Bloody Prie Break :angry:

 

Think i need to spend more time in the library!!! Under php section!!!

Posted

Time to forget about the Price Formatter class. If you have the Products ID (and you should, anywhere there is a price) then you can get the Tax Class from the database.

	$product_info_query = tep_db_query ("select products_tax_class_id
									 from " . TABLE_PRODUCTS . "
									 where products_id = '" . (int) $products_id . "'
								   );

$product_info = tep_db_fetch_array($product_info_query);

Now $product_info['products_tax_class_id'] is your tax ID to use in tep_get_tax_rate()

 

Note: This assumes that $products_id is the correct variable to get the ID. Change as needed for wherever you are using this.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Posted
Time to forget about the Price Formatter class. If you have the Products ID (and you should, anywhere there is a price) then you can get the Tax Class from the database.

	$product_info_query = tep_db_query ("select products_tax_class_id
									 from " . TABLE_PRODUCTS . "
									 where products_id = '" . (int) $products_id . "'
								   );

$product_info = tep_db_fetch_array($product_info_query);

Now $product_info['products_tax_class_id'] is your tax ID to use in tep_get_tax_rate()

 

Note: This assumes that $products_id is the correct variable to get the ID. Change as needed for wherever you are using this.

 

Regards

Jim

 

 

 

Wahoo Yes :) You beauty. Thanks Jim that worked a treat. Identified each one as you said.

 

You made me a very happy girl.

Archived

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

×
×
  • Create New...