Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Support thread for JcM No Stock Header Tags-V1.0


JcMagpie

Recommended Posts

V1.0 by JcMagpie based on idea by BrockleyJohn

A simple header_tag module to let you disable buy buttons for products with zero stock.

This is a standalone add-on and makes no changes to core files.

That’s it simply copy all files of the into relevant sections and go to admin modules /header tags and install.

Has been tested on Phoenix 1.0.2.2 only.

can be seen on thi test site

 

You can expand it function if required.

a) change class success to danger to make button red?

b) replace text from buy and add to cart, to no stock?

That's it enjoy.

image.png.b1f80da6e4053e41a5e8e6af43586692.png

 

image.png.eed4a6c6e36f6e63e7adc350c4a34efa.png

 

 

Link to comment
Share on other sites

  • 6 months later...

I have tried implementing this on the latest Phoenix 1.0.5.5 and there are some issues with it. It correctly changes the buy button to a colour and with the no stock text, but it also changes all the other buy buttons where there is stock to the same colour without any text/image. The buttons for the in stock items are active so it appears to be just a display issue. It also effects the other buttons on the page, for instance, the index page with the contact us and existing customers log in buttons that also become red with no text.

Has anyone else seen this behaviour?

If i only have in stock items, then the buttons behave as expected

Is there another way to disable the "buy now" and "add to cart buttons" when the item is out of stock?

nostock-index.jpg

Edited by sjdmedia-ltd
Link to comment
Share on other sites

  • 3 weeks later...

Yes, same issue with v1.0.58
Buy now cart icon disappears and button changes to the same color as defined for the no stock button.
Other than that, it's working as it should.

Have you found a fix for that?

Patty

Link to comment
Share on other sites

  • 2 weeks later...

After hours of trying to figure this out (mind you, I'm not a coder, I think I finally found a fix for the above mentioned issues.

This is my code. If someone could try it and confirm it's really working, I'll update the addon.
Just replace the code between the script tags.

File: includes/modules/header_tags/ht_jcm_no_stock.php

<script>
  $(document).ready(function() {
    $('*[data-in-stock]').filter(function () {
	  return $(this).data('in-stock') <= 0;
	}).each(function() {
	  $(this).addClass('disabled fas fa-ban text-danger').text('$no_stock_text'); // use to change appearance
	  $(this).attr('disabled', true);
	//  $('btn-product-listing.btn-buy').addClass('text-white').text('$no_stock_text');
	  // $('.btn.btn-light').text('');
	//  $('.btn.btn-success.btn-product-info').addClass('text-white').text('$no_stock_text');
	  $('.btn.btn-success.btn-product-info').removeClass('btn-success text-danger').addClass('btn btn-product-info text-white $no_stock_color').text('$no_stock_text');	  
	  // $('.btn.btn-light').removeClass('btn btn-light').addClass('btn $no_stock_color');
	  // $(this).prepend('<span>{$no_stock_text}</span>');
	});

  });  
</script>

 

Edited by Patty

Patty

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...
27 minutes ago, Peper said:

@JcMagpie @Patty

I've found something wrong with this.
For some products the Out of Stock button shows on products_info page, however my admin shows that qty is in stock, date is empty

No worries, found Certified addon from Raiwa :)

Getting the Phoenix off the ground

Link to comment
Share on other sites

Sorry for the late response. I've been away for the past few days. And JcMagpie seems to be MIA, I hope he's alright.

I'll try to replicate the issue when I find some free time. But glad you've found an alternative for a supported addon. 👍

Patty

Link to comment
Share on other sites

11 hours ago, Patty said:

But glad you've found an alternative for a supported addon. 👍

You can't go wrong with an addon from @raiwa.  @burt also has one if you contact him.

 

Edited by peterpil19

CE PHOENIX SUPPORTER

Support the Project, go PRO and get access to certified add ons

Full-time I am a C-suite executive of a large retail company in Australia. In my spare time, I enjoying learning about web-design.

Download the latest version of CE Phoenix from gitHub here

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...