I haven't been able to find anything about this on here, so if this has been dealt with before I apologize -- please direct away....
I created a new field in my product table product_media_mail_eligible. TinyInt. Default is 0/No. I successfully added the field to the admin products page with the radio buttons for yes/no. I am able to select the Yes radio button, save it and it appears in the database. But when I reload the page, the button appears as No even though it is Yes in the database. I changed the following files to reflect the new field:
collect_info.php (2 of them)
update_product.php (2 of them)
Here's the code from collect_info.php:
andCode:$parameters = array('products_name' => '', 'products_description' => '', 'products_url' => '', 'products_id' => '', 'products_quantity' => '', 'products_model' => '', 'products_upc' => '', 'products_isbn' => '', ... 'products_price_sorter' => '0', 'master_categories_id' => '', 'product_media_mail_eligible' => '' );
andCode:$product = $db->Execute("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, ... p.products_price_sorter, p.master_categories_id, p.product_media_mail_eligible from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$_GET['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'");
and finallyCode:// Product is Media Mail eligible -- trying to get it to work if (!isset($pInfo->product_media_mail_eligible)) $pInfo->product_media_mail_eligible = '0'; switch ($pInfo->product_media_mail_eligible) { case '0': $is_media = false; $not_is_media = true; break; case '1': $is_media = true; $not_is_media = false; break; default: $is_media = false; $not_is_media = true; }
From update_product.php:Code:<tr> <td class="main" valign="top"><?php echo 'Is product eligible for media mail?'; ?></td> <td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_radio_field('product_media_mail_eligible', '1', ($is_media==1)) . ' ' . TEXT_YES . ' ' . zen_draw_radio_field('product_media_mail_eligible', '0', ($not_is_media==0)) . ' ' . TEXT_NO . ' ' . ($pInfo->product_media_mail_eligible == 0 ? '<span class="errorText">' . '</span>' : ''); ?></td> </tr>
I have tried as best as I know how to track this through the code, but I can't figure out where it is failing to load the stored value for this field, while everything else is fine. Even if you don't know the answer from the code, if you could at least point me in the direction to look for what I am missing that would be helpful. I followed the instructions from several webpages about adding new fields to the product table and admin pages, but clearly I didn't do it right.Code:$sql_data_array = array('products_quantity' => $products_quantity, 'products_type' => zen_db_prepare_input($_GET['product_type']), 'products_model' => zen_db_prepare_input($_POST['products_model']), 'products_upc' => zen_db_prepare_input($_POST['products_upc']), 'products_isbn' => zen_db_prepare_input($_POST['products_isbn']), 'products_price' => $products_price, 'products_date_available' => $products_date_available, 'products_weight' => $products_weight, 'products_status' => zen_db_prepare_input((int)$_POST['products_status']), 'products_virtual' => zen_db_prepare_input((int)$_POST['products_virtual']), .... 'products_price_sorter' => zen_db_prepare_input($_POST['products_price_sorter']), 'product_media_mail_eligible' => zen_db_prepare_input((int)$_POST['product_media_mail_eligible']) );
BTW -- no, there is nothing in extra_datafiles -- since I didn't create a new table I didn't see where to add anything particularly. This could be the problem, I suppose, but I don't have any idea where I would add this new field if that IS the problem.
Thanks for your help!



Reply With Quote


Bookmarks