I'm making and slide in function to that product page. So when you are close to the bottom a static block will come visible.

That static block should have a link to an article the link is different from product to product and is set in by a custom product attribute.

The problem is to get that custom attribute into my .js can you help?

What I've done so far

  1. Call in an custom.js in page.xml
  2. Make static block, and call it in at the bottom on view.phtml

custom_att name is article link The js have only the "do somthing when you are close to bottom" function right now

jQuery(window).scroll(function() {
   if(jQuery(window).scrollTop() + jQuery(window).height() > jQuery(document).height() - 100) {
       alert("near bottom!");
  • custom attribute name and add js code too May 3, 2016 at 6:39
  • Ive added more data May 3, 2016 at 6:45

1 Answer 1


You can place this JS code anywhere to product page :

<script type="text/javascript">
    var article_link = "<?php echo $product->getArticleLink() ?>";

Now you can use javascript variable article_link anywhere on .js file, in your case it's custom.js

  • Every time i try I destoy all the other js on the site :O May 3, 2016 at 7:30
  • Can you send VIEW-SOURCE of this line var article_link = '<?php echo $product->getArticleLink() ?>'; May 3, 2016 at 7:34
  • What do you need? :D May 3, 2016 at 7:45
  • Do VIEW-SOURCE of the page (ctrl+U), and send me the above line. O/W send me product page link May 3, 2016 at 8:00
  • <script type="text/javascript"> var article_link = <br /> <b>Fatal error</b>: Call to a member function getartikelkode() on null in <b>/var/www/ifp.dk/public_html/app/design/frontend/ultimo/default/template/catalog/product/view.phtml</b> on line <b>534</b><br /> And a random product page is ifp.dev.magepartner.net/… May 3, 2016 at 8:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.