Accessing product_id within template files and updating via ajax.
I have a product display page that contains n products within it. I have customized my template to access various product fields with calls such as
This has worked out quite nicely as these update via ajax when a different product is selected within the same product display.
In addition I have hacked drupal commerce to allow initial load of differing products based upon product_id in the url, ie http://mysite.com/node/688?product_id=5010 would load product display 688 with the product 5010 initially selected. Works great. However, a challenge rears its head!
I now need to set up 'email to a friend' and print pages. Using the pdf/email/print module I have gotten this working, and out of the box it works fine with my product_id load. However, I have no way of creating the link from a product_display node to the print page.
I need to be able to create a link such as this
With the product_id updating when a separate product in the same product display is updated. I cannot just use the URL parameter as that does not update when products are navigated within a product display.
Is there a somewhat straightforward way of hooking into the ajax that updates the product_display and applying it to a templated field?