Пример #1
0
            </tr>
          </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>
Пример #2
0
     }
     if ($error === false) {
         $osC_Database->commitTransaction();
         osC_Cache::clear('categories');
         osC_Cache::clear('category_tree');
         osC_Cache::clear('also_purchased');
         $osC_MessageStack->add_session('header', SUCCESS_DB_ROWS_UPDATED, 'success');
     } else {
         $osC_Database->rollbackTransaction();
         $osC_MessageStack->add_session('header', ERROR_DB_ROWS_NOT_UPDATED, 'error');
     }
     tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'page=' . $_GET['page'] . '&cPath=' . $cPath . '&cID=' . $category_id));
     break;
 case 'delete_category_confirm':
     if (isset($_GET['cID']) && is_numeric($_GET['cID'])) {
         $osC_CategoryTree->setBreadcrumbUsage(false);
         $categories = array_merge(array(array('id' => $_GET['cID'], 'text' => '')), $osC_CategoryTree->getTree($_GET['cID']));
         $products = array();
         $products_delete = array();
         foreach ($categories as $c_entry) {
             $Qproducts = $osC_Database->query('select products_id from :table_products_to_categories where categories_id = :categories_id');
             $Qproducts->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
             $Qproducts->bindInt(':categories_id', $c_entry['id']);
             $Qproducts->execute();
             while ($Qproducts->next()) {
                 $products[$Qproducts->valueInt('products_id')]['categories'][] = $c_entry['id'];
             }
         }
         foreach ($products as $key => $value) {
             $Qcheck = $osC_Database->query('select count(*) as total from :table_products_to_categories where products_id = :products_id and categories_id not in :categories_id');
             $Qcheck->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);