Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

Hi

 

I have implemented the Advanced Actual Attribute Price contrib. on my site at http://craftsmansgallery.co.za, which is running Oscommerce Milestone 2.

 

It is showing errors as attached when trying to checkout on the shopping_cart page (although the checkout process actually works), as follows;

 

What's In My Cart? What's In My Cart?

 

Warning: Variable passed to each() is not an array or object in /usr/www/users/craftn/catalog/shopping_cart.php on line 65

Remove Qty. Model Product(s) Total

Camouflage Top with shorts (girls)

- Size Months 3 - 6 $10.00

 

Camouflage Top with shorts (girls)

- Size Years 2 - 3 $10.00

$1.00

Harmony Masks

- Size Large $8.00

$25.00

African Beaded Cross Keyholder

Warning: reset(): Passed variable is not an array or object in /usr/www/users/craftn/catalog/includes/modules/order_details.php on line 83

 

Warning: Variable passed to each() is not an array or object in /usr/www/users/craftn/catalog/includes/modules/order_details.php on line 84

$2.10

Warning: reset(): Passed variable is not an array or object in /usr/www/users/craftn/catalog/includes/modules/order_details.php on line 105

 

Warning: Variable passed to each() is not an array or object in /usr/www/users/craftn/catalog/includes/modules/order_details.php on line 106

 

 

Is this familiar to you? Would appreciate your help if possible.

 

shopping_cart.php looks like this;

 

<?php

/*

$Id: shopping_cart.php,v 1.71 2003/02/14 05:51:28 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require("includes/application_top.php");

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SHOPPING_CART);

 

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SHOPPING_CART));

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

<link rel="stylesheet" type="text/css" href="stylesheet.css">

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="3" cellpadding="3">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>

<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_cart.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<?php

if ($cart->count_contents() > 0) {

?>

<tr>

<td><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_SHOPPING_CART, 'action=update_product')); ?>

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<?php

$any_out_of_stock = 0;

$products = $cart->get_products();

for ($i=0, $n=sizeof($products); $i<$n; $i++) {

// Push all attributes information in an array

if (isset($products[$i]['attributes'])) {

while (list($option, $value) = each($products[$i]['attributes'])) { <!------------------ offending line -->

echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);

$attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix

from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa

where pa.products_id = '" . $products[$i]['id'] . "'

and pa.options_id = '" . $option . "'

and pa.options_id = popt.products_options_id

and pa.options_values_id = '" . $value . "'

and pa.options_values_id = poval.products_options_values_id

and popt.language_id = '" . $languages_id . "'

and poval.language_id = '" . $languages_id . "'");

$attributes_values = tep_db_fetch_array($attributes);

 

$products[$i][$option]['products_options_name'] = $attributes_values['products_options_name'];

$products[$i][$option]['options_values_id'] = $value;

$products[$i][$option]['products_options_values_name'] = $attributes_values['products_options_values_name'];

$products[$i][$option]['options_values_price'] = $attributes_values['options_values_price'];

$products[$i][$option]['price_prefix'] = $attributes_values['price_prefix'];

}

}

}

 

require(DIR_WS_MODULES. 'order_details.php');

?>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td align="right" class="main"><b><?php echo SUB_TITLE_SUB_TOTAL; ?> <?php echo $currencies->format($cart->show_total()); ?></b></td>

</tr>

<?php

if ($any_out_of_stock == 1) {

if (STOCK_ALLOW_CHECKOUT == 'true') {

?>

<tr>

<td class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></td>

</tr>

<?php

} else {

?>

<tr>

<td class="stockWarning" align="center"><br><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></td>

</tr>

<?php

}

}

?>

<tr>

<td><br><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><?php echo tep_image_submit('button_update_cart.gif', IMAGE_BUTTON_UPDATE_CART); ?></td>

<?php

$back = sizeof($navigation->path)-2;

if (isset($navigation->path[$back])) {

?>

<td class="main"><?php echo '<a href="' . tep_href_link($navigation->path[$back]['page'], tep_array_to_string($navigation->path[$back]['get'], array('action')), $navigation->path[$back]['mode']) . '">' . tep_image_button('button_continue_shopping.gif', IMAGE_BUTTON_CONTINUE_SHOPPING) . '</a>'; ?></td>

<?php

}

?>

<td align="right" class="main"><a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>"><?php echo tep_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT); ?></a></td>

</tr>

</table></td>

</tr>

<?php

} else {

?>

<tr>

<td align="center" class="main"><?php echo TEXT_CART_EMPTY; ?></td>

</tr>

<tr>

<td align="right" class="main"><br><a href="<?php echo tep_href_link(FILENAME_DEFAULT); ?>"><?php echo tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></a></td>

</tr>

<?php

}

?>

</table></td>

<!-- body_text_eof //-->

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

<!-- right_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>

<!-- right_navigation_eof //-->

</table></td>

</tr>

</table>

<!-- body_eof //-->

 

<!-- footer //-->

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<!-- footer_eof //-->

<br>

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

The other errors refer to order_details.php, which looks like;

 

<?php

/*

$Id: order_details.php,v 1.7 2003/02/13 01:46:54 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

?>

<!-- order_details -->

<?php

echo ' <tr>' . "\n";

 

$colspan = 3;

 

if (strstr($PHP_SELF, FILENAME_SHOPPING_CART)) {

$colspan++;

echo ' <td align="center" class="smallText"><b>' . TABLE_HEADING_REMOVE . '</b></td>' . "\n";

}

 

echo ' <td align="center" class="tableHeading">' . TABLE_HEADING_QUANTITY . '</td>' . "\n";

 

if ((PRODUCT_LIST_MODEL > 0) && strstr($PHP_SELF, FILENAME_SHOPPING_CART)) {

$colspan++;

echo ' <td class="tableHeading">' . TABLE_HEADING_MODEL . '</td>' . "\n";

}

 

echo ' <td class="tableHeading">' . TABLE_HEADING_PRODUCTS . '</td>' . "\n";

 

if (!strstr($PHP_SELF, FILENAME_SHOPPING_CART)) {

$colspan++;

echo ' <td align="center" class="tableHeading">' . TABLE_HEADING_TAX . '</td>' . "\n";

}

 

echo ' <td align="right" class="tableHeading">' . TABLE_HEADING_TOTAL . '</td>' . "\n" .

' </tr>' . "\n" .

' <tr>' . "\n" .

' <td colspan="' . $colspan . '">' . tep_draw_separator() . '</td>' . "\n" .

' </tr>' . "\n";

 

for ($i=0, $n=sizeof($products); $i<$n; $i++) {

echo ' <tr>' . "\n";

 

// Delete box only for shopping cart

if (strstr($PHP_SELF, FILENAME_SHOPPING_CART)) {

echo ' <td align="center" valign="top">' . tep_draw_checkbox_field('cart_delete[]', $products[$i]['id']) . '</td>' . "\n";

}

 

// Quantity box or information as an input box or text

if (strstr($PHP_SELF, FILENAME_SHOPPING_CART)) {

echo ' <td align="center" valign="top">' . tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']) . '</td>' . "\n";

} else {

echo ' <td align="center" valign="top" class ="main">' . $products[$i]['quantity'] . '</td>' . "\n";

}

 

// Model

if ((PRODUCT_LIST_MODEL > 0) && strstr($PHP_SELF, FILENAME_SHOPPING_CART)) {

echo ' <td valign="top" class="main"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">' . $products[$i]['model'] . '</a></td>' . "\n";

}

 

// Product name, with or without link

if (strstr($PHP_SELF, FILENAME_SHOPPING_CART)) {

echo ' <td valign="top" class="main"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a>';

} else {

echo ' <td valign="top" class="main"><b>' . $products[$i]['name'] . '</b>';

}

 

// Display marker if stock quantity insufficient

if (!strstr($PHP_SELF, FILENAME_ACCOUNT_HISTORY_INFO)) {

if (STOCK_CHECK == 'true') {

echo $stock_check = tep_check_stock($products[$i]['id'], $products[$i]['quantity']);

if ($stock_check) $any_out_of_stock = 1;

}

}

 

// Product options names

$attributes_exist = ((isset($products[$i]['attributes'])) ? 1 : 0);

 

if ($attributes_exist == 1) {

reset($products[$i]['attributes']);

while (list($option, $value) = each($products[$i]['attributes'])) {

echo '<br><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';

}

}

 

echo '</td>' . "\n";

 

// Tax (not in shopping cart, tax rate may be unknown)

if (!strstr($PHP_SELF, FILENAME_SHOPPING_CART)) {

echo ' <td align="center" valign="top" class="main">' . number_format($products[$i]['tax'], TAX_DECIMAL_PLACES) . '%</td>' . "\n";

}

 

// Product price

if (!strstr($PHP_SELF, FILENAME_ACCOUNT_HISTORY_INFO)) {

echo ' <td align="right" valign="top" class="main"><b>' . $currencies->display_price($products[$i]['price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>';

} else {

echo ' <td align="right" valign="top" class="main"><b>' . $currencies->display_price($products[$i]['price'], $products[$i]['tax'], $products[$i]['quantity']) . '</b>';

}

 

// Product options prices

if ($attributes_exist == 1) {

reset($products[$i]['attributes']); <!---------------- offending code ---->

while (list($option, $value) = each($products[$i]['attributes'])) { <!--------- offending code ---->

if ($products[$i][$option]['options_values_price'] != 0) {

if (!strstr($PHP_SELF, FILENAME_ACCOUNT_HISTORY_INFO)) {

echo '<br><small><i>' . $products[$i][$option]['price_prefix'] . $currencies->display_price($products[$i][$option]['options_values_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</i></small>';

} else {

echo '<br><small><i>' . $products[$i][$option]['price_prefix'] . $currencies->display_price($products[$i][$option]['options_values_price'], $products[$i]['tax'], $products[$i]['quantity']) . '</i></small>';

}

} else {

// Keep price aligned with corresponding option

echo '<br><small><i> </i></small>';

}

}

}

 

echo '</td>' . "\n" .

' </tr>' . "\n";

}

?>

<!-- order_details_eof -->

 

Thanks for any support.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...