Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Missing argument 4 for currencies::display_price()


PHP_User

Recommended Posts

Hi,

 

I am trying to track down a check out issue and found quite a few of these PHP Warnings. "Missing argument 4 for currencies::display_price(), called in .......... store\checkout_process.php on line 248"

 

That line of code is:

 

$products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
}

 

It does not stop the transaction from completing. I found quite a few posts about missing argument 2, and some 3 but none with 4 that seemed to apply to my issue.

 

Can anyone give me some direction on this error?

 

Thanks,

Don

Link to comment
Share on other sites

Here is the function:

 

function display_price($products_price, $products_tax, $quantity , $product_id) {
global $customer_id;
$query = tep_db_query("select g.customers_groups_discount,g.customers_groups_id from " . customers_groups . " g inner join  " . TABLE_CUSTOMERS  . " c on g.customers_groups_id = c.customers_groups_id and c.customers_id = '" . $customer_id . "'");
$query_result = tep_db_fetch_array($query);
$customer_discount = $query_result['customers_groups_discount'];
$array =  $_SESSION['cart']->contents;
$i=0;
if(count($array) > 0 ) {
while (current($array)) {
$getcurrentcartproductlist[$i] = key($array);
$i++;
next($array);
}
}
$getmembershipleverl = mysql_query("SELECT * FROM `products_to_categories` WHERE `categories_id` = 4 ");
$j=0;
while($rows52 = mysql_fetch_array($getmembershipleverl)) {
$discountproductlist[$j] =  $rows52['products_id'];
$j++;
}
if(count($getcurrentcartproductlist)>0) {
$findanydiscountproductarray = array_intersect($getcurrentcartproductlist,$discountproductlist);
foreach ($findanydiscountproductarray as &$getdp) {
}
}
if($getdp!="") {
$sql = "SELECT customers_groups.*,products_groups.* FROM `customers_groups` inner join products_groups on products_groups.gid  =  customers_groups.customers_groups_id where customers_groups.pgid = ".$getdp." and products_groups.pid = ".$product_id."";
$result99 = mysql_query($sql);
$row99 = mysql_fetch_array($result99);
$getnumrows = mysql_num_rows($result99);
}
if($query_result['customers_groups_id']!="") {
$query2 =mysql_query("SELECT *FROM `products_groups` WHERE `pid`=".$product_id." AND gid = ".$query_result['customers_groups_id']." ");
$num = mysql_num_rows($query2);
}
if(($num>0))
{
 if (strstr($customer_groups_discount, "+") != null) {
  $products_price = $products_price + $products_price * abs($customer_discount) / 100;
 } else {
  $products_price = $products_price - $products_price * abs($customer_discount) / 100;
 }
} elseif($getnumrows>0) {
 $customer_discount = $row99['customers_groups_discount'];
 $products_price = $products_price - $products_price * abs($customer_discount) / 100;
} else {
 return $this->format($this->calculate_price($products_price, $products_tax, $quantity));
}
return $this->format($products_price);
}

Link to comment
Share on other sites

Your function is modified and requires 4 parameters

 

function display_price($products_price, $products_tax, $quantity , $product_id)

 

The addition to default is the $products_id

 

In other places of your site,like the code you posted initially, you supply only 3 parameters

 

$currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty'])

 

Result is the error of course, why? Because the required 4rth parameter is missing.

 

What to do?

 

One option would be to set $products_id like this

 

function display_price($products_price, $products_tax, $quantity , $product_id = '') {

 

so, the error will go away, but I have no idea if the function will keep doing its job, this you need to test, or better you check pack to the support and/or installation instructions from where you got this code, probably an addon

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...