Forum Replies Created

Viewing 15 replies - 1 through 15 (of 20 total)
  • Thread Starter admt2018

    (@admt2018)

    Hi, thanks for response.
    I’ll send both in private.
    Thank you

    Thread Starter admt2018

    (@admt2018)

    Hi, David, thankyou for quick response.
    Yes, you’re right! That’s what I meant.
    Do you think that is possible to apply the hook?
    I need to create a directory where i can put my cart pdf.
    May you help me?
    Thank you

    Thread Starter admt2018

    (@admt2018)

    Thank you

    Thread Starter admt2018

    (@admt2018)

    Now I need to remove button form proceed to checkout div

    Thread Starter admt2018

    (@admt2018)

    My case is a bit unusual, in that I put a form on the cart page to print some text fields. So I manage the button directly in the form on the cart page. I realized that it is enough for me to insert the blank target in the form to solve my problem. Thanks so much for your assistance

    Thread Starter admt2018

    (@admt2018)

    Hi,
    no changes.
    The file is opening in same window.

    Thread Starter admt2018

    (@admt2018)

    This is my child theme function.php with your code posted at the bottom of the page

    <?php
    /**
     * TemplateMela
     * @copyright  Copyright (c) TemplateMela. (https://www.templatemela.com)
     * @license    https://www.templatemela.com/license/
     * @author         TemplateMela
     * @version        Release: 1.0
     */
    /**  Set Default options : Theme Settings  */
    
    function tm_set_default_options_child()
    { 
    	add_option("tm_logo_image", get_stylesheet_directory_uri()."/images/megnor/logo.png"); // set logo image	
    	add_option("tm_mob_logo_image", get_stylesheet_directory_uri()."/images/megnor/mob-logo.png"); // set logo image
    	add_option("tm_revslider_alias","tm_homeslider_fashiro_tools"); // Revolution Slider Alias	
    	add_option("tm_top_nav_bg_color","000000"); // Top menu background color
    	add_option("tm_top_nav_bar_opacity","1"); // Top menu background opacity
    	add_option("tm_top_menu_text_color","FFFFFF"); // Top menu text color
    	add_option("tm_top_menu_texthover_color","FFC301"); // Top menu text hover color
    	/* Header CMS Service Block  */
    	add_option("tm_service_block","yes"); // Show Custom Banner
    	add_option("tm_custom_title1","Free World Delivery"); // Custom title 1
    	add_option("tm_custom_desc1","Orders Over $100"); // Custom Description 1
    	add_option("tm_custom_title2","Money Back Guarantee"); // Custom title 2	
    	add_option("tm_custom_desc2","with a 30 day"); // Custom Description 2
    	add_option("tm_custom_title3","Best Online support"); // Custom title 3
    	add_option("tm_custom_desc3","Hours: 8AM -11PM"); // Custom Description 3
    
    	add_option("tm_footer_top_bkg_color","000000"); // footer background color
    	add_option("tm_footer_bottom_bkg_color","000000"); // footer background color
    	add_option("tm_footerlink_color","B2B2B2"); // footer link text color	
    }	
    add_action('init', 'tm_set_default_options_child');
    function tm_child_scripts() {
        wp_enqueue_style( 'tm-child-style', get_template_directory_uri(). '/style.css' );	
    }
    add_action( 'wp_enqueue_scripts', 'tm_child_scripts' );
    function tm_load_scripts_child() {		
    	wp_enqueue_script( 'tm_custom', get_stylesheet_directory_uri() . '/js/megnor/custom.js', array(), '', true);				 	
     }
    add_action( 'wp_enqueue_scripts', 'tm_load_scripts_child' );
    
    if ( ! function_exists( 'tm_get_topbar_banner' ) ) :
    function tm_get_topbar_banner() {	
    	$tm_custom_title1 = get_option('tm_custom_title1');
    	$tm_custom_title2 = get_option('tm_custom_title2');
    	$tm_custom_title3 = get_option('tm_custom_title3');
    	$tm_custom_desc1 = get_option('tm_custom_desc1');
    	$tm_custom_desc2 = get_option('tm_custom_desc2');
    	$tm_custom_desc3 = get_option('tm_custom_desc3');
    	$output = '';
    	$output .= '<div class="service-cms">';		
    		if (!empty($tm_custom_title1)):
    			$output .= '<div class="service-list service-1"><div class="service-content"><span class="icon-image"></span><div class="content"><div class="service-title">'.$tm_custom_title1.'</div><div class="service_other_text">'.$tm_custom_desc1.'</div></div></div></div>';	
    		endif;
    		if (!empty($tm_custom_title2)):
    			$output .= '<div class="service-list service-2"><div class="service-content"><span class="icon-image"></span><div class="content"><div class="service-title">'.$tm_custom_title2.'</div><div class="service_other_text">'.$tm_custom_desc2.'</div></div></div></div>';	
    		endif;
    		if (!empty($tm_custom_title3)):
    			$output .= '<div class="service-list service-3"><div class="service-content"><span class="icon-image"></span><div class="content"><div class="service-title">'.$tm_custom_title3.'</div><div class="service_other_text">'.$tm_custom_desc3.'</div></div></div></div>';				
    		endif;
    		$output .= '</div>';				
    					
    	echo balanceTags($output);
    }
    endif;
    
    function woocommerce_header_add_to_cart_fragment_child( $fragments ) {
    	global $woocommerce;	
    	ob_start();	
    	?>
    						<a class="cart-contents" href="<?php echo esc_url($woocommerce->cart->get_cart_url()); ?>" title="<?php esc_html_e('View your shopping cart', 'fashiro'); ?>"><span class="label"><?php esc_html_e('Shopping Cart', 'fashiro'); ?></span><span><?php echo sprintf(_n('(%d) item', '(%d) items', $woocommerce->cart->cart_contents_count, 'fashiro'), $woocommerce->cart->cart_contents_count);?></span></a>
    <?php	
    	$fragments['a.cart-contents'] = ob_get_clean();	
    	return $fragments;	
    }
    add_filter('add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment_child',20);
    
    // MODIFICHE FUNCTION
    add_action( 'woocommerce_after_shop_loop_item_title', 'w_box_name', 3 );
    function w_box_name () {
        global $post;
        $terms = get_the_terms( $post->ID, 'box' );
        foreach ( $terms as $term ){
          echo '<div class="box">Box: ' . $term->name . '</div>';
        }
    
    }
    
    add_action( 'woocommerce_after_shop_loop_item_title', 'w_label_name', 1 );
    function w_label_name () {
        global $post;
        $terms = get_the_terms( $post->ID, 'alias_display' );
        foreach ( $terms as $term ){
          echo '<div class="price-sku">COD: ' . $term->name . '</div>';
        }
    
    }
    
    add_action( 'woocommerce_after_shop_loop_item_title', 'w_barcode_name', 2 );
    function w_cfornitore_name () {
        global $post;
        $terms = get_the_terms( $post->ID, 'codice_fornitore' );
        foreach ( $terms as $term ){
          echo '<div class="aliastile">Cod. fornitore: ' . $term->name . '</div>';
        }
    
    }
    
    add_action( 'woocommerce_after_shop_loop_item_title', 'w_cfornitore_name', 1 );
    
    add_action( 'woocommerce_product_meta_end', 'action_product_meta_end' );
    function action_product_meta_end() {
        global $product;
    
        $term_ids = wp_get_post_terms( $product->get_id(), 'codice_fornitore', array('fields' => 'ids') );
    
        echo get_the_term_list( $product->get_id(), 'codice_fornitore', '<span class="aliasschedainternaprd">' . _n( 'Codice fornitore:', 'Codice fornitore:', count( $term_ids ), 'woocommerce' ) . ' ', ', ', '</span>' );
    }
    
    add_filter( 'woocommerce_cart_item_name', 'showing_sku_in_cart_items', 99, 3 );
    function showing_sku_in_cart_items( $item_name, $cart_item, $cart_item_key  ) {
        // The WC_Product object
        $product = $cart_item['data'];
        // Get the  SKU
        $sku = $product->get_sku();
    
        // When sku doesn't exist
        if(empty($sku)) return $item_name;
    
        // Add the sku
        $item_name .= '<br><span class="aliastile2">' . __( "COD: ", "woocommerce") . $sku . '</span>';
    
        return $item_name;
    }    
    
    function wc_cart_pdf_button() {
    	if ( ! is_cart() || WC()->cart->is_empty() ) {
    		return;
    	}
    
    	?>
    
    	<a href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'cart-pdf' => '1' ), wc_get_cart_url() ), 'cart-pdf' ) ); ?>" class="cart-pdf-button button" target="_blank">
    		<?php esc_html_e( get_option( 'wc_cart_pdf_button_label', __( 'Download Cart as PDF', 'wc-cart-pdf' ) ) ); ?>
    	</a>
    
    	<?php
    }
    add_action( 'woocommerce_proceed_to_checkout', 'wc_cart_pdf_button', 21 );
    
    add_filter( 'woocommerce_cart_item_name', 'showing_alias_in_cart_items', 99, 3 );
    function showing_alias_in_cart_items( $item_name, $cart_item, $cart_item_key  ) {
        // The WC_Product object
        $product = $cart_item['data'];
        $alias = wp_get_post_terms( $product->get_id(), 'codice_fornitore', array('fields' => 'ids') );
        
         if(empty($alias)) return $item_name;
         
          $item_name .= get_the_term_list( $product->get_id(), 'codice_fornitore', '<br><span class="aliastile2">' . _n( 'Codice fornitore:', 'Codice fornitore:', count( $term_ids ), 'woocommerce' ) . ' ', ', ', '</span>' );
    
         return $item_name; 
    }
    
    ?>

    and that is the error that I see after save the function file:

    
    Si è verificato un errore critico sul tuo sito web.
    
    Scopri di più riguardo la risoluzione dei problemi in WordPress.
    
    Thread Starter admt2018

    (@admt2018)

    I need to show you an attach.
    Could you send it by email?

    Thread Starter admt2018

    (@admt2018)

    Hi, your plugin is very useful, congratulations! However, I need to solve a small problem. I need to only show the search form without showing the full contact list and consequently only show the search results. How could I solve? Is there a specific shortcode? Thank you very much

    Thread Starter admt2018

    (@admt2018)

    Hi Ewout, thanks for your availability. I wrote to you yesterday, but I still haven’t received an answer.
    I await your news, thanks.

    Thread Starter admt2018

    (@admt2018)

    Hi David, I’m sending to you a email. Thanks for the support

    Thread Starter admt2018

    (@admt2018)

    Oh, great! It works!
    Thank you very much!

    Thread Starter admt2018

    (@admt2018)

    Thanks, it works, but only if I send with my form and not with the download pdf button. How can I replace the button

    Thread Starter admt2018

    (@admt2018)

    No problem, thanks for the reply. Now I have inserted a function in the function.php that generates a form in the cart that allows me to print a free text. The form is printed on the pdf but I cannot print its content
    I’ll report the codes used:
    The first is the function written in function.php

    add_action('woocommerce_before_cart_contents', 'tf_cart_page_custom_text');
     
    function tf_cart_page_custom_text() {
     
        $message='<div class="cart-custom-message">';
            $message.='';
            $message.='<form action="" method="post">
    <label>Cliente:</label><br>
    <textarea cols="35" rows="12" name="comments" id="para1">
    </textarea><br>
    <input type="submit" name="button" value="Invia"/></form>';
        $message.='</div>';
      
     
        echo $message;
    }

    this, on the other hand, is the code inserted in the cart-table.php that regularly prints me all the contents of $ message

    do_action( 'woocommerce_before_cart_contents', 'tf_cart_page_custom_text' );
    if ( file_exists( $message ) ) {
    echo $message;	
    	}
    	

    To make the form work I entered $ comments = $ _POST ['comments']; and echo "Current header:". "<br>". $ comments;

    But in the pdf I only see the form without the content of $comments.

    Could you help me? Thank you very much

    • This reply was modified 3 years, 11 months ago by admt2018.
    Thread Starter admt2018

    (@admt2018)

    Isn’t this problem interesting enough? I have searched through the topics but there is nothing that can help me. Should I consider not receiving support? Thank you

Viewing 15 replies - 1 through 15 (of 20 total)