Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • rgbear

    (@rgbear)

    It’s strange because in the preview “mysite.it/?trp-edit-translation=preview” everything works, while in the clean url it brokes the links.

    The problem may be linked with the plugin “ultimate-addons-for-gutenberg”

    • This reply was modified 5 years ago by rgbear.
    rgbear

    (@rgbear)

    Same problem here. After the latest updates of the plugin, I can’t see any image in the translated pages.

    Looks like the plugin doesn’t insert the src attribute in the images. I tried also to relink the images through the translation menù, but the value goes nowhere.

    • This reply was modified 5 years ago by rgbear.
    Thread Starter rgbear

    (@rgbear)

    Hi @luminus , everything seems to work. Thank you for the reply. I set “Mark as resolved”

    Thread Starter rgbear

    (@rgbear)

    I understand, I already tried, but I didn’t get an answer about this problem.
    I’ve created a temporary fix with the following code, maybe it helps someone. Thanks for your answer!

    add_action( 'woocommerce_after_shop_loop_item_title', 'sm_display_product_color_options', 9 );
    function sm_display_product_color_options(){
    
    global $product;
    $variations1=$product->get_children();
        if ( $product->has_attributes() && $variations1[0]!=0 ) {
    		echo '<p style="line-height: 1.2em;">( ';
            /*foreach ($variations1 as $value) {
    		$single_variation=new WC_Product_Variation($value);
    		$comma_separated = implode(",", $single_variation->get_variation_attributes());
                echo '<option  value="'.$value.'">'.implode(" / ", $single_variation->get_variation_attributes()).'-'.get_woocommerce_currency_symbol().$single_variation->price.'</option>';
    			echo ucfirst($comma_separated).', ';
    		}*/
    
    		
            $attributes = ( object ) array (
            'color'              => $product->get_attribute( 'pa_color' ),
            );
    
    	foreach ($attributes as $attribute) {
    		echo $attribute;
    	}
    
    	echo ' )</p>';
    	} 
    }
    Thread Starter rgbear

    (@rgbear)

    Even with a simpler formula, I don’t get any change in variable prices:

    
    function adjust_lifetime_discount_price( $price ) {
    	return $price * 2;
    }
    add_filter('woocommerce_product_get_regular_price', 'adjust_lifetime_discount_price' );
    add_filter('woocommerce_product_variation_get_regular_price', 'adjust_lifetime_discount_price' );
    add_filter('woocommerce_product_variation_get_price', 'adjust_lifetime_discount_price' );
    add_filter( 'woocommerce_get_price', 'adjust_lifetime_discount_price' );
    
    
    Thread Starter rgbear

    (@rgbear)

    I see, thank you for the answer

    Thread Starter rgbear

    (@rgbear)

    Ok I removed the conflicting filter, now works better.

    add_action( 'woocommerce_before_calculate_totals', 'add_custom_price', 20, 1);
    
    //if ( is_page( 'cart' ) || is_cart() || is_checkout() || is_page( 'checkout' ) ) {
    	remove_filter( 'woocommerce_product_get_price', 'product_custom_price', 10, 2 );
    	remove_filter( 'woocommerce_product_variation_get_price', 'product_custom_price', 10, 2 );
    	remove_filter( 'woocommerce_product_get_sale_price', 'product_custom_price', 10, 2 );
    //}
    
    	function add_custom_price( $cart_obj ) {
    
    			// This is necessary for WC 3.0+
    			if ( is_admin() && ! defined( 'DOING_AJAX' ) )
    				return;
    
    			// Avoiding hook repetition (when using price calculations for example)
    			if ( did_action( 'woocommerce_before_calculate_totals' ) >= 2 )
    				return;
    				global $woocommerce;
    				$ssivata = 7.93;
    				$ivaitaperprezzofabbrica = 122/100;
    				$arrotondamento = 4/10;
    				$my_current_lang = apply_filters( 'wpml_current_language', NULL );
    				$selected_country = $woocommerce->customer->get_shipping_country();
    
    				if( $my_current_lang =='it' || $selected_country =='IT' ) {
    				// Loop through cart items
    				foreach ( $cart_obj->get_cart() as $cart_item ) {
    					$cart_item['data']->set_price( 40 );
    					}
    				}
    				if( $my_current_lang =='at' || $selected_country =='AT' ) {
    					foreach ( $cart_obj->get_cart() as $cart_item ) {
    						$cart_item['data']->set_price( 4067414 );
    					}
    				}
    	}
    Thread Starter rgbear

    (@rgbear)

    FIXED seems to work fine. Global variables broke the cart.

    function product_custom_price($price, $product) {
    	$custom_price = $product->get_regular_price();
    	$ssivata = 7.93;
    	$tax = 122/100;
    	$shipping = 6.5;
    	//calcola prezzo di fabbrica
    	$custom_price = $custom_price - $ssivata;
    	$custom_price = $custom_price / $tax;
    	//calcolo del prezzo
    	$custom_price = $custom_price + $shipping;
    	$custom_price = $custom_price * $tax;
        return $custom_price;
    }
    add_filter('woocommerce_product_get_price', 'product_custom_price', 10, 2);
    add_filter( 'woocommerce_product_variation_get_price', 'product_custom_price', 10, 2 );
    add_filter( 'woocommerce_product_get_sale_price', 'product_custom_price', 10, 2 );
    
    • This reply was modified 7 years, 3 months ago by rgbear.
    Thread Starter rgbear

    (@rgbear)

    Ok thank you Steven and sorry for the bad english, I really wrote badly XD.

    Topic moved here:
    NEW DISCUSSION

    Thread Starter rgbear

    (@rgbear)

    I found a great solution!

    1 – Create a product on Worpress (title is enough) and trash it.
    2 – Open the product from the trash and copy its url
    EX: “https://www.mysite.net/wp-admin/post.php?post=9249&action=edit&lang=en
    3 – Go to PHPMYADMIN
    4 – Search through the tables specifing “post_type=product” and “post_status=trash”
    5 – Copy the ID of the products listed and put them one by one in the url of the previously trashed product. In the EX the post ID was 9249, change it with the ID of the results on PHPMYADMIN.
    6 – Use the url in your browser, open them. A page will ask you to restore or delete permanently the product.
    7 (EXTRA) – If you need to restore the product do it. Since it will still be invisible inside wordpress, open a post and copy the url of the “modify” page. Here change the url inserting again the ID of the restored post. Now you should be able to modify the invisible post.

Viewing 10 replies - 1 through 10 (of 10 total)