Need help on technical part

Highlighted
New Member
4 0 0

Hi,

My website is https://www.theatomstores.com/

I am facing few issues followed as:

1) The buy now button in the 1st banner opens in new tab I want to make that happen in the same tab,

2) In the same banner section the size of banner appears to be small in mobile view or desktop view as compared to below images. (size of banner is much larger).

3) https://www.theatomstores.com/collections/mens-plain/products/be-simple-man-yellow?variant=293587103... ,In this link the product price is different when clicked on 3XL and 4XL, But the price changes when the user move to cart or refreshes the page.

 

How do I fix these issues, Please Help !!!

0 Likes
Excursionist
20 0 5

Hey there,

 

here are my thoughts on your questions.

 

1.  You have to Remove target="_blank" from the Button (a-Tag).  This has to be done in the slideshow theme-file

 

2.  This is not unusual and looks normal to me.

 

3. Usually updating the price for different Variants is done through javascript.

Your theme.js file looks slightly broken. Try to remove all the script tags in it.

 <script>
</script>

 

Before you start, make sure to backup your theme by duplicating it.

 

 

Hope that helps :-)

Was this answer helpful?
Leave a thumbs up, so others might find it faster.

Would you like to learn more about Shopify Development?
You might like my Youtube Channel
0 Likes
New Member
4 0 0

Hi, @Jan_F

 

Thank you for the solution, that you provided, among the 3 only the 1st part has been successfully done.

 

For the point 2, Please have a look at the navigational arrows on the first banner you will understand. I am attaching a screenshot for your reference.Screenshot_1.png

 

For Point 3, I tried removing script file but didnt find any resolution, I am attaching the theme.js file, Can you please have a look to it?

window.theme = window.theme || {};

theme.customerTemplates = (function() {

  function initEventListeners() {
    // Show reset password form
    $('#RecoverPassword').on('click', function(evt) {
      evt.preventDefault();
      toggleRecoverPasswordForm();
    });

    // Hide reset password form
    $('#HideRecoverPasswordLink').on('click', function(evt) {
      evt.preventDefault();
      toggleRecoverPasswordForm();
    });
  }

  /**
   *
   *  Show/Hide recover password form
   *
   */
  function toggleRecoverPasswordForm() {
    $('#RecoverPasswordForm').toggleClass('hide');
    $('#CustomerLoginForm').toggleClass('hide');
  }

  /**
   *
   *  Show reset password success message
   *
   */
  function resetPasswordSuccess() {
    var $formState = $('.reset-password-success');

    // check if reset password form was successfully submited.
    if (!$formState.length) {
      return;
    }

    // show success message
    $('#ResetSuccess').removeClass('hide');
  }

  /**
   *
   *  Show/hide customer address forms
   *
   */
  function customerAddressForm() {
    var $newAddressForm = $('#AddressNewForm');

    if (!$newAddressForm.length) {
      return;
    }

    // Initialize observers on address selectors, defined in shopify_common.js
    if (Shopify) {
      // eslint-disable-next-line no-new
      new Shopify.CountryProvinceSelector('AddressCountryNew', 'AddressProvinceNew', {
        hideElement: 'AddressProvinceContainerNew'
      });
    }

    // Initialize each edit form's country/province selector
    $('.address-country-option').each(function() {
      var formId = $(this).data('form-id');
      var countrySelector = 'AddressCountry_' + formId;
      var provinceSelector = 'AddressProvince_' + formId;
      var containerSelector = 'AddressProvinceContainer_' + formId;

      // eslint-disable-next-line no-new
      new Shopify.CountryProvinceSelector(countrySelector, provinceSelector, {
        hideElement: containerSelector
      });
    });

    // Toggle new/edit address forms
    $('.address-new-toggle').on('click', function() {
      $newAddressForm.toggleClass('hide');
    });

    $('.address-edit-toggle').on('click', function() {
      var formId = $(this).data('form-id');
      $('#EditAddress_' + formId).toggleClass('hide');
    });

    $('.address-delete').on('click', function() {
      var $el = $(this);
      var formId = $el.data('form-id');
      var confirmMessage = $el.data('confirm-message');

      // eslint-disable-next-line no-alert
      if (confirm(confirmMessage || 'Are you sure you wish to delete this address?')) {
        Shopify.postLink('/account/addresses/' + formId, {parameters: {_method: 'delete'}});
      }
    });
  }

  /**
   *
   *  Check URL for reset password hash
   *
   */
  function checkUrlHash() {
    var hash = window.location.hash;

    // Allow deep linking to recover password form
    if (hash === '#recover') {
      toggleRecoverPasswordForm();
    }
  }

  return {
    init: function() {
      checkUrlHash();
      initEventListeners();
      resetPasswordSuccess();
      customerAddressForm();
    }
  };
})();


<script>

  var selectCallback = function(variant, selector) {
   

    if (variant) {
      if (variant.featured_image) {
        var newImage = variant.featured_image;
        var mainImageEl = $('.image.featured img')[0];
        Shopify.Image.switchImage(newImage, mainImageEl, MinimalTheme.switchImage);
      }
      if (variant.price < variant.compare_at_price) {
        jQuery('#price-preview').html(Shopify.formatMoney(variant.price, "{{ shop.money_format }}") + " <del>" + Shopify.formatMoney(variant.compare_at_price, "{{ shop.money_format }}") + "</del>");
      }
      else {
        jQuery('#price-preview').html(Shopify.formatMoney(variant.price, "{{ shop.money_format }}"));
      }
      if (variant.available) {
        jQuery('#add-to-cart').removeAttr('disabled').removeClass('disabled').val({{ 'products.general.add_html' | t | json }});
      }
      else {
        jQuery('#add-to-cart').val({{ 'products.general.sold_out_html' | t | json }}).addClass('disabled').attr('disabled', 'disabled');
      }
    }
    else {
      jQuery('#add-to-cart').val({{ 'products.general.unavailable_html' | t | json }}).addClass('disabled').attr('disabled', 'disabled');
    }
    
        // BEGIN SWATCHES
if (variant) {
  var form = jQuery('#' + selector.domIdPrefix).closest('form');
  for (var i=0,length=variant.options.length; i<length; i++) {
    var radioButton = form.find('.swatch[data-option-index="' + i + '"] :radio[value="' + variant.options[i] +'"]');
    if (radioButton.size()) {
      radioButton.get(0).checked = true;
    }
  }
}
// END SWATCHES

  };

  jQuery(document).ready(function($){
    var optionSelectors = new Shopify.OptionSelectors("product-select", { product: {{ product | json }}, onVariantSelected: selectCallback, enableHistoryState: true });

    // Add label if only one product option and it isn't 'Title'.
    {% if product.options.size == 1 and product.options.first != 'Title' %}
      $('.selector-wrapper:eq(0)').prepend('<label>{{ product.options.first }}</label>');
    {% endif %}

  });

  </script>
  
<script>
    
	jQuery(function() {
  	jQuery('.swatch :radio').change(function() {
    var optionIndex = jQuery(this).closest('.swatch').attr('data-option-index');
    var optionValue = jQuery(this).val();
    jQuery(this)
      .closest('form')
      .find('.single-option-selector')
      .eq(optionIndex)
      .val(optionValue)
      .trigger('change');
  });
});
     
</script>

@Jan_F wrote:

Hey there,

 

here are my thoughts on your questions.

 

1.  You have to Remove target="_blank" from the Button (a-Tag).  This has to be done in the slideshow theme-file

 

2.  This is not unusual and looks normal to me.

 

3. Usually updating the price for different Variants is done through javascript.

Your theme.js file looks slightly broken. Try to remove all the script tags in it.

 <script>
</script>

 

Before you start, make sure to backup your theme by duplicating it.

 

 

Hope that helps :-)



theme.init = function() { theme.customerTemplates.init(); }; $(theme.init); <script type="text/javascript"> jQuery('div.increase items').on('click', 'input.qty', function(){ jQuery("[name='quantity']").trigger("click"); }); </script>

 

0 Likes