Пример #1
0
*/
require 'includes/application_top.php';
// calculate category path
$cPath = isset($_GET['cPath']) ? $_GET['cPath'] : '';
if (!empty($cPath)) {
    $cPath_array = tep_parse_category_path($cPath);
    $cPath = implode('_', $cPath_array);
    $current_category_id = end($cPath_array);
} else {
    $current_category_id = 0;
}
require '../includes/classes/category_tree.php';
$osC_CategoryTree = new osC_CategoryTree();
$osC_CategoryTree->setSpacerString(' ', 2);
$categories_array = array();
foreach ($osC_CategoryTree->getTree() as $value) {
    $categories_array[] = array('id' => $value['id'], 'text' => $value['title']);
}
$action = isset($_GET['action']) ? $_GET['action'] : '';
if (!isset($_GET['page']) || isset($_GET['page']) && !is_numeric($_GET['page'])) {
    $_GET['page'] = 1;
}
if (!isset($_GET['search'])) {
    $_GET['search'] = '';
}
if (!empty($action)) {
    switch ($action) {
        case 'save_category':
            $category_id = '';
            $error = false;
            $osC_Database->startTransaction();
Пример #2
0
*/
require 'includes/application_top.php';
// calculate category path
$cPath = isset($_GET['cPath']) ? $_GET['cPath'] : '';
if (!empty($cPath)) {
    $cPath_array = tep_parse_category_path($cPath);
    $cPath = implode('_', $cPath_array);
    $current_category_id = end($cPath_array);
} else {
    $current_category_id = 0;
}
require '../includes/classes/category_tree.php';
$osC_CategoryTree = new osC_CategoryTree();
$osC_CategoryTree->setSpacerString(' ', 2);
$categories_array = array();
foreach ($osC_CategoryTree->getTree() as $value) {
    $categories_array[] = array('id' => $value['id'], 'text' => $value['title']);
}
$action = isset($_GET['action']) ? $_GET['action'] : '';
if (!isset($_GET['page']) || isset($_GET['page']) && !is_numeric($_GET['page'])) {
    $_GET['page'] = 1;
}
if (!isset($_GET['search'])) {
    $_GET['search'] = '';
}
if (!empty($action)) {
    switch ($action) {
        case 'delete_product_confirm':
            if (isset($_GET['pID']) && isset($_POST['product_categories']) && is_array($_POST['product_categories']) && !empty($_POST['product_categories'])) {
                $Qpc = $osC_Database->query('delete from :table_products_to_categories where products_id = :products_id and categories_id in :categories_id');
                $Qpc->bindTable(':table_products_to_categories', TABLE_PRODUCTS_TO_CATEGORIES);
Пример #3
0
            </tr>
          </thead>
          <tbody>
<?php 
$product_categories_array = array();
$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', $_GET['pID']);
$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->getTree() as $value) {
    echo '          <tr onMouseOver="rowOverEffect(this);" onMouseOut="rowOutEffect(this);">' . "\n" . '            <td class="smallText"><a href="#" onClick="document.new_product.categories_' . $value['id'] . '.checked=!document.new_product.categories_' . $value['id'] . '.checked;">' . $value['title'] . '</a></td>' . "\n" . '            <td class="smallText" align="right">' . osc_draw_checkbox_field('categories[]', $value['id'], in_array($value['id'], $product_categories_array), 'id="categories_' . $value['id'] . '"') . '</td>' . "\n" . '          </tr>' . "\n";
}
?>
        </table></td>
      </tr>
    </table>
  </div>

  <p align="right"><?php 
echo osc_draw_hidden_field('products_date_added', isset($pInfo) && isset($pInfo->products_date_added) ? $pInfo->products_date_added : date('Y-m-d')) . '<input type="submit" value="' . IMAGE_PREVIEW . '" class="operationButton"> <input type="button" value="' . IMAGE_CANCEL . '" onClick="document.location.href=\'' . tep_href_link(FILENAME_PRODUCTS, 'cPath=' . $cPath . '&search=' . $_GET['search'] . (isset($_GET['pID']) ? '&pID=' . $_GET['pID'] : '')) . '\';" class="operationButton">';
?>
</p>

  </form>
</div>