Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Jun 2009
    Posts
    617
    Plugin Contributions
    0

    Default Write a Reviews button

    Is there a way to change this If statement, so that both the Read Reviews button *AND* the Write a Reviews button both appear, even if there is at least 1 review?

    Currently it seems that if you have 1 review or more the Write a Reviews button will not display.
    Thank you,
    autoace

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Write a Reviews button

    The if that controls it is:
    Code:
    <!--bof Reviews button and count-->
    <?php
      if ($flag_show_product_info_reviews == 1) {
        // if more than 0 reviews, then show reviews button; otherwise, show the "write review" button
        if ($reviews->fields['count'] > 0 ) { ?>
    <div id="productReviewLink" class="buttonRow back"><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS, zen_get_all_get_params()) . '">' . zen_image_button(BUTTON_IMAGE_REVIEWS, BUTTON_REVIEWS_ALT) . '</a>'; ?></div>
    <br class="clearBoth" />
    <p class="reviewCount"><?php echo ($flag_show_product_info_reviews_count == 1 ? TEXT_CURRENT_REVIEWS . ' ' . $reviews->fields['count'] : ''); ?></p>
    <?php } else { ?>
    <div id="productReviewLink" class="buttonRow back"><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, zen_get_all_get_params(array())) . '">' . zen_image_button(BUTTON_IMAGE_WRITE_REVIEW, BUTTON_WRITE_REVIEW_ALT) . '</a>'; ?></div>
    <br class="clearBoth" />
    <?php
      }
    }
    ?>
    <!--eof Reviews button and count -->
    You could change it from an IF to display both ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Jun 2009
    Posts
    617
    Plugin Contributions
    0

    Default Re: Write a Reviews button

    Just to be clear the If statement that I need to modify is:

    PHP Code:
    if ($reviews->fields['count'] > ) { ?> 
    Correct?
    Thank you,
    autoace

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Write a Reviews button

    That is correct, the first part of the IF is for the Reviews and the second part is for the Write Review ...

    You could comment out the IF then the ELSE then the closing bracket and both would run ... or take the IF out complete and just leave the code ...

    Be sure to use your templates and overrides for this ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Write a Reviews button

    Another way to do this is to show only the Write when there are no reviews and both the Read and Write when there are reviews:
    Code:
    <!--bof Reviews button and count-->
    <?php
      if ($flag_show_product_info_reviews == 1) {
        // if more than 0 reviews, then show reviews button; otherwise, show the "write review" button
        if ($reviews->fields['count'] > 0 ) { ?>
    <div id="productReviewLink" class="buttonRow back"><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS, zen_get_all_get_params()) . '">' . zen_image_button(BUTTON_IMAGE_REVIEWS, BUTTON_REVIEWS_ALT) . '</a>'; ?></div>
    <br class="clearBoth" />
    <p class="reviewCount"><?php echo ($flag_show_product_info_reviews_count == 1 ? TEXT_CURRENT_REVIEWS . ' ' . $reviews->fields['count'] : ''); ?></p>
    <?php } // was an else ?>
    <div id="productReviewLink" class="buttonRow back"><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, zen_get_all_get_params(array())) . '">' . zen_image_button(BUTTON_IMAGE_WRITE_REVIEW, BUTTON_WRITE_REVIEW_ALT) . '</a>'; ?></div>
    <br class="clearBoth" />
    <?php
    // was a closing bracket
    }
    ?>
    <!--eof Reviews button and count -->
    This I have changed the:
    } else {

    to a closing } and removed the closing bracket of the IF ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  6. #6
    Join Date
    Feb 2010
    Location
    Minnesota
    Posts
    391
    Plugin Contributions
    0

    Default Re: Write a Reviews button

    Can you guy's tell this newbee exactly what file to place this code?
    I am extremely green at this stuff.
    Thanks

  7. #7
    Join Date
    Jun 2009
    Posts
    617
    Plugin Contributions
    0

    Default Re: Write a Reviews button

    Quote Originally Posted by Ajeh View Post
    Another way to do this is to show only the Write when there are no reviews and both the Read and Write when there are reviews:
    Code:
    <!--bof Reviews button and count-->
    <?php
      if ($flag_show_product_info_reviews == 1) {
        // if more than 0 reviews, then show reviews button; otherwise, show the "write review" button
        if ($reviews->fields['count'] > 0 ) { ?>
    <div id="productReviewLink" class="buttonRow back"><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS, zen_get_all_get_params()) . '">' . zen_image_button(BUTTON_IMAGE_REVIEWS, BUTTON_REVIEWS_ALT) . '</a>'; ?></div>
    <br class="clearBoth" />
    <p class="reviewCount"><?php echo ($flag_show_product_info_reviews_count == 1 ? TEXT_CURRENT_REVIEWS . ' ' . $reviews->fields['count'] : ''); ?></p>
    <?php } // was an else ?>
    <div id="productReviewLink" class="buttonRow back"><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, zen_get_all_get_params(array())) . '">' . zen_image_button(BUTTON_IMAGE_WRITE_REVIEW, BUTTON_WRITE_REVIEW_ALT) . '</a>'; ?></div>
    <br class="clearBoth" />
    <?php
    // was a closing bracket
    }
    ?>
    <!--eof Reviews button and count -->
    This I have changed the:
    } else {

    to a closing } and removed the closing bracket of the IF ...
    Thanks Ajeh, it worked, your code combined with some addon code and I got the Reviews links to act as I want. Now I just need to apply some CSS to them and its done. Thank you for your help
    Thank you,
    autoace

  8. #8
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Write a Reviews button

    You are most welcome ... thanks for the update that this worked for you ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  9. #9
    Join Date
    Feb 2010
    Location
    Minnesota
    Posts
    391
    Plugin Contributions
    0

    Default Re: Write a Reviews button

    Can you tell me the file in which this code is located?

  10. #10
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Write a Reviews button

    That is in your template file:
    /includes/templates/template_default/tpl_product_info_display.php

    Copy that to your templates and overrides directory to make the changes:
    /includes/templates/your_template_name/tpl_product_info_display.php
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 2
    Last Post: 22 Aug 2011, 09:20 PM
  2. Write Product reviews
    By fatiga in forum General Questions
    Replies: 0
    Last Post: 11 Aug 2011, 02:47 PM
  3. I want reviews write box disappear on all pages
    By 100asa in forum General Questions
    Replies: 5
    Last Post: 9 Jan 2010, 11:08 AM
  4. Write Reviews errors not going to the right page
    By lat9 in forum Addon Templates
    Replies: 3
    Last Post: 20 Oct 2009, 12:12 PM
  5. Adding "write reviews" form and reviews to product info display
    By papa smurf in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 31 Dec 2007, 09:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg