Example #1
0
  $Id: categories.php,v 1.27 2004/02/16 07:26:01 hpdl Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2004 osCommerce

  Released under the GNU General Public License
*/
?>
<!-- categories //-->
          <tr>
            <td>
<?php 
$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES);
new infoBoxHeading($info_box_contents, true, false);
$osC_CategoryTree = new osC_CategoryTree();
$osC_CategoryTree->setCategoryPath($cPath, '<b>', '</b>');
$osC_CategoryTree->setParentGroupString('', '');
$osC_CategoryTree->setParentString('', '->');
$osC_CategoryTree->setChildString('', '<br>');
$osC_CategoryTree->setSpacerString('&nbsp;', 2);
$info_box_contents = array();
$info_box_contents[] = array('text' => $osC_CategoryTree->buildTree());
new infoBox($info_box_contents);
?>
            </td>
          </tr>
<!-- categories_eof //-->
Example #2
0
          </thead>
          <tbody>
<?php 
$product_categories_array = array();
if (isset($osC_ObjectInfo)) {
    $Qcategories = $osC_Database->query('select categories_id from :table_products_to_categories where products_id = :products_id');
    $Qcategories->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
    $Qcategories->bindInt(':products_id', $osC_ObjectInfo->getInt('products_id'));
    $Qcategories->execute();
    while ($Qcategories->next()) {
        $product_categories_array[] = $Qcategories->valueInt('categories_id');
    }
}
$assignedCategoryTree = new osC_CategoryTree();
$assignedCategoryTree->setBreadcrumbUsage(false);
$assignedCategoryTree->setSpacerString('&nbsp;', 5);
foreach ($assignedCategoryTree->getArray() as $value) {
    echo '          <tr onmouseover="rowOverEffect(this);" onmouseout="rowOutEffect(this);">' . "\n" . '            <td>' . osc_draw_checkbox_field('categories[]', $value['id'], in_array($value['id'], $product_categories_array), 'id="categories_' . $value['id'] . '"') . '</td>' . "\n" . '            <td><a href="#" onclick="document.product.categories_' . $value['id'] . '.checked=!document.product.categories_' . $value['id'] . '.checked;">' . $value['title'] . '</a></td>' . "\n" . '          </tr>' . "\n";
}
?>
        </table></td>
      </tr>
    </table>
  </div>
</div>

<p align="right"><?php 
echo osc_draw_hidden_field('subaction', 'confirm') . '<input type="submit" value="' . $osC_Language->get('button_save') . '" class="operationButton" /> <input type="button" value="' . $osC_Language->get('button_cancel') . '" onclick="document.location.href=\'' . osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&cID=' . $_GET['cID']) . '\';" class="operationButton" />';
?>
</p>