Pereiti prie turinio

ramasp

Nariai
  • Pranešimai

    1
  • Užsiregistravo

  • Lankėsi

  • Atsiliepimai

    0%

ramasp Pranešimai

  1. Gerbiamieji,

     

    gal galite padėti išsprėsti tą nelaimingą dviejų valiutų problemą woocomerce / wordprese?

     

    Bandžiau dėti kodą į functions.php, bet tik nulūžta puslapis. Gal galite padėti?

     

    greičiausiai functions.php faile atsirado tusciu eiluču prieš <? arba po ?>

     

    Fanatas & darkooo: kokia pas jus versija woocommerce? Galit parasyt i pm prisijungimus, noreciau pasiziureti. Pataisytas dvigubas kainos eurais rodymas.

     

    Jeigu kainas rodo 0.00 Eur - atsinaujinkite WooCommerce, nes Fanatui ir Darkooo būtent dėl to ir kyla nesklandumų.

     

    add_filter('woocommerce_get_price_html','fwoocommerce_get_price_html', 10, 2);
    add_filter('woocommerce_cart_item_price','fwoocommerce_cart_item_price', 10, 3);
    add_filter('woocommerce_cart_item_subtotal','fwoocommerce_cart_item_subtotal', 10, 3);
    add_filter('woocommerce_cart_total', 'fwoocommerce_cart_total', 10, 1);
    add_filter('woocommerce_cart_total_ex_tax', 'fwoocommerce_cart_total_ex_tax', 10, 1);
    add_filter('woocommerce_cart_subtotal', 'fwoocommerce_cart_subtotal', 10, 3);
    add_filter('woocommerce_cart_shipping_method_full_label', 'fwoocommerce_cart_shipping_method_full_label', 10, 2);
    add_filter('woocommerce_cart_totals_coupon_html', 'fwoocommerce_cart_totals_coupon_html', 10, 2);
    add_filter('woocommerce_order_formatted_line_subtotal', 'fwoocommerce_order_formatted_line_subtotal', 10, 3);
    add_filter('woocommerce_get_order_item_totals', 'fwoocommerce_get_order_item_totals', 10, 2);
    add_filter('woocommerce_get_formatted_order_total', 'fwoocommerce_get_formatted_order_total', 10, 2);
    
    function fwoocommerce_get_formatted_order_total($formatted_total, $this) {
    $formatted_total = $formatted_total . " / " . number_format(strip_tags($formatted_total) / 3.4528, 2)." €";
    return $formatted_total;
    }
    
    function fwoocommerce_get_order_item_totals($total_rows, $this) {
    
    foreach ($total_rows as &$row) {
    	if (strpos($row["value"],"€") == false) { 
    		$row["value"] = $row["value"] . " / " . number_format(strip_tags($row["value"]) / 3.4528, 2)." €";
    	} 
    }
    
    return $total_rows;
    }
    
    function fwoocommerce_order_formatted_line_subtotal($subtotal, $item, $this ) {
    $eurPrice = strip_tags($subtotal);
    return $subtotal . " / ". number_format($eurPrice / 3.4528, 2)." €";
    }
    
    function fwoocommerce_cart_totals_coupon_html($value, $coupon) {
    $valuez = explode("</span>", $value);
    
    if (count($valuez) == 2) {
    	$value = $valuez[0] . " / ";
    	$valuez[0] = str_ireplace(" lt", '', $valuez[0]);
    	$value .= number_format(strip_tags($valuez[0]) / 3.4528, 2)." €";
    	$value .= "</span>" . $valuez[1];
    }
    
    return $value;
    }
    
    function fwoocommerce_cart_shipping_method_full_label($label, $method) {
    //	var_dump(htmlspecialchars($label));
    $labelz = explode("<span class=\"amount\">", $label);
    $label = $labelz[0];
    $label .= "<span class=\"amount\">".$labelz[1]."</span>";
    $label .= " / " . number_format($labelz[1] / 3.4528, 2)." €";
    return $label;
    }
    
    
    function fwoocommerce_cart_subtotal($cart_subtotal, $compound, $this) { //ok
    
    $cart_subtotal = strip_tags($cart_subtotal);
    return "<span class=\"amount\">". $cart_subtotal." / ".number_format($cart_subtotal / 3.4528, 2)." €</span>";
    }
    
    function fwoocommerce_cart_item_subtotal($price, $cart_item, $cart_item_key ){
    
    $eurPrice = strip_tags($price);
    
    $eurPrice = str_ireplace(" lt", '', $eurPrice);
    
    return $price." / ". (float)round($eurPrice / 3.4528, 2) ." €";
    }
    
    function fwoocommerce_cart_item_price($price, $cart_item, $cart_item_key ){
    
    $eurPrice = strip_tags($price);
    
    $eurPrice = str_ireplace(" lt", '', $eurPrice);
    
    return $price." / ". (float)round($eurPrice / 3.4528, 2) ." €";
    }
    
    
    function fwoocommerce_cart_total($price){ //ok
    
    $eurPrice = strip_tags($price);
    return $price." / ".number_format($eurPrice / 3.4528, 2)." €";
    }
    
    
    
    function fwoocommerce_cart_total_ex_tax($price){ //ok
    
    $eurPrice = strip_tags($price);
    return $price." / ".number_format($eurPrice / 3.4528, 2)." €";
    }
    
    function fwoocommerce_get_price_html($price, $productId){ //ok
    $product = get_product($productId);
    
    $prices = explode("–", strip_tags($price));
    
    if (count($prices) == 1) {
           	return $price." / ".number_format($product->get_price() / 3.4528, 2)." €";
    } else if (count($prices) == 2) {
    	return $price." / ".number_format($prices[0] / 3.4528, 2)."€-". number_format($prices[1] / 3.4528, 2). "€";
    } else {
    	return $price;
    }
    }

     

    Puikus darbas. Ačiū labai. Tik pastebėjau, kad produktuose su variantais kaina rodo nuo iki, bet kai pasirenki varianta, jau kainos eurais nebeprideda(prisegu paveikslėlį).

    post-98124-0-76515000-1408812153_thumb.png

×
×
  • Pasirinkite naujai kuriamo turinio tipą...