List price shouldn't be visible when not set (equals to zero).
On views this is already doable using "Count the number 0 as empty" and "Hide if empty" field options; but on product page there is no property to set.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mandreato’s picture

Status: Active » Needs review
FileSize
979 bytes

A special format/widget for the field in admin/structure/types/manage/product/display would be the optimum, but at the moment this patch is what I can afford.

TR’s picture

I see this as a theming issue. If on your site you want to display the list price only in some circumstances, you can customize your site by overriding theme_uc_product_price(). I think a more common use case, if you're using list prices at all, would be to display list price with a strikethrough when the sell price differs from the list price. Setting list price to zero in those cases seems a little odd to me. Regardless, these sorts of things can and should be handled in the theme layer IMO.

mandreato’s picture

The use case you described is exactly mine: I set the following CSS statement to indicate as a original price is discounted for a product.
.list-price { text-decoration: line-through; }
But then I don't want to discount all products, so just a few have a list price !=0. I need to hide those with zero and probably it's a very common use case.

Since this behaviour is the same for dimensions (which also disappears when zero), I thought to manage it in Ubercart core, not via customization. Maybe the patch #1 is a rough way and it should have an option somewhere to enable/disable the field display.

longwave’s picture

Status: Needs review » Needs work

While I agree that showing a list price of $0 will be uncommon, the right place to do this is in theme_uc_product_price(), so it can be overridden if necessary, and easily extended to other price fields if necessary. I guess a sell price of $0 is usually valid, while a list price or cost of $0 should probably be hidden by default.

mandreato’s picture

Status: Needs work » Needs review
FileSize
1.22 KB

OK, I changed the patch by moving the exclusion logic into theme_uc_product_price()

philsward’s picture

Ideally, I think we need the ability to disable a product from purchase altogether. I have a separate custom module that will "hide" the price and checkout form but it doesn't yet work with panels or views.

Longterm, I'd love to see this integrated into core, but there's obviously some bugs that need worked out. I can share what I have if anyone is interested...

end user’s picture

Might be overboard but if you use views one you node page to display the price info/buy/now button you can set it to be not shown when the field is 0. I believe you have to remove the formating on the price other wise it doesn't work.

meshweta’s picture

mandreato,
Thanks for the patch this worked for me. I was thinking to write jQuery for the same but your patch is too good. Thanks once again! God Bless You!

mandreato’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Patch #5 is on my live site since 4 months with no problems.

carlodimartino’s picture

Thanks. Patch #5 worked perfectly for me too.

Gemini Lights’s picture

Just wondering if patch #5 will be committed to a stable release version of Ubercart 7.x-3.x?

Gixxernutter’s picture

+1 on #5 - thanks