|
'',
'products_description' => '',
'products_url' => '',
'products_id' => '',
'products_quantity' => '',
'products_model' => '',
'products_image' => '',
'products_price' => '',
'products_weight' => '',
'products_date_added' => '',
'products_last_modified' => '',
'products_date_available' => '',
'products_status' => '',
'products_tax_class_id' => '',
'manufacturers_id' => '');
$pInfo = new objectInfo($parameters);
if (isset($HTTP_GET_VARS['pID']) && empty($HTTP_POST_VARS)) {
$product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");
$product = tep_db_fetch_array($product_query);
$pInfo->objectInfo($product);
} elseif (tep_not_null($HTTP_POST_VARS)) {
$pInfo->objectInfo($HTTP_POST_VARS);
$products_name = $HTTP_POST_VARS['products_name'];
$products_description = $HTTP_POST_VARS['products_description'];
$products_url = $HTTP_POST_VARS['products_url'];
}
$manufacturers_array = array(array('id' => '', 'text' => TEXT_NONE));
$manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
$manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'],
'text' => $manufacturers['manufacturers_name']);
}
$tax_class_array = array(array('id' => '0', 'text' => TEXT_NONE));
$tax_class_query = tep_db_query("select tax_class_id, tax_class_title from " . TABLE_TAX_CLASS . " order by tax_class_title");
while ($tax_class = tep_db_fetch_array($tax_class_query)) {
$tax_class_array[] = array('id' => $tax_class['tax_class_id'],
'text' => $tax_class['tax_class_title']);
}
$languages = tep_get_languages();
if (!isset($pInfo->products_status)) $pInfo->products_status = '1';
switch ($pInfo->products_status) {
case '0': $in_status = false; $out_status = true; break;
case '1':
default: $in_status = true; $out_status = false;
}
?>
|
|
|
|
|
(YYYY-MM-DD) |
|
|
|
manufacturers_id); ?> |
|
|
products_id, $languages[$i]['id']))); ?> |
|
|
products_tax_class_id, 'onchange="updateGross()"'); ?> |
|
products_price, 'onKeyUp="updateGross()"'); ?> |
|
products_price, 'OnKeyUp="updateNet()"'); ?> |
|
|
|
products_id, $languages[$i]['id']))); ?> |
|
|
|
products_quantity); ?> |
|
|
products_model); ?> |
|
|
' . tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . $pInfo->products_image . tep_draw_hidden_field('products_previous_image', $pInfo->products_image); ?> |
|
' . TEXT_PRODUCTS_URL_WITHOUT_HTTP . ''; ?> |
products_id, $languages[$i]['id']))); ?> |
|
|
products_weight); ?> |
|
|
products_date_added) ? $pInfo->products_date_added : date('Y-m-d'))) . tep_image_submit('button_preview.gif', IMAGE_PREVIEW) . ' ' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . ''; ?> |
products_image;
}
$form_action = (isset($HTTP_GET_VARS['pID'])) ? 'update_product' : 'insert_product';
echo tep_draw_form($form_action, FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : '') . '&action=' . $form_action, 'post', 'enctype="multipart/form-data"');
$languages = tep_get_languages();
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
if (isset($HTTP_GET_VARS['read']) && ($HTTP_GET_VARS['read'] == 'only')) {
$pInfo->products_name = tep_get_products_name($pInfo->products_id, $languages[$i]['id']);
$pInfo->products_description = tep_get_products_description($pInfo->products_id, $languages[$i]['id']);
$pInfo->products_url = tep_get_products_url($pInfo->products_id, $languages[$i]['id']);
} else {
$pInfo->products_name = tep_db_prepare_input($products_name[$languages[$i]['id']]);
$pInfo->products_description = tep_db_prepare_input($products_description[$languages[$i]['id']]);
$pInfo->products_url = tep_db_prepare_input($products_url[$languages[$i]['id']]);
}
?>
products_name; ?> |
format($pInfo->products_price); ?> |
|
|
products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'align="right" hspace="5" vspace="5"') . $pInfo->products_description; ?> |
products_url) {
?>
|
products_url); ?> |
|
products_date_available > date('Y-m-d')) {
?>
products_date_available)); ?> |
products_date_added)); ?> |
|
products_id;
}
?>
' . tep_image_button('button_back.gif', IMAGE_BACK) . ''; ?> |
' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '';
?> |
|
|
|
|
tep_childs_in_category_count($categories['categories_id']));
$category_products = array('products_count' => tep_products_in_category_count($categories['categories_id']));
$cInfo_array = array_merge($categories, $category_childs, $category_products);
$cInfo = new objectInfo($cInfo_array);
}
if (isset($cInfo) && is_object($cInfo) && ($categories['categories_id'] == $cInfo->categories_id) ) {
echo ' ' . "\n";
} else {
echo ' ' . "\n";
}
?>
' . tep_image(DIR_WS_ICONS . 'folder.gif', ICON_FOLDER) . ' ' . $categories['categories_name'] . ''; ?> |
|
categories_id) ) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . ''; } ?> |
products_id) ) {
echo ' ' . "\n";
} else {
echo ' ' . "\n";
}
?>
' . tep_image(DIR_WS_ICONS . 'preview.gif', ICON_PREVIEW) . ' ' . $products['products_name']; ?> |
' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', IMAGE_ICON_STATUS_RED_LIGHT, 10, 10) . '';
} else {
echo '' . tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', IMAGE_ICON_STATUS_GREEN_LIGHT, 10, 10) . ' ' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10);
}
?> |
products_id)) { echo tep_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '' . tep_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . ''; } ?> |
0) {
for ($i=0, $n=sizeof($cPath_array)-1; $i<$n; $i++) {
if (empty($cPath_back)) {
$cPath_back .= $cPath_array[$i];
} else {
$cPath_back .= '_' . $cPath_array[$i];
}
}
}
$cPath_back = (tep_not_null($cPath_back)) ? 'cPath=' . $cPath_back . '&' : '';
?>
|
|
'' . TEXT_INFO_HEADING_NEW_CATEGORY . '');
$contents = array('form' => tep_draw_form('newcategory', FILENAME_CATEGORIES, 'action=insert_category&cPath=' . $cPath, 'post', 'enctype="multipart/form-data"'));
$contents[] = array('text' => TEXT_NEW_CATEGORY_INTRO);
$category_inputs_string = '';
$languages = tep_get_languages();
for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {
$category_inputs_string .= ' ' . 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'] . ']');
}
$contents[] = array('text' => ' ' . TEXT_CATEGORIES_NAME . $category_inputs_string);
$contents[] = array('text' => ' ' . TEXT_CATEGORIES_IMAGE . ' ' . tep_draw_file_field('categories_image'));
$contents[] = array('text' => ' ' . TEXT_SORT_ORDER . ' ' . tep_draw_input_field('sort_order', '', 'size="2"'));
$contents[] = array('align' => 'center', 'text' => ' ' . tep_image_submit('button_save.gif', IMAGE_SAVE) . ' ' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '');
break;
case 'edit_category':
$heading[] = array('text' => '' . TEXT_INFO_HEADING_EDIT_CATEGORY . '');
$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 .= ' ' . 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']));
}
$contents[] = array('text' => ' ' . TEXT_EDIT_CATEGORIES_NAME . $category_inputs_string);
$contents[] = array('text' => ' ' . tep_image(DIR_WS_CATALOG_IMAGES . $cInfo->categories_image, $cInfo->categories_name) . ' ' . DIR_WS_CATALOG_IMAGES . ' ' . $cInfo->categories_image . '');
$contents[] = array('text' => ' ' . TEXT_EDIT_CATEGORIES_IMAGE . ' ' . tep_draw_file_field('categories_image'));
$contents[] = array('text' => ' ' . TEXT_EDIT_SORT_ORDER . ' ' . tep_draw_input_field('sort_order', $cInfo->sort_order, 'size="2"'));
$contents[] = array('align' => 'center', 'text' => ' ' . tep_image_submit('button_save.gif', IMAGE_SAVE) . ' ' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '');
break;
case 'delete_category':
$heading[] = array('text' => '' . TEXT_INFO_HEADING_DELETE_CATEGORY . '');
$contents = array('form' => tep_draw_form('categories', FILENAME_CATEGORIES, 'action=delete_category_confirm&cPath=' . $cPath) . tep_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' => ' ' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' ' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '');
break;
case 'move_category':
$heading[] = array('text' => '' . TEXT_INFO_HEADING_MOVE_CATEGORY . '');
$contents = array('form' => tep_draw_form('categories', FILENAME_CATEGORIES, 'action=move_category_confirm&cPath=' . $cPath) . tep_draw_hidden_field('categories_id', $cInfo->categories_id));
$contents[] = array('text' => sprintf(TEXT_MOVE_CATEGORIES_INTRO, $cInfo->categories_name));
$contents[] = array('text' => ' ' . sprintf(TEXT_MOVE, $cInfo->categories_name) . ' ' . tep_draw_pull_down_menu('move_to_category_id', tep_get_category_tree(), $current_category_id));
$contents[] = array('align' => 'center', 'text' => ' ' . tep_image_submit('button_move.gif', IMAGE_MOVE) . ' ' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '');
break;
case 'delete_product':
$heading[] = array('text' => '' . TEXT_INFO_HEADING_DELETE_PRODUCT . '');
$contents = array('form' => tep_draw_form('products', FILENAME_CATEGORIES, 'action=delete_product_confirm&cPath=' . $cPath) . tep_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 = tep_generate_category_path($pInfo->products_id, 'product');
for ($i = 0, $n = sizeof($product_categories); $i < $n; $i++) {
$category_path = '';
for ($j = 0, $k = sizeof($product_categories[$i]); $j < $k; $j++) {
$category_path .= $product_categories[$i][$j]['text'] . ' > ';
}
$category_path = substr($category_path, 0, -16);
$product_categories_string .= tep_draw_checkbox_field('product_categories[]', $product_categories[$i][sizeof($product_categories[$i])-1]['id'], true) . ' ' . $category_path . ' ';
}
$product_categories_string = substr($product_categories_string, 0, -4);
$contents[] = array('text' => ' ' . $product_categories_string);
$contents[] = array('align' => 'center', 'text' => ' ' . tep_image_submit('button_delete.gif', IMAGE_DELETE) . ' ' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '');
break;
case 'move_product':
$heading[] = array('text' => '' . TEXT_INFO_HEADING_MOVE_PRODUCT . '');
$contents = array('form' => tep_draw_form('products', FILENAME_CATEGORIES, 'action=move_product_confirm&cPath=' . $cPath) . tep_draw_hidden_field('products_id', $pInfo->products_id));
$contents[] = array('text' => sprintf(TEXT_MOVE_PRODUCTS_INTRO, $pInfo->products_name));
$contents[] = array('text' => ' ' . TEXT_INFO_CURRENT_CATEGORIES . ' ' . tep_output_generated_category_path($pInfo->products_id, 'product') . '');
$contents[] = array('text' => ' ' . sprintf(TEXT_MOVE, $pInfo->products_name) . ' ' . tep_draw_pull_down_menu('move_to_category_id', tep_get_category_tree(), $current_category_id));
$contents[] = array('align' => 'center', 'text' => ' ' . tep_image_submit('button_move.gif', IMAGE_MOVE) . ' ' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '');
break;
case 'copy_to':
$heading[] = array('text' => '' . TEXT_INFO_HEADING_COPY_TO . '');
$contents = array('form' => tep_draw_form('copy_to', FILENAME_CATEGORIES, 'action=copy_to_confirm&cPath=' . $cPath) . tep_draw_hidden_field('products_id', $pInfo->products_id));
$contents[] = array('text' => TEXT_INFO_COPY_TO_INTRO);
$contents[] = array('text' => ' ' . TEXT_INFO_CURRENT_CATEGORIES . ' ' . tep_output_generated_category_path($pInfo->products_id, 'product') . '');
$contents[] = array('text' => ' ' . TEXT_CATEGORIES . ' ' . tep_draw_pull_down_menu('categories_id', tep_get_category_tree(), $current_category_id));
$contents[] = array('text' => ' ' . TEXT_HOW_TO_COPY . ' ' . tep_draw_radio_field('copy_as', 'link', true) . ' ' . TEXT_COPY_AS_LINK . ' ' . tep_draw_radio_field('copy_as', 'duplicate') . ' ' . TEXT_COPY_AS_DUPLICATE);
$contents[] = array('align' => 'center', 'text' => ' ' . tep_image_submit('button_copy.gif', IMAGE_COPY) . ' ' . tep_image_button('button_cancel.gif', IMAGE_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' => '' . tep_image_button('button_edit.gif', IMAGE_EDIT) . ' ' . tep_image_button('button_delete.gif', IMAGE_DELETE) . ' ' . tep_image_button('button_move.gif', IMAGE_MOVE) . '');
$contents[] = array('text' => ' ' . TEXT_DATE_ADDED . ' ' . tep_date_short($cInfo->date_added));
if (tep_not_null($cInfo->last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . tep_date_short($cInfo->last_modified));
$contents[] = array('text' => ' ' . tep_info_image($cInfo->categories_image, $cInfo->categories_name, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT) . ' ' . $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' => '' . tep_get_products_name($pInfo->products_id, $languages_id) . '');
$contents[] = array('align' => 'center', 'text' => '' . tep_image_button('button_edit.gif', IMAGE_EDIT) . ' ' . tep_image_button('button_delete.gif', IMAGE_DELETE) . ' ' . tep_image_button('button_move.gif', IMAGE_MOVE) . ' ' . tep_image_button('button_copy_to.gif', IMAGE_COPY_TO) . '');
$contents[] = array('text' => ' ' . TEXT_DATE_ADDED . ' ' . tep_date_short($pInfo->products_date_added));
if (tep_not_null($pInfo->products_last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . tep_date_short($pInfo->products_last_modified));
if (date('Y-m-d') < $pInfo->products_date_available) $contents[] = array('text' => TEXT_DATE_AVAILABLE . ' ' . tep_date_short($pInfo->products_date_available));
$contents[] = array('text' => ' ' . tep_info_image($pInfo->products_image, $pInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . ' ' . $pInfo->products_image);
$contents[] = array('text' => ' ' . TEXT_PRODUCTS_PRICE_INFO . ' ' . $currencies->format($pInfo->products_price) . ' ' . TEXT_PRODUCTS_QUANTITY_INFO . ' ' . $pInfo->products_quantity);
$contents[] = array('text' => ' ' . TEXT_PRODUCTS_AVERAGE_RATING . ' ' . number_format($pInfo->average_rating, 2) . '%');
}
} else { // create category/product info
$heading[] = array('text' => '' . EMPTY_CATEGORY . '');
$contents[] = array('text' => TEXT_NO_CHILD_CATEGORIES_OR_PRODUCTS);
}
break;
}
if ( (tep_not_null($heading)) && (tep_not_null($contents)) ) {
echo ' ' . "\n";
$box = new box;
echo $box->infoBox($heading, $contents);
echo ' | ' . "\n";
}
?>
|
|