Support » Plugin: Pepro Ultimate Invoice » Translation of labels into portuguese + Customize layout + Disable bar codes

  • Resolved sidneyts

    (@sidneyts)


    Good afternoon.

    I am developing an e-Commerce and its plugin “Ultimate Invoice” proved to be the most suitable.

    1) I am trying to change the labels to Portuguese, without success ;-(
    Please, how can I perform this change?

    2) To meet the needs of this website, I need to make some changes to the layout, if possible by placing the Seller data on the top line, next to the logo. With that I will gain more space on the page and more products will be printed on the same page.

    3) I disabled the bar codes option (Invoice no. And Tracking no.), But they still appear on the page. Please, how do I resolve this issue?

    Thank you for your attention.

    The page I need help with: [log in to see the link]

Viewing 15 replies - 16 through 30 (of 34 total)
  • Plugin Author Pepro Dev

    (@peprodev)

    Hi, I didn’t quite understand your problem but I’m sure you can do any manipulation to invoices by just looking into WordPress and WooCommerce code-base and documentations.

    Thread Starter sidneyts

    (@sidneyts)

    Good Morning.
    It can resolve most of the necessary changes.

    The only one that got stuck is the following:

    I have products that have variations, where the lowest price is always “0.00”, and the highest, of course, is a value greater than “0.00”.

    In the “price” cell of the invoice, I need that in these cases of variations (where the lowest price is “0.00”), the value of the highest price of this variation always appears.

    Thanks for your help.

    Plugin Author Pepro Dev

    (@peprodev)

    Good evening,

    I think what you need are the following functions, Please Let me know if there’s anything else I can help you with.

    
    
    // All prices: multidimensional array with all variation prices (including active prices, regular prices and sale prices). 
    $prices = $product->get_variation_prices();
    $prices_for_display = $product->get_variation_prices( true ); // For display
    
    // The min or max active price.
    $min_price = $product->get_variation_price(); // Min active price
    $min_price_for_display = $product->get_variation_price('min', true); // Min active price for display
    $max_price = $product->get_variation_price('max'); // Max active price
    $max_price_for_display = $product->get_variation_price('max', true); // Max active price for display
    
    // The min or max regular price.
    $min_price = $product->get_variation_regular_price(); // Min regular price
    $min_price_for_display = $product->get_variation_regular_price('min', true); // Min regular price for display
    $max_price = $product->get_variation_regular_price('max'); // Max regular price
    $max_price_for_display = $product->get_variation_regular_price('max', true); // Max regular price for display
    
    // The min or max sale price.
    $min_price = $product->get_variation_sale_price(); // Min sale price
    $min_price_for_display = $product->get_variation_sale_price('min', true); // Min sale price for display
    $max_price = $product->get_variation_sale_price('max'); // Max sale price
    $max_price_for_display = $product->get_variation_sale_price('max', true); // Max sale price for display
    
    
    Thread Starter sidneyts

    (@sidneyts)

    I add this code at Snippets, and receive a fatal error at line 2.

    Uncaught Error: Call to a member function get_variation_prices() on null in /home/u574875641/domains/derorganicos.com.br/public_html/wp-content/plugins/code-snippets/php/admin-menus/class-edit-menu.php(221) : eval()'d code:2 Stack trace: #0 /home/u574875641/domains/derorganicos.com.br/public_html/wp-content/plugins/code-snippets/php/admin-menus/class-edit-menu.php(221): eval() #1 /home/u574875641/domains/derorganicos.com.br/public_html/wp-content/plugins/code-snippets/php/admin-menus/class-edit-menu.php(271): Code_Snippets_Edit_Menu->test_code(Object(Code_Snippet)) #2 /home/u574875641/domains/derorganicos.com.br/public_html/wp-content/plugins/code-snippets/php/admin-menus/class-edit-menu.php(130): Code_Snippets_Edit_Menu->save_posted_snippet() #3 /home/u574875641/domains/derorganicos.com.br/public_html/wp-content/plugins/code-snippets/php/admin-menus/class-edit-menu.php(107): Code_Snippets_Edit_Menu->process_actions() #4 /home/u574875641/domains/derorganicos.com.br/public_html/wp-includes/class-wp-hook.php(29

    Please, there another place to add this code?

    Plugin Author Pepro Dev

    (@peprodev)

    It is preferable to add your snippets in a custom plugin or Theme’s function.php file.
    and get_variation_prices should be called on a product, that means you have to initiate WC_Product class with given ID.

    Please send me your complete code so I could find the problem.

    Have a nice day.

    Thread Starter sidneyts

    (@sidneyts)

    Good morning.

    I work with the child theme, and always use the pluging Snippets to add extra function to “functions.php” child theme.

    My “functions.php” child theme is:

    <?php
    /**
     * Your Inspiration Themes
     *
     * @package WordPress
     * @subpackage Your Inspiration Themes
     * @author Your Inspiration Themes Team <info@yithemes.com>
     *
     * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0)
     * that is bundled with this package in the file LICENSE.txt.
     * It is also available through the world-wide-web at this URL:
     * http://www.gnu.org/licenses/gpl-3.0.txt
     */
    
    add_action( 'wp_enqueue_scripts', 'yit_enqueue_parent_theme_style', 5 );
    
    if ( ! function_exists( 'yit_enqueue_parent_theme_style' ) ) {
        /**
         * enqueue the parent css file
         *
         *
         * @return void
         * @since  1.0.0
         * @author Francesco Licandro
         */
        function yit_enqueue_parent_theme_style() {
    
            wp_enqueue_style( 'reset-bootstrap' );
            wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css', array( 'reset-bootstrap' ) );
            wp_enqueue_style( 'main-style' );
    
            if( function_exists( 'is_shop_installed' ) && is_shop_installed() ) {
    
                $version = WC()->version;
                $path = WC()->template_path();
    
                if ( version_compare( preg_replace( '/-beta-([0-9]+)/', '', $version ), WC_LATEST_VERSION, '<' ) ) {
                    $path = 'woocommerce_' . substr( $version, 0, 3 ) . '.x/';
                }
    
                wp_enqueue_style( 'woocommerce-parent-style', get_template_directory_uri() . '/' . $path . 'style.css' );
            }
        }
    }
    
    add_action( 'after_setup_theme', 'yit_child_theme_setup' );
    
    if ( ! function_exists( 'yit_child_theme_setup' ) ) {
        /**
         * load child language files
         *
         *
         * @return void
         * @since  1.0.0
         * @author Francesco Licandro
         */
        function yit_child_theme_setup() {
            load_child_theme_textdomain( 'yit', get_stylesheet_directory() . '/languages' );
        }
    }
    
    // Add customized template to Ultimate Invoice
    add_filter( "puiw_get_templates_list", function ($templates){
    	$templates[] = get_stylesheet_directory() . '\default\default.cfg';
    	return $templates;
    }, 10, 1);
    Thread Starter sidneyts

    (@sidneyts)

    And add the following functions with Snippets:

    1) Select Variations on the Shop Page

    add_action( 'woocommerce_before_shop_loop', 'oisidney_select_variations' );
    add_filter( 'woocommerce_add_to_cart_redirect', 'wp_get_referer' );
    
    function oisidney_select_variations() {
    	remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
    	add_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_single_add_to_cart', 30 );
    }
    Thread Starter sidneyts

    (@sidneyts)

    2) Disable Redirect to Product Page on Search Results Page
    add_filter( ‘woocommerce_redirect_single_search_result’, ‘__return_false’ );

    Thread Starter sidneyts

    (@sidneyts)

    3) WooCommerce :: Disable billing

    // Do NOT include the opening php tag.
    // Place in your theme's functions.php file
    
    add_filter( 'cfw_billing_shipping_address_heading', function( $heading ) {
       return 'Shipping address';
    } );
    Thread Starter sidneyts

    (@sidneyts)

    4) Removing the html image link from WooCommerce single product

    apply_filters(
        'woocommerce_single_product_image_thumbnail_html',
        sprintf(
          '<a href="%s" class="%s" title="%s" data-rel="prettyPhoto[product-gallery]">%s</a>',
          esc_url( $props['url'] ),
          esc_attr( $image_class ),
          esc_attr( $props['caption'] ),
          wp_get_attachment_image( $attachment_id, apply_filters( 'single_product_small_thumbnail_size', 'shop_thumbnail' ), 0, $props )
        ),
        $attachment_id,
        $post->ID,
        esc_attr( $image_class )
    Thread Starter sidneyts

    (@sidneyts)

    5) Prevent access to product page

    function prevent_access_to_product_page(){
        global $post;
        if ( is_product() ) {
            global $wp_query;
            $wp_query->set_404();
            status_header(404);
        }
    }
    
    add_action('wp','prevent_access_to_product_page');
    Thread Starter sidneyts

    (@sidneyts)

    6) Filter Pepro Ultimate Invoice Order Row item’s value

    /**
     * Filter Pepro Ultimate Invoice Order Row item's value
     *
     * @author Amirhosseinhpv ( @amirhosseinhpv )
     */
    add_filter( "puiw_printinvoice_create_html_item_row_metas", "make_zero_look_empty", 99, 5);
    
    /**
     * output empty string instead of zero with currency when price is empty
     *
     * @method  make_zero_look_empty
     * @param   array $item_details
     * @param   int $item_id Current item's ID in Order items loop
     * @param   WC_Order_Item $item Current item's instance in Order items loop
     * @param   int $product_id Parent product in Order loop
     * @param   WC_Order $order Current Order instance
     * @return  array modified row data
     * @version 1.0.0
     * @license https://pepro.dev/license Pepro.dev License
     */
    function make_zero_look_empty($item_details, $item_id, $item, $product_id, $order )
    {
    
      // current item's calculated price
      if ( $order->get_item_subtotal( $item, false, true ) <= 0 ){
        $item_details["base_price"] = "";
        $item_details["nettotal"] = "";
        $item_details["extra_classes"] = $item_details["extra_classes"] . " _zero_price ";
      }
    
      // current item's calculated tax
      if ( $item->get_subtotal_tax() <= 0 ){
        $item_details["tax"] = "";
        $item_details["extra_classes"] = $item_details["extra_classes"] . " _zero_tax ";
      }
    
      // current item's calculated discount
      if ( (float) $item_details["discount"] <= 0 ){
        $item_details["discount"] = "";
        $item_details["extra_classes"] = $item_details["extra_classes"] . " _zero_discount ";
      }
    
      return $item_details;
    }
    Thread Starter sidneyts

    (@sidneyts)

    Those line can help?

    Plugin Author Pepro Dev

    (@peprodev)

    Hi, Could you please send me the code that generated error below:

    Uncaught Error: Call to a member function get_variation_prices() on null in /home/u574875641/domains/derorganicos.com.br/public_html/wp-content/pl ….

    Thread Starter sidneyts

    (@sidneyts)

    follow the code that generated the error….

    // All prices: multidimensional array with all variation prices (including active prices, regular prices and sale prices). 
    $prices = $product->get_variation_prices();
    $prices_for_display = $product->get_variation_prices( true ); // For display
    
    // The min or max active price.
    $min_price = $product->get_variation_price(); // Min active price
    $min_price_for_display = $product->get_variation_price('min', true); // Min active price for display
    $max_price = $product->get_variation_price('max'); // Max active price
    $max_price_for_display = $product->get_variation_price('max', true); // Max active price for display
    
    // The min or max regular price.
    $min_price = $product->get_variation_regular_price(); // Min regular price
    $min_price_for_display = $product->get_variation_regular_price('min', true); // Min regular price for display
    $max_price = $product->get_variation_regular_price('max'); // Max regular price
    $max_price_for_display = $product->get_variation_regular_price('max', true); // Max regular price for display
    
    // The min or max sale price.
    $min_price = $product->get_variation_sale_price(); // Min sale price
    $min_price_for_display = $product->get_variation_sale_price('min', true); // Min sale price for display
    $max_price = $product->get_variation_sale_price('max'); // Max sale price
    $max_price_for_display = $product->get_variation_sale_price('max', true); // Max sale price for display
Viewing 15 replies - 16 through 30 (of 34 total)
  • You must be logged in to reply to this topic.