More offers-display the rating of the product itself instead of the store rating

MultivendorX

Resolved
Viewing 9 reply threads
  • Author
    Posts
    • #190549
      l.gan
      Participant

      Hello
      Thanks for the great support!

      Please tell me, I’m using the code to transfer the tab from “More offers”.

      How can I display the rating of the product itself instead of the store rating?

      Thank you

      add_action(‘woodmart_after_product_content’,’single_product_multi_vendor_single_product’);
      function single_product_multi_vendor_single_product(){

      global $woocommerce, $MVX, $post, $wpdb;
      $product = wc_get_product( $post->ID );
      $more_product_array = $mapped_products = array();
      $has_product_map_id = get_post_meta( $product->get_id(), ‘_mvx_spmv_map_id’, true );
      if( $has_product_map_id ){
      $products_map_data_ids = get_mvx_spmv_products_map_data( $has_product_map_id );
      $mapped_products = array_diff( $products_map_data_ids, array( $product->get_id() ) );
      $more_product_array = get_mvx_more_spmv_products( $product->get_id() );
      }
      $single_pro = $product;

      if(isset($more_product_array) && is_array($more_product_array) && count($more_product_array) > 0) {

      foreach ($more_product_array as $more_product ) {
      $_product = wc_get_product($more_product[‘product_id’]);
      ?>
      <div class=”row rowbody”>
      <div class=”rowsub “>
      <div class=”vendor_name”>
      ” class=”mvx_seller_name”><?php echo esc_html($more_product[‘seller_name’]); ?>
      <?php do_action(‘mvx_after_singleproductmultivendor_vendor_name’, $more_product[‘product_id’], $more_product);?>
      </div>

      <?php
      if(isset($more_product[‘rating_data’]) && is_array($more_product[‘rating_data’]) && isset($more_product[‘rating_data’][‘avg_rating’]) && $more_product[‘rating_data’][‘avg_rating’]!=0 && $more_product[‘rating_data’][‘avg_rating’]!=”){
      echo wp_kses_post(wc_get_rating_html( $more_product[‘rating_data’][‘avg_rating’] ));
      }else {
      echo “<div class=’star-rating’></div>”;
      }
      ?>

      </div>
      <div class=”rowsub”>
      <?php echo $_product->get_price_html(); ?>
      </div>
      <div class=”rowsub”>
      <?php
      // reset global $product variable
      global $product;
      $product = $_product;
      woocommerce_template_loop_add_to_cart( array(
      ‘quantity’ => 1,
      ) );
      ?>
      ” class=”buttongap button” ><?php echo esc_html_e(‘Details’,’multivendorx’); ?>
      </div>
      <div style=”clear:both;”></div>
      </div>

      <?php
      }
      // reset again with global product
      global $product;
      $product = $single_pro;
      }
      }

    • #190550
      l.gan
      Participant

      Also, tell me please, how can I add a product image there?

    • #190625
      promita
      Keymaster

      @l.gan kindly share a detailed video describing what customization you are looking for and where you want it to be displayed so that we can help you accordingly

    • #190626
      l.gan
      Participant
      This reply has been marked as private.
    • #190783
      This reply has been marked as private.
      • #190918
        l.gan
        Participant
        This reply has been marked as private.
    • #190990

      Hi, can you share the page link so we can assist you further.

    • #191255
      l.gan
      Participant

      Hi, Please check your spam, it looks like my links (which you requested) ended up there

    • #190993
      l.gan
      Participant
      This reply has been marked as private.
    • #191307
      This reply has been marked as private.
    • #194213

      Hope your query is solved. We are closing this thread as of now. If you need help or face issue in future please open a new thread.

Viewing 9 reply threads

The topic ‘More offers-display the rating of the product itself instead of the store rating’ is closed to new replies.