Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

another division by zero


rabbitseffort

Recommended Posts

This is my first division by zero, but I know many have had them in various places---here is the line it refers to in specials.php

$contents[] = array('text' => '' . TEXT_INFO_PERCENTAGE . ' ' . number_format(100 - (($sInfo->specials_new_products_price / $sInfo->products_price) * 100)) . '%');

 

and this is the error message:

Warning: Division by zero in /...../..../...../...../catalog/admin/specials.php on line 258

I have hide price if 0 if this is mattering somehow. I set my prices to zero on this shop and use the attributes as my price options

 

I am setting a product as a special with a price of 0 just so it will be displayed in the specials box which is really a way to control a featured product

 

I appreciate any help with this error--it doesnt seem to keep anything from working, but it is an ugly error message

"I must admit that I personally measure success in terms of the contributions an individual makes to her or his fellow human beings."

---Margaret Mead---

 

"The answer is never the answer. What's really interesting is the mystery. If you seek the mystery instead of the answer, you'll always be seeking. I've never seen anybody really find the answer -- they think they have, so they stop thinking. But the job is to seek mystery, evoke mystery, plant a garden in which strange plants grow and mysteries bloom. The need for mystery is greater than the need for an answer.

--Ken Kesey"

Link to comment
Share on other sites

I have hide price if 0 if this is mattering somehow. I set my prices to zero on this shop and use the attributes as my price options

That's why.

 

You should be able to ignore the message, and I think everything might still work like you want. If it does, then you can get rid of the message by changing that line to

$contents[] = array('text' => '' . TEXT_INFO_PERCENTAGE . ' ' . ( $sInfo->products_price == 0 ? '' : number_format(100 - (($sInfo->specials_new_products_price / $sInfo->products_price) * 100))  . '%' ));

 

Before you change the code, make sure it's working like you want it to.

Contributions

 

Discount Coupon Codes

Donations

Link to comment
Share on other sites

Thanks again for the reply--seems to make sense--all does work right still so it will be ok this way--have a great night!

"I must admit that I personally measure success in terms of the contributions an individual makes to her or his fellow human beings."

---Margaret Mead---

 

"The answer is never the answer. What's really interesting is the mystery. If you seek the mystery instead of the answer, you'll always be seeking. I've never seen anybody really find the answer -- they think they have, so they stop thinking. But the job is to seek mystery, evoke mystery, plant a garden in which strange plants grow and mysteries bloom. The need for mystery is greater than the need for an answer.

--Ken Kesey"

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...