Banner Logo

Be a part of the family: Connect, Receive Support,
Contribute, and Reap Abundant Rewards!

Customer Rate Product/Vendor

WCMp Core

Resolved
Viewing 16 reply threads
  • Author
    Posts
    • #117707
      James
      Participant

      Hello,

      When a customer rate a product the “stars and the comment” appear on the product.
      When a customer rate a vendor the “stars and the comment” appear on the vendor shop.

      I would like, when a vendor get a Rate from a customer it atomaticaly goes on the Vendor rate in the vendor shop.
      And on the product the rate that appear is the rate from the vendor shop.
      (if you don’t see what i am talking about it like the rate system on etsy)

      Best Regards.
      James.

    • #117712

      Hello,

      Thank you for reaching out to us.

      Our team is looking to it and we will update you by tomorrow.

    • #117798

      Hello,

      Thank you for reaching out to us.

      By default flow, product review is only for the products. Now if you want the product review to go to the vendor store page then you have to do custom coding at your end. Kindly let us know if you need any help with the hooks and filter then our team will guide you accordingly .

    • #117841
      James
      Participant

      Hello,
      I don’t mind to have the product review.
      I juste would like them to appear on the vendor review also.
      How do i do this ?
      Best Regards.
      James.

    • #117867
    • #117931
      James
      Participant

      Hello,
      Very nice !
      It’s solve most of what i wanted ^^.
      Only 1 last think i would like to change is the number of review beside the stars (like on the pdf i have added)
      I want it to be the vendor review + the vendor product review.
      Like this vendor have 1 product review and 1 vendor review so i want the review beside the star to be “2 reviews”.
      (Avis : Review)
      Best Regards,
      James.

    • #118012

      Hi,
      To change the data and text you have to override templates/review/rating.php template by copying it to yourtheme/dc-product-vendor/review/rating.php and add some custom code.

      Regards,

    • #118014
      James
      Participant

      Hello,
      Ok do you have any code i can use to do this and paste in my “childtheme” php function ?
      Best Regards.
      James.

    • #118108

      James, currently we don’t have any such code snippet. Our dev team will look into this, if this requires a small coding snippet, they will provide that.

    • #118156

      Hi,
      To change the data and text you have to override templates/review/rating.php template by copying it to yourtheme/dc-product-vendor/review/rating.php.

      Remove all code from the rating.php and add the below code on this page.

      <?php
      /**
       * Vendor Review Comments Template
       *
       * Closing li is left out on purpose!.
       *
       * This template can be overridden by copying it to yourtheme/dc-product-vendor/review/rating.php.
       *
       * HOWEVER, on occasion WC Marketplace 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.
       *
       * 
       * @author  WC Marketplace
       * @package dc-woocommerce-multi-vendor/Templates
       * @version 3.3.5
       */
      if (!defined('ABSPATH')) {
          exit; // Exit if accessed directly
      }
      global $WCMp;
      $rating_result_array = array();
      if (is_tax($WCMp->taxonomy->taxonomy_name)) {
          // Get vendor ID
          $vendor_id = get_queried_object()->term_id;
          // Get vendor info
          $vendor = get_wcmp_vendor_by_term($vendor_id);
          $vendor_products = wp_list_pluck( $vendor->get_products_ids(), 'ID' );
          $rating = $rating_pro_count = 0;
          if( $vendor_products ) {
              foreach( $vendor_products as $product_id ) {
                  if( get_post_meta( $product_id, '_wc_average_rating', true ) ) {
                      $rating += get_post_meta( $product_id, '_wc_average_rating', true );
                      $rating_pro_count++;
                  };
              }
          }
          if( $rating_pro_count ) {
              $rating_result_array['total_rating'] = $rating_pro_count;
              $rating_result_array['avg_rating'] = $rating / $rating_pro_count;
          }
      }
      
      $rating = round($rating_val_array['avg_rating'], 1);
      $count = intval($rating_val_array['total_rating']);
      $rating_type = $rating_val_array['rating_type'];
      
      if( !empty($rating_result_array) ){
      
       $avg_rating = ($rating_val_array['avg_rating'] + $rating_result_array['avg_rating'])/2;
       $rating = round($avg_rating, 1);
       $count = intval($rating_val_array['total_rating'] + $rating_result_array['total_rating']);
      }
      
      if( $rating_type == 'product-rating' ) {
          $review_text = $count > 1 ? __('Products reviews', 'dc-woocommerce-multi-vendor') : __('Product review', 'dc-woocommerce-multi-vendor');
      } else {
          $review_text = $count > 1 ? __('Reviews', 'dc-woocommerce-multi-vendor') : __('Review', 'dc-woocommerce-multi-vendor');
      }
      
      ?> 
      <div style="clear:both; width:100%;"></div> 
      <?php if ($count > 0) { ?>
          <span class="wcmp_total_rating_number"><?php echo sprintf(' %s ', $rating); ?></span>
      <?php } ?>
      <a href="#<?php echo ($rating_type != 'product-rating' ) ? 'reviews' : ''; ?>">
      <?php if ($count > 0) { ?>	
              <span itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating" class="star-rating" title="<?php echo sprintf(__('Rated %s out of 5', 'dc-woocommerce-multi-vendor'), $rating) ?>">
                  <span style="width:<?php echo ( round($rating_val_array['avg_rating']) / 5 ) * 100; ?>%"><strong itemprop="ratingValue"><?php echo $rating; ?></strong> <?php _e('out of 5', 'dc-woocommerce-multi-vendor'); ?></span>
              </span>
              <?php echo sprintf(' %s %s', $count, $review_text); ?>
      
          <?php
      } else {
          ?>
              <?php esc_html_e(' No Review Yet ', 'dc-woocommerce-multi-vendor'); ?>
          <?php } ?>
      </a>
      Copy

      Regards,

    • #118210
      James
      Participant
      This reply has been marked as private.
    • #118211
      James
      Participant

      My bad i have done it wrong ,

      There is no “vendor/review/rating.php” in “mytheme/dc-product-vendor” so i have done it directly in templates/review/rating.php
      it is working perfect now 🙂 Thanks a lot for it.
      just the code in templates/review/rating.php wouldn’t he be errased at the next wcmp update ?

      Best regards.
      James.

    • #118271

      @James, as you have overridden the template file in your theme, hence when you will update the theme it will override the edit.
      So, please use a child theme and add all the modifications there.

    • #118296
      James
      Participant
      This reply has been marked as private.
    • #118335

      Hi,
      As per your requirement you have to override the file
      Kindly override wp-content/plugins/dc-woocommerce-multi-vendor/templates/review/rating.php template by copying it to yourchildtheme/dc-product-vendor/review/rating.php.

      **You have to create the folder structure in your child theme folder.
      Create a rating.php file and then add the above shared code in this file.
      Kindly follow the reply #118156

      Regards,

    • #118340
      James
      Participant

      Hello,
      Ok i have create the folder structure “yourchildtheme/dc-product-vendor/review/rating.php” and put you code in this “rating.php”
      So i think i have done it well, my website doesn’t show a critical error x) , Thanks for you’r patience with me !
      Best Regards.
      James.

    • #118343

      You are most welcome @James

      I hope you are satisfied with our assistance and plugin. A 5/5 review here- https://wordpress.org/support/plugin/dc-woocommerce-multi-vendor/reviews/#new-post , would be a great way to share your experience with others.

      This motivates us to continue providing the best experience possible and also helps others know how WC-Marketplace can make their life easier.

Viewing 16 reply threads

The topic ‘Customer Rate Product/Vendor’ is closed to new replies.