Skip to content

Commit

Permalink
Merge pull request #1444 from leemyongpakvn/8.x---DBnTS-update
Browse files Browse the repository at this point in the history
Update sql link, ts extensions, and branch links
  • Loading branch information
kpodemski committed Aug 16, 2022
2 parents 2d7d551 + d80bb80 commit 87f0308
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 37 deletions.
24 changes: 12 additions & 12 deletions development/database/structure.md
Expand Up @@ -9,7 +9,7 @@ weight: 4

### Global definition

The database structure of PrestaShop can be found in `install/data/db_structure.sql` ([1.7.3.x releases example](https://github.com/PrestaShop/PrestaShop/blob/1.7.3.x/install-dev/data/db_structure.sql)).
The database structure of PrestaShop can be found in `install/data/db_structure.sql` ([8.0.x releases example](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/install-dev/data/db_structure.sql)).

It is used one time, during the installation of PrestaShop.
It contains the structure of almost all tables. If a table needs to be added or
Expand Down Expand Up @@ -46,22 +46,22 @@ This SQL file will be stored in the [auto upgrade](https://github.com/PrestaShop

Its name is the PrestaShop version on which the change will be applied.

For instance, here is the file *[1.7.3.0.sql](https://github.com/PrestaShop/autoupgrade/tree/dev/upgrade/sql/1.7.3.0.sql)*,
used by shops upgrading to 1.7.3.0 or later:
For instance, here is the file *[1.7.8.0.sql](https://github.com/PrestaShop/autoupgrade/tree/dev/upgrade/sql/1.7.8.0.sql)*,
used by shops upgrading to 1.7.8.0 or later:

```sql
[...]
UPDATE `PREFIX_tab` SET `position` = 0 WHERE `class_name` = 'AdminZones' AND `position` = '1';
UPDATE `PREFIX_tab` SET `position` = 1 WHERE `class_name` = 'AdminCountries' AND `position` = '0';
/* First set all products to standard type, then update them based on cached columns that identify the type */
UPDATE `PREFIX_product` SET `product_type` = "standard";
UPDATE `PREFIX_product` SET `product_type` = "combinations" WHERE `cache_default_attribute` != 0;
UPDATE `PREFIX_product` SET `product_type` = "pack" WHERE `cache_is_pack` = 1;
UPDATE `PREFIX_product` SET `product_type` = "virtual" WHERE `is_virtual` = 1;

/* PHP:ps_1730_add_quick_access_evaluation_catalog(); */;
/* PHP:ps_1730_move_some_aeuc_configuration_to_core(); */;

ALTER TABLE `PREFIX_product` ADD `low_stock_threshold` INT(10) NULL DEFAULT NULL AFTER `minimal_quantity`;
/* PHP:ps_1780_add_feature_flag_tab(); */;
[...]
```

In there we can read the SQL queries to execute when upgrading to 1.7.3.0.
In there we can read the SQL queries to execute when upgrading to 1.7.8.0.
Each of them alters the structure and/or modify the existing data.
In case you have complex algorithms to run, you can call PHP code with the
`PHP:` keyword.
Expand All @@ -70,11 +70,11 @@ To make the code callable, a dedicated file has to be created in
`/upgrade/php/` with a function in it. This file and function must have
the same name as we saw in the SQL upgrade file.

If we reuse the previous example, we will find the corresponding file *[/upgrade/php/ps_1730_add_quick_access_evaluation_catalog.php](https://github.com/PrestaShop/autoupgrade/blob/dev/upgrade/php/ps_1730_add_quick_access_evaluation_catalog.php)*:
If we reuse the previous example, we will find the corresponding file *[/upgrade/php/ps_1780_add_feature_flag_tab.php](https://github.com/PrestaShop/autoupgrade/blob/dev/upgrade/php/ps_1780_add_feature_flag_tab.php)*:

```php
<?php
function ps_1730_add_quick_access_evaluation_catalog()
function ps_1780_add_feature_flag_tab()
{
// Code inserting values in database
[...]
Expand Down
Expand Up @@ -32,8 +32,8 @@ This page is very specific compared to other BO pages, it has kind of a flow - e

{{% notice %}}

All the javascript code related to this page can be found at `admin-dev/themes/new-theme/js/pages/order/create.js`.
These `.js` files are the `develop` version prior compiling. See ["How to compile assets"]({{< relref "/8/development/compile-assets" >}}) for
All the javascript code related to this page can be found at `admin-dev/themes/new-theme/js/pages/order/create.ts`.
These `.ts` files are the `develop` version prior compiling. See ["How to compile assets"]({{< relref "/8/development/compile-assets" >}}) for
more information.

{{% /notice %}}
Expand Down
46 changes: 23 additions & 23 deletions development/page-reference/back-office/order/view-order/_index.md
Expand Up @@ -9,11 +9,11 @@ title: Order view
{{% /notice %}}

This page can be reached by visiting `Sell -> Orders -> Orders -> View (grid row action)`. It allows the Back Office user to view the details of selected order and edit it. The **related code can be found in following locations**:
- Main **twig template** [src/PrestaShopBundle/Resources/views/Admin/Sell/Order/Order/view.html.twig](https://github.com/PrestaShop/PrestaShop/tree/1.7.8.x/src/PrestaShopBundle/Resources/views/Admin/Sell/Order/Order/view.html.twig).
- **Javascript** ([pre-compiled]({{< relref "/8/development/compile-assets" >}})) [admin-dev/themes/new-theme/js/pages/order/view](https://github.com/PrestaShop/PrestaShop/tree/1.7.8.x/admin-dev/themes/new-theme/js/pages/order/view).
- **OrderController** [src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController](https://github.com/PrestaShop/PrestaShop/blob/1.7.8.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php) (other domain controllers are used as well, those will be mentioned in related block references bellow)
- **Commands** & **Queries** at [src/Core/Domain/Order](https://github.com/PrestaShop/PrestaShop/tree/1.7.8.x/src/Core/Domain/Order) in `Command`, `Query` directories.
- Most **handlers** or **domain services implementations** can be found in `Adapter` namespace [src/Adapter/Order](https://github.com/PrestaShop/PrestaShop/tree/1.7.8.x/src/Adapter/Order)
- Main **twig template** [src/PrestaShopBundle/Resources/views/Admin/Sell/Order/Order/view.html.twig](https://github.com/PrestaShop/PrestaShop/tree/8.0.x/src/PrestaShopBundle/Resources/views/Admin/Sell/Order/Order/view.html.twig).
- **Javascript** ([pre-compiled]({{< relref "/8/development/compile-assets" >}})) [admin-dev/themes/new-theme/js/pages/order/view](https://github.com/PrestaShop/PrestaShop/tree/8.0.x/admin-dev/themes/new-theme/js/pages/order/view).
- **OrderController** [src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php) (other domain controllers are used as well, those will be mentioned in related block references bellow)
- **Commands** & **Queries** at [src/Core/Domain/Order](https://github.com/PrestaShop/PrestaShop/tree/8.0.x/src/Core/Domain/Order) in `Command`, `Query` directories.
- Most **handlers** or **domain services implementations** can be found in `Adapter` namespace [src/Adapter/Order](https://github.com/PrestaShop/PrestaShop/tree/8.0.x/src/Adapter/Order)

Once opened, the page will show following blocks:

Expand All @@ -30,34 +30,34 @@ Once opened, the page will show following blocks:
{{< figure src="./img/actions-block.png" title="Order actions block" >}}

This block contains following actions:
- Status update - new order status can be selected from a dropdown. See [OrderController::updateStatusAction](https://github.com/PrestaShop/PrestaShop/blob/1.7.8.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php).
- View invoice - generates invoice PDF. See [OrderController::generateInvoicePdfAction](https://github.com/PrestaShop/PrestaShop/blob/1.7.8.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php).
- Print order - prepares and shows modified page layout for printing. This action is performed by javascript in [admin-dev/themes/new-theme/js/pages/order/view](https://github.com/PrestaShop/PrestaShop/tree/1.7.8.x/admin-dev/themes/new-theme/js/pages/order/view)
- Status update - new order status can be selected from a dropdown. See [OrderController::updateStatusAction](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php).
- View invoice - generates invoice PDF. See [OrderController::generateInvoicePdfAction](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php).
- Print order - prepares and shows modified page layout for printing. This action is performed by javascript in [admin-dev/themes/new-theme/js/pages/order/view](https://github.com/PrestaShop/PrestaShop/tree/8.0.x/admin-dev/themes/new-theme/js/pages/order/view)
- Refund - read about refunds [here]({{< relref "./refunds" >}}).
- Next/Previous - allows to quickly jump to next or previous order in the list (simple `href` buttons redirecting to another `View order` page).

### Customer block
{{< figure src="./img/customer-block.png" title="Order customer block" >}}

Contains information like customer `email`, `addresses`, `orders count`, `total spent sum`. Click the `View full details` link to see more information about the customer (it redirects to `Customers -> Customers -> View customer` page). This block also allows following actions:
- Editing and selecting new customer shipping and/or invoice addresses (both of these actions opens a modal with a `Customers -> Addresses -> Edit` page inside an `iframe` using the `Lite display` mode of the Back Office). See [OrderController::changeCustomerAddressAction](https://github.com/PrestaShop/PrestaShop/blob/1.7.8.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php).
- Adding a private note (`Customer->note`). See [CustomerController::setPrivateNoteAction](https://github.com/PrestaShop/PrestaShop/blob/1.7.8.x/src/PrestaShopBundle/Controller/Admin/Sell/Customer/CustomerController.php).
- Editing and selecting new customer shipping and/or invoice addresses (both of these actions opens a modal with a `Customers -> Addresses -> Edit` page inside an `iframe` using the `Lite display` mode of the Back Office). See [OrderController::changeCustomerAddressAction](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php).
- Adding a private note (`Customer->note`). See [CustomerController::setPrivateNoteAction](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/src/PrestaShopBundle/Controller/Admin/Sell/Customer/CustomerController.php).

### Products block
{{< figure src="./img/products-block.png" title="Order products block" >}}

Contains a list of ordered products and prices summary. The list is rendered using javascript `ajax` by calling [OrderController::getProductsListAction](https://github.com/PrestaShop/PrestaShop/blob/1.7.8.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php) in [order-view-page.js](https://github.com/PrestaShop/PrestaShop/blob/1.7.8.x/admin-dev/themes/new-theme/js/pages/order/view/order-view-page.js). **The response of this action is not a `json`, but a rendered template**.
Contains a list of ordered products and prices summary. The list is rendered using javascript `ajax` by calling [OrderController::getProductsListAction](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php) in [order-view-page.ts](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/admin-dev/themes/new-theme/js/pages/order/view/order-view-page.ts). **The response of this action is not a `json`, but a rendered template**.

{{% notice %}}
The product list has a pagination feature, but it is **only a front-end pagination** (not the database level) - all the products are loaded into the memory and handled by javascript. See [admin-dev/themes/new-theme/js/pages/order/view/order-product-renderer.js](https://github.com/PrestaShop/PrestaShop/blob/1.7.8.x/admin-dev/themes/new-theme/js/pages/order/view/order-product-renderer.js).
The product list has a pagination feature, but it is **only a front-end pagination** (not the database level) - all the products are loaded into the memory and handled by javascript. See [admin-dev/themes/new-theme/js/pages/order/view/order-product-renderer.ts](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/admin-dev/themes/new-theme/js/pages/order/view/order-product-renderer.ts).
{{% /notice %}}

The following actions can be done in this block (most of these actions are related to [OrderDetail](https://github.com/PrestaShop/PrestaShop/blob/1.7.8.x/classes/order/OrderDetail.php) - one `OrderDetail` is equivalent to one row in a products list):
- Add a product - create additional `OrderDetail` for the `Order`. See [OrderController::addProductAction](https://github.com/PrestaShop/PrestaShop/blob/1.7.8.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php).
- Remove product - remove the `OrderDetail` related to the selected product. See [OrderController::deleteProductAction](https://github.com/PrestaShop/PrestaShop/blob/1.7.8.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php).
- Edit product price - modify the base price of the `OrderDetail` related to the selected product. See [OrderController::updateProductAction](https://github.com/PrestaShop/PrestaShop/blob/1.7.8.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php).
- Edit product quantity - modify the quantity of the `OrderDetail` related to the selected product. See [OrderController::updateProductAction](https://github.com/PrestaShop/PrestaShop/blob/1.7.8.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php).
- Add discount - create a new `CartRule` and assign it to this order. See [OrderController::addCartRuleAction](https://github.com/PrestaShop/PrestaShop/blob/1.7.8.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php).
The following actions can be done in this block (most of these actions are related to [OrderDetail](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/classes/order/OrderDetail.php) - one `OrderDetail` is equivalent to one row in a products list):
- Add a product - create additional `OrderDetail` for the `Order`. See [OrderController::addProductAction](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php).
- Remove product - remove the `OrderDetail` related to the selected product. See [OrderController::deleteProductAction](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php).
- Edit product price - modify the base price of the `OrderDetail` related to the selected product. See [OrderController::updateProductAction](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php).
- Edit product quantity - modify the quantity of the `OrderDetail` related to the selected product. See [OrderController::updateProductAction](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php).
- Add discount - create a new `CartRule` and assign it to this order. See [OrderController::addCartRuleAction](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php).

{{% notice %}}
It is possible to have multiple invoices related to same order, therefore when editing a product or adding a discount you can select which invoice to use.
Expand All @@ -67,23 +67,23 @@ It is possible to have multiple invoices related to same order, therefore when e
### Messages block
{{< figure src="./img/order-messages-bo.png" title="Order messages in Back Office" >}}

This block shows order messages (relies on [OrderMessage](https://github.com/PrestaShop/PrestaShop/blob/1.7.8.x/classes/order/OrderMessage.php)). These messages can be visible for the customer in Front Office order details or can stay hidden - that depends on the checkbox `Display to customer`.
This block shows order messages (relies on [OrderMessage](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/classes/order/OrderMessage.php)). These messages can be visible for the customer in Front Office order details or can stay hidden - that depends on the checkbox `Display to customer`.
{{< figure src="./img/order-messages-fo.png" title="Order messages in Front Office" >}}
Predefined message can be chosen in a dropdown which contains a list of message templates from `Sell -> Customer service -> Order messages`. This page can be quickly reached by clicking a shortcut link `Configure predefined messages`. Message sending is handled by [OrderController::sendMessageAction](https://github.com/PrestaShop/PrestaShop/blob/1.7.8.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php), while the related javascript code is located in [order-view-page-messages-handler.js](https://github.com/PrestaShop/PrestaShop/blob/1.7.8.x/admin-dev/themes/new-theme/js/pages/order/message/order-view-page-messages-handler.js).
Predefined message can be chosen in a dropdown which contains a list of message templates from `Sell -> Customer service -> Order messages`. This page can be quickly reached by clicking a shortcut link `Configure predefined messages`. Message sending is handled by [OrderController::sendMessageAction](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php), while the related javascript code is located in [order-view-page-messages-handler.ts](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/admin-dev/themes/new-theme/js/pages/order/message/order-view-page-messages-handler.ts).

### History block
{{< figure src="./img/history-block.png" title="Order history block" >}}

This block doesn't have an actual title like others, but let's just call it "History block" for now - it's the one containing following tabs:
- Status - you can see transitions of this order statuses and update the status, you can also add an Order note in this tab. (`Order->note`). See [OrderController::setInternalNoteAction](https://github.com/PrestaShop/PrestaShop/blob/1.7.8.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php).
- Status - you can see transitions of this order statuses and update the status, you can also add an Order note in this tab. (`Order->note`). See [OrderController::setInternalNoteAction](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php).
- Documents - this tab contains invoices list.
- Carriers - contains carriers information. You can change the current carrier and add a tracking number. See [OrderController::updateShippingAction](https://github.com/PrestaShop/PrestaShop/blob/1.7.8.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php).
- Carriers - contains carriers information. You can change the current carrier and add a tracking number. See [OrderController::updateShippingAction](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php).
- Merchandise returns - information about refunds history.

### Payments block
{{< figure src="./img/payments-block.png" title="Order payments block" >}}

Shows a list of payments done for this order and allows manually adding a payment. See [OrderController::addPaymentAction](https://github.com/PrestaShop/PrestaShop/blob/1.7.8.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php).
Shows a list of payments done for this order and allows manually adding a payment. See [OrderController::addPaymentAction](https://github.com/PrestaShop/PrestaShop/blob/8.0.x/src/PrestaShopBundle/Controller/Admin/Sell/Order/OrderController.php).

{{% notice %}}
If order total and payments amount sum differs, then a warning in this block will notify the Back Office user about the difference.
Expand Down

0 comments on commit 87f0308

Please sign in to comment.