Jump to content

Products accessories AJAX in fancybox window


Recommended Posts

Hello!

 

I have problem with too many accessories shown on product page, what causes slow loading of  pages.

 

What I need is to load product pages without products accessories block, but with button instead for example "Accessories".

 

After clicking on button I'd like to load Accessories with Ajax in fancybox frame.

 

How to do this?

 

Presta 1.6

 

 

Thank you in advance.

 

 

 

 

Link to comment
Share on other sites

To do this i cuted accessories block from product.tpl file and pasted it to accessories.tpl file.
 
Then in custom js file 
 
    $('#thebutton').click(function(){
        $('#thediv').load('{$tpl_dir}/accessories.tpl');
    });
 
but I've got 404. 
 
How to use $tpl_dir in js file? 
 
Thanks!

Link to comment
Share on other sites

To do this i cuted accessories block from product.tpl file and pasted it to accessories.tpl file.

 

Then in custom js file 

 

    $('#thebutton').click(function(){

        $('#thediv').load('{$tpl_dir}/accessories.tpl');

    });

 

but I've got 404. 

 

How to use $tpl_dir in js file? 

 

Thanks!

I found other js script

 

<script>
function theaccessories() {
       $.ajax({
                                        url: '{$img_dir}../accessories.tpl',
                                        type: 'get',
                                        data: 'ajax=true',
                                        success: function(data) {
                                                console.log('success');
                                                $('#thebutton').text(data);
                                        }
                                });
    return false;
    }
</script>
 
but now I have 403 forbidden... I think it is because of some folder restrictions..
 
How to solve this.
 
I appreciate any help :)
Link to comment
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
×
×
  • Create New...