Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Hide comparasion button if is on compare page

    General Discussion
    2
    2
    123
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      LilD last edited by

      Hi, how can I hide this button if that product is on the comparison list or still delete it?
      Is there a way?

      <template>
          <a
              :title="`${addTooltip}`"
              class="unset compare-icon text-right"
              @click="addProductToCompare">
              <i class="material-icons">compare_arrows</i>
          </a>
      </template>
      addProductToCompare: function () {
                      if (this.customer == "true" || this.customer == true) {
                          this.$http.put(
                              `${this.$root.baseUrl}/comparison`, {
                                  productId: this.productId,
                              }
                          ).then(response => {
                              window.showAlert(`alert-${response.data.status}`, response.data.label, response.data.message);
                          }).catch(error => {
                              window.showAlert(
                                  'alert-danger',
                                  this.__('shop.general.alert.error'),
                                  this.__('error.something_went_wrong')
                              );
                          });
      
      1 Reply Last reply Reply Quote 0
      • devansh-webkul
        devansh-webkul last edited by

        Hi @LilD,

        You need to check in the local storage for the guest user and in the database (velocity_customer_compare_products table) for customer users.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post