Infinite scroll not load the script from listing_img_title.php

  • Posts: 427
  • Thank you received: 19
5 years 4 months ago #308892

-- HikaShop version -- : 4.2.0

Hi, I've activated the feature "Infinite scroll" in the product page but I have the following problem.I have a script in who does not want to load from listing_img_title.php. Is there any way I can load the script?

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 years 4 months ago #308904

Hi,

Then, you should also edit the listing_div.php view file to add some javascript code after or before the code:

o.removeClass(container, 'loading');
		container.loading = false;
		window.localPage.infiniteScrollPage++;
so that you can do some processing after the infinite scroll system adds more products to the page.

The following user(s) said Thank You: neo191987

Please Log in or Create an account to join the conversation.

  • Posts: 427
  • Thank you received: 19
5 years 4 months ago #308945

Thanks, I managed to add it, but the following problem arose. Some of the scripts require a different ID for the purpose I use product_id, but when I add it it does not change. Any idea? Thanks in advance.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 years 4 months ago #308946

Hi,

Well, I don't know. Without looking at the code and the situation it's hard to say anything.

Please Log in or Create an account to join the conversation.

  • Posts: 427
  • Thank you received: 19
5 years 4 months ago #309019

I found a simple solution to add it as information if someone needs it. To run the code correctly put it in listing_img_title.php

<?php if(((int)$this->params->get('infinite_scroll', 0) == 0)) { ?> // Infinite Scroll - No
<script type="text/javaScript">
script....
</script>
<?php } ?>
<?php if(((int)$this->params->get('infinite_scroll', 0) == 1)) { ?> // Infinite Scroll - Yes
<script type="text/javaScript">
setTimeout(function(){ var script = document.createElement('script'); script.type = 'text/javascript'; script.text = " script... "; jQuery('.hikashop_products_listing').append(script);  }, 100);
</script>
<?php } ?>

This create the script for each product and loads the correct ID. :)

Last edit: 5 years 4 months ago by neo191987.
The following user(s) said Thank You: nicolas

Please Log in or Create an account to join the conversation.

Time to create page: 0.063 seconds
Powered by Kunena Forum