Forum Replies Created

Viewing 15 replies - 1 through 15 (of 17 total)
  • Thread Starter webdev00

    (@webdev00)

    return $product->price > 1;

    actually.

    dunno what’s going on. wordpress can’t seem to make up it’s mind which way it wants to count.

    Thread Starter webdev00

    (@webdev00)

    Hi maybe I can work this out myself but I don’t see an if condition there.

    The above code accomplishes the opposite of what I want : the compare button is on the price = 0 products only.

    I want it to be on the price > 0 products only.

    Thank you.

    EDIT :
    return $product->price < 1;
    this did the job

    Thread Starter webdev00

    (@webdev00)

    ok thank you!

    Thread Starter webdev00

    (@webdev00)

    ok guys thanks !

    I’ll just edit the plugin files directly.

    Thread Starter webdev00

    (@webdev00)

    I hacked a way of doing this by editing a Js file

    Thread Starter webdev00

    (@webdev00)

    yeah that’s it.

    here as you can see I currently have a working override of my woocommerce plugin in my child theme (I deleted the attempt I made at overriding a YITH plugin :
    https://i.imgur.com/ZgQhJQj.png

    and here is my YITH essential kit tree:
    https://i.imgur.com/MnQZ0aO.png

    If I try to reproduce this hiarchy in my child theme like I did with woocommerce, nothing happens.

    Thread Starter webdev00

    (@webdev00)

    wow!

    I’d love to do that, actually!

    how would that be done?

    Thread Starter webdev00

    (@webdev00)

    Wow!

    Holy Moly someone should really pin this thread.

    I can see it being useful to a lot of people.

    Thanks man, you’re an angel!

    I also added this bit of CSS :

    #centralimage{
        min-height: 50vh;
    }

    to prevent flashing into place of the elements below the central image during the time it was empty (a millisecond).

    Thread Starter webdev00

    (@webdev00)

    fixed with css :

    .yith_ywraq_add_item_response .yith_ywraq_add_item_response_message,
    .yith_ywraq_add_item_browse-list .yith_ywraq_add_item_browse_message{
        display :none;
    }

    Thread Starter webdev00

    (@webdev00)

    I found out how to solve my issue.

    I edited the get_product_rating_html function at line 1499 in class.yith-woocommerce-advanced-reviews.php in /wp-content/plugins/yith-essential-kit-for-woocommerce-advanced-reviews :

    public function get_product_rating_html ( $rating_html, $rating ) {
                global $product;
                $rating_html = '';
    
                $rating = $this->get_average_rating ( $product->id );
                $noreview = '';
                if ( ICL_LANGUAGE_CODE=='en' ){ $noreview = "No reviews yet";}
                else { $noreview = "Pas encore d'avis";}
    
                if ( $rating > 0 ) {
    
                    $rating_html = '<div class="star-rating" title="' . sprintf ( __ ( 'Rated %s out of 5', 'yith-woocommerce-advanced-reviews' ), $rating ) . '">';
    
                    $rating_html .= '<span style="width:' . ( ( $rating / 5 ) * 100 ) . '%"><strong class="rating">' . $rating . '</strong> ' . __ ( 'out of 5', 'yith-woocommerce-advanced-reviews' ) . '</span>';
    
                    $rating_html .= '</div>';
                }else{
                    $rating_html = '<div>'.$noreview.'</div>';
                }
    
                return $rating_html;
            }

    now it shows up necessarily and I have it translated depending on the language.

    I also added :

    .grid4 .star-rating{
        margin: 0!important;
    }
    .star-rating{
        margin: 0!important;
    }

    to my CSS file in order for the two cases to occupy the same screen space and for everything to be lined up.

    Thread Starter webdev00

    (@webdev00)

    Ok, here’s where I’m at : I found out I had messed up the architecture of woocommerce in my child theme and anyhow I can’t get the edits to these files to show up from my child theme anymore so I’m editing the raw files for now until I figure that out.

    i’m working with product-thumbnails.php and product-image.php :

    <?php
    /**
     * Single Product Thumbnails
     *
     * This template can be overridden by copying it to yourtheme/woocommerce/single-product/product-thumbnails.php.
     *
     * HOWEVER, on occasion WooCommerce will need to update template files and you (the theme developer).
     * will need to copy the new files to your theme to maintain compatibility. We try to do this.
     * as little as possible, but it does happen. When this occurs the version of the template file will.
     * be bumped and the readme will list any important changes.
     *
     * @see 	    https://docs.woothemes.com/document/template-structure/
     * @author 		WooThemes
     * @package 	WooCommerce/Templates
     * @version     2.3.0
     */
    
    if ( ! defined( 'ABSPATH' ) ) {
    	exit; // Exit if accessed directly
    }
    
    global $post, $product, $woocommerce;
    
    $attachment_ids = $product->get_gallery_attachment_ids();
    
    if ( $attachment_ids ) {
    	$loop 		= 0;
    	$columns 	= apply_filters( 'woocommerce_product_thumbnails_columns', 3 );
    	?>
    	<div class="thumbnails <?php echo 'columns-' . $columns; ?>"><?php
    
    		foreach ( $attachment_ids as $attachment_id ) {
    
    			$classes = array( 'zoom' );
    
    			if ( $loop === 0 || $loop % $columns === 0 )
    				$classes[] = 'first';
    
    			if ( ( $loop + 1 ) % $columns === 0 )
    				$classes[] = 'last';
    
    			$image_link = wp_get_attachment_url( $attachment_id );
    
    			if ( ! $image_link )
    				continue;
    
    			$image_title 	= esc_attr( get_the_title( $attachment_id ) );
    			$image_caption 	= esc_attr( get_post_field( 'post_excerpt', $attachment_id ) );
    
    			$single_img = wp_get_attachment_image( $attachment_id, 'shop_single', 0, $attr = array(
    				'title' => $image_title,
    				'alt'   => $image_title,
    			) );
    
    			$image       = wp_get_attachment_image( $attachment_id, apply_filters( 'single_product_small_thumbnail_size', 'shop_thumbnail' ), 0, $attr = array(
    				'title'	=> $image_title,
    				'alt'	=> $image_title,
    				'onclick'=> "function(){document.getElementById('centralimage').innerHTML = '<img src=\"'$single_img'\" />';}",
    			) );
    
    			$image_class = esc_attr( implode( ' ', $classes ) );
    
    			echo apply_filters( 'woocommerce_single_product_image_thumbnail_html', $image, $attachment_id, $post->ID, $image_class );
    
    			$loop++;
    		}
    
    		?></div>
    	<?php
    }

    and :

    <?php
    /**
     * Single Product Image
     *
     * This template can be overridden by copying it to yourtheme/woocommerce/single-product/product-image.php.
     *
     * HOWEVER, on occasion WooCommerce will need to update template files and you (the theme developer).
     * will need to copy the new files to your theme to maintain compatibility. We try to do this.
     * as little as possible, but it does happen. When this occurs the version of the template file will.
     * be bumped and the readme will list any important changes.
     *
     * @see 	    https://docs.woothemes.com/document/template-structure/
     * @author 		WooThemes
     * @package 	WooCommerce/Templates
     * @version     2.0.14
     */
    
    if ( ! defined( 'ABSPATH' ) ) {
    	exit; // Exit if accessed directly
    }
    
    global $post, $woocommerce, $product;
    
    ?>
    <div class="images">
    	<?php
    		if ( has_post_thumbnail() ) {
    			$image_caption = get_post( get_post_thumbnail_id() )->post_excerpt;
    			$image_link    = wp_get_attachment_url( get_post_thumbnail_id() );
    			$image         = get_the_post_thumbnail( $post->ID, apply_filters( 'single_product_large_thumbnail_size', 'shop_single' ), array(
    				'title'	=> get_the_title( get_post_thumbnail_id() )
    			) );
    
    			$attachment_count = count( $product->get_gallery_attachment_ids() );
    
    			if ( $attachment_count > 0 ) {
    				$gallery = '[product-gallery]';
    			} else {
    				$gallery = '';
    			}
    
    			echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<a href="%s" itemprop="image" id="centralimage" class="woocommerce-main-image zoom" title="%s" data-rel="prettyPhoto' . $gallery . '">%s</a>', $image_link, $image_caption, $image ), $post->ID );
    
    		} else {
    
    			echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<img src="%s" alt="%s" />', wc_placeholder_img_src(), __( 'Placeholder', 'woocommerce' ) ), $post->ID );
    
    		}
    	?>
    
    	<?php do_action( 'woocommerce_product_thumbnails' ); ?>
    </div>

    in this last file I added id="centralimage" and removing the href prevents the image from showing up. I don’t know why but the fact that when you click that zone you’re redirected to the image is annoying.

    as you can see the function shows up although I’m not sure about the syntaxe :
    https://i.imgur.com/swO4C61.png

    and so does the id :
    https://i.imgur.com/001N4ha.png

    I’ve tried all the combos of either src=\"'$single_img'\"or src='$single_img' and document.getElementById('centralimage').innerHTML = or document.getElementById('centralimage')[0].innerHTML =

    but the error continues to show up and I cannot get the central image to change. ??

    thank you again!

    Thread Starter webdev00

    (@webdev00)

    Thread Starter webdev00

    (@webdev00)

    I can’t :

    https://i.imgur.com/PJVixbh.png

    YITH comes free and but as you can see they deny support to any other than people who have purchased their themes not even their plugins.

    So basically you’re telling me noone will help me.

    Thread Starter webdev00

    (@webdev00)

    Hi!

    Wow I’ve gotta say you’ve been really helpful!!

    I think we’re really scratching the surface now.

    I noticed the main image was a Class rather than an id so after testing your code as-is I replaced the onclick with :
    'onclick'=> "function(){document.getElementsByClassName('attachment-shop_single').innerHTML = '<img src=\"$single_img\" />';}",

    this did not help much however. in both cases the images show an onclick in the chrome dev tools but do not have the “clickable” cursor when hovered and don’t do anything when clicked apart for undeclared errors :
    https://i.imgur.com/d9j6txu.png

    https://i.imgur.com/UnY6o3k.png

    Thread Starter webdev00

    (@webdev00)

    alright!

    looking better : https://i.imgur.com/zDi3V2O.png

    I’m supposing nothing extra would be required in this process if I apply it straight to my child theme rather than my theme?

    I’m going to edit my copied “product-image.php” and “product-thumbnails.php”
    to have the onclick attribute.

    I’ll update to say how it goes.

    EDIT::

    I’m supposing that the gallery file is the file I should add the js in :

    <?php
    /**
     * Single Product Thumbnails
     *
     * This template can be overridden by copying it to yourtheme/woocommerce/single-product/product-thumbnails.php.
     *
     * HOWEVER, on occasion WooCommerce will need to update template files and you (the theme developer).
     * will need to copy the new files to your theme to maintain compatibility. We try to do this.
     * as little as possible, but it does happen. When this occurs the version of the template file will.
     * be bumped and the readme will list any important changes.
     *
     * @see 	    https://docs.woothemes.com/document/template-structure/
     * @author 		WooThemes
     * @package 	WooCommerce/Templates
     * @version     2.3.0
     */
    
    if ( ! defined( 'ABSPATH' ) ) {
    	exit; // Exit if accessed directly
    }
    
    global $post, $product, $woocommerce;
    
    $attachment_ids = $product->get_gallery_attachment_ids();
    
    if ( $attachment_ids ) {
    	$loop 		= 0;
    	$columns 	= apply_filters( 'woocommerce_product_thumbnails_columns', 3 );
    	?>
    	<div class="thumbnails <?php echo 'columns-' . $columns; ?>"><?php
    
    		foreach ( $attachment_ids as $attachment_id ) {
    
    			$classes = array( 'zoom' );
    
    			if ( $loop === 0 || $loop % $columns === 0 )
    				$classes[] = 'first';
    
    			if ( ( $loop + 1 ) % $columns === 0 )
    				$classes[] = 'last';
    
    			$image_link = wp_get_attachment_url( $attachment_id );
    
    			if ( ! $image_link )
    				continue;
    
    			$image_title 	= esc_attr( get_the_title( $attachment_id ) );
    			$image_caption 	= esc_attr( get_post_field( 'post_excerpt', $attachment_id ) );
    
    			$image       = wp_get_attachment_image( $attachment_id, apply_filters( 'single_product_small_thumbnail_size', 'shop_thumbnail' ), 0, $attr = array(
    				'title'	=> $image_title,
    				'alt'	=> $image_title
    				) );
    
    			$image_class = esc_attr( implode( ' ', $classes ) );
    
    			echo apply_filters( 'woocommerce_single_product_image_thumbnail_html', sprintf( '<a href="%s" class="%s" title="%s" data-rel="prettyPhoto[product-gallery]">%s</a>', $image_link, $image_class, $image_caption, $image ), $attachment_id, $post->ID, $image_class );
    
    			$loop++;
    		}
    
    	?></div>
    	<?php
    }

    but as you can see, instead of an “img” there’s an “a” contaning some sort of shortcode : <a href="%s" class="%s" title="%s" data-rel="prettyPhoto[product-gallery]">%s</a>

    what do I do?

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