Gumpy54 Posted August 27, 2005 Share Posted August 27, 2005 I have had a search and I can only find one post ( http://www.oscommerce.com/forums/index.php?sho...id=676395&st=0& ) regarding this. I have a pricelist which I import via Easypopulate (great contribution). This price list is my wholesale price plus my markup. However, as my markup is a percentage of the wholesale price I end up with untidy pricing. i.e. ?1.58 ?24.71 ?14.27 etc. I have made the changes specified in the contribution to attempt to round my prices up to the nearest .99 i.e ?1.99 ?24.99 ?14.99 but there doesnt seem to be any change. This is the changes I made.... /includes/classes/currencies.php From this.... // class methods function format($number, $calculate_currency_value = true, $currency_type = '', $currency_value = '') { global $currency; if (empty($currency_type)) $currency_type = $currency; if ($calculate_currency_value == true) { $rate = (tep_not_null($currency_value)) ? $currency_value : $this->currencies[$currency_type]['value']; $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format(tep_round($number * $rate, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right']; To this... // class methods function format($number, $calculate_currency_value = true, $currency_type = '', $currency_value = '', $round=1) { global $currency; if (empty($currency_type)) $currency_type = $currency; if ($calculate_currency_value == true) { $rate = (tep_not_null($currency_value)) ? $currency_value : $this->currencies[$currency_type]['value']; $calc_price = $number * $rate; if ($round != 1) { $round = 1 / $round; if (round(($calc_price*$round), 0)/$round != 0) { $calc_price = round(($calc_price*$round), 0)/$round; } else { $calc_price = 1/$round; } } $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format(tep_round($calc_price, $this->currencies[$currency_type]['decimal_places']), $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right']; AND........... includes/boxes/shop_by_price.php From this.... $info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHOP_BY_PRICE, 'range=0', 'NONSSL') . '">' . TEXT_INFO_UNDER . $currencies->format($sbp_array[0]) . '</a><br>'); for ($i=1, $ii=count($sbp_array); $i < $ii; $i++) { $info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHOP_BY_PRICE, 'range=' . $i, 'NONSSL') . '">' . TEXT_INFO_FROM . $currencies->format($sbp_array[$i-1]) . TEXT_INFO_TO . $currencies->format($sbp_array[$i]) . '</a><br>'); } if (MODULE_SHOPBYPRICE_OVER == True) { $info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHOP_BY_PRICE, 'range=' . $i, 'NONSSL') . '">' . $currencies->format($sbp_array[$i-1]) . TEXT_INFO_ABOVE . '</a><br>'); To this.... $info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHOP_BY_PRICE, 'range=0', 'NONSSL') . '">' . TEXT_INFO_UNDER . $currencies->format($sbp_array[0],true, '', '' , 5) . '</a><br>'); for ($i=1, $ii=count($sbp_array); $i < $ii; $i++) { $info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHOP_BY_PRICE, 'range=' . $i, 'NONSSL') . '">' . TEXT_INFO_FROM . $currencies->format($sbp_array[$i-1],true, '', '' , 5) . TEXT_INFO_TO . $currencies->format($sbp_array[$i],true, '', '' , 5) . '</a><br>'); } if (MODULE_SHOPBYPRICE_OVER == True) { $info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHOP_BY_PRICE, 'range=' . $i, 'NONSSL') . '">' . $currencies->format($sbp_array[$i-1],true, '', '' , 5) . TEXT_INFO_ABOVE . '</a><br>'); Is there anything else I can do as this seems to make no difference. Link to comment Share on other sites More sharing options...
brianstorm Posted September 5, 2006 Share Posted September 5, 2006 hi, i just found your post when i was looking for something else, dunno if you got this resolved but you could just remove the pence after your price is marked up and add 0.99 cheers andy $info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHOP_BY_PRICE, 'range=0', 'NONSSL') . '">' . TEXT_INFO_UNDER . $currencies->format($sbp_array[0],true, '', '' , 5) . '</a><br>'); for ($i=1, $ii=count($sbp_array); $i < $ii; $i++) { $info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHOP_BY_PRICE, 'range=' . $i, 'NONSSL') . '">' . TEXT_INFO_FROM . $currencies->format($sbp_array[$i-1],true, '', '' , 5) . TEXT_INFO_TO . $currencies->format($sbp_array[$i],true, '', '' , 5) . '</a><br>'); } if (MODULE_SHOPBYPRICE_OVER == True) { $info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHOP_BY_PRICE, 'range=' . $i, 'NONSSL') . '">' . $currencies->format($sbp_array[$i-1],true, '', '' , 5) . TEXT_INFO_ABOVE . '</a><br>'); Is there anything else I can do as this seems to make no difference. with ten thousand dollars we'll all be millionaires Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.