Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #657421

    Hi, I created a web site with Enfold which works also with a woocommerce area. Pages /categories /portfolio/ products etc. are already made in teh default language (english). I then tried to install WPML and the other adds-on to make it working with woocommerce, but after a long work of duplicating pages in the new language (italian), and after menu sync, I realized that something was broken and received and internal error 500.

    At this point I have restored a clean version of the web site and I am ready to try again, but before doing it I would like from you some advices:
    1) when I first install wpml which Language URL format do you suggest better for enfold? I would like http://mydomain.com/ for the home page in the original language (EN) and http://mydomain.com/it/ for the translated home page. In this case case I should choose the “Different languages in directories” option >>> but how about the permalinks? Right now they are set as “post name” which is what I want. Are they ok? Product permalinks are setted as “product base”

    2) The adds-on for woocommerce should be installed before doany translation of the various category/tag/etc??

    3) the menu syncronization: I think that this thing is what didn’t work in my first attempt. I followed the instructions from https://wpml.org/2016/02/enfold-theme-and-wpml/ but it came out with a big mess

    Since I didn’t find a deeply explained tutorial on how installing wpml, you may give me some hints on the steps to be done and in which order

    Thank you

    #657874

    Hello, while waiting for your answer I tried again the installation of wpml and right now it seems everything ok. I mean, I translated the home page and the blog page. Fine.

    However, before translating the rest of the pages, I tried to to translate the Woocommerce section. Here I found a major problem. First with woocommerce multilingual plugin I did translate categories and attributes. After that I did translate the products. However here comes the problem. I created each product page with avia layout builder and in the orginal language (english) everything was fine. Now the translated products show the default woocommerce product appearance above my personal layout. Moreover, se html code that I wrote and included (the calendar with places availability below the add to cart button) does not appear anymore.

    I include two screenshots. Let me know if you need to log in the website since I am working on a local machine. Right now the NOT translated web site is available at http://whalesanddolphins.tethys.org/test/product/csr-expeditions-payment/
    I prefer to do the tests on a local machine before substituting the web site online.

    Please let me know as it is urgent
    Thank you very much

    #657911

    Just to update you in my progresses: I tried to change on woocommerce multilingual > settings> native woo commerce product editing screen (instead of wpm translation editor). Now the product appears more or less like it should. However the custom html code doesn’t appear as well as the avia-layout shortcode that I created to show the calendar.

    Moreover I noticed that for those products that use the Woocommerce Name Your Price plugin the field for writing the price doesn’t show up.

    Another thing is that the menu font color (which was ovrewritten a in style.css in my child theme) appears as set in the Theme options: i.e. it doesn’t get information from my css.

    I guess I lost some passage to make the full theme translatable and thus the informations stored in my child theme (css sheets and custom shortcodes) are not loaded in the italian version

    Any suggestion?

    Thanks

    Elena

    • This reply was modified 7 years, 8 months ago by elenapoliti.
    #657965

    Ok I solved more or less all the issues axcept one. First I work with the woocommerce multilingual settings as stated above. This give me the possibility of opening the product in each language from teh standard avia layout builder of Enfold. In this way I can check all settings (example I found that in the automatic copy the Name Your Price Option was not set and that’s why it didn’t appear in the front end).

    I downloaded a wpml-config.xml file that I copied in my child theme and the menu now has the same color taken from my custom css style sheet.

    However the custom shortcodes don’t work. They appear in the avia layout builder in the administrative panel (while editing the product), but nothing appears in the front-end. It is like the php function I wrote is not working in the front end translated page.

    The code is the following… maybe I should add something the php file.

    It takes takes the formatted name from each variation of the product (which are cruise dates) and it extrapolates the variation name and its stock availability (= places available in each cruise date).

    <?php
    
    if( !class_exists( 'woocommerce' ) )
    {
    	add_shortcode('csr_calendar_button', 'avia_please_install_woo');
    	return;
    }
    
    if ( !class_exists( 'avia_csr_calendar_button' ) )
    {
    	class avia_csr_calendar_button extends aviaShortcodeTemplate
    	{
    		/**
    		 * Create the config array for the shortcode button
    		 */
    		function shortcode_insert_button()
    		{
    			$this->config['name']		= __('CSR Calendar', 'avia_framework' );
    			$this->config['tab']		= __('Plugin Additions', 'avia_framework' );
    			$this->config['icon']		= AviaBuilder::$path['imagesURL']."sc-button.png";
    			$this->config['order']		= 23;
    			$this->config['target']		= 'avia-target-insert';
    			$this->config['shortcode'] 	= 'csr_calendar_button';
    			$this->config['tooltip'] 	= __('Display the "CSR Calendar" button for the current product', 'avia_framework' );
    			$this->config['drag-level'] = 3;
    			$this->config['tinyMCE'] 	= array('disable' => "true");
    			$this->config['posttype'] 	= array('product',__('This element can only be used on single product pages','avia_framework'));
    		}
    
    		/**
    		 * Editor Element - this function defines the visual appearance of an element on the AviaBuilder Canvas
    		 * Most common usage is to define some markup in the $params['innerHtml'] which is then inserted into the drag and drop container
    		 * Less often used: $params['data'] to add data attributes, $params['class'] to modify the className
    		 *
    		 *
    		 * @param array $params this array holds the default values for $content and $args.
    		 * @return $params the return array usually holds an innerHtml key that holds item specific markup.
    		 */
    		function editor_element($params)
    		{
    			$params['innerHtml'] = "<img src='".$this->config['icon']."' title='".$this->config['name']."' />";
    			$params['innerHtml'].= "<div class='avia-element-label'>".$this->config['name']."</div>";
    			$params['content'] 	 = NULL; //remove to allow content elements
    			return $params;
    		}
    
    		/**
    		 * Frontend Shortcode Handler
    		 *
    		 * @param array $atts array of attributes
    		 * @param string $content text within enclosing form of shortcode element
    		 * @param string $shortcodename the shortcode found, when == callback name
    		 * @return string $output returns the modified html string
    		 */
    		function shortcode_handler($atts, $content = "", $shortcodename = "", $meta = "")
    		{
    			$output = "";
    			$meta['el_class'];
    			
    			global $woocommerce, $product;
    			if(!is_object($woocommerce) || !is_object($woocommerce->query) || empty($product)) return;
    
    			// $product = wc_get_product();
    			
    			$output .= "<div class='av-woo-calendar-button ".$meta['el_class']."'>";
    			ob_start();?>
    			
                    <table cellspacing="0" cellpadding="2">
                        <thead>
                            <tr>
                                <th scope="col" style="text-align:left; background-color:rgba(255,255,255,1); vertical-align:middle;"><?php _e('Cruise', 'woothemes'); ?></th>
                                <th scope="col" style="text-align:center;background-color:rgba(255,255,255,1);"><?php _e('Places<br/>available', 'woothemes'); ?></th>
                            </tr>
                        </thead>
                        <tbody>
                        <?php
                        
                        $args = array(
                            'post_type'			=> 'product_variation',
                            'post_status' 		=> 'publish',
                            'posts_per_page' 	=> -1,
                            'orderby'			=> 'title',
                            'order'				=> 'ASC',
                           'meta_query' => array(
                                array(
                                    'key' 		=> '_stock',
                                    'value' 	=> array('', false, null),
                                    'compare' 	=> 'NOT IN'
                                )
                            )
                        );
                        
                        $loop = new WP_Query( $args );
                    
                        while ( $loop->have_posts() ) : $loop->the_post();
                        
                                        $product = new WC_Product_Variation( $loop->post->ID );
    									
                                if (get_the_title( $loop->post->post_parent ) == 'CSR Expeditions Payment')
                                {		
    								$variation_formatted_name = $product->get_formatted_name();
    								$variation_name_array = explode("&ndash;", $variation_formatted_name);
    								$variation_name = $variation_name_array[2];
    								$variation_price = $variation_name_array[3];
    								$variation_sku = $variation_name_array[0];
    								$variation_name_only = explode(":", $variation_name);
    								$variation_name_only = $variation_name_only[1];
                            ?>
                            
                            <tr>
                                <td><?php  echo $variation_name_only ."&ndash;" . $variation_price; ?></td>
                                <?php
    								if (intval ($product->stock) >0)
    								{ ?>
                               			<td style="text-align:center; font-size: 13px; background-color:#70C940; color:rgba(255,255,255,1);"><?php echo intval ($product->stock); ?></td>
    								<?php
                                    }
    								else
    								{ ?>
                               			<td style="text-align:center; font-size: 13px; background-color:#D11E1B;color:rgba(255,255,255,1);"> <?php echo intval ($product->stock); ?></td>
                                    <?php    
    								}
    								
    							?>
                            </tr>
                            <?php
                                }
                        endwhile; 
                        
                        ?>
                        </tbody>
                    </table>
    
    			<?php
    			
    			$output .= ob_get_clean();
    			$output .= "</div>";
    			return $output;
    		}
    	}
    }
    
    #658183

    Hello there, excuse me but I found also the solution to the last issue. Actually in the shortcode php code the $loop variable was looking for the english name of the product category! Jus added a condition “or” to add the translated category name and now it works perfectly.

    Hence, just for the information to other users, in order to work smoothly with woocommerce custom layout products and wpml I simply changed the translations settings in WPML Woocommerce Multilingual

    woocommerce multilingual > settings> native woocommerce product editing screen => although this is not recommended it permits to edit each single product inthe translated version from its page via avia layout builder.

    Consider also that Name Your Product must be checked again in each product in the translated page!

    You can close the topic

    Thanks and sorry for the disturb

    #658392

    Hi,

    Great, glad you found the solution and thank you very much for the useful feedback. Please open a new thread if you should have any other problems or questions.

    Best regards,
    Rikard

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘WPML settings problems with permalinks’ is closed to new replies.