示例#1
0
     break;
 case $action == 'viewSortProducts':
     $items = array();
     if (intval($_GET['cat_id']) > 0) {
         $items = $db->get_all("SELECT id,name,sort_order FROM fw_products WHERE parent='" . intval($_GET['cat_id']) . "' ORDER BY sort_order");
         $items = String::unformat_array($items);
     }
     $smarty->assign("items", $items);
     $template = 'shop.a_sortProducts.html';
     $template_mode = 'single';
     break;
 case $action == 'edit_cat' && isset($_GET['id']):
     $id = $_GET['id'];
     $navigation[] = array("url" => BASE_URL . "/admin/?mod=shop&action=catalogue", "title" => 'Категории');
     $navigation[] = array("url" => BASE_URL . "/admin/?mod=shop&action=edit_cat", "title" => 'Редактировать категорию');
     $parent = $tree->getParent($id);
     $cat = $db->get_single("SELECT *, (SELECT GROUP_CONCAT(property_id SEPARATOR ',') FROM fw_catalogue_relations WHERE cat_id='{$id}') as properties FROM fw_catalogue WHERE id='{$id}' GROUP BY id");
     $cat['properties'] = explode(",", $cat['properties']);
     $cat = String::unformat_array($cat);
     $properties = $db->get_all("\n\t\t\tSELECT cp.*, cr.sort_order\n\t\t\tFROM fw_catalogue_properties as cp\n\t\t\tLEFT JOIN fw_catalogue_relations as cr\n\t\t\t\tON cr.property_id=cp.id AND cr.cat_id='" . $cat['id'] . "'\n\t\t\tORDER BY name\n\t\t");
     $properties = String::unformat_array($properties);
     $smarty->assign("parent", $parent['id']);
     $smarty->assign("cat", $cat);
     $smarty->assign("mode", "edit");
     $smarty->assign("cat_list", Common::get_nodes_list($cat_list));
     $smarty->assign("properties", $properties);
     $template = 'shop.a_edit_cat.html';
     break;
 case $action == 'products_list':
     $navigation[] = array("url" => BASE_URL . "/admin/?mod=shop&action=products_list", "title" => 'Товары');
     if (isset($_GET['page']) && $_GET['page'] != '') {
示例#2
0
	if (!$_GET["node_id"]) {
		echo "error";
		exit;
		}
	$tree->delete($_GET["node_id"]);
	header("Location:?");
	}
*/
$sql = 'SELECT cat_id,cat_title, cat_left, cat_right, cat_level 
FROM category 
WHERE cat_id != 1
ORDER BY cat_level, cat_title';
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
    // create treeview
    $parent_array = mysql_fetch_assoc($tree->getParent($row['cat_id']));
    $parent = $parent_array["cat_id"];
    #$render_node .= '<option value="'.$row['cat_id'].'">'.$row['cat_title'].'</option>';
    // nodes with children are not selectable
    if (mysql_fetch_assoc($tree->enumChildrenAll($row['cat_id']))) {
        $js_tree .= "d.add(" . $row['cat_id'] . "," . $parent . ",'" . $row['cat_title'] . "');\n";
    } else {
        $js_tree .= "d.add(" . $row['cat_id'] . "," . $parent . ",'" . $row['cat_title'] . "','node_edit.php?node_id=" . $row['cat_id'] . "');\n";
    }
}
$formData1 = array('node_id' => array('type' => 'select', 'label' => 'Category', 'value' => $node_id, 'options' => display_tree_select(1, $node_id, 'data'), 'required' => 2, 'attributes' => array('class' => 'addr')), 'node_title' => array('type' => 'text', 'label' => 'Title', 'required' => 2, 'attributes' => array('class' => 'addr')));
// start new form object
$form = new Form();
$form->addForm("form", "get", $PHP_SELF);
$form->addHtml("<div id=\"standard_form\">\n");
$form->addField("hidden", "action", "", "add_node");