Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function featured_product_form() {
- $query = “SELECT p.*, UNIX_TIMESTAMP(p.create_date) AS create_date, c.name FROM {product} p LEFT JOIN {category} c ON p.cid = c.cid
- WHERE p.status = 1 ORDER BY p.product_name”;
- $rs = db_query($query);
- $featured_products = featured_product();
- $status = array();
- if ($rs) {
- while ($data = db_fetch_object($rs)) {
- $options[$data->productid] = ”;
- $form[$data->productid]['name'] = array(’#value’ => stripslashes($data->product_name));
- $form[$data->productid]['category'] = array(’#value’ => stripslashes($data->name));
- $form[$data->productid]['discount'] = array(’#value’ => $data->discount . ‘%’);
- $form[$data->productid]['createdon'] = array(’#value’ => date(’m-d-Y’, $data->create_date));
- if (in_array($data->productid, $featured_products)) {
- $status[] = $data->productid;
- }
- }
- }
- $form['featured'] = array(
- ‘#type’ => ‘checkboxes’,
- ‘#options’ => $options,
- ‘#default_value’ => $status,
- );
- $form['submit'] = array(
- ‘#type’ => ’submit’,
- ‘#value’ => t(’Submit’),
- );
- $form['cancel'] = array(
- ‘#type’ => ‘markup’,
- ‘#value’ => l(t(’Cancel’), ‘dashboard’),
- );
- $form['#redirect'] = ‘featured_product_mgmt’;
- return $form;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment