Jump to content
JcMagpie

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

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

 


 

Share this post


Link to post
Share on other sites
Posted (edited)

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
Posted (edited)

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

Share this post


Link to post
Share on other sites

@Patty Thanks, just what i was looking for

Seems there is no out of stock button or message in stock Phoenix.


Getting the Phoenix off the ground

Share this post


Link to post
Share on other sites

@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


Getting the Phoenix off the ground

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
Posted (edited)
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×