Book Image

PrestaShop Module Development

By : Serny
Book Image

PrestaShop Module Development

By: Serny

Overview of this book

If you are a developer who is new to PrestaShop and wants to get a good foundation in development on the PrestaShop framework, this book is for you. It's assumed that you will have some experience with PHP5, jQuery, and HTML/CSS (no need to be an expert on it).
Table of Contents (13 chapters)
12
Index

Using hooks to display templates


Let's come back to our main goal here: we want to add the possibility for customers to rate and comment on products. We first have to create a form for the customers. In order to avoid HTML code in PHP files, we will use what we learned in the previous chapter:

  1. Create a template for the hook:

    views/templates/hook/displayProductTabContent.tpl
  2. Use the display method in the hookDisplayProductTabContent function:

    return $this->display(__FILE__, 'displayProductTabContent.tpl');
  3. Then, write a simple form in the displayProductTabContent.tpl template we just created:

    <h3 class="page-product-heading">Product Comments</h3>
    <div class="rte">
      <form action="" method="POST" id="comment-form">
        <div class="form-group">
          <label for="grade">Grade:</label>
          <div class="row">
            <div class="col-xs-4">
              <select id="grade" class="form-control" name="grade">
                <option value="0"&gt...