Jump to content

Help, problem Jquery integration on smarty on product page


ubik

Recommended Posts

Hello

Its quite hell for me didn't succes to debug my page

I have setup so a full custum product.tpl page with lot of jquery animation (action when page load)

 

So i have completly rebuild the product.tpl page and setup my jquery.

I succefully implement jquery on _js file but have a probleme

 

i have script like this : when we clic on button back for exemple, it fade some coponent then redirect to the last page

 

The script is like this :

$('#gamme').click(function() {
  $('#pageinfo').animate({marginLeft: "270",opacity: 'toggle'}, 500);
  $('#breadcrumb').delay("100").animate({marginLeft: "270",opacity: 'toggle'});
  $('#fullscreen').delay("100").fadeOut(800);
  $('#print').delay("200").fadeOut(800);
  $('#sitemap').delay("300").fadeOut(800);
  $('#contentsubbox').animate({marginTop: "50",opacity: 'toggle'}, 800, function() {window.location = ('page.php?puid={category_id}')});});

 

The probleme is :

If i put this code directly on product.tpl page at the end on <script></script> it crash the page. So the other way is to put this code on .js file, but in this case i can't grab my category_id for redirection

 

Is there someone who can help me ? looking for a while

Thanks

Link to comment
Share on other sites

Just a tip that you could use. Store the category id in a hidden input and give the input a uniquie id. Grab that ID via jQuery.

 

So in your product.tpl create a hidden input.

 

<input type="hidden" name="categoryID" id="categoryID" value="{category_id}" />

 

Amend the jQuery -

 

$('#contentsubbox').animate({marginTop: "50",opacity: 'toggle'}, 800, function() {window.location = ('page.php?puid=' + $('#categoryID').val())});});

 

That way you should be able to place the jQuery code in a separate file.

  • Like 1
Link to comment
Share on other sites

<input type="hidden" name="categoryID" id="categoryID" value="{$category->id}" />

 

With this one running well, so much thanks it was not the way that i was supposed to past variable to js file but running well ! thanks :)

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...