Ejemplo n.º 1
0
                $price_info['brand'] = $pdb->GetOne("SELECT name FROM {$tb_prefix}brands WHERE id=" . $price_info['brand_id']);
            }
            $price_info['category'] = $pdb->GetOne("SELECT name FROM {$tb_prefix}productcategories WHERE id=" . $price_info['category_id']);
        } elseif (!empty($product_id)) {
            $pinfo = $pdb->GetRow("SELECT * FROM {$tb_prefix}products WHERE id=" . $product_id);
            if (!empty($pinfo)) {
                $price_info['title'] = $price_info['productname'] = $pinfo['name'];
                $price_info['product_id'] = $pinfo['id'];
                $price_info['category_id'] = $pinfo['category_id'];
                $brand_id = $pdb->GetOne("SELECT brand_id FROM {$tb_prefix}products WHERE id=" . $product_id);
                $price_info['brand'] = $pdb->GetOne("SELECT name FROM {$tb_prefix}brands WHERE id=" . $brand_id);
                $price_info['category'] = $pdb->GetOne("SELECT name FROM {$tb_prefix}productcategories WHERE id=" . $price_info['category_id']);
            }
        }
        if (!empty($price_info)) {
            setvar("item", $price_info);
        }
        $tpl_file = "price_edit";
        template($tpl_file);
        exit;
    }
}
$conditions[] = "Productprice.member_id=" . $_SESSION['MemberID'];
$amount = $productprices->findCount('', $conditions, "id");
$joins[] = "LEFT JOIN {$tb_prefix}products p ON Productprice.product_id=p.id";
$page->setPagenav($amount);
$result = $productprices->findAll("Productprice.id AS id,Productprice.type_id,Productprice.title AS title,Productprice.price AS price,Productprice.units AS units,Productprice.currency AS currency,p.name AS productname", $joins, $conditions, "Productprice.id DESC", $page->firstcount, $page->displaypg);
setvar("Items", $result);
setvar("ByPages", $page->pagenav);
setvar("Amount", $amount);
template($tpl_file);
Ejemplo n.º 2
0
            $vals['brand_id'] = $pdb->GetOne("SELECT id FROM {$tb_prefix}brands WHERE name='" . $_POST['brand_name'] . "'");
        }
    }
    if (isset($_POST['price']['product_name'])) {
        if (!pb_strcomp($_POST['price']['product_name'], $_POST['product_name'])) {
            $vals['product_id'] = $pdb->GetOne("SELECT id FROM {$tb_prefix}products WHERE name='" . $_POST['price']['product_name'] . "'");
        } else {
            $vals['product_id'] = $pdb->GetOne("SELECT id FROM {$tb_prefix}products WHERE name='" . $_POST['product_name'] . "'");
        }
    }
    //$vals['industry_id'] = PbController::getMultiId($_POST['industry']['id']);
    $vals['area_id'] = PbController::getMultiId($_POST['area']['id']);
    if (!empty($id)) {
        $vals['modified'] = $time_stamp;
        $result = $productprices->save($vals, "update", $id);
    } else {
        $vals['created'] = $vals['modified'] = $time_stamp;
        $result = $productprices->save($vals);
    }
    if (!$result) {
        flash();
    }
}
$amount = $productprices->findCount(null, $conditions, null);
$joins[] = "LEFT JOIN {$tb_prefix}members m ON Productprice.member_id=m.id";
$page->setPagenav($amount);
$fields = "Productprice.id AS id,Productprice.title AS title,Productprice.units AS units, Productprice.price AS price,Productprice.currency AS currency,m.username AS name";
$result = $productprices->findAll($fields, $joins, $conditions, "Productprice.id DESC", $page->firstcount, $page->displaypg);
uaAssign(array("ByPages" => $page->pagenav));
setvar("Items", $result);
template($tpl_file);
Ejemplo n.º 3
0
            $tpl_file = "product/price.list";
            if ($type_id) {
                $viewhelper->setTitle($_PB_CACHE['price_type'][$type_id]);
                $conditions[] = "Productprice.type_id=" . $type_id;
            }
            if ($cat_id) {
                $viewhelper->setTitle($cat_name = $pdb->GetOne("SELECT name FROM " . $tb_prefix . "productcategories WHERE id=" . $cat_id));
                $viewhelper->setPosition($cat_name, "product/price.php?do=search&catid=" . $cat_id);
                $conditions[] = "Productprice.category_id=" . $cat_id;
            }
            if ($area_id) {
                $viewhelper->setTitle($area_name = $pdb->GetOne("SELECT name FROM " . $tb_prefix . "areas WHERE id=" . $area_id));
                $viewhelper->setPosition($area_name);
                $conditions[] = "Productprice.area_id=" . $area_id;
            }
            $amount = $price->findCount(null, $conditions, null);
            $joins[] = "LEFT JOIN {$tb_prefix}members m ON Productprice.member_id=m.id";
            $joins[] = "LEFT JOIN {$tb_prefix}companies c ON Productprice.company_id=c.id";
            $joins[] = "LEFT JOIN {$tb_prefix}productcategories pc ON Productprice.category_id=pc.id";
            $fields = "Productprice.*,m.username AS username,c.name AS companyname,pc.name AS categoryname";
            $result = $price->findAll($fields, $joins, $conditions, "Productprice.id DESC", $pos, $limit);
            setvar("paging", array('total' => $amount));
            setvar("Prices", $result);
            render($tpl_file, true);
            break;
        default:
            break;
    }
}
if (isset($_GET['id'])) {
    $id = intval($_GET['id']);