|
|
|
Execute("SELECT c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, c.categories_status FROM " . $oostable['categories'] . " c, " . $oostable['categories_description'] . " cd WHERE c.categories_id = cd.categories_id AND c.categories_status = 0 AND cd.categories_languages_id = '" . intval($_SESSION['language_id']) . "' AND cd.categories_name like '%" . oos_db_input($_GET['search']) . "%' ORDER BY c.sort_order, cd.categories_name");
} else {
$categories_result = $dbconn->Execute("SELECT c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, c.categories_status FROM " . $oostable['categories'] . " c, " . $oostable['categories_description'] . " cd WHERE c.parent_id = '" . intval($current_category_id) . "' AND c.categories_status = 0 AND c.categories_id = cd.categories_id AND cd.categories_languages_id = '" . intval($_SESSION['language_id']) . "' ORDER BY c.sort_order, cd.categories_name");
}
while ($categories = $categories_result->fields) {
$categories_count++;
$rows++;
// Get parent_id for subcategories if search
if (isset($_GET['search'])) $cPath = intval($categories['parent_id']);
if ((!isset($_GET['cID']) && !isset($_GET['pID']) || (isset($_GET['cID']) && ($_GET['cID'] == $categories['categories_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
$category_childs = array('childs_count' => oos_childs_in_category_count($categories['categories_id']));
$category_products = array('products_count' => oos_products_in_category_count($categories['categories_id']));
$cInfo_array = array_merge($categories, $category_childs, $category_products);
$cInfo = new objectInfo($cInfo_array);
}
?>
' . ' #' . $categories['categories_id'] . ' ' . $categories['categories_name'] . ''; ?> |
|
categories_id . '&action=edit_category') . '">
';
?> |
MoveNext();
}
$products_count = 0;
if (isset($_GET['search'])) {
$products_result = $dbconn->Execute("SELECT p.products_id, pd.products_name, p.products_quantity, p.products_reorder_level, p.products_image, p.products_price, p.products_base_price, p.products_base_unit, p.products_tax_class_id, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_setting, p2c.categories_id, p.products_price_list, p.products_quantity_order_min, p.products_quantity_order_max, p.products_quantity_order_units, p.products_discount1, p.products_discount2, p.products_discount3, p.products_discount4, p.products_discount1_qty, p.products_discount2_qty, p.products_discount3_qty, p.products_discount4_qty, p.products_sort_order FROM " . $oostable['products'] . " p, " . $oostable['products_description'] . " pd WHERE p.products_setting = '0' AND p.products_id = pd.products_id AND pd.products_languages_id = '" . intval($_SESSION['language_id']) . "' AND pd.products_name like '%" . oos_db_input($_GET['search']) . "%' OR p.products_model like '%" . oos_db_input($_GET['search']) . "%' ORDER BY pd.products_name");
} else {
$products_result = $dbconn->Execute("SELECT p.products_id, pd.products_name, p.products_quantity, p.products_reorder_level, p.products_image, p.products_price, p.products_base_price, p.products_base_unit, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_tax_class_id, p.products_setting, p.products_price_list, p.products_quantity_order_min, p.products_quantity_order_max, p.products_quantity_order_units, p.products_discount1, p.products_discount2, p.products_discount3, p.products_discount4, p.products_discount1_qty, p.products_discount2_qty, p.products_discount3_qty, p.products_discount4_qty, p.products_sort_order FROM " . $oostable['products'] . " p, " . $oostable['products_description'] . " pd WHERE p.products_setting = '0' AND p.products_id = pd.products_id AND pd.products_languages_id = '" . intval($_SESSION['language_id']) . "' ORDER BY pd.products_name");
}
while ($products = $products_result->fields) {
$products_count++;
$rows++;
// Get categories_id for product if search
if (isset($_GET['search'])) $cPath = intval($products['categories_id']);
if ((!isset($_GET['pID']) && !isset($_GET['cID']) || (isset($_GET['pID']) && ($_GET['pID'] == $products['products_id']))) && !isset($pInfo) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
// find out the rating average from customer reviews
$reviews_result = $dbconn->Execute("SELECT (avg(reviews_rating) / 5 * 100) as average_rating FROM " . $oostable['reviews'] . " WHERE products_id = '" . intval($products['products_id']) . "'");
$reviews = $reviews_result->fields;
$pInfo_array = array_merge($products, $reviews);
$pInfo = new objectInfo($pInfo_array);
}
if (isset($pInfo) && is_object($pInfo) && ($products['products_id'] == $pInfo->products_id) ) {
echo ' ' . "\n";
} else {
echo ' ' . "\n";
}
?>
|
|
';
?> |
MoveNext();
}
?>
|
'' . TEXT_INFO_HEADING_DELETE_CATEGORY . '');
$contents = array('form' => oos_draw_form('id', 'categories', $aContents['wastebasket'], 'action=delete_category_confirm&cPath=' . $cPath, 'post', FALSE) . oos_draw_hidden_field('categories_id', $cInfo->categories_id));
$contents[] = array('text' => TEXT_DELETE_CATEGORY_INTRO);
$contents[] = array('text' => '
' . $cInfo->categories_name . '');
if ($cInfo->childs_count > 0) $contents[] = array('text' => '
' . sprintf(TEXT_DELETE_WARNING_CHILDS, $cInfo->childs_count));
if ($cInfo->products_count > 0) $contents[] = array('text' => '
' . sprintf(TEXT_DELETE_WARNING_PRODUCTS, $cInfo->products_count));
$contents[] = array('align' => 'center', 'text' => '
' . oos_submit_button(BUTTON_DELETE_PERMANENTLY) . ' ' . BUTTON_CANCEL . '');
break;
case 'delete_product':
$heading[] = array('text' => '' . TEXT_INFO_HEADING_DELETE_PRODUCT . '');
$contents = array('form' => oos_draw_form('id', 'products', $aContents['wastebasket'], 'action=delete_product_confirm&cPath=' . $cPath, 'post', FALSE) . oos_draw_hidden_field('products_id', $pInfo->products_id));
$contents[] = array('text' => TEXT_DELETE_PRODUCT_INTRO);
$contents[] = array('text' => '
' . $pInfo->products_name . '');
$product_categories_string = '';
$product_categories = oos_generate_category_path($pInfo->products_id, 'product');
for ($i = 0, $n = count($product_categories); $i < $n; $i++) {
$category_path = '';
for ($j = 0, $k = count($product_categories[$i]); $j < $k; $j++) {
$category_path .= $product_categories[$i][$j]['text'] . ' > ';
}
$category_path = substr($category_path, 0, -16);
$product_categories_string .= oos_draw_checkbox_field('product_categories[]', $product_categories[$i][count($product_categories[$i])-1]['id'], true) . ' ' . $category_path . '
';
}
$product_categories_string = substr($product_categories_string, 0, -6);
$contents[] = array('text' => '
' . $product_categories_string);
$contents[] = array('align' => 'center', 'text' => '
' . oos_submit_button(BUTTON_DELETE_PERMANENTLY) . ' ' . BUTTON_CANCEL . '');
break;
default:
if ($rows > 0) {
if (isset($cInfo) && is_object($cInfo)) { // category info box contents
$heading[] = array('text' => '' . $cInfo->categories_name . '');
$contents[] = array('align' => 'center', 'text' => '' . oos_button(BUTTON_EDIT) . '
' . oos_button(BUTTON_DELETE) . '
' . oos_button(BUTTON_UNTRASH) . '');
$contents[] = array('text' => TEXT_CATEGORIES . ' ' . oos_get_categories_name($cPath) . ' ' . oos_get_categories_name($cID) . '
' . TEXT_DATE_ADDED . ' ' . oos_date_short($cInfo->date_added));
$contents[] = array('text' => '
' . oos_info_image('category/medium/' . $cInfo->categories_image, $cInfo->categories_name) . '
' . $cInfo->categories_image);
$contents[] = array('text' => '
' . TEXT_SUBCATEGORIES . ' ' . $cInfo->childs_count . '
' . TEXT_PRODUCTS . ' ' . $cInfo->products_count);
} elseif (isset($pInfo) && is_object($pInfo)) { // product info box contents
$heading[] = array('text' => '' . $pInfo->products_name . '');
$contents[] = array('align' => 'center', 'text' => '' . oos_button(BUTTON_EDIT) . '
' . oos_button(BUTTON_DELETE) . '
' . oos_button(BUTTON_UNTRASH) . '');
$contents[] = array('text' => '#' . $pInfo->products_id . ' ' . TEXT_CATEGORIES . ' ' . oos_get_categories_name($current_category_id) . '
' . TEXT_DATE_ADDED . ' ' . oos_date_short($pInfo->products_date_added));
if (oos_is_not_null($pInfo->products_last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . oos_date_short($pInfo->products_last_modified));
if (date('Y-m-d') < $pInfo->products_date_available) $contents[] = array('text' => TEXT_DATE_AVAILABLE . ' ' . oos_date_short($pInfo->products_date_available));
$contents[] = array('text' => '
' . product_info_image($pInfo->products_image, $pInfo->products_name) . '
' . $pInfo->products_image);
$contents[] = array('text' => '
' . TEXT_PRODUCTS_AVERAGE_RATING . ' ' . number_format($pInfo->average_rating, 2) . '%');
}
} else { // create category/product info
$parent_categories_name = oos_output_generated_category_path($current_category_id);
$heading[] = array('text' => '' . EMPTY_CATEGORY . '');
$contents[] = array('text' => sprintf(TEXT_NO_CHILD_CATEGORIES_OR_PRODUCTS, $parent_categories_name));
}
break;
}
if ( (oos_is_not_null($heading)) && (oos_is_not_null($contents)) ) {
?>
infoBox($heading, $contents);
?>
|