Forums / Addon Admin Tools / Ajax Back In Stock (re-written version of Conor/Ceon's Back In Stock Module)

Ajax Back In Stock (re-written version of Conor/Ceon's Back In Stock Module)

Views: 35,770

Results 141 to 147 of 147
14 Oct 2018, 12:05 PM
#141
billj avatar

billj

New Zenner

Join Date:
Sep 2013
Location:
Devon, UK
Posts:
88
Plugin Contributions:
1

Ajax Back In Stock (re-written version of Conor/Ceon's Back In Stock Module)

P.S. Using PHP 7.1 on the new server, if that makes a difference. I can't see anything in the logs.

14 Oct 2018, 2:51 PM
#142
bislewl avatar

bislewl

Totally Zenned

Join Date:
Dec 2011
Location:
Wisconsin, USA
Posts:
674
Plugin Contributions:
12

Re: Ajax Back In Stock (re-written version of Conor/Ceon's Back In Stock Module)

The product listing pages use a single game box the image, name, and product are populated upon clicking the link. My guess is that the template being used isn't using the same classes as what it's set up for.

Could you please copy and paste the HTML as <code> from a single product on the product listing page into a reply here?

14 Oct 2018, 5:36 PM
#143
billj avatar

billj

New Zenner

Join Date:
Sep 2013
Location:
Devon, UK
Posts:
88
Plugin Contributions:
1

Re: Ajax Back In Stock (re-written version of Conor/Ceon's Back In Stock Module)

bislewl:

Could you please copy and paste the HTML as <code> from a single product on the product listing page into a reply here?
Thanks for the quick response, bislewl. This is the code I think you're asking for:

  <tr  class="productListing-even">
   <td class="productListing-data"><a href="http://saabitstest.saab9000.com/saabits">SAABits</a></td>
   <td class="productListing-data" align="center"><a href="http://saabitstest.saab9000.com/all/saab-9000-turbo-service-kit-1992-1993-a-c?cPath=256_260&"><img src="images/svk312a.png" alt="Saab 9000 Turbo service kit 1992-1993 (A/C)" title=" Saab 9000 Turbo service kit 1992-1993 (A/C) " width="150" height="113" class="listingProductImage" /></a></td>
   <td class="productListing-data"><h3 class="itemTitle"><a href="http://saabitstest.saab9000.com/all/saab-9000-turbo-service-kit-1992-1993-a-c?cPath=256_260&">Saab 9000 Turbo service kit 1992-1993 (A/C)</a></h3><div class="listingDescription"></div></td>
   <td class="productListing-data" align="right"><span class="productBasePrice">£27.92</span><br /><br /><a href="http://saabitstest.saab9000.com/all/saab-9000-turbo-service-kit-1992-1993-a-c?cPath=256_260&">... more info</a><br /><span class="cssButton normal_button button  button_sold_out" onmouseover="this.className='cssButtonHover normal_button button  button_sold_out button_sold_outHover'" onmouseout="this.className='cssButton normal_button button  button_sold_out'"> Sold Out </span><div class="product_detail"><a class="back-in-stock-listing-popup-link" href="#back-in-stock-popup-wrapper">Email me when back in stock</a><input type="hidden" name="bis-product-id" value="611" class="bis-product-id" /></div><br /><br /></td>
   <td class="productListing-data">SVK312A</td>
  </tr>

Note that I have modified the code slightly so it always shows the "Sold Out" button even when BIS is enabled. The problem shows up whether or not my modification is in place. I suspect you are correct - the template is based on the "Responsive All Business" template, which is quite old now.

15 Oct 2018, 12:17 AM
#144
bislewl avatar

bislewl

Totally Zenned

Join Date:
Dec 2011
Location:
Wisconsin, USA
Posts:
674
Plugin Contributions:
12

Re: Ajax Back In Stock (re-written version of Conor/Ceon's Back In Stock Module)

BillJ:

Note that I have modified the code slightly so it always shows the "Sold Out" button even when BIS is enabled. The problem shows up whether or not my modification is in place. I suspect you are correct - the template is based on the "Responsive All Business" template, which is quite old now.

You appear to be correct. Below is the JavaScript that is called when the link is clicked.

  $('a.back-in-stock-listing-popup-link').click(function (event) {
        event.preventDefault();
        var productDiv = $(this).parent();
        $('#contact_messages').empty();
        $('#back-in-stock-product-image img').attr('src', $(productDiv).find('.listingProductImage').attr('src'));
        if ($(productDiv).find('h3.itemTitle')) {
            $('#productName').html($(productDiv).find('h3.itemTitle').text());
        } else {
            $('#productName').html($(productDiv).find('span.itemTitle').text());
        }
        $('input[name="product_id"]').attr('value', $(productDiv).find('input[name="bis-product-id"]').attr('value'));
        $.fancybox({
            href: '#back-in-stock-popup-wrapper',
            afterShow: function () {
                $(document).on('submit', '#back-in-stock-popup-wrapper form[name="back_in_stock"]', function () {
                    $.post('ajax/back_in_stock_subscribe_pop_up.php', $('#back-in-stock-popup-wrapper form[name="back_in_stock"]').serialize(), function (data) {
                        $('#contact_messages').html(data);
                        if ($('.messageStackSuccess').length) {
                            $('.back-in-stock-popup-wrapper-button-row').hide();
                            $('.back-in-stock-popup-content-wrapper').hide();
                        }
                    });
                    return false;
                });
            }
        });
    });

So personally I would first try is in: catalog/includes/templates/YOUR_TEMPLATE/jscript/jquery/jquery_back_in_stock.js

Change: ```
var productDiv = $(this).parent();

To:```
var productDiv = $(this).parent().parent().parent();
15 Oct 2018, 12:09 PM
#145
billj avatar

billj

New Zenner

Join Date:
Sep 2013
Location:
Devon, UK
Posts:
88
Plugin Contributions:
1

Re: Ajax Back In Stock (re-written version of Conor/Ceon's Back In Stock Module)

bislewl:

So personally I would first try is in: catalog/includes/templates/YOUR_TEMPLATE/jscript/jquery/jquery_back_in_stock.js

Change: ```
var productDiv = $(this).parent();

> To:```
var productDiv = $(this).parent().parent().parent();

Thanks, bislewl! That sorted it out. And now I understand where it's getting the image and description from, I can remember to revisit that Javascript if I ever change the listing template.
So to summarise, it wasn't a bug in the module but rather it was due to my template being non-standard.

15 Oct 2018, 1:45 PM
#146
bislewl avatar

bislewl

Totally Zenned

Join Date:
Dec 2011
Location:
Wisconsin, USA
Posts:
674
Plugin Contributions:
12

Re: Ajax Back In Stock (re-written version of Conor/Ceon's Back In Stock Module)

BillJ:

Thanks, bislewl! That sorted it out. And now I understand where it's getting the image and description from, I can remember to revisit that Javascript if I ever change the listing template.
So to summarise, it wasn't a bug in the module but rather it was due to my template being non-standard.

No Problem!

I think, yes it's part the template, but I should have a better way to call the name and image, because each template may change that. I made a note to add that in the next release. Along with a few other improvements!

13 Dec 2020, 8:52 AM
#147
markau avatar

markau

New Zenner

Join Date:
Oct 2020
Location:
australia
Posts:
31
Plugin Contributions:
0

Re: Ajax Back In Stock (re-written version of Conor/Ceon's Back In Stock Module)

Does this work with zen cart 1.5.7?