Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Practical Module development for Prestashop 8
Practical Module development for Prestashop 8

Practical Module development for Prestashop 8: Create modern, customizable, and dynamic online stores using efficient modules

eBook
€13.99 €20.99
Paperback
€26.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Colour book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
Table of content icon View table of contents Preview book icon Preview Book

Practical Module development for Prestashop 8

Quick Overview of PrestaShop

Having set up PrestaShop (please see https://devdocs.prestashop-project.org/1.7/basics/installation/, if you haven’t) and used it, you may know the two main parts of it. As with other content management systems (CMSs) such as WordPress, there’s a public part unrestricted and visible by any visitor of your website named the Front Office (FO), and there’s a restricted part, only visible by employees with email and password authentication, called the Back Office (BO).

In this chapter, we will explain quickly how everything is designed, from the database to the core structure of the FO and the BO, and how they are linked.

In this chapter, we will cover the following main topics:

  • The data model—how and where data is stored
  • The core classes—how the Model-View-Controller (MVC) works

By the end of this chapter, you will know how the database is built, the types of tables, and how the core manages and manipulates entities. You will understand, from a high-level point of view, the MVC structure of FO and BO pages and how some BO pages are being migrated from the legacy-based core to a Symfony-based one.

Technical requirements

As we will explore the environment of PrestaShop to understand how everything is articulated, you will have to use some tools to do mainly reverse engineering:

  • phpMyAdmin or other MySQL database clients such as Adminer
  • Any PHP code editor
  • A (Secure) File Transfer Protocol ((S)FTP) client to browse your website files (only if you work on a remote server—not necessary if you work on a local server)

The data model–how and where data is stored

Let’s start this journey into PrestaShop by presenting how data is stored.

Data is all mutable information stored on the server to make the shop work, such as product information, customer details, orders, category information, employee settings, and so on.

All this information is stored in a MySQL database on the server. You may already know this because you have been requested to provide the database details to access the MySQL database during the installation steps.

Let’s browse the data to see how it works.

Browsing the data

To browse all the data stored in the PrestaShop database, please follow these steps:

  1. Connect to the database created for your PrestaShop with your favorite database client such as phpMyAdmin.
  2. Show all tables.

There, you will see a list of all tables, named following these patterns:

  • prefix_nameofentity (for example, ps_cms and ps_access):

All entities should use the prefix_nameofentity table name to store all non-localized data, without any restrictions on the number of columns. The first column for those tables is always the unique ID (UID) of each row, and its name always follows the same pattern: id_nameofentity. This is useful for creating relationships with other entities and makes data management easier.

  • prefix_nameofentity_lang (for example, ps_cms_lang and ps_carrier_lang):

If an entity has localizable data, you should use another table called prefix_nameofentity_lang to store fields depending on the user’s language.

It should represent a many-to-many relationship between the prefix_nameofentity table and prefix_lang table that contains all available languages in your PrestaShop platform. That’s why you will always find an id_nameofentity column to represent the link with the prefix_nameofentity table and an id_lang column to represent the link with the prefix_lang table. These tables are not mandatory if you don’t have localized data to store.

  • prefix_nameofentity_shop (for example, ps_cms_shop and ps_product_shop):

If an entity is shop-dependent (in the context of a multistore website, as PrestaShop makes this possible), you will find another table called prefix_nameofentity_shop. It represents a many-to-many relationship between the prefix_nameofentity table and the ps_shop table containing all available stores created in your PrestaShop platform. Exactly the same way as _lang tables do, you will always find an id_nameofentity column to represent the link with the prefix_nameofentity table and an id_shop column to represent the link with the prefix_shop table. These tables are only present if you want to make your entity multistore compliant.

What are prefix_ and nameofentity?

prefix_ is a string that is set during the installation process, in the database details step, and by default, it’s set to ps_, but you may have chosen a different one.

In the rest of the book, we will assume that you chose ps_ as a prefix.

nameofentity stands for the name of the entity stored. For example, for products, the name of the entity is product; that’s why you should find a ps_product table in the database!

Reverse engineering the contact entity

The contact entity contains all information about the recipients of contact queries done through the Contact us page of your store. You can put as many recipients of services as you need. Usually, there are two of them automatically set: one for technical queries and the other for customer/sales queries.

The best way to understand how things work is by doing reverse engineering. So, let’s explore how the contact entity is built in the database. By browsing the tables list, considering that our prefix is set to ps_, you will find three tables corresponding to the contact entity:

  • The ps_contact table:

Name

Type

Extra information

id_contact

Int(10)

Auto_increment

email

Varchar(255)

customer_service

TinyInt(1)

position

TinyInt(2)

Table 1.1 – The ps_contact table

This table contains all universal, non-translatable fields about contact information: the email address, a flag (true=1/false=0) to inform the system if the recipient provides customer service, and the position for the display order on the contact form. Please note that there is always a key column following the id_nameofentity pattern in entities. It is auto-incrementing and set as the primary key. It enables us to identify and manipulate rows easily. It is also mandatory if we have to create a many-to-one relationship with this table.

  • The ps_contact_lang table:

Name

Type

Extra information

id_contact

Int(10)

id_lang

Int(10)

name

Varchar(255)

description

Text

Table 1.2 – The ps_contact_lang table

This table contains all localizable data languages linked. It is used to provide translated content to the system. For the contact entity, there are only two fields requiring localization: the name field, designating the recipient of contact queries, and the description field, explaining the function of the recipient. This table materializes the many-to-one relationship with ps_contact, as there are many translations for only one contact. The id_contact column is used to map translations with the corresponding ps_contact rows. The id_lang column is used to map translations with the corresponding languages (1 for English, 2 for French, and so on, depending on your settings).

  • The ps_contact_shop table:

Name

Type

Extra information

id_contact

Int(11)

id_shop

Int(11)

Table 1.3 – The ps_contact_shop table

This table represents the many-to-many relationship between the ps_contact entity and the ps_shop entity. It links contacts to the store in which they are available to customers/visitors. The id_contact column stands for the linked contact, and id_shop stands for the shop where the corresponding contact is available.

As you may have seen, the tables are not linked by foreign keys, which would be normal with a many-to-many relationship, but in PrestaShop, this is not the case yet.

You now know with this example how things are linked and stored together in the database.

Tip

If you want to inspect the whole structure and the links between tables, the structure is available during the installation process—that is, if you have not yet removed the install folder (which is recommended), at this path: /install/data/db_structure.sql.

Now that you know how and where data is stored in the database, let’s see where and how entities are coded in PHP in order to manage them.

Manipulating data by extending the ObjectModel class

PrestaShop is a set of PHP files, templates, and assets (such as images, JavaScript, or style sheets) working together to generate an e-commerce system.

Specifically, inside the PHP files, in the /classes/ObjectModel.php folder, you will find the definition of the ObjectModel class, which implements the EntityInterface interface defined in the /src/Code/Foundation/Database/EntityInterface.php folder with these methods:

public static function getRepositoryClassName();
public function save();
public function delete();
public function hydrate(array $keyValueData);

Almost all entities of the system extend this ObjectModel class, which contains all the necessary tools to manipulate the entity.

Practically, all entities’ definitions are PHP classes defined in /classes/NameOfEntity.php. Feel free to open some of the files to see how they work.

If you come back to the ObjectModel class, you will see that it contains a property named $definition. This is an array that will contain all metadata fields and properties of the entity. It has to follow this prototype:

public static $definition = [
    'table' => 'nameofentity',
    'primary' => 'id_nameofentity',
    'multilang' => true,//if not localizable set to false
    'multishop' => true,//if not multistore set to false
  //'multilang_shop' => true, 
  //can replace both previous fields set to true
    'fields' => array(
        'id_nameofentity'  => ['type' => self::TYPE_INT,
            'validate' => 'isUnsignedInt'],
        'field_name'           => ['type' => ... ],
     ....)
];

Member variables have to be defined to represent each field that will be hydrated with their value. For example, if you have a field named field_name in the database, it has to be added to the entity class, like this:

public $field_name;

As seen before, to comply with the EntityInterface interface, we have to implement the three following methods:

  • The save() method implements, in the database, the insertion or updates of the row represented by the current entity instance
  • The delete() method removes the current row
  • The hydrate() method sets the member variables of the current instance in order to be able to use the object

Practically, after having defined an entity with the creation of its class, everywhere in the code of PrestaShop, we will be able to create a new instance of it by using this:

//To create an empty instance of NameOfEntity
$entityInstance = new NameOfEntity();

If you want an entity to be instanced and hydrated with the values of the row with id_nameofentity equal to $value_id_nameofentity, you can use this code:

/* To create a hydrated instance of NameofEntity with id_nameofentity=$value_id_nameofentity */
$entityInstanceHydrated = new NameOfEntity((int) $value_id_nameofentity);

Try this

As a practical exercise, try to open one of the classes defined in the /classes folder.

Using the Db class

As you may have seen by opening some classes of the /classes folder, the ObjectModel child class uses the Db class defined in the /classes/db/Db.php file to work with the database’s low-level actions, such as insert, update, and delete. We won’t dive deeply into this class—you just have to remember that you can use this class anywhere with the following methods. In this method, we’ll instantiate the Db class to use its functions:

/*Instantiate the Db class in order to be able use its functions*/
$db = \Db::get Instance();

The following are the SELECT methods:

/*To do a select query with _DB_PREFIX_ a constant that contains the prefix for tables*/
$select_query = 'SELECT * FROM `' . _DB_PREFIX_ . 'nameofentity` WHERE 1';
$result = $db->executeS($select_query);
/*To get the first line of the results as an array */
$select_query = "SELECT `id_nameofentity`, `field_name` FROM `' . _DB_PREFIX_ . 'nameofentity` WHERE 1";
$result = $db->getRow($request);

The following code can be used to insert, update, and delete and for custom query methods:

/*To insert row(s) with pSQL() a function to avoid SQL injections or other threats*/
$result = $db->insert('nameofentity ',
    [
        //First row
        [
            'field_name' => pSQL('field_value'),
            'field_name' => pSQL('field_value'),
        ],
        //Second row
        [
            'field_name' => pSQL('field_value'),
            'field_name' => pSQL('field_value'),
        ]
    ]
);
/*To update row with id_nameofentity=2*/
$result = $db->update('nameofentity', [
    'field_name' => pSQL('field_value'),
    'field_name' => pSQL('field_value'),
], 'id_nameofentity = 2', 1, true);
/*To delete row with id_nameofentity=2*/
$result = $db->delete('nameofentity', 'id_nameofentity = 2');
/*To execute a raw custom query*/
$sql_query = "UPDATE `' . _DB_PREFIX_ . 'nameofentity`  SET ` field_name `= 3 WHERE `id_nameofentity `=2";
$result = $db->execute($sql_query);

Important note

The way of managing data by using the ObjectModel extension is a bit old-fashioned. As PrestaShop is being migrated to a Symfony-based core, the target is to use the Doctrine library for all entities as soon as the migration is finished.

Currently, while the migration is still a work in progress, most entities are still using ObjectModel to manage the database interfaces, as illustrated in the following diagram:

Figure 1.1 – The data management process in PrestaShop

Figure 1.1 – The data management process in PrestaShop

Now that we know how the data is stored and can be manipulated, we need to understand how FO and BO pages are generated by PrestaShop.

The core classes – how the MVC works

Let’s explore how pages are generated by PrestaShop. Don’t worry if you think that we won’t go deep enough into how everything works; we want to stay in a high-level point of view to get a full picture of the system. In Chapters 3 and 4, we will be more technical!

FO and BO pages are automatically generated by the core of PrestaShop. As with many existing CMSs, PrestaShop uses a custom PHP framework that was improved following the versions. This original framework built from the beginning to version 1.7.x.x is called the legacy core by the developers of the PrestaShop community. It is still improving to cope with the immediate needs of users, but the choice was made by the core developers to move to a new framework based on Symfony.

As it is a strong and efficient framework, it can take care of all the main generic needs of the system, such as security, database handling, and forms generation, and all the most useful tools it provides. It should enable the PrestaShop community to focus on e-commerce-specific needs.

Presenting the legacy core MVC pattern

The legacy core is based on an MVC pattern. If you don’t know this famous design pattern, just remember that each page is generated by a PHP Controller. It uses a Model Object to retrieve or modify data in the database and takes care of all computation and data processing to provide it to a View template. This View template is responsible for the graphical aspect of the page.

It enables the different actors of a project not to interfere. The developers can work on the controller while data managers can take care of the model and the integrators build the views. This way, you can also change each tier of the structure without changing others. Here is a diagram illustrating the same:

Figure 1.2 – The legacy core MVC design pattern

Figure 1.2 – The legacy core MVC design pattern

As presented in Figure 1.2, the Controller calls Object Model(s) to get or manipulate the data, processes it, and sends it to a View template to generate a final view.

\What is the legacy core?

As it is not obvious, the legacy core is a set of PHP classes that are part of the PrestaShop framework. They are mainly stored in the /classes and /controllers folders.

Discovering the core migration

As we have seen before, a migration from the old legacy core to a Symfony-based one is in progress. This migration started with the BO pages and will end with the FO pages. The FO migration will start when the BO has fully migrated. That’s the reason why some BO pages are still using the legacy core MVC and some others use the new Symfony design. All FO pages still use the legacy core before and in the v8.0 release.

You can discriminate which BO pages are migrated by watching their URLs: those containing /index.php?controller=Admin are not migrated yet, and those containing /index.php/ are migrated.

The Symfony migrated pages also use an MVC structure, but they follow the Symfony way of coding by using a different templating engine. Even if Symfony is made to use Doctrine and its entities to manipulate the data, during the migration process, we will still use the ObjectModel child objects we have seen before. The new core of PrestaShop is being built into the /src/ folder. We will see in Chapter 4, The Back Office, how this can be done.

In the following diagram, you will find a summary of how the different pages can be managed during the migration of PrestaShop from Legacy Core to Symfony Core:

Figure 1.3 – How things work during the migration process

Figure 1.3 – How things work during the migration process

The aim of the migration process is to remove Legacy Core and make every page of PrestaShop generated by Symfony Core, as illustrated in the following diagram:

Figure 1.4 – How things will work after the migration process

Figure 1.4 – How things will work after the migration process

Once everything is migrated, every page of the BO and FO will rely on the Symfony core and the full system will be able to use Doctrine entities. This process is likely to spend some years. The full PrestaShop open source project is working on it.

Summary

In this chapter, we learned that all data is stored in MySQL tables. There are three types of tables, depending on the localization and the multistore support of each entity. The entities of the core are still stored in the /classes/ folder, and each entity class extends ObjectModel.

We also learned that the Db class must be used to manipulate the data in the database. The core is a set of classes generating the pages of the FO and the BO. The core is MVC pattern-based. The FO and some pages of the BO are using the legacy core. Some BO pages are using the Symfony-based core. The interface with the database is still managed by the ObjectModel child classes during the migration process.

We know now how data is managed, and the design of the core. From a high-level point of view, we know how pages are generated. In the next chapter, we will discover how PrestaShop is initialized both for the FO and the BO, how global variables are set, and how to manually set parameter variables to manage access to the database.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Understand the data and object architecture of the legacy and new Symfony core of PrestaShop
  • Create modules to add features such as content blocks, payment options, and carriers to your store
  • Learn to customize themes and override existing module templates

Description

After version 1.7, PrestaShop underwent a host of changes, including migration to a Symfony-based system from an outdated legacy code. This migration brought about significant changes for developers, from routine maintenance to module development. Practical Module Development for PrestaShop 8 is curated to help you explore the system architecture, including migrated and non-migrated controllers, with a concise data structure overview. You’ll understand how hooks enable module customization and optimize the CMS. Through the creation of seven modules, you’ll learn about the structure of modules, hook registration, the creation of front-office controllers, and Symfony back-office controllers. By using Doctrine entities, services, CQRS, grids, and forms, you’ll be guided through the creation of standard, payment and carrier modules. Additionally, you'll customize and override themes to achieve your desired e-commerce store look. By the end of this book, you’ll be well equipped to provide modern solutions with PrestaShop that meet client requirements.

Who is this book for?

If you are a junior or advanced PHP developer already using PrestaShop as a simple user willing to know more or to solve online sellers' problems by creating modules as a professional, this book is definitely for you. In order to learn from this book, you should have a basic knowledge of the Symfony framework. This book will be a really good help for the module developers expecting to move from the old legacy environment to the modern one. Other CMS developers can use that book as a tool to compare and move to PrestaShop.

What you will learn

  • Understand the structure of PrestaShop's core
  • Explore hooks and their functions
  • Create a hello world module
  • Build modules to display blocks in the front office with different styles
  • Design a module to add fields to the category pages and manage them
  • Fashion a blogging module with front and modern back-office controllers
  • Fabricate payment and carrier modules to improve the user experience
  • Customize a theme by creating a child theme
Estimated delivery fee Deliver to Germany

Premium delivery 7 - 10 business days

€17.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Apr 28, 2023
Length: 300 pages
Edition : 1st
Language : English
ISBN-13 : 9781837635962
Languages :
Concepts :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Colour book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
Estimated delivery fee Deliver to Germany

Premium delivery 7 - 10 business days

€17.95
(Includes tracking information)

Product Details

Publication date : Apr 28, 2023
Length: 300 pages
Edition : 1st
Language : English
ISBN-13 : 9781837635962
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 96.97
Practical Model-Driven Enterprise Architecture
€31.99
Drupal 10 Development Cookbook
€37.99
Practical Module development for Prestashop 8
€26.99
Total 96.97 Stars icon

Table of Contents

21 Chapters
Part 1 – Understanding How PrestaShop is Structured and How It Works Chevron down icon Chevron up icon
Chapter 1: Quick Overview of PrestaShop Chevron down icon Chevron up icon
Chapter 2: The Configuration and Initialization of PrestaShop Chevron down icon Chevron up icon
Chapter 3: The Front Office Chevron down icon Chevron up icon
Chapter 4: The Back Office Chevron down icon Chevron up icon
Chapter 5: The Hooks Chevron down icon Chevron up icon
Chapter 6: The Themes Chevron down icon Chevron up icon
Part 2 – How to Create Your Own Modules Chevron down icon Chevron up icon
Chapter 7: What Are Modules? Let’s Create a Hello World Module Chevron down icon Chevron up icon
Chapter 8: A Reinsurance Block Module Chevron down icon Chevron up icon
Chapter 9: A Customer Callback Request Module Chevron down icon Chevron up icon
Chapter 10: Category Extension Module Chevron down icon Chevron up icon
Chapter 11: A Simple Blogging Module Chevron down icon Chevron up icon
Chapter 12: A Cash Payment Module Chevron down icon Chevron up icon
Chapter 13: A Drive Delivery Module Chevron down icon Chevron up icon
Part 3 – Customizing Your Theme Chevron down icon Chevron up icon
Chapter 14: How to Create a Child Theme Chevron down icon Chevron up icon
Chapter 15: Overriding Some Templates Chevron down icon Chevron up icon
Chapter 16: Assets Compiling with Webpack Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Full star icon 5
(1 Ratings)
5 star 100%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
Markus Karl Weitzer Aug 03, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Das Buch half mir dabei ein eigenes Prestashop 8.1 Modul zu entwickeln.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela