does anyone know how to hide the "new product" button in admin/categories.php if you're in a parent category?
I don't want to give store admins the ability to add products in parent categories alongside other categories because it's not needed. Currently if there are products in a parent category with other categories, then only the products show up on the frontend not the sub categories as well. So forcing them to add a new category below in order to add new products only in that lowest category is best. I've never seen a shop that has a store page with both category listings and product listings at the same time, so this isn't needed.
Let me know how I might go about doing this.
Here's my categories.php code where the new product button is. You can see i'm trying to work it but it's not working right.
<?php
}
$cPath_back = '';
if (sizeof($cPath_array) > 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 . '&' : '';
$categories_query = tep_db_query("select parent_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");
while ($categories = tep_db_fetch_array($categories_query)) {
if (sizeof($cPath_array) > 0) {
if (!$categories['parent_id'] > 0) {
$new_prod_button = '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&action=new_product') . '">' .tep_image_button('button_new_product.gif', IMAGE_NEW_PRODUCT) . '</a>';
}}}
?>
<tr>
<td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
<td class="smallText"><?php echo TEXT_CATEGORIES . ' ' . $categories_count . '<br>' . TEXT_PRODUCTS . ' ' . $products_count; ?></td>
<td align="right" class="smallText"><?php if (sizeof($cPath_array) > 0) echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, $cPath_back . 'cID=' . $current_category_id) . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a> '; if (!isset($HTTP_POST_VARS['search'])) echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&action=new_category') . '">' . tep_image_button('button_new_category.gif', IMAGE_NEW_CATEGORY) . '</a> '.$new_prod_button; ?> </td>
</tr>
</table></td>
</tr>
</table></td>





LinkBack URL
About LinkBacks









so endith the lesson
Bookmarks