Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help with Administration Modification


novelone

Recommended Posts

A bit of background:

I am working on setting up my site to use two different names for each category (one for use in the navigation bar on the left, and the other for all other instances.) This way I can use a shorter version of the title for the navigation bar, while using a more complete title for the page heading and such.

 

I am relatively close to accomplishing this. I have added another field in the categories_description table appropriately name "nav_name". I have set up the categories box to pull from this field rather than "category_name". On the administration page, I have added an additional field to update the "nav_name". I believe I have this section of code mostly correct, but when I hit save after changing the text in the "nav_name" field, that database field is not being updated. This is what my modified code for the administration section looks like:

 

      case 'edit_category':
       $heading[] = array('text' => '<b>' . TEXT_INFO_HEADING_EDIT_CATEGORY . '</b>');

       $contents = array('form' => tep_draw_form('categories', FILENAME_CATEGORIES, 'action=update_category&cPath=' . $cPath, 'post', 'enctype="multipart/form-data"') . tep_draw_hidden_field('categories_id', $cInfo->categories_id));
       $contents[] = array('text' => TEXT_EDIT_INTRO);


       $category_inputs_string = '';
       $languages = tep_get_languages();
       for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
         $category_inputs_string .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('categories_name[' . $languages[$i]['id'] . ']', tep_get_category_name($cInfo->categories_id, $languages[$i]['id']));
       }
 
//begin mod
      $category_inputs_string2 = '';
      $languages = tep_get_languages();
      for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
        $category_inputs_string2 .= '<br>' . tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('nav_name[' . $languages[$i]['id'] . ']', tep_get_nav_name($cInfo->categories_id, $languages[$i]['id']));
      }
//end mod

       $contents[] = array('text' => '<br>' . TEXT_EDIT_CATEGORIES_NAME . $category_inputs_string);
//begin mod
    $contents[] = array('text' => '<br>' . TEXT_EDIT_NAV_NAME . $category_inputs_string2);
   //end mod
    $contents[] = array('text' => '<br>' . tep_image(DIR_WS_CATALOG_IMAGES . $cInfo->categories_image, $cInfo->categories_name) . '<br>' . DIR_WS_CATALOG_IMAGES . '<br><b>' . $cInfo->categories_image . '</b>');
       $contents[] = array('text' => '<br>' . TEXT_EDIT_CATEGORIES_IMAGE . '<br>' . tep_draw_file_field('categories_image'));
       $contents[] = array('text' => '<br>' . TEXT_EDIT_SORT_ORDER . '<br>' . tep_draw_input_field('sort_order', $cInfo->sort_order, 'size="2"'));
       $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');
       break;

 

 

I must admit I am pretty new to osCommerce, php, and MYSQL, but I am trying to learn as I go. I don't know if it's too much to ask, but what does clicking the "save" button on that page actually do? How does it update the database? I have tried sifting through the code to determine this myself (as I am pretty sure if I understood, my problem of the database not being updated could be resolved easily). If after looking at the code, and taking into consideration my limited understanding, someone could offer an explanation / solution for why the database field is not being updated, I would greatly appreciate it. I really don't know where to go next with this, but I do want to learn. Thanks in advance-

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...