示例#1
0
function nzshpcrt_getcategoryform($catid)
{
    global $wpdb, $nzshpcrt_imagesize_info;
    function parent_category_list($category_id, $category_parent_id)
    {
        global $wpdb, $category_data;
        $options = "";
        $selected = "";
        $concat = "";
        $values = $wpdb->get_results("SELECT * FROM `wp_product_categories` WHERE `category_parent`='0' AND `active` = '1' AND `id` != '{$category_id}' ORDER BY `id` ASC", ARRAY_A);
        $url = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['SCRIPT_NAME'] . "?page=wp-shopping-cart/display-items.php";
        $options .= "<option value='{$url}'>" . TXT_WPSC_SELECT_PARENT . "</option>\r\n";
        if ($values != null) {
            foreach ($values as $option) {
                $category_data[$option['id']] = $option['name'];
                if ($category_parent_id == $option['id']) {
                    $selected = "selected='selected'";
                }
                $options .= "<option {$selected} value='" . $option['id'] . "'>" . $option['name'] . "</option>\r\n";
                $selected = "";
            }
        }
        $concat .= "<select name='category_parent'>" . $options . "</select>\r\n";
        return $concat;
    }
    $sql = "SELECT * FROM `wp_product_categories` WHERE `id`={$catid} LIMIT 1";
    $product_data = $wpdb->get_results($sql, ARRAY_A);
    $product = $product_data[0];
    $output = "        <table>\n\r";
    $output .= "          <tr>\n\r";
    $output .= "            <td>\n\r";
    $output .= TXT_WPSC_NAME . ": ";
    $output .= "            </td>\n\r";
    $output .= "            <td>\n\r";
    $output .= "<input type='text' name='title' value='" . stripslashes($product['name']) . "' />";
    $output .= "            </td>\n\r";
    $output .= "          </tr>\n\r";
    $output .= "          <tr>\n\r";
    $output .= "            <td>\n\r";
    $output .= TXT_WPSC_DESCRIPTION . ": ";
    $output .= "            </td>\n\r";
    $output .= "            <td>\n\r";
    $output .= "<textarea name='description' cols='50' rows='4' >" . stripslashes($product['description']) . "</textarea>";
    $output .= "            </td>\n\r";
    $output .= "          </tr>\n\r";
    $output .= "          </tr>\n\r";
    $output .= "          <tr>\n\r";
    $output .= "            <td>\n\r";
    $output .= TXT_WPSC_CATEGORY_PARENT . ": ";
    $output .= "            </td>\n\r";
    $output .= "            <td>\n\r";
    $output .= parent_category_list($product['id'], $product['category_parent']);
    $output .= "            </td>\n\r";
    $output .= "          </tr>\n\r";
    $output .= "          </tr>\n\r";
    $output .= "          <tr>\n\r";
    $output .= "            <td>\n\r";
    $output .= TXT_WPSC_IMAGE . ": ";
    $output .= "            </td>\n\r";
    $output .= "            <td>\n\r";
    $output .= "<input type='file' name='image' value='' />";
    $output .= "            </td>\n\r";
    $output .= "          </tr>\n\r";
    $output .= "          </tr>\n\r";
    if (function_exists("getimagesize")) {
        if ($product['image'] != '') {
            $basepath = str_replace("/wp-admin", "", getcwd());
            $imagedir = $basepath . "/wp-content/plugins/wp-shopping-cart/category_images/";
            $imagepath = $imagedir . $product['image'];
            include 'getimagesize.php';
            $output .= "          <tr>\n\r";
            $output .= "            <td>\n\r";
            $output .= "            </td>\n\r";
            $output .= "            <td>\n\r";
            $output .= TXT_WPSC_HEIGHT . ":<input type='text' size='6' name='height' value='" . $imagetype[1] . "' /> " . TXT_WPSC_WIDTH . ":<input type='text' size='6' name='width' value='" . $imagetype[0] . "' /><br /><span class='small'>{$nzshpcrt_imagesize_info}</span>";
            $output .= "            </td>\n\r";
            $output .= "          </tr>\n\r";
        } else {
            $output .= "          <tr>\n\r";
            $output .= "            <td>\n\r";
            $output .= "            </td>\n\r";
            $output .= "            <td>\n\r";
            $output .= TXT_WPSC_HEIGHT . ":<input type='text' size='6' name='height' value='" . get_option('product_image_height') . "' /> " . TXT_WPSC_WIDTH . ":<input type='text' size='6' name='width' value='" . get_option('product_image_width') . "' /><br /><span class='small'>{$nzshpcrt_imagesize_info}</span>";
            $output .= "            </td>\n\r";
            $output .= "          </tr>\n\r";
        }
    }
    $output .= "          <tr>\n\r";
    $output .= "            <td>\n\r";
    $output .= TXT_WPSC_DELETEIMAGE . ": ";
    $output .= "            </td>\n\r";
    $output .= "            <td>\n\r";
    $output .= "<input type='checkbox' name='deleteimage' value='1' />";
    $output .= "            </td>\n\r";
    $output .= "          </tr>\n\r";
    $output .= "          </tr>\n\r";
    $output .= "          <tr>\n\r";
    $output .= "            <td>\n\r";
    $output .= "            </td>\n\r";
    $output .= "            <td>\n\r";
    $output .= "<input type='hidden' name='prodid' value='" . $product['id'] . "' />";
    $output .= "<input type='hidden' name='submit_action' value='edit' />";
    $output .= "<input class='edit_button' type='submit' name='submit' value='" . TXT_WPSC_EDIT . "' />";
    $output .= "<a class='delete_button' href='admin.php?page=wp-shopping-cart/display-category.php&deleteid=" . $product['id'] . "' onclick=\"return conf();\" >" . TXT_WPSC_DELETE . "</a>";
    $output .= "            </td>\n\r";
    $output .= "          </tr>\n\r";
    $output .= "        </table>\n\r";
    return $output;
}
示例#2
0
:
      </td>
      <td>
        <textarea name='description' cols='40' rows='8'></textarea>
      </td>
    </tr>
    <tr>
      <td>
        <?php 
echo TXT_WPSC_CATEGORY_PARENT;
?>
:
      </td>
      <td>
        <?php 
echo parent_category_list();
?>
      </td>
    </tr>
    <tr>
      <td>
        <?php 
echo TXT_WPSC_IMAGE;
?>
:
      </td>
      <td>
        <input type='file' name='image' value='' />
      </td>
    </tr>
<?php