I have a website set up with the Fusion theme, and Ubercart Ajax Attribute Calculations is not working as expected. I switched my theme momentarily to Garland and it did work then, so it's definitely something to do with the Fusion theme, or a node-product.tpl.php file in my Fusion theme.

The UC AAC module page states

Product node divs must have an identifier in the same form as the garland theme. For instance, trying to use bluemarine theme without adding the following code to node.tpl.php will result in the module not working. id="node-<?php print $node->nid; ?>"

I checked my node.tpl.php in my fusion core folder and in my fusion sub-theme folder, and I do have this line in both copies of the file:

<div id="node-<?php print $node->nid; ?>" class="node <?php print $node_classes; ?>">

I also have a node-product.tpl.php file in my fusion sub-theme folder, which has this line of code:

<div id="node-<?php print $node->nid; ?>" class="node clear-block <?php print $node_classes; ?>">

In my node-product.tpl.php file, this is the code that displays the product price on the product page. This is a file that was inherited from a prior developer for the website in question, and I am wondering if perhaps there is something in this code that is keeping the Ajax price change from working:

                <div class="productpage-right">
                <div class="pricecluster">

                                            <?php $lp = (int)$list_price; if ($lp != 0) { ?>
                    <div><span style="text-decoration:line-through;">Regular Price: $<?php print substr($list_price,0,-3); ?></span></div>
                                            <?php } ?>
                    <div><span style="font-weight:bold">Special Price: <span style="color:#5c9001; font-size:18px">$<?php print substr($sell_price,0,-3); ?></span></span></div>
                    <?php print $fusion_uc_add_to_cart; ?>
                                            $current_rating = votingapi_select_results(array('content_id' => $node->nid, 'function' => 'average'));
                                            $current_rating = $current_rating[0]['value'];
                                            $converted = $current_rating / 20;
                                            $converted = round($converted,1);

                                            <div class="ratingcluster">
                                            <div>Average Customer Rating:</div>
                                            <?php print theme('fivestar_static', $current_rating, '5'); ?>
                                            <?php if ($converted == 0): ?>
                                                <div>- Not yet rated -</div>
                                            <?php else: ?>
                                                <div xmlns:v="http://rdf.data-vocabulary.org/#" typeof="v:Review-aggregate">
                                                    <span property="v:itemreviewed" style="display:none"><?php print $node->title; ?></span>
                                                    <span rel="v:rating">
                                                        <span typeof="v:Rating">
                                                            <div><a href="#reviews"><span property="v:rating"><?php print $converted ?></span> stars out of 5 stars</a></div>
                                                    <?php if ($node->comment_count > 0): ?>
                                                        <?php $verbage = ($node->comment_count > 1) ? " Reviews" : " Review"; ?>
                                                        <div><a href="#reviews">Based on <span property="v:count"><?php print $node->comment_count.$verbage; ?></span></a></div>
                                                    <?php endif; ?> 
                                            <?php endif; ?>


When I remove the node-product.tpl.php file from the server, the AJAX price change does work in my Fusion theme, so I think it must have something to do with that block of code above. Can anyone tell me which part might be causing the issue?



Fixed it...

I changed this:

<div><span style="font-weight:bold">Special Price: <span style="color:#5c9001; font-size:18px">$<?php print substr($sell_price,0,-3); ?></span></span></div>

to this:

<div><span style="font-weight:bold">Special Price: <span style="color:#5c9001; font-size:18px"><?php print $fusion_uc_sell_price; ?></span></span></div>

(which is the sell price code taken from the original fusion node-product.tpl.php file, one version of which can be found here: http://drupalcode.org/project/fusion.git/blob/c2189d8:/fusion_starter/node-product.tpl.php)

I'm still open to any suggestions to get the original version of the code to work, and am also curious whether anyone can explain what the other code's purpose was.

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.