php zencart mod - having problems with attributes array

Posted by user80151 on Stack Overflow See other posts from Stack Overflow or by user80151
Published on 2010-04-21T05:33:40Z Indexed on 2010/04/22 3:43 UTC
Read the original article Hit count: 206

Filed under:
|

I inherited a zencart mod and can't figure out what's wrong. The customer selects a product and an attribute (model#). This is then sent to another form that they complete. When they submit the form, the product and the attribute should be included in the email sent.

At this time, only the product is coming through. The attribute just says "array." The interesting part is, when I delete the line that prints the attribute, the products_options_names will print out. So I know that both the product and the products_options_names are working. The attribute is the only thing that is not working right.

Here's what I believe to be the significant code. This is the page that has the form, so the attribute should already be passed to the form.

//Begin Adding of New features
//$productsimage = $product['productsImage'];
$productsname = $product['productsName'];
$attributes = $product['attributes'];
$products_options_name = $value['products_options_name'];

$arr_product_list[] = "<strong>Product Name:</strong> $productsname <br />";
$arr_product_list[] .= "<strong>Attributes:</strong> $attributes <br />";
$arr_product_list[] .= "<strong>Products Options Name:</strong> $products_options_name  <br />";
$arr_product_list[] .=  "---------------------------------------------------------------";

//End  Adding of New features

  } // end foreach ($productArray as $product)
?>

Above this, there is another section that has attributes:

 <?php
   echo $product['attributeHiddenField'];
   if (isset($product['attributes']) && is_array($product['attributes'])) {
   echo '<div class="cartAttribsList">';
    echo '<ul>';
    reset($product['attributes']);
    foreach ($product['attributes'] as $option => $value) {
?>

Can anyone help me figure out what is wrong? I'm not sure if the problem is on this page or if the attribute isn't being passed to this page.

TIA

© Stack Overflow or respective owner

Related posts about php

Related posts about arrays