Banner Logo

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

Issue wit the cart page after the recent update.

MultivendorX Pro

Resolved
Viewing 25 reply threads
  • Author
    Posts
    • #192665
      Dhruv Jha
      Participant

      Hi, I wanted to bring to your attention that when multiple products from different vendors are added to the cart, the layout of the cart page becomes distorted.

      https://prnt.sc/x5CjIqa7MHbM
      https://prnt.sc/GWGJT3qv8u3y

    • #192679

      Hi Dhruv, sorry for the inconvenience.

      We have reported the issue. Our team is looking into this. You can track the progress of this issue from here https://github.com/multivendorx/MultiVendorX/issues/398

    • #192746
      Chris
      Participant

      Hi there, may I know how to display the product sold by Vendor_Name on top of each product?

    • #192796

      In order to display vendor_name at the top of Product_name, add this code in the function.php of your theme

      /**
      * Add Sold by Vendor text
      */
      public function mvx_single_product_summary() {
      global $post;
      if (get_mvx_vendor_settings(‘display_product_seller’, ‘settings_general’) && apply_filters(‘mvx_sold_by_text_after_products_shop_page’, true, $post->ID)) {
      $vendor = get_mvx_product_vendors($post->ID);
      if ($vendor) {
      $sold_by_text = apply_filters(‘mvx_sold_by_text’, __(‘Sold By’, ‘multivendorx’), $post->ID);
      echo ‘permalink . ‘”>’ . $sold_by_text . ‘ ‘ . $vendor->page_title . ‘‘;
      do_action(‘after_sold_by_text_shop_page’, $vendor);
      }
      }
      }

      add_action(‘woocommerce_before_single_product_summary’, array($this, ‘mvx_single_product_summary’), 25);

    • #192814
      Chris
      Participant

      Hi, thanks for helping. However, the code results in critical error. Error log: syntax error, unexpected token “public”, expecting end of file. Also, if I do not enable Display Product Sellers in General Settings, how do I display vendor’s store name on top of the product_name at cart and checkout pages? Can you help to complete the following codes if the following codes are usable?

      /**
      * Add Sold by vendor’s store_name text on top of Cart & Checkout Pages
      */
      add_action( ‘woocommerce_before_single_product_summary’, ‘display_vendor_store_name_in_single_product_summary’);

      function display_vendor_store_name_in_single_product_summary() {
      // Get the current cart instance
      $cart = WC()->cart;

      // Array to store the vendor IDs
      $vendor_ids = array();

      // Loop through each cart item
      foreach ($cart->get_cart() as $cart_item_key => $cart_item) {
      // Get the product ID
      $product_id = $cart_item[‘product_id’];

      // Get the vendor ID for the product
      $vendor_id = get_mvx_product_vendors($product_id)->id;

      // Add the vendor ID to the array if it doesn’t already exist
      if (!in_array($vendor_id, $vendor_ids)) {
      $vendor_ids[] = $vendor_id;
      }
      }

      // Loop through the vendor IDs and display the vendor’s store name
      if (!empty($vendor_ids)) {
      foreach ($vendor_ids as $vendor_id) {
      $store_name = to_be_modified
      }
      }

    • #192897

      Our team is looking into this.
      Kindly provide them with some time.

    • #192901
      Chris
      Participant

      Okay, thank you

      • #192940

        Hi Chris, thank you for your time and consideration. we tried to resolve your problems with most easy way and fully tested, as following…

        ==================

        for product page
        add this code on wp-content/themes/yourtheme/functions.php

        <?php
        function mvx_after_add_to_cart_form() {
        global $post;
        if ( apply_filters(‘mvx_sold_by_text_after_products_shop_page’, true, $post->ID)) {
        $vendor = get_mvx_product_vendors($post->ID);
        if ($vendor) {
        $sold_by_text = apply_filters(‘mvx_sold_by_text’, __(‘Sold By’, ‘multivendorx’), $post->ID);
        echo ‘permalink . ‘”>’ . $sold_by_text . ‘ ‘ . $vendor->page_title . ‘‘;
        do_action(‘after_sold_by_text_shop_page’, $vendor);
        }
        }
        }
        add_action(‘woocommerce_before_single_product_summary’, ‘mvx_after_add_to_cart_form’, 25);

        add_action(‘woocommerce_shop_loop_item_title’, ‘mvx_after_add_to_cart_form’, 6);
        ?>

        =====================================
        for checkout page
        copy:
        wp-content/plugins/woocommerce/templates/checkout/review-order.php to wp-content/themes/yourtheme/woocommerce/templates/checkout/review-order.php

        The copied file will now override the WooCommerce default template file.

        take out the following code from copied file, line no 40.

        “<?php echo wc_get_formatted_cart_item_data( $cart_item ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>”

        and move it to above line no 30. (before this code)”<?php echo wp_kses_post( apply_filters( ‘woocommerce_cart_item_name’, $_product->get_name(), $cart_item, $cart_item_key ) ) . ‘ ‘; ?>”

        ======================================
        for cart page
        copy:
        wp-content/plugins/woocommerce/templates/cart/cart.php to wp-content/themes/yourtheme/woocommerce/templates/cart/cart.php

        The copied file will now override the WooCommerce default template file.

        take out the following code from copied file, line no 88.

        “// Meta data.
        echo wc_get_formatted_cart_item_data( $cart_item ); // PHPCS: XSS ok.”

        and move it to above line no 79. (before this code)”if ( ! $product_permalink ) {
        echo wp_kses_post( apply_filters( ‘woocommerce_cart_item_name’, $_product->get_name(), $cart_item, $cart_item_key ) . ‘ ‘ );”

    • #193200
      Chris
      Participant

      Hi kundandualcube, thanks for helping. I followed the instructions but the product_name still could not appear. I tried to resolve it but I cant make it. Could you please help me?
      1) For this line of code:
      echo ‘permalink . ‘”>’ . $sold_by_text . ‘ ‘ . $vendor->page_title . ‘‘;
      Since copying the codes from here will result in different syntax, I have to manually change “ ” and ‘’ to ” ” and ‘ ‘ respectively. I’ve tried to change them to echo ‘permalink . ‘”>’ . $sold_by_text . ‘ ‘ . $vendor->page_title . ”; but it shows another syntax error. So I tried to interpret it and change the syntax as shown in line 7 ( https://prnt.sc/AO_HT1bI-AMC ), can you please help me double check if I’ve interpret it wrongly or what should I change?

      • #193214
        Chris
        Participant

        It’s vendor_name, not product_name, sorry about that typo.

    • #193205
      Chris
      Participant

      2) For template overriding, just to double confirm, is it that I have to copy to wp-content/themes/yourtheme/woocommerce/templates/checkout/review-order.php or wp-content/themes/yourtheme/woocommerce/checkout/review-order.php ?
      3) For the /yourtheme, should I use my parent theme or my child theme? Because last time when I tried to override some php files related to woocommerce, (for eg. wp-content/themes/yourtheme/woocommerce/myaccount/dashboard.php), the override only works if I copy the file to my parent theme. It doesn’t work if I copy it to my child theme.
      4) For checkout page, I noticed that my parent theme has its checkout directory with review-order.php file (wp-content/themes/myparenttheme/woocommerce/checkout/review-order.php), so I guess I have to edit this file instead right? I compared both review-order.php file from the original woocommerce directory and my parent theme directory, edited the file and added the code you instructed to line 65, (before this code) <div class=”check-name” <?php echo apply_filters( ‘woocommerce_cart_item_name’, $_product->get_name(), $cart_item, $cart_item_key ) . ‘ ‘; ?></div> . The attached file below is the review-order.php file from my parent theme. Can you please help me double check if I’m doing it correctly?

    • #193207
      Chris
      Participant
      This reply has been marked as private.
    • #193210
      Chris
      Participant
      This reply has been marked as private.
      • #193238

        Hi Chris, our replies are inline :
        1. 1) For this line of code:
        echo ‘permalink . ‘”>’ . $sold_by_text . ‘ ‘ . $vendor->page_title . ‘‘;
        Since copying the codes from here will result in different syntax, I have to manually change “ ” and ‘’ to ” ” and ‘ ‘ respectively. I’ve tried to change them to echo ‘permalink . ‘”>’ . $sold_by_text . ‘ ‘ . $vendor->page_title . ”; but it shows another syntax error. So I tried to interpret it and change the syntax as shown in line 7 ( https://prnt.sc/AO_HT1bI-AMC ), can you please help me double check if I’ve interpret it wrongly or what should I change?

        >> sorry from my side, I didn’t double check my replay and our website took that line as a hyperlink you can copy the code from attached file.

        2. For template overriding, just to double confirm, is it that I have to copy to wp-content/themes/yourtheme/woocommerce/templates/checkout/review-order.php or wp-content/themes/yourtheme/woocommerce/checkout/review-order.php ?

        >> yes, the template can be overridden by copying it to yourtheme/woocommerce/checkout/review-order.php

        3. For the /yourtheme, should I use my parent theme or my child theme? Because last time when I tried to override some php files related to woocommerce, (for eg. wp-content/themes/yourtheme/woocommerce/myaccount/dashboard.php), the override only works if I copy the file to my parent theme. It doesn’t work if I copy it to my child theme.

        >> You have to apply the changes in the active theme. Therefore if the child theme is activated now, then you need to apply the changes there.

        4. For checkout page, I noticed that my parent theme has its checkout directory with review-order.php file (wp-content/themes/myparenttheme/woocommerce/checkout/review-order.php), so I guess I have to edit this file instead right?

        >> Sorry, for this, it will be better to ask the theme author and ask them whether that code will impact any flow?
        Otherwise you can also add this code and see for yourself.

    • #193324
      Chris
      Participant

      Thanks for the file. The snippets are working on product pages but I only need it for cart and checkout pages. For the overriding solutions provided, it causes my product name thrown to the bottom and nothing else displayed unless the ‘Display product seller’ option is enabled. What I wanted was something like this
      https://prnt.sc/aIf4MoIYL1jh

    • #193325
      Chris
      Participant
    • #193326
      This reply has been marked as private.
    • #193391

      @Chris, the flow you are looking for, doesn’t require any code.
      If you have enabled “Sold by” (https://prnt.sc/3UjlI9lTMPSW), then at the checkout page you will already have the seller divided as https://prnt.sc/VHQQBdYXUX_f

      Can you please check again.

    • #193415
      Chris
      Participant

      Hmm this is weird, never knew it was there at all since my first touch on it. As you can see, https://prnt.sc/deXBC5ltLy5L , “Sold by” is enabled.

    • #193416
      Chris
      Participant

      However, its still the same when using storefront theme and all other plugins deactivated in my staging site except MVX, MVX Pro and WooCommerce
      https://prnt.sc/MaP663gwoz-Q

    • #193417
      Chris
      Participant

      Even live site using storefront theme with quite a few product test also have this issue
      https://prnt.sc/ulbqrWRd_mN0

    • #193418
      Chris
      Participant

      Btw where does the customer support show? The customer support I meant was from here https://prnt.sc/deXBC5ltLy5L
      Can you send me some front end/back end screenshots from your end as well? Because I cant found it on my end also…

    • #193451

      @Chris We have checked on our end again, if the Display product seller option is enabled then on the cart the products from different sellers will be separated https://prnt.sc/Def6KY_cKoSe
      Can you please share temporary admin access to your staging site so we can check on your site?

    • #193460
      Chris
      Participant
      This reply has been marked as private.
    • #193490
      This reply has been marked as private.
    • #193515
      Chris
      Participant

      Hi, I cannot see the private content as this thread was not opened by me. I’ve created a new thread, can you please copy your replies at https://multivendorx.com/support-forum/topic/divided-seller-name-on-top-of-each-product-in-cart-checkout-page/

    • #193532
    • #195558

      Its been a while and we have not heard back from you. We presume you issue is solved now. We are closing this thread. If you need help or face issue in future please open a new thread.

    • #193414
      Chris
      Participant

      Hmm this is weird, never knew it was there at all since my first touch on it. As you can see, https://prnt.sc/deXBC5ltLy5L , “Sold by” is enabled and its still the same when using storefront theme
      https://prnt.sc/ulbqrWRd_mN0

Viewing 25 reply threads

The topic ‘Issue wit the cart page after the recent update.’ is closed to new replies.