本文整理汇总了PHP中process_url函数的典型用法代码示例。如果您正苦于以下问题:PHP process_url函数的具体用法?PHP process_url怎么用?PHP process_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了process_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: product_details
function product_details()
{
if (!$_GET["id"]) {
return is_redirect("./?object=shop");
}
// Get products from database
if (is_numeric($_GET["id"])) {
$add_sql = "id= '" . intval($_GET["id"]);
} else {
$add_sql = "url='" . _es($_GET['id']);
}
$sql = "SELECT * FROM " . db('shop_products') . " WHERE active='1' AND " . $add_sql . "'";
$product_info = db()->query_fetch($sql);
// Required for comments
module("shop")->_comments_params["object_id"] = $product_info["id"];
module("shop")->_comments_params["objects_ids"] = $product_info["id"];
$N = module("shop")->_get_num_comments();
$N = $N[$product_info["id"]];
if ($N == "") {
$N = 0;
}
$dirs = sprintf("%06s", $product_info["id"]);
$dir2 = substr($dirs, -3, 3);
$dir1 = substr($dirs, -6, 3);
$mpath = $dir1 . "/" . $dir2 . "/";
$group_prices = module("shop")->_get_group_prices($product_info["id"]);
$product_info["_group_price"] = $group_prices[module("shop")->USER_GROUP];
module("shop")->_product_info = $product_info;
$atts = module("shop")->_products_get_attributes($product_info["id"]);
$thumb_path = $product_info["url"] . "_" . $product_info["id"] . "_" . $product_info["image"] . module("shop")->THUMB_SUFFIX . ".jpg";
$img_path = $product_info["url"] . "_" . $product_info["id"] . "_" . $product_info["image"] . module("shop")->FULL_IMG_SUFFIX . ".jpg";
if ($product_info["image"] == 0) {
$image = "";
} else {
$image_files = _class('dir')->scan_dir(module("shop")->products_img_dir . $mpath, true, "/" . $product_info["url"] . "_" . $product_info["id"] . ".+?_small\\.jpg" . "/");
$reg = "/" . $product_info["url"] . "_" . $product_info["id"] . "_(?P<content>[\\d]+)_small\\.jpg/";
foreach ((array) $image_files as $filepath) {
preg_match($reg, $filepath, $rezult);
$i = $rezult["content"];
if ($i != $product_info["image"]) {
$thumb_temp = module("shop")->products_img_webdir . $mpath . $product_info["url"] . "_" . $product_info["id"] . "_" . $i . module("shop")->THUMB_SUFFIX . ".jpg";
$img_temp = module("shop")->products_img_webdir . $mpath . $product_info["url"] . "_" . $product_info["id"] . "_" . $i . module("shop")->FULL_IMG_SUFFIX . ".jpg";
$replace2 = ["thumb_path" => $thumb_temp, "img_path" => $img_temp, "name" => $product_info["url"]];
$image .= tpl()->parse("shop/image_items", $replace2);
}
}
}
$URL_PRODUCT_ID = module("shop")->_product_id_url($product_info);
$sql_man = "SELECT * FROM " . db('shop_manufacturers') . " WHERE id = " . $product_info["manufacturer_id"];
$manufacturer = db()->query_fetch($sql_man);
if (module("shop")->SHOW_products_similar_by_price == true) {
$products_similar_by_price = module("shop")->products_similar_by_price($product_info["price"], $product_info["id"]);
}
if (module("shop")->products_similar_by_basket == true) {
$products_similar_by_basket = module("shop")->products_similar_by_basket($product_info["id"]);
}
$replace = ["name" => _prepare_html($product_info["name"]), "model" => _prepare_html($product_info["model"]), "desc" => $product_info["description"], "manufacturer" => _prepare_html(module("shop")->_manufacturer[$product_info["manufacturer_id"]]["name"]), "url_manufacturer" => process_url("./?object=shop&action=products_show&id=" . module("shop")->_manufacturer[$product_info["manufacturer_id"]]["url"]), "date" => _format_date($product_info["add_date"], "long"), "price" => module("shop")->_format_price(module("shop")->_product_get_price($product_info)), "currency" => _prepare_html(module("shop")->CURRENCY), "thumb_path" => file_exists(module("shop")->products_img_dir . $mpath . $img_path) ? module("shop")->products_img_webdir . $mpath . $img_path : "", "img_path" => file_exists(module("shop")->products_img_dir . $mpath . $img_path) ? module("shop")->products_img_webdir . $mpath . $img_path : "", "image" => $image, "basket_add_url" => $product_info["external_url"] ? $product_info["external_url"] : process_url("./?object=shop&action=basket_add&id=" . $URL_PRODUCT_ID), "external_url" => intval((bool) $product_info["external_url"]), "back_url" => process_url("./?object=shop"), "show_basket_url" => process_url("./?object=shop&action=basket"), "dynamic_atts" => module("shop")->_get_select_attributes($atts), "cats_block" => module("shop")->_categories_show(), "cat_name" => _prepare_html(module("shop")->_shop_cats[$product_info["cat_id"]]), "cat_url" => process_url("./?object=shop&action=product_details&id=" . module("shop")->_shop_cats_all[$product_info["cat_id"]]['url']), 'comments' => module("shop")->_view_comments(), "N" => $N, "products_similar_by_price" => $products_similar_by_price, "products_similar_by_basket" => $products_similar_by_basket, "product_related" => module("shop")->products_related($product_info["id"])];
db()->query("UPDATE " . db('shop_products') . " SET viewed = viewed+1 , last_viewed_date = " . time() . " WHERE " . $add_sql . "'");
return tpl()->parse("shop/details", $replace);
}
示例2: products_similar_by_price
function products_similar_by_price($price, $id)
{
$price_min = floor($price - $price * 10 / 100);
$price_max = ceil($price + $price * 10 / 100);
$sql1 = "SELECT category_id FROM " . db('shop_product_to_category') . " WHERE product_id = " . $id . "";
$cat_id = db()->query($sql1);
while ($A = db()->fetch_assoc($cat_id)) {
$cats_id .= $A["category_id"] . ",";
}
$cats_id = rtrim($cats_id, ",");
$sql2 = "SELECT product_id FROM " . db('shop_product_to_category') . " WHERE category_id IN ( " . $cats_id . ")";
$prod = db()->query($sql2);
while ($A = db()->fetch_assoc($prod)) {
$prods .= $A["product_id"] . ",";
}
$prods = rtrim($prods, ",");
$sql = "SELECT * FROM " . db('shop_products') . " WHERE price > " . $price_min . " AND price < " . $price_max . " AND id != " . $id . " AND id IN(" . $prods . ")";
$product = db()->query_fetch_all($sql);
foreach ((array) $product as $k => $product_info) {
$thumb_path = $product_info["url"] . "_" . $product_info["id"] . "_1" . module("shop")->THUMB_SUFFIX . ".jpg";
$URL_PRODUCT_ID = module("shop")->_product_id_url($product_info);
$items[$product_info["id"]] = ["name" => _prepare_html($product_info["name"]), "price" => module("shop")->_format_price(module("shop")->_product_get_price($product_info)), "currency" => _prepare_html(module("shop")->CURRENCY), "image" => file_exists(module("shop")->products_img_dir . $thumb_path) ? module("shop")->products_img_webdir . $thumb_path : "", "link" => $product_info["external_url"] ? $product_info["external_url"] : process_url("./?object=shop&action=product_details&id=" . $URL_PRODUCT_ID), "special" => ""];
}
$replace = ["items" => $items, "title" => "Similar price"];
return tpl()->parse("shop/products_similar_by_price", $replace);
}
示例3: _order_step_start
/**
* Order step
*/
function _order_step_start($FORCE_DISPLAY_FORM = false)
{
module('shop')->_basket_save();
$basket_contents = module('shop')->_basket_api()->get_all();
$products_ids = [];
foreach ((array) $basket_contents as $_item_id => $_info) {
if ($_info["product_id"]) {
$products_ids[$_info["product_id"]] = $_info["product_id"];
}
}
if (!empty($products_ids)) {
$products_infos = db()->query_fetch_all("SELECT * FROM " . db('shop_products') . " WHERE id IN(" . implode(",", $products_ids) . ") AND active='1'");
$products_atts = module('shop')->_products_get_attributes($products_ids);
$group_prices = module('shop')->_get_group_prices($products_ids);
}
$total_price = 0;
foreach ((array) $products_infos as $_info) {
$_product_id = $_info["id"];
$_info["_group_price"] = $group_prices[$_product_id][module('shop')->USER_GROUP];
$quantity = $basket_contents[$_info["id"]]["quantity"];
$price = module('shop')->_product_get_price($_info);
$dynamic_atts = [];
foreach ((array) $products_atts[$_product_id] as $_attr_id => $_attr_info) {
if ($basket_contents[$_product_id]["atts"][$_attr_info["name"]] == $_attr_info["value"]) {
$dynamic_atts[$_attr_id] = "- " . $_attr_info["name"] . " " . $_attr_info["value"];
$price += $_attr_info["price"];
}
}
$URL_PRODUCT_ID = module('shop')->_product_id_url($_info);
$products[$_info["id"]] = ["name" => _prepare_html($_info["name"]), "price" => module('shop')->_format_price($price), "currency" => _prepare_html(module('shop')->CURRENCY), "quantity" => intval($quantity), "details_link" => process_url("./?object=shop&action=product_details&id=" . $URL_PRODUCT_ID), "dynamic_atts" => !empty($dynamic_atts) ? implode("\n<br />", $dynamic_atts) : "", "cat_name" => _prepare_html(module('shop')->_shop_cats[$_info["cat_id"]]), "cat_url" => process_url("./?object=shop&action=products_show&id=" . module('shop')->_shop_cats_all[$_info["cat_id"]]['url'])];
$total_price += $price * $quantity;
}
$replace = ["products" => $products, "total_price" => module('shop')->_format_price($total_price), "currency" => _prepare_html(module('shop')->CURRENCY), "back_link" => "./?object=shop&action=basket", "next_link" => "./?object=shop&action=order&id=delivery", "cats_block" => module('shop')->_categories_show()];
return tpl()->parse("shop/order_start", $replace);
}
示例4: products_similar_by_basket
function products_similar_by_basket($id)
{
$sql_order_id = "SELECT order_id FROM " . db('shop_order_items') . " WHERE product_id = " . $id;
$orders = db()->query($sql_order_id);
while ($A = db()->fetch_assoc($orders)) {
$order_id .= $A["order_id"] . ",";
}
$order_id = rtrim($order_id, ",");
if (!empty($order_id)) {
$sql_product_id = "SELECT product_id FROM " . db('shop_order_items') . " WHERE order_id IN ( " . $order_id . ") AND product_id != " . $id;
$products = db()->query($sql_product_id);
while ($A = db()->fetch_assoc($products)) {
$product_id .= $A["product_id"] . ",";
}
$product_id = rtrim($product_id, ",");
}
if (!empty($product_id)) {
$sql = "SELECT * FROM " . db('shop_products') . " WHERE id in ( " . $product_id . ")";
$product = db()->query_fetch_all($sql);
foreach ((array) $product as $k => $product_info) {
$thumb_path = $product_info["url"] . "_" . $product_info["id"] . "_1" . module("shop")->THUMB_SUFFIX . ".jpg";
$URL_PRODUCT_ID = module("shop")->_product_id_url($product_info);
$items[$product_info["id"]] = ["name" => _prepare_html($product_info["name"]), "price" => module("shop")->_format_price(module("shop")->_product_get_price($product_info)), "currency" => _prepare_html(module("shop")->CURRENCY), "image" => file_exists(module("shop")->products_img_dir . $thumb_path) ? module("shop")->products_img_webdir . $thumb_path : "", "link" => $product_info["external_url"] ? $product_info["external_url"] : process_url("./?object=shop&action=product_details&id=" . $URL_PRODUCT_ID), "special" => ""];
}
}
$replace = ["items" => $items, "title" => "Those who purchased this product also buy"];
return tpl()->parse("shop/products_similar_by_price", $replace);
}
示例5: _manufacturer_show
function _manufacturer_show()
{
// Prepare manufacturer
$replace = ["brand" => module("shop")->_manufacturer, "manufacturer_box" => common()->select_box("manufacturer", module("shop")->_man_for_select, $_SESSION['man_id'], false, 2), "url_manufacturer" => process_url("./?object=shop&action=products_show")];
unset($_SESSION["man_id"]);
return tpl()->parse("shop/manufacturer", $replace);
}
示例6: _order_step_finish
/**
* Order step
*/
function _order_step_finish($FORCE_DISPLAY_FORM = false)
{
module('shop')->_basket_api()->clean();
if (isset($_GET["page"])) {
$_GET["id"] = intval($_GET["page"]);
unset($_GET["page"]);
}
$_GET["id"] = intval($_GET["id"]);
if ($_GET["id"]) {
$order_info = db()->query_fetch("SELECT * FROM " . db('shop_orders') . " WHERE id=" . intval($_GET["id"]) . " AND user_id=" . intval(main()->USER_ID));
}
if (empty($order_info)) {
return _e("No such order");
}
$products_ids = [];
$Q = db()->query("SELECT * FROM " . db('shop_order_items') . " WHERE `order_id`=" . intval($order_info["id"]));
while ($_info = db()->fetch_assoc($Q)) {
if ($_info["product_id"]) {
$products_ids[$_info["product_id"]] = $_info["product_id"];
}
$order_items[$_info["product_id"]] = $_info;
}
if (!empty($products_ids)) {
$products_infos = db()->query_fetch_all("SELECT * FROM " . db('shop_products') . " WHERE id IN(" . implode(",", $products_ids) . ") AND active='1'");
$products_atts = module('shop')->_products_get_attributes($products_ids);
}
foreach ((array) $order_items as $_info) {
$_product_id = $_info["product_id"];
$_product = $products_infos[$_product_id];
$price = $_info["sum"];
$dynamic_atts = [];
if (strlen($_info["attributes"]) > 3) {
foreach ((array) unserialize($_info["attributes"]) as $_attr_id) {
$_attr_info = $products_atts[$_info["product_id"]][$_attr_id];
$dynamic_atts[$_attr_id] = "- " . $_attr_info["name"] . " " . $_attr_info["value"];
$price += $_attr_info["price"];
}
}
$URL_PRODUCT_ID = module('shop')->_product_id_url($_product);
$products[$_info["product_id"]] = ["name" => _prepare_html($_product["name"]), "price" => module('shop')->_format_price($price), "sum" => module('shop')->_format_price($_info["sum"]), "currency" => _prepare_html(module('shop')->CURRENCY), "quantity" => intval($_info["quantity"]), "details_link" => process_url("./?object=shop&action=product_details&id=" . $URL_PRODUCT_ID), "dynamic_atts" => !empty($dynamic_atts) ? implode("\n<br />", $dynamic_atts) : "", "cat_name" => _prepare_html(module('shop')->_shop_cats[$_product["cat_id"]]), "cat_url" => process_url("./?object=shop&action=products_show&id=" . module('shop')->_shop_cats_all[$_product["cat_id"]]['url'])];
$total_price += $price * $quantity;
}
$total_price = $order_info["total_sum"];
if (main()->USER_ID) {
$order_info = my_array_merge(module('shop')->_user_info, $order_info);
} else {
$order_info["email"] = $order_info["email"];
$order_info["phone"] = $order_info["phone"];
}
$order_info = my_array_merge(module('shop')->COMPANY_INFO, $order_info);
$replace2 = my_array_merge($order_info, ["id" => $_GET["id"], "products" => $products, "ship_cost" => module('shop')->_format_price(0), "total_cost" => module('shop')->_format_price($total_price), "password" => ""]);
// Prepare email template
$message = tpl()->parse("shop/invoice_email", $replace2);
common()->quick_send_mail($order_info["email"], "invoice #" . $_GET["id"], $message);
$replace = my_array_merge($replace2, ["error_message" => _e(), "products" => $products, "ship_price" => module('shop')->_format_price(module('shop')->_ship_types_names[$order_info["ship_type"]]), "total_price" => module('shop')->_format_price($total_price), "order_no" => str_pad($order_info["id"], 8, "0", STR_PAD_LEFT), "hash" => _prepare_html($order_info["hash"]), "back_link" => "./?object=shop&action=show", "cats_block" => module('shop')->_categories_show()]);
return tpl()->parse("shop/order_finish", $replace);
}
示例7: _products_last_viewed
function _products_last_viewed()
{
$sql_prod_id = "SELECT * FROM " . db('shop_products') . " ORDER BY last_viewed_date DESC LIMIT 5";
$item_prod_id = db()->query_fetch_all($sql_prod_id);
$items = [];
foreach ((array) $item_prod_id as $k => $product_info) {
$thumb_path = $product_info["url"] . "_" . $product_info["id"] . "_1" . module("shop")->THUMB_SUFFIX . ".jpg";
$URL_PRODUCT_ID = module("shop")->_product_id_url($product_info);
$items[$product_info["id"]] = ["name" => _prepare_html($product_info["name"]), "price" => module("shop")->_format_price(module("shop")->_product_get_price($product_info)), "currency" => _prepare_html(module("shop")->CURRENCY), "image" => file_exists(module("shop")->products_img_dir . $thumb_path) ? module("shop")->products_img_webdir . $thumb_path : "", "link" => $product_info["external_url"] ? $product_info["external_url"] : process_url("./?object=shop&action=product_details&id=" . $URL_PRODUCT_ID), "special" => ""];
}
return tpl()->parse("shop/last_viewed", ["items" => $items]);
}
示例8: _show_shop_best_sales
function _show_shop_best_sales()
{
$sql_prod_id = "SELECT product_id, COUNT(quantity) FROM " . db('shop_order_items') . " GROUP BY product_id ORDER BY COUNT(quantity) DESC LIMIT 0,5";
$item_prod_id = db()->query_fetch_all($sql_prod_id);
$items = [];
foreach ((array) $item_prod_id as $k => $v) {
$sql = "SELECT * FROM " . db('shop_products') . " WHERE active='1' AND id = " . $v["product_id"];
$product_info = db()->query_fetch($sql);
$thumb_path = $product_info["url"] . "_" . $product_info["id"] . "_1" . module("shop")->THUMB_SUFFIX . ".jpg";
$URL_PRODUCT_ID = module("shop")->_product_id_url($product_info);
$items[$product_info["id"]] = ["name" => _prepare_html($product_info["name"]), "price" => module("shop")->_format_price(module("shop")->_product_get_price($product_info)), "currency" => _prepare_html(module("shop")->CURRENCY), "image" => file_exists(module("shop")->products_img_dir . $thumb_path) ? module("shop")->products_img_webdir . $thumb_path : "", "link" => $product_info["external_url"] ? $product_info["external_url"] : process_url("./?object=shop&action=product_details&id=" . $URL_PRODUCT_ID), "special" => ""];
}
return tpl()->parse("shop/best_sales", ["items" => $items]);
}
示例9: _categories_show
function _categories_show()
{
$shop_cats = [];
foreach ((array) module("shop")->_shop_cats_for_select as $_cat_id => $_cat_name) {
if (!$_cat_name) {
continue;
}
$shop_cats[_prepare_html($_cat_name)] = process_url("./?object=shop&action=show&id=" . module("shop")->_shop_cats_all[$_cat_id]['url']);
}
if (empty($shop_cats)) {
$shop_cats = "";
}
return tpl()->parse("shop/cats_block", ["shop_cats" => $shop_cats]);
}
示例10: user_var_edit
/**
* Edit user var
*/
function user_var_edit()
{
$_GET['id'] = intval($_GET['id']);
$A = db()->query_fetch('SELECT * FROM ' . db('locale_user_tr') . ' WHERE id=' . intval($_GET['id']));
if (!$A) {
return _e('No id');
}
if (main()->is_post()) {
db()->UPDATE('locale_user_tr', ['name' => _es($_POST['name']), 'translation' => _es($_POST['translation']), 'last_update' => time()], 'id=' . intval($_GET['id']));
return js_redirect('./?object=' . $_GET['object'] . '&action=user_vars');
}
$DATA = my_array_merge($A, $_POST);
$replace = ['form_action' => './?object=' . $_GET['object'] . '&action=' . $_GET['action'] . ($_GET['id'] ? '&id=' . $_GET['id'] : ''), 'back_url' => process_url('./?object=' . $_GET['object'] . '&action=user_vars'), 'error' => _e(), 'for_edit' => 1, 'id' => _prepare_html($DATA['id']), 'user_id' => _prepare_html($DATA['user_id']), 'name' => _prepare_html($DATA['name']), 'translation' => _prepare_html($DATA['translation']), 'locale' => _prepare_html($DATA['locale']), 'site_id' => _prepare_html($DATA['site_id'])];
return tpl()->parse($_GET['object'] . '/user_vars_edit', $replace);
}
示例11: _order_view
/**
* view orders
*/
function _order_view()
{
if ($_POST["order_id"]) {
$_GET["id"] = intval($_POST["order_id"]);
} else {
$_GET["id"] = intval($_GET["id"]);
}
if ($_GET["id"]) {
$order_info = db()->query_fetch("SELECT * FROM " . db('shop_orders') . " WHERE id=" . intval($_GET["id"]));
}
if (empty($order_info)) {
return _e("No such order");
}
if (!empty($_POST["status"])) {
db()->UPDATE(db('shop_orders'), ["status" => _es($_POST["status"])], "id=" . intval($_GET["id"]));
return js_redirect("./?object=shop&action=orders");
}
$products_ids = [];
$Q = db()->query("SELECT * FROM " . db('shop_order_items') . " WHERE `order_id`=" . intval($order_info["id"]));
while ($_info = db()->fetch_assoc($Q)) {
if ($_info["product_id"]) {
$products_ids[$_info["product_id"]] = $_info["product_id"];
}
$order_items[$_info["product_id"]] = $_info;
}
if (!empty($products_ids)) {
$products_infos = db()->query_fetch_all("SELECT * FROM " . db('shop_products') . " WHERE id IN(" . implode(",", $products_ids) . ") AND active='1'");
$products_atts = module('shop')->_products_get_attributes($products_ids);
}
foreach ((array) $order_items as $_info) {
$_product = $products_infos[$_info["product_id"]];
$dynamic_atts = [];
if (strlen($_info["attributes"]) > 3) {
foreach ((array) unserialize($_info["attributes"]) as $_attr_id) {
$_attr_info = $products_atts[$_info["product_id"]][$_attr_id];
$dynamic_atts[$_attr_id] = "- " . $_attr_info["name"] . " " . $_attr_info["value"];
$price += $_attr_info["price"];
}
}
$products[$_info["product_id"]] = ["name" => _prepare_html($_product["name"]), "price" => module('shop')->_format_price($_info["sum"]), "currency" => _prepare_html(module('shop')->CURRENCY), "quantity" => intval($_info["quantity"]), "details_link" => process_url("./?object=shop&action=view&id=" . $_product["id"]), "dynamic_atts" => !empty($dynamic_atts) ? implode("\n<br />", $dynamic_atts) : ""];
$total_price += $_info["price"] * $quantity;
}
$total_price = $order_info["total_sum"];
$replace = my_array_merge($replace, _prepare_html($order_info));
$replace = my_array_merge($replace, ["form_action" => "./?object=shop&action=" . $_GET["action"] . "&id=" . $_GET["id"], "order_id" => $order_info["id"], "total_sum" => module('shop')->_format_price($order_info["total_sum"]), "user_link" => _profile_link($order_info["user_id"]), "user_name" => _display_name(user($order_info["user_id"])), "error_message" => _e(), "products" => (array) $products, "total_price" => module('shop')->_format_price($total_price), "ship_type" => module('shop')->_ship_type[$order_info["ship_type"]], "pay_type" => module('shop')->_pay_types[$order_info["pay_type"]], "date" => _format_date($order_info["date"], "long"), "status_box" => module('shop')->_statuses[$order_info["status"]], "back_url" => "./?object=shop&action=orders"]);
return tpl()->parse("shop/order_view", $replace);
}
示例12: show
/**
* Display page contents
*/
function show()
{
$a = $this->_get_page_from_db();
if (!$a) {
return _404();
}
$this->_set_global_info($a);
// Get sub-pages (from menu)
$sub_pages = [];
$menus = main()->get_data('menus');
$cur_menu_id = 0;
// Find first user menu
if (!$cur_menu_id) {
foreach ((array) $menus as $_info) {
if ($_info['type'] == 'user' && $_info['active']) {
$cur_menu_id = $_info['id'];
break;
}
}
}
$cur_menu_item_id = 0;
if ($cur_menu_id) {
$menu_items = main()->get_data('menu_items');
foreach ((array) $menu_items[$cur_menu_id] as $item_info) {
if (!$item_info['active'] || $item_info['parent_id']) {
continue;
}
if ($item_info['location'] == 'object=' . $_GET['object'] . '&action=' . $_GET['action'] . '&id=' . $_GET['id']) {
$cur_menu_item_id = $item_info['parent_id'] ? $item_info['parent_id'] : $item_info['id'];
break;
}
}
}
if ($cur_menu_id && $cur_menu_item_id) {
foreach ((array) $menu_items[$cur_menu_id] as $item_info) {
if (!$item_info['active'] || $item_info['parent_id'] != $cur_menu_item_id) {
continue;
}
$sub_pages[$item_info['id']] = ['name' => _prepare_html($item_info['name']), 'link' => process_url('./?' . $item_info['location'])];
}
}
$content = tpl()->parse_string(stripslashes($a['text']), [], 'static_page__' . $a['id']);
// Process template
$replace = ['id' => intval($a['id']), 'name' => stripslashes($a['name']), 'content' => $content, 'page_heading' => _prepare_html(_ucfirst($a['page_heading'])), 'page_page_title' => _prepare_html(_ucfirst($a['page_title'])), 'print_link' => './?object=' . $_GET['object'] . '&action=print_view&id=' . $a['id'], 'pdf_link' => './?object=' . $_GET['object'] . '&action=pdf_view&id=' . $a['id'], 'email_link' => './?object=' . $_GET['object'] . '&action=email_page&id=' . $a['id'], 'sub_pages' => $sub_pages];
return tpl()->parse($_GET['object'] . '/main', $replace);
}
示例13: _order_step_select_payment
/**
* Order step
*/
function _order_step_select_payment($FORCE_DISPLAY_FORM = false)
{
// Show previous form if needed
if (common()->_error_exists() || empty($_POST)) {
return module('shop')->_order_step_delivery();
}
if (module('shop')->FORCE_PAY_METHOD) {
$_POST["pay_type"] = module('shop')->FORCE_PAY_METHOD;
$FORCE_DISPLAY_FORM = false;
}
if (main()->is_post() && !$FORCE_DISPLAY_FORM) {
module('shop')->_order_validate_select_payment();
// Verify products
if (!common()->_error_exists()) {
$ORDER_ID = module('shop')->_order_create();
$ORDER_ID = intval($ORDER_ID);
}
// Order id is required to continue, check it again
if (empty($ORDER_ID) && !common()->_error_exists()) {
_re("SHOP: Error while creating `order`, please <a href='" . process_url("./?object=support") . "'>contact</a> site admin");
}
// Display next form if we have no errors
if (!common()->_error_exists()) {
module('shop')->_CUR_ORDER_ID = $ORDER_ID;
return module('shop')->_order_step_do_payment(true);
}
}
$DATA = $_POST;
if (!isset($DATA["pay_type"])) {
$DATA["pay_type"] = key(module('shop')->_pay_types);
}
$hidden_fields = "";
$hidden_fields .= module('shop')->_hidden_field("ship_type", $_POST["ship_type"]);
foreach ((array) module('shop')->_b_fields as $_field) {
$hidden_fields .= module('shop')->_hidden_field($_field, $_POST[$_field]);
}
/* foreach ((array)module('shop')->_s_fields as $_field) {
$hidden_fields .= module('shop')->_hidden_field($_field, $_POST[$_field]);
} */
$hidden_fields .= module('shop')->_hidden_field('card_num', $_POST['card_num']);
$hidden_fields .= module('shop')->_hidden_field('exp_date', $_POST['exp_date']);
$replace = ["form_action" => "./?object=shop&action=" . $_GET["action"] . "&id=" . $SELF_METHOD_ID, "error_message" => _e(), "pay_type_box" => module('shop')->_box("pay_type", $DATA["pay_type"]), "hidden_fields" => $hidden_fields, "back_link" => "./?object=shop&action=order&id=delivery", "cats_block" => module('shop')->_categories_show()];
return tpl()->parse("shop/order_select_payment", $replace);
}
示例14: search_fast
/**
*/
function search_fast($str_search)
{
$str_search2 = implode(" ", $str_search);
$str_search = implode("%", $str_search);
$sql = "SELECT id FROM " . db('shop_products') . " WHERE name LIKE ";
$_sql = "";
$_sql = $sql . "'%" . $str_search . "%'";
$Q = db()->query($_sql);
$product_ids = "";
while ($product_id = db()->fetch_assoc($Q)) {
$product_ids .= $product_id["id"] . ",";
}
$product_ids = rtrim($product_ids, ",");
if ($product_ids == "") {
$replace = ["str_search" => $str_search2, "form_action" => process_url("./?object=shop&action=search&id=fast")];
return tpl()->parse("shop/no_search_results", $replace);
} else {
$replace = module('shop')->products_show($product_ids, $str_search2);
}
return $replace;
}
示例15: basket
/**
* Display basket contents (save changes also here)
*/
function basket($params = [])
{
$STPL_NAME = $params["STPL"] ? $params["STPL"] : "shop/basket";
$basket_contents = module('shop')->_basket_api()->get_all();
// Save basket contents
if (!empty($_POST["quantity"]) && !module('shop')->_basket_is_processed) {
module('shop')->_basket_save();
return js_redirect("./?object=shop&action=" . $_GET["action"]);
}
// Get products from db
$products_ids = [];
foreach ((array) $basket_contents as $_item_id => $_info) {
if ($_info["product_id"]) {
$products_ids[$_info["product_id"]] = $_info["product_id"];
}
}
if (!empty($products_ids)) {
$products_infos = db()->query_fetch_all("SELECT * FROM " . db('shop_products') . " WHERE active='1' AND id IN(" . implode(",", $products_ids) . ")");
$products_atts = module('shop')->_products_get_attributes($products_ids);
$group_prices = module('shop')->_get_group_prices($products_ids);
}
$total_price = 0;
foreach ((array) $products_infos as $_info) {
$_product_id = $_info["id"];
$_info["_group_price"] = $group_prices[$_product_id][module('shop')->USER_GROUP];
$quantity = $basket_contents[$_info["id"]]["quantity"];
$price = module('shop')->_product_get_price($_info);
$dynamic_atts = [];
foreach ((array) $products_atts[$_product_id] as $_attr_id => $_attr_info) {
if ($basket_contents[$_product_id]["atts"][$_attr_info["name"]] == $_attr_info["value"]) {
$dynamic_atts[$_attr_id] = "- " . $_attr_info["name"] . " " . $_attr_info["value"];
$price += $_attr_info["price"];
}
}
$URL_PRODUCT_ID = module('shop')->_product_id_url($_info);
$products[$_info["id"]] = ["name" => _prepare_html($_info["name"]), "price" => module('shop')->_format_price($price), "currency" => _prepare_html(module('shop')->CURRENCY), "quantity" => intval($quantity), "delete_link" => "./?object=shop&action=basket_clean&id=" . $URL_PRODUCT_ID, "details_link" => process_url("./?object=shop&action=product_details&id=" . $URL_PRODUCT_ID), "dynamic_atts" => !empty($dynamic_atts) ? implode("\n<br />", $dynamic_atts) : "", "cat_name" => _prepare_html(module('shop')->_shop_cats[$_info["cat_id"]]), "cat_url" => process_url("./?object=shop&action=products_show&id=" . module('shop')->_shop_cats_all[$_info["cat_id"]]['url'])];
$total_price += $price * $quantity;
}
return tpl()->parse($STPL_NAME, ["form_action" => "./?object=shop&action=" . $_GET["action"], "products" => $products, "total_price" => module('shop')->_format_price($total_price), "currency" => _prepare_html(module('shop')->CURRENCY), "clean_all_link" => "./?object=shop&action=basket_clean", "order_link" => "./?object=shop&action=order", "back_link" => js_redirect($_SERVER["HTTP_REFERER"], false), "cats_block" => module('shop')->_categories_show()]);
}