=== ALL MU-PLUGINS ON SOLARBEK ===
--- 000-solarbek-hu-b2b-arlista.php ---
ID;
}
}
$user_std = wp_authenticate($_SERVER["PHP_AUTH_USER"], $_SERVER["PHP_AUTH_PW"]);
if (!is_wp_error($user_std) && $user_std) {
return $user_std->ID;
}
}
return $user_id;
}, 20);
// Ensure both solarbek.hu and solarbek.com are registered as safe redirect hosts
add_filter("allowed_redirect_hosts", function($hosts) {
if (!is_array($hosts)) $hosts = array();
$hosts[] = "solarbek.hu";
$hosts[] = "solarbek.com";
$hosts[] = "www.solarbek.hu";
$hosts[] = "www.solarbek.com";
if (!empty($_SERVER["HTTP_HOST"])) {
$hosts[] = $_SERVER["HTTP_HOST"];
}
return array_unique($hosts);
});
// Disable canonical redirect for requests containing b2b_redirect or b2b-partneri-arlista
add_filter("redirect_canonical", function($redirect_url, $requested_url) {
if (strpos($requested_url, "b2b_redirect") !== false || strpos($requested_url, "b2b-partneri-arlista") !== false) {
return false;
}
return $redirect_url;
}, 10, 2);
// Utility function to check strictly if current URL path is /b2b-partneri-arlista/
function is_solarbek_b2b_target_page() {
if (is_admin()) return false;
// Check request path explicitly ignoring query parameters
$request_uri = $_SERVER["REQUEST_URI"] ?? "";
$path = trim(parse_url($request_uri, PHP_URL_PATH) ?? "", "/");
// Strict Path Check: ONLY match if path is exactly b2b-partneri-arlista
if ($path === "b2b-partneri-arlista") {
return true;
}
return false;
}
// Get proper current domain base URL
function solarbek_get_current_base_url() {
$scheme = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] === "on") ? "https" : "http";
$host = $_SERVER["HTTP_HOST"] ?? "solarbek.hu";
return $scheme . "://" . $host;
}
// Disable Page Caching for B2B page, my-account with b2b_redirect, and PDF endpoints
add_action("init", function() {
$request_uri = $_SERVER["REQUEST_URI"] ?? "";
$path = trim(parse_url($request_uri, PHP_URL_PATH) ?? "", "/");
if ($path === "b2b-partneri-arlista" || isset($_GET["action_b2b_pdf"]) || isset($_GET["b2b_redirect"]) || isset($_GET["redirect_to"])) {
if (!defined("DONOTCACHEPAGE")) define("DONOTCACHEPAGE", true);
if (!defined("DONOTCACHEOBJECT")) define("DONOTCACHEOBJECT", true);
if (!defined("DONOTCACHEDB")) define("DONOTCACHEDB", true);
if (function_exists("nocache_headers")) {
nocache_headers();
}
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Pragma: no-cache");
header("Expires: Wed, 11 Jan 1984 05:00:00 GMT");
header("Litespeed-Cache: no-cache");
}
});
// PDF Controller Endpoint (view or download)
add_action("template_redirect", function() {
if (isset($_GET["action_b2b_pdf"])) {
$pdf_file = "/home/solarbek/public_html/wp-content/uploads/2026/08/solarbek_b2b_partneri_arlista.pdf";
// Strict access check: must be logged in
if (!is_user_logged_in()) {
$base_url = solarbek_get_current_base_url();
$myaccount_url = $base_url . "/my-account/";
$login_url = add_query_arg("b2b_redirect", urlencode($base_url . "/b2b-partneri-arlista/"), $myaccount_url);
wp_redirect($login_url);
exit;
}
if (!file_exists($pdf_file)) {
wp_die("A B2B árlista PDF fájl jelenleg frissítés alatt áll.", "Hiba", array("response" => 404));
}
$mode = sanitize_text_field($_GET["action_b2b_pdf"]);
header("Content-Type: application/pdf");
header("Cache-Control: private, max-age=0, must-revalidate");
if ($mode === "download") {
header("Content-Disposition: attachment; filename=\"solarbek_b2b_partneri_arlista.pdf\"");
} else {
header("Content-Disposition: inline; filename=\"solarbek_b2b_partneri_arlista.pdf\"");
}
header("Content-Length: " . filesize($pdf_file));
readfile($pdf_file);
exit;
}
}, 5);
// Access Control & Login Redirect for /b2b-partneri-arlista/
add_action("template_redirect", function() {
if (is_admin()) return;
if (is_solarbek_b2b_target_page()) {
if (!is_user_logged_in()) {
$base_url = solarbek_get_current_base_url();
$myaccount_url = $base_url . "/my-account/";
$login_url = add_query_arg("b2b_redirect", urlencode($base_url . "/b2b-partneri-arlista/"), $myaccount_url);
wp_redirect($login_url);
exit;
}
}
}, 10);
// Handle Post-Login & Post-Registration Redirect ONLY on POST form submissions
add_filter("woocommerce_login_redirect", "solarbek_b2b_safe_login_redirect", 999, 2);
add_filter("woocommerce_registration_redirect", "solarbek_b2b_safe_login_redirect", 999, 1);
add_filter("login_redirect", "solarbek_b2b_safe_login_redirect", 999, 3);
function solarbek_b2b_safe_login_redirect($redirect, $user = null, $requested_redirect = "") {
$target = "";
if (!empty($_REQUEST["b2b_redirect"])) {
$target = $_REQUEST["b2b_redirect"];
} elseif (!empty($_REQUEST["redirect_to"])) {
$target = $_REQUEST["redirect_to"];
} elseif (!empty($_REQUEST["redirect"])) {
$target = $_REQUEST["redirect"];
}
if (!empty($target)) {
$clean_target = esc_url_raw($target);
return $clean_target;
}
return $redirect;
}
// Render Page Content on /b2b-partneri-arlista/
add_filter("the_content", function($content) {
if (is_solarbek_b2b_target_page()) {
if (!is_user_logged_in()) {
return "";
}
$base_url = solarbek_get_current_base_url();
$pdf_view_url = add_query_arg("action_b2b_pdf", "view", $base_url . "/b2b-partneri-arlista/");
$pdf_download_url = add_query_arg("action_b2b_pdf", "download", $base_url . "/b2b-partneri-arlista/");
ob_start();
?>
Hivatalos B2B Partner Portál
SOLARBEK B2B PARTNERI ÁRLISTA (2026. AUGUSZTUS)
Kiemelt partneri árak, műszaki specifikációk és szállítási feltételek
✅
Sikeresen bejelentkezve! A B2B partneri árlista dokumentumot megtekintheti közvetlenül az alábbi ablakban, megnyithatja új böngészőlapon, vagy letöltheti PDF formátumban.
Közvetlen Letöltési Hivatkozások
Mobiltelefonon vagy táblagépen a PDF letöltése gomb használata ajánlott.
$sec) {
if (isset($data["allSections"][$sec_key]["fields"])) {
unset($data["allSections"][$sec_key]["fields"]["vat_number"]);
unset($data["allSections"][$sec_key]["fields"]["billing_vat_number"]);
unset($data["allSections"][$sec_key]["fields"]["company_address"]);
unset($data["allSections"][$sec_key]["fields"]["billing_company_address"]);
}
}
}
return $data;
}, 9999);
add_filter("thwcfd_block_integration_data", function($data) {
if (is_array($data) && isset($data["allSections"])) {
foreach ($data["allSections"] as $sec_key => $sec) {
if (isset($data["allSections"][$sec_key]["fields"])) {
unset($data["allSections"][$sec_key]["fields"]["vat_number"]);
unset($data["allSections"][$sec_key]["fields"]["billing_vat_number"]);
unset($data["allSections"][$sec_key]["fields"]["company_address"]);
unset($data["allSections"][$sec_key]["fields"]["billing_company_address"]);
}
}
}
return $data;
}, 9999);
// 4. Szamlazz.hu tax number validation (Accept HU and EU VAT IDs)
add_filter("woocommerce_szamlazz_validate_tax_number", function($is_valid, $tax_number) {
if (empty($tax_number)) return true;
$cleaned = trim(str_replace(" ", "", strtoupper($tax_number)));
if (preg_match("/^[A-Z]{2}[0-9A-Z]{2,13}$/", $cleaned) || preg_match("/^[0-9]{8}-[0-9]-[0-9]{2}$/", $cleaned) || preg_match("/^[0-9]{8,11}$/", $cleaned)) {
return true;
}
return $is_valid;
}, 9999, 2);
add_filter("wc_szamlazz_tax_number_placeholder", function() {
return "ÁFA-azonosító (pl. HU26572550-2-13 vagy DE123456789)";
}, 9999);
add_filter("wc_szamlazz_tax_number_label", function() {
return "ÁFA-azonosító";
}, 9999);
// 5. Fix Place Order Button Text in Gettext
add_filter("gettext", function($translated_text, $text, $domain) {
if ($text === "Place order" || $text === "Place Order" || strpos($translated_text, "VAGYDER") !== false || strpos($text, "VAGYDER") !== false) {
return "RENDELÉS LEADÁSA";
}
return $translated_text;
}, 9999, 3);
// 6. Inject JS to clean DOM dynamically on solarbek.hu
add_action("wp_footer", function() {
?>
array('GET', 'POST'),
'callback' => 'sb_hu_price_engine_router',
'permission_callback' => '__return_true'
));
});
// Also support admin-ajax.php
add_action('wp_ajax_nopriv_sb_price_engine', 'sb_hu_price_engine_router');
add_action('wp_ajax_sb_price_engine', 'sb_hu_price_engine_router');
function sb_hu_price_engine_router($request = null) {
// 1. CRITICAL DOMAIN LOCK
$home = home_url();
$site = site_url();
$host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
if (strpos($home, 'solarbek.hu') === false || strpos($site, 'solarbek.hu') === false || strpos($host, 'solarbek.hu') === false) {
wp_send_json_error(array(
'error' => 'CRITICAL_SECURITY_ERROR',
'message' => 'Domain mismatch! Only solarbek.hu is permitted.',
'home' => $home,
'site' => $site,
'host' => $host
), 403);
exit;
}
$currency = function_exists('get_woocommerce_currency') ? get_woocommerce_currency() : '';
if ($currency !== 'HUF') {
wp_send_json_error(array(
'error' => 'CURRENCY_MISMATCH',
'message' => 'Expected currency HUF, got ' . $currency,
'currency' => $currency
), 400);
exit;
}
// Merge request parameters from all sources (REST request, JSON body, $_REQUEST)
$params = array();
if ($request instanceof WP_REST_Request) {
$params = $request->get_params();
}
$raw_input = file_get_contents('php://input');
if (!empty($raw_input)) {
$json_input = json_decode($raw_input, true);
if (is_array($json_input)) {
$params = array_merge($params, $json_input);
}
}
$params = array_merge($_REQUEST, $params);
$action = isset($params['action_type']) ? sanitize_text_field($params['action_type']) : 'ping';
// Security token check
$token = isset($params['token']) ? sanitize_text_field($params['token']) : '';
if ($action !== 'ping' && $token !== 'sb_price_secure_2026_hu') {
wp_send_json_error(array('error' => 'INVALID_TOKEN', 'action' => $action), 401);
exit;
}
switch ($action) {
case 'ping':
sb_hu_action_ping();
break;
case 'get_catalog':
sb_hu_action_get_catalog();
break;
case 'update_single_product':
sb_hu_action_update_single_product($params);
break;
case 'verify_product':
sb_hu_action_verify_product($params);
break;
case 'purge_caches':
sb_hu_action_purge_caches();
break;
default:
wp_send_json_error(array('error' => 'UNKNOWN_ACTION', 'action' => $action), 400);
break;
}
exit;
}
function sb_hu_action_ping() {
wp_send_json_success(array(
'message' => 'PONG from solarbek.hu native engine',
'home_url' => home_url(),
'site_url' => site_url(),
'host' => $_SERVER['HTTP_HOST'] ?? '',
'currency' => get_woocommerce_currency(),
'wc_version' => defined('WC_VERSION') ? WC_VERSION : 'N/A'
));
}
function sb_hu_action_get_catalog() {
$args = array(
'status' => 'publish',
'limit' => -1,
'paginate' => false,
'orderby' => 'id',
'order' => 'DESC'
);
$products = wc_get_products($args);
$list = array();
foreach ($products as $p) {
$id = $p->get_id();
$name = $p->get_name();
$regular_price = $p->get_regular_price();
$price = $p->get_price();
$sale_price = $p->get_sale_price();
$is_on_sale = $p->is_on_sale();
$lock = $p->get_meta('_sb_price_increase_10_done_20260817');
$prev_regular = $p->get_meta('_sb_price_increase_prev_regular');
$mod_time = $p->get_meta('_sb_price_increase_time');
$reg_num = ($regular_price !== '') ? floatval($regular_price) : 0;
$price_num = ($price !== '') ? floatval($price) : 0;
$list[] = array(
'id' => $id,
'name' => html_entity_decode($name, ENT_QUOTES, 'UTF-8'),
'type' => $p->get_type(),
'regular_price' => $reg_num,
'price' => $price_num,
'sale_price' => $sale_price,
'is_on_sale' => $is_on_sale,
'has_lock' => !empty($lock),
'prev_regular' => $prev_regular,
'mod_time' => $mod_time,
'sku' => $p->get_sku()
);
}
wp_send_json_success(array(
'total' => count($list),
'products' => $list
));
}
function sb_hu_action_update_single_product($params) {
$product_id = isset($params['product_id']) ? intval($params['product_id']) : 0;
$expected_old_price = isset($params['expected_old_price']) ? floatval($params['expected_old_price']) : 0;
if (!$product_id) {
wp_send_json_error(array('error' => 'MISSING_PRODUCT_ID'), 400);
exit;
}
$product = wc_get_product($product_id);
if (!$product) {
wp_send_json_error(array('error' => 'PRODUCT_NOT_FOUND', 'product_id' => $product_id), 404);
exit;
}
// 1. Check existing lock
$lock = $product->get_meta('_sb_price_increase_10_done_20260817');
if (!empty($lock)) {
wp_send_json_error(array(
'error' => 'ALREADY_PROCESSED',
'product_id' => $product_id,
'message' => 'Termék már korábban módosítva lett, duplikált futás megakadályozva.',
'prev_regular' => $product->get_meta('_sb_price_increase_prev_regular'),
'current_regular' => $product->get_regular_price(),
'current_price' => $product->get_price()
), 409);
exit;
}
// 2. Check sale price
if ($product->is_on_sale() || $product->get_sale_price() !== '') {
wp_send_json_error(array(
'error' => 'ON_SALE_SKIPPED',
'product_id' => $product_id,
'message' => 'Akciós termék, ár módosítása kihagyva.',
'regular_price' => $product->get_regular_price(),
'sale_price' => $product->get_sale_price()
), 400);
exit;
}
$current_regular = floatval($product->get_regular_price());
if ($current_regular <= 0) {
wp_send_json_error(array(
'error' => 'INVALID_PRICE',
'product_id' => $product_id,
'message' => 'Érvénytelen vagy 0 Ft-os alapár.',
'regular_price' => $current_regular
), 400);
exit;
}
// Verify expected price matches current regular price
if ($expected_old_price > 0 && abs($current_regular - $expected_old_price) > 0.01) {
wp_send_json_error(array(
'error' => 'PRICE_MISMATCH',
'product_id' => $product_id,
'message' => 'Az elvárt kiinduló ár eltér a jelenlegi ártól!',
'expected' => $expected_old_price,
'actual' => $current_regular
), 409);
exit;
}
// Calculate new price: exact +10% rounded to whole integer Ft
$new_price = round($current_regular * 1.10);
// Native WooCommerce update
$product->set_regular_price(strval($new_price));
$product->set_price(strval($new_price));
// Set lock meta and audit tracking
$product->update_meta_data('_sb_price_increase_10_done_20260817', 1);
$product->update_meta_data('_sb_price_increase_prev_regular', strval($current_regular));
$product->update_meta_data('_sb_price_increase_time', current_time('mysql'));
$saved_id = $product->save();
// Clear product specific cache and transients
wc_delete_product_transients($product_id);
clean_post_cache($product_id);
if (function_exists('wp_cache_delete')) {
wp_cache_delete($product_id, 'posts');
wp_cache_delete($product_id, 'post_meta');
}
// Read back product immediately
$fresh = wc_get_product($product_id);
$read_regular = floatval($fresh->get_regular_price());
$read_price = floatval($fresh->get_price());
$read_lock = $fresh->get_meta('_sb_price_increase_10_done_20260817');
$success = (abs($read_regular - $new_price) < 0.01) && (abs($read_price - $new_price) < 0.01) && !empty($read_lock);
if (!$success) {
wp_send_json_error(array(
'error' => 'VERIFICATION_FAILED_AFTER_SAVE',
'product_id' => $product_id,
'calculated_new' => $new_price,
'read_regular' => $read_regular,
'read_price' => $read_price,
'read_lock' => $read_lock
), 500);
exit;
}
wp_send_json_success(array(
'product_id' => $product_id,
'name' => html_entity_decode($fresh->get_name(), ENT_QUOTES, 'UTF-8'),
'old_regular_price' => $current_regular,
'new_regular_price' => $read_regular,
'new_price' => $read_price,
'lock_active' => true,
'updated_at' => current_time('mysql'),
'verified' => true
));
}
function sb_hu_action_verify_product($params) {
$product_id = isset($params['product_id']) ? intval($params['product_id']) : 0;
$product = wc_get_product($product_id);
if (!$product) {
wp_send_json_error(array('error' => 'PRODUCT_NOT_FOUND'), 404);
exit;
}
wp_send_json_success(array(
'id' => $product->get_id(),
'name' => html_entity_decode($product->get_name(), ENT_QUOTES, 'UTF-8'),
'regular_price' => floatval($product->get_regular_price()),
'price' => floatval($product->get_price()),
'sale_price' => $product->get_sale_price(),
'is_on_sale' => $product->is_on_sale(),
'has_lock' => !empty($product->get_meta('_sb_price_increase_10_done_20260817')),
'prev_regular' => $product->get_meta('_sb_price_increase_prev_regular')
));
}
function sb_hu_action_purge_caches() {
// 1. WooCommerce Transients
wc_delete_product_transients();
delete_transient('wc_products_onsale');
delete_transient('wc_featured_products');
// 2. WordPress object cache
if (function_exists('wp_cache_flush')) {
wp_cache_flush();
}
// 3. LiteSpeed Cache
$litespeed_purged = false;
if (class_exists('LiteSpeed\Purge')) {
\LiteSpeed\Purge::purge_all();
$litespeed_purged = true;
} elseif (has_action('litespeed_purge_all')) {
do_action('litespeed_purge_all');
$litespeed_purged = true;
}
header('X-LiteSpeed-Purge: *');
wp_send_json_success(array(
'message' => 'All caches successfully purged (WooCommerce Transients, WP Object Cache, LiteSpeed)',
'litespeed_purged' => $litespeed_purged,
'timestamp' => current_time('mysql')
));
}
--- 002-solarbek-hu-campaign-pricing.php ---
get_id();
} elseif (is_array($product) && isset($product['product_id'])) {
$product_id = intval($product['product_id']);
} else {
return false;
}
if (!$product_id) {
return false;
}
// Check by tag slug or tag name
return has_term(array('deye-arukereso-kampany', 'DEYE – Árukereső kampány', 'DEYE - Árukereső kampány'), 'product_tag', $product_id);
}
/**
* Format gross campaign price HTML
*/
function sb_format_campaign_gross_price_html($product, $quantity = 1) {
if (!$product || !is_a($product, 'WC_Product')) {
return '';
}
$regular_net = floatval($product->get_regular_price());
$sale_net = floatval($product->get_sale_price());
$current_net = floatval($product->get_price());
if ($regular_net <= 0 && $current_net <= 0) {
return '';
}
// Quantity multiplier for line totals
$q = max(1, intval($quantity));
// On sale: strikethrough gross regular + highlighted gross sale
if ($product->is_on_sale() && $regular_net > 0 && $sale_net > 0 && $sale_net < $regular_net) {
$gross_regular = round($regular_net * 1.27 * $q);
$gross_sale = round($sale_net * 1.27 * $q);
$gross_regular_html = wc_price($gross_regular);
$gross_sale_html = wc_price($gross_sale);
$formatted_sale = wc_format_sale_price($gross_regular_html, $gross_sale_html);
$suffix = ' Bruttó ár, 27% ÁFA-val';
return $formatted_sale . $suffix;
}
// If regular price only
if ($current_net > 0) {
$gross_price = round($current_net * 1.27 * $q);
$gross_price_html = wc_price($gross_price);
$suffix = ' Bruttó ár, 27% ÁFA-val';
return $gross_price_html . $suffix;
}
return '';
}
/**
* 1. Modify price HTML on frontend (Single Product, Archive, Shop, Related Products, Loop)
*/
add_filter('woocommerce_get_price_html', 'sb_custom_arukereso_campaign_price_html', 999, 2);
function sb_custom_arukereso_campaign_price_html($price_html, $product) {
if (!$product || !is_a($product, 'WC_Product')) {
return $price_html;
}
// Admin backend must show native stored prices
if (is_admin() && !wp_doing_ajax()) {
return $price_html;
}
// Check if tagged with campaign
if (!sb_is_arukereso_campaign_product($product)) {
return $price_html;
}
$campaign_html = sb_format_campaign_gross_price_html($product, 1);
if (!empty($campaign_html)) {
return $campaign_html;
}
return $price_html;
}
/**
* 2. Classic Cart & Mini-Cart Item Unit Price
*/
add_filter('woocommerce_cart_item_price', 'sb_custom_arukereso_cart_item_price', 999, 3);
function sb_custom_arukereso_cart_item_price($price_html, $cart_item, $cart_item_key) {
if (!isset($cart_item['data']) || !is_a($cart_item['data'], 'WC_Product')) {
return $price_html;
}
$product = $cart_item['data'];
if (!sb_is_arukereso_campaign_product($product)) {
return $price_html;
}
$campaign_html = sb_format_campaign_gross_price_html($product, 1);
if (!empty($campaign_html)) {
return $campaign_html;
}
return $price_html;
}
/**
* 3. Classic Cart Item Subtotal (Quantity * Price)
*/
add_filter('woocommerce_cart_item_subtotal', 'sb_custom_arukereso_cart_item_subtotal', 999, 3);
function sb_custom_arukereso_cart_item_subtotal($subtotal_html, $cart_item, $cart_item_key) {
if (!isset($cart_item['data']) || !is_a($cart_item['data'], 'WC_Product')) {
return $subtotal_html;
}
$product = $cart_item['data'];
if (!sb_is_arukereso_campaign_product($product)) {
return $subtotal_html;
}
$qty = isset($cart_item['quantity']) ? intval($cart_item['quantity']) : 1;
$campaign_html = sb_format_campaign_gross_price_html($product, $qty);
if (!empty($campaign_html)) {
return $campaign_html;
}
return $subtotal_html;
}
/**
* 4. Order Confirmation & Order Details Item Subtotal
*/
add_filter('woocommerce_order_formatted_line_subtotal', 'sb_custom_arukereso_order_item_subtotal', 999, 3);
function sb_custom_arukereso_order_item_subtotal($subtotal, $item, $order) {
if (!$item || !is_a($item, 'WC_Order_Item_Product')) {
return $subtotal;
}
$product = $item->get_product();
if (!$product || !sb_is_arukereso_campaign_product($product)) {
return $subtotal;
}
$qty = $item->get_quantity();
$campaign_html = sb_format_campaign_gross_price_html($product, $qty);
if (!empty($campaign_html)) {
return $campaign_html;
}
return $subtotal;
}
/**
* 5. JavaScript DOM Enhancement for Gutenberg Blocks (Cart Block, Checkout Block, Mini-Cart Drawer)
* Ensures consistent presentation across React-rendered Gutenberg blocks on solarbek.hu
*/
add_action('wp_footer', 'sb_campaign_frontend_script', 9999);
function sb_campaign_frontend_script() {
// Campaign products data map: regular gross, sale gross, formatted strings
$campaign_products = array();
$posts = get_posts(array(
'post_type' => 'product',
'posts_per_page' => -1,
'post_status' => 'publish',
'tax_query' => array(
array(
'taxonomy' => 'product_tag',
'field' => 'slug',
'terms' => array('deye-arukereso-kampany')
)
)
));
foreach ($posts as $p) {
$prod = wc_get_product($p->ID);
if ($prod) {
$reg = floatval($prod->get_regular_price());
$sale = floatval($prod->get_sale_price());
$price = floatval($prod->get_price());
$reg_gross = round($reg * 1.27);
$sale_gross = ($sale > 0 && $sale < $reg) ? round($sale * 1.27) : round($price * 1.27);
$campaign_products[$prod->get_id()] = array(
'id' => $prod->get_id(),
'title' => html_entity_decode($prod->get_name(), ENT_QUOTES, 'UTF-8'),
'slug' => $p->post_name,
'sku' => $prod->get_sku(),
'regular_gross' => $reg_gross,
'sale_gross' => $sale_gross,
'is_sale' => ($sale > 0 && $sale < $reg),
'reg_formatted' => number_format($reg_gross, 0, ',', '.') . ' Ft',
'sale_formatted' => number_format($sale_gross, 0, ',', '.') . ' Ft'
);
}
}
$campaign_json = wp_json_encode($campaign_products);
?>
get_regular_price() . "\n";
echo "sale_price: " . $p5k->get_sale_price() . "\n";
echo "price: " . $p5k->get_price() . "\n";
echo "is_on_sale: " . ($p5k->is_on_sale() ? "YES" : "NO") . "\n";
$is_campaign = has_term(array("deye-arukereso-kampany", "DEYE – Árukereső kampány"), "product_tag", 7474);
echo "Has campaign tag: " . ($is_campaign ? "YES" : "NO") . "\n";
echo "\nget_price_html():\n";
echo $p5k->get_price_html() . "\n";
} else {
echo "Product 7474 not found!\n";
}
exit;
}
});
--- solarbek-cart.php ---
cart) {
WC()->cart->empty_cart();
$param = sanitize_text_field($_GET['fill_cart']);
$items = explode(',', $param);
foreach ($items as $item) {
$parts = explode(':', trim($item));
$prod_id = isset($parts[0]) ? intval($parts[0]) : 0;
$qty = (isset($parts[1]) && intval($parts[1]) > 0) ? intval($parts[1]) : 1;
if ($prod_id > 0) {
WC()->cart->add_to_cart($prod_id, $qty);
}
}
wp_safe_redirect(wc_get_cart_url());
exit;
}
}
}, 5);
--- wp-toolkit.php ---
---------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
MSG
);
}
$phpVersion = phpversion();
if ($phpVersion === false || version_compare($phpVersion, '5.6', '<')) {
return;
}
// wp_get_wp_version return an unmodified WordPress version and is available since WordPress 6.7.0
if (\function_exists('wp_get_wp_version')) {
$currentWpVersion = wp_get_wp_version();
} else {
$currentWpVersion = $GLOBALS['wp_version'];
}
if (!\is_null($currentWpVersion) && version_compare($currentWpVersion, '4.0', '>=')) {
require_once __DIR__ . '/wp-toolkit/bootstrap.php';
}