Product variation selection - ajax reload and the $content variable issue

I am struggling with a customized node template for a Commerc Kickstart product display (which includes a number of variations).

To display the page as I want, I am using various elements of $content, using render($content)[#####].

This all works find, except on changing produuct variations. The ajax reload updates certain elements of the page, but does not updatee the $content variable with the new product variation info (not does it unrender the rendered parts, so it treats the variable as already rendered).

I need to do on of the following. Either is fine (I see no great value in ajax reload compared to page refresh when is an uncomplicated page and on decent hosting).

1. find a way to get the $content variable refreshed on the ajax reload


2. force a page refresh instead of ajax

If someone can give me an idea how to approach either, it would be greatly appreciated.

Posted: Oct 2, 2014


mikeaja on October 3, 2014

Solved it another way. I realised the missing piece of my puzzle was the way Drupal treats forms. The ajax request from selecting a different product variation only refresehes form data, not the rest of the data (which I guess is logical). So I set up a template for the form.

This means the product display page theming is in two places (the product display content themed by a custom node-- file, and the product variation part themed by a custom form template.

Thanks also to the creator of this page http://themery.com/book/export/html/106 which provided a valuable insight into the form theming process.

I now have the styling control over the page I wanted (and also that I feel is necessary as a wider Commerce goal, to not have to rely on the layout already specified by $content).