Kerstin: Variablen aus array an Funktion übergeben

Beitrag lesen

hi,
kann mir jemand dabei helfen, der Variablen $this in der unten stehenden Funktion count_contents()
alle Variablen, die sich in $order befinden, zuzuführen?

alle Produkte, die ich der Funktion count_contents() zuführen will, werden auf einer anderen .php-Seite mit dem folgenden Script angezeigt:

require(DIR_WS_CLASSES . 'request.php');
  $order = new order($HTTP_GET_VARS['order_id']);

ANZEIGE IM HTML-CODE:
for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {
    echo '          <tr>' . "\n" .
         '            <td class="main" align="right" valign="top" width="30">' . $order->products[$i]['qty'] . '&nbsp;x</td>' . "\n" .
         '            <td class="main" valign="top">' . $order->products[$i]['name'];

if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {
      for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
        echo '<br><nobr><small>&nbsp;<i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>';
      }
    }

function count_contents() {  // get total number of items in cart
      $total_items = 0;
      if (is_array($this->contents)) {
        reset($this->contents);
        while (list($products_id, ) = each($this->contents)) {
          $total_items += $this->get_quantity($products_id);
        }
      }

vielen Dank
Kerstin