Reader small image

You're reading from  PrestaShop Module Development

Product typeBook
Published inNov 2014
Reading LevelBeginner
Publisher
ISBN-139781783280254
Edition1st Edition
Languages
Concepts
Right arrow
Author (1)
Fabien Serny
Fabien Serny
author image
Fabien Serny

Fabien Serny is a former core developer at PrestaShop. He has 10 years of experience in web development and e-commerce. He has worked for several big e-commerce companies in France, and then created his own company named 23Prod in late 2010. In 2014, along with two other former core developers from PrestaShop, he launched Froggy Commerce, a platform that sells simple and powerful modules for PrestaShop based on the needs of e-tailers. You can visit his websites http://www.23prod.com and http://www.froggy-commerce.com.
Read more about Fabien Serny

Right arrow

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">...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
PrestaShop Module Development
Published in: Nov 2014Publisher: ISBN-13: 9781783280254

Author (1)

author image
Fabien Serny

Fabien Serny is a former core developer at PrestaShop. He has 10 years of experience in web development and e-commerce. He has worked for several big e-commerce companies in France, and then created his own company named 23Prod in late 2010. In 2014, along with two other former core developers from PrestaShop, he launched Froggy Commerce, a platform that sells simple and powerful modules for PrestaShop based on the needs of e-tailers. You can visit his websites http://www.23prod.com and http://www.froggy-commerce.com.
Read more about Fabien Serny