Kinokoruta Posted May 16, 2004 Posted May 16, 2004 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
Kinokoruta Posted May 16, 2004 Author Posted May 16, 2004 If anyone needs a better explanation let me know my email is [email protected] thanks
Chris Dunning Posted May 16, 2004 Posted May 16, 2004 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.
Kinokoruta Posted May 16, 2004 Author Posted May 16, 2004 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
Graffe Posted May 16, 2004 Posted May 16, 2004 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:
Graffe Posted May 16, 2004 Posted May 16, 2004 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.
Kinokoruta Posted May 16, 2004 Author Posted May 16, 2004 Thats just what I'm trying to do. Let me know if you find anything out Graffe. I will do the same for you.
SGershon Posted May 16, 2004 Posted May 16, 2004 if ($products_price<0{ Shouldn't it be "if ($products_price<0) {"? If at first you don't succeed, you must be a programmer. Tip Posted: Languageless Reviews
Graffe Posted May 16, 2004 Posted May 16, 2004 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!
Chris Dunning Posted May 16, 2004 Posted May 16, 2004 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.
Graffe Posted May 16, 2004 Posted May 16, 2004 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) {
Graffe Posted May 17, 2004 Posted May 17, 2004 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.
Chris Dunning Posted May 17, 2004 Posted May 17, 2004 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.
clothahump Posted May 19, 2004 Posted May 19, 2004 Can someone post the correct block to change please, bit confused here. ;)
Recommended Posts
Archived
This topic is now archived and is closed to further replies.