Zen Cart Logo
Forums / General Questions / Adding Options to the admin 'Add/Edit Product' Page

Adding Options to the admin 'Add/Edit Product' Page

Locked

Views: 6,374

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
21 May 2008, 8:03 PM
#1
dizz avatar

dizz

Zen Follower

Join Date:
Oct 2006
Posts:
170
Plugin Contributions:
0

Adding Options to the admin 'Add/Edit Product' Page

Hi All,

Now I am trying to modify the 'Add/Edit Product' page in the admin area. I realize that the front-end <form> elements will need to be added in 'admin/product.php' but I'm not sure where to modify the query to update the database properly. Basically I would like to add this option:

Require 18+ Notice? <select name="reqnotice"><option value="1">Yes</option><option value="0">No</option></select>

And then modify the INSERT/UPDATE query accordingly:

$sql = "UPDATE... legalnotice='$reqnotice'";

Can anyone direct me as to where to make the query modifications?

24 May 2008, 9:33 PM
#2
dizz avatar

dizz

Zen Follower

Join Date:
Oct 2006
Posts:
170
Plugin Contributions:
0

Re: Adding Options to the admin 'Add/Edit Product' Page

Well I wasn't able to figure out how to add new product fields to the 'Add/Edit Product' pages, so I went ahead and created a custom admin page that contains the functionality I need. In case there is anyone else out there who wants to do this, I thought I would post some info about how I went about this -

Here is the shell of an admin page, think of this as the 'blank slate' you can build new admin pages from. Just copy/paste this file, save it as 'whatever.php' and then add your custom code appropriately:

<?php require('includes/application_top.php'); ?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title>Page Title Here</title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
<script language="javascript" src="includes/menu.js"></script>
<script language="javascript" src="includes/general.js"></script>
</head>
<body onLoad="init()">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

After you've created the admin page content, you'll need to add it to the admin links menu. This can be done by editing any of the following files which are located in 'admin/includes/boxes/':

<?php

  require(DIR_WS_BOXES . 'configuration_dhtml.php');
  require(DIR_WS_BOXES . 'catalog_dhtml.php');
  require(DIR_WS_BOXES . 'modules_dhtml.php');
  require(DIR_WS_BOXES . 'customers_dhtml.php');
  require(DIR_WS_BOXES . 'taxes_dhtml.php');
  require(DIR_WS_BOXES . 'localization_dhtml.php');
  require(DIR_WS_BOXES . 'reports_dhtml.php');
  require(DIR_WS_BOXES . 'tools_dhtml.php');
  require(DIR_WS_BOXES . 'gv_admin_dhtml.php');
  require(DIR_WS_BOXES . 'extras_dhtml.php');

?>

Each one of the boxes represents a top-level admin category. For my purposes, I needed to add the link under the 'Catalog' drop-down, so I edited the 'admin/includes/boxes/catalog_dhtml.php' file and added the following line:

  $za_contents[] = array('text' => 'Link Text Goes Here', 'link' => zen_href_link('yourfile.php', '', 'NONSSL'));

You can copy/paste that line anywhere in the array definitions, and just replace the 'Link Text Goes Here' with the link name you want, and the 'yourfile.php' with the admin page you created.

This might be 101 stuff that most of you already know, but thought I would share my findings anyway.