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

Validating a cart into an order


We will now create a module's front controller named validation (you should have created the form, whose action calls the validation controller, in the previous section of this chapter).

This controller won't display anything; it will only transform a cart into an order. First, create a file named validation.php in the controllers/front/ directory of your module, then create the corresponding class in it:

<?php
class MyModPaymentValidationModuleFrontController extends ModuleFrontController
{
}

We will create a method called postProcess (in fact, we will override it since it already exists in all the controllers). This method is called at the beginning of the controller's execution, so we will be able to perform all our operations before any display.

The first thing to do is to check whether the cart exists and is correctly filled in and whether the payment module is still enabled. If one of these conditions is incorrect, we will redirect the customer at the...

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