From a5347df4270834b678674c2b32a67eeb8c95f1f1 Mon Sep 17 00:00:00 2001 From: Thomas Mery Date: Tue, 6 Jun 2017 22:30:47 +0200 Subject: [PATCH] Should fix POS Pro custom templates not found seemed like it was not possible to add custom templates for Pos Pro Screens this fix passes along the pos pro template dir path so it can be used as the string to be replaced when building the theme woocommerce-pos template dir path without this fix the `locate_template_file` method would not replace the template dir path as it was set to the woocommerce pos template dir path and not found in the template path passed to the method --- includes/class-wc-pos-template.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/class-wc-pos-template.php b/includes/class-wc-pos-template.php index 4ef6dbc1..f24322f4 100755 --- a/includes/class-wc-pos-template.php +++ b/includes/class-wc-pos-template.php @@ -336,7 +336,7 @@ static public function locate_default_template_files( $partials_dir = '' ) { static public function locate_template_files( $partials_dir = '' ) { $files = array(); foreach ( self::locate_default_template_files( $partials_dir ) as $slug => $path ) { - $files[ $slug ] = self::locate_template_file( $path ); + $files[ $slug ] = self::locate_template_file( $path, $partials_dir ); }; return $files; @@ -348,8 +348,8 @@ static public function locate_template_files( $partials_dir = '' ) { * @param string $default_path * @return string */ - static public function locate_template_file( $default_path = '' ) { - $custom_path1 = str_replace( self::get_template_dir(), 'woocommerce-pos', $default_path ); + static public function locate_template_file( $default_path = '', $partials_dir = '' ) { + $custom_path1 = str_replace( $partials_dir ?: self::get_template_dir(), 'woocommerce-pos', $default_path ); $custom_path2 = str_replace( 'tmpl-', '', $custom_path1 ); $custom = locate_template( array( $custom_path1, $custom_path2 ) );