- Posts: 431
- Thank you received: 19
Infinite scroll not load the script from listing_img_title.php
7 years 2 months ago #308892
by neo191987
-- 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?
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.
7 years 2 months ago #308904
by nicolas
Replied by nicolas on topic Infinite scroll not load the script from listing_img_title.php
Hi,
Then, you should also edit the listing_div.php view file to add some javascript code after or before the code:
so that you can do some processing after the infinite scroll system adds more products to the page.
Then, you should also edit the listing_div.php view file to add some javascript code after or before the code:
Code:
o.removeClass(container, 'loading');
container.loading = false;
window.localPage.infiniteScrollPage++;
The following user(s) said Thank You: neo191987
Please Log in or Create an account to join the conversation.
7 years 2 months ago #308945
by neo191987
Replied by neo191987 on topic Infinite scroll not load the script from listing_img_title.php
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.
7 years 2 months ago #308946
by nicolas
Replied by nicolas on topic Infinite scroll not load the script from listing_img_title.php
Hi,
Well, I don't know. Without looking at the code and the situation it's hard to say anything.
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.
7 years 2 months ago - 7 years 2 months ago #309019
by neo191987
Replied by neo191987 on topic Infinite scroll not load the script from listing_img_title.php
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
This create the script for each product and loads the correct ID.
Code:
<?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: 7 years 2 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.217 seconds