Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Pricing Question


Kinokoruta

Recommended Posts

Ok I hope this doesnt confuse anyone, but i am building my site up and I have a few items that are price by size. Anyways so i put the price as zero and then used the product attributes to price my items. My question is, Is there anyway to hide the Zero price and just have the product attributes pricing displayed? Any help on this would be greatly appreciated.. TIA

 

Kristina

Link to comment
Share on other sites

It's not that a better explanation is needed, you were quite clear...it's just that this has been discussed many times in the forums and is probably in the help docs. The search function is your friend. Regardless, I'll be nice:

 

Open up includes/classes/currencies.php and find this:

 

function display_price($products_price, $products_tax, $quantity = 1) {
return $this->format(tep_add_tax($products_price, $products_tax) * $quantity); 
}
}

 

Replace it with this:

function display_price($products_price, $products_tax, $quantity = 1) {
if ($products_price<0{
return $this->format(tep_add_tax($products_price, $products_tax) * $quantity); 
}else{
return '';
}
}
}

 

That will output a blank string if the price is 0 - you could change that blank string to have a line of text if you wanted.

 

There's also a contribution called "free call for price" or something like that...but I think for your purposes it would be overkill.

Chris Dunning

osCommerce, Contributions Moderator Team

 

Please do not send me PM! I do not read or answer these often. Use the email button instead!

 

I do NOT support contributions other than my own. Emails asking for support on other people's contributions will be ignored. Ask in the forum or contact the contribution author directly.

Link to comment
Share on other sites

I did that already and here is the error message that i got!!

 

Parse error: parse error in /home/kina24/public_html/includes/classes/currencies.php on line 78

 

Fatal error: Cannot instantiate non-existent class: currencies in /home/kina24/public_html/includes/application_top.php on line 258

 

what do i do? LOL figures

Link to comment
Share on other sites

Heh.. funny. I just posted to the Contibution forum because I thought the "Hide Price if $0.00" would solve the same issue. It did.. but now you can't purchase the product. D'oh! :lol:

Link to comment
Share on other sites

By the way, I removed my "Hide Price if $0.00" contribution and did what BlueNoteMkVI said to do. I got the same line 78 parse error. Line 78 happens to be:

 

if ($products_price<0{

 

Anyone see an issue with that line? I've also done searches on the subject and came up empty. I don't want to have the attribute system work like + or - because it just makes it too confusing for the customer. They should be able to drop the menu down and see the actual price next to the item.

Link to comment
Share on other sites

Thank you for trying SGershon! Sadly, that line still produces an error:

 

Parse error: parse error, unexpected T_RETURN in /catalog/includes/classes/currencies.php on line 73

 

I (and Kinokoruta probably as well) appreciate your help though!

Link to comment
Share on other sites

Hey, thanks for fixing my code!

 

kinokoruta - this isn't much help:

 

Parse error: parse error in /home/kina24/public_html/includes/classes/currencies.php on line 78

 

Fatal error: Cannot instantiate non-existent class: currencies in /home/kina24/public_html/includes/application_top.php on line 258

 

without this:

if ($products_price<0{

 

Once I saw that, I knew instantly the problem - but someone got here before I did. If you have any errors that you can't figure out, it's best to post the offending line of code and a few above and below as well so that forum readers can see the code that's causing the issue and get an idea of what it's trying to do.

Chris Dunning

osCommerce, Contributions Moderator Team

 

Please do not send me PM! I do not read or answer these often. Use the email button instead!

 

I do NOT support contributions other than my own. Emails asking for support on other people's contributions will be ignored. Ask in the forum or contact the contribution author directly.

Link to comment
Share on other sites

Okay.. I've got the store to work partially. It no longer displays the pricing. However, it does not display any pricing either. If you click on 'Add to Cart', then it displays the price in your cart but it has removed the pricing from items that are not zero as well. The code that is doing the above mentioned is:

 

function display_price($products_price, $products_tax, $quantity = 1) {
if ($products_price<0) {
return $this->format(tep_add_tax($products_price, $products_tax) * $quantity); 
}else{
return '';
}
}
}

 

Any thoughts? I've also tried:

if ($products_price<0.00) {

Link to comment
Share on other sites

Shameless bump being that I'd love to have my store up and running sometime this coming week. The code that BlueNoteMKVI posted is so, so close. I'm 99.9% sure this is the right route to go.

Link to comment
Share on other sites

Oh heck...I apologize for my stupidity in giving that code out. I've been working too many hours lately.

 

if ($products_price<0) {

 

That says "If the price is less than 0" (ie, a negative number)

 

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

 

That says "output the price of the product, formatted properly for the currency we're using, adding tax if necessary, multiplied by the quantity ordered."

 

}else{
return '';

 

Otherwise, output a blank string.

 

So...the price will only be displayed if it's LESS THAN 0. This is obviously wrong. Just make that < a > and you'll be good.

 

if ($products_price>0) {

 

That's what you need.

Chris Dunning

osCommerce, Contributions Moderator Team

 

Please do not send me PM! I do not read or answer these often. Use the email button instead!

 

I do NOT support contributions other than my own. Emails asking for support on other people's contributions will be ignored. Ask in the forum or contact the contribution author directly.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...