Skip to content

Commit

Permalink
[Documentation][CatalogPromotion] Fixes to cookbooks about creating c…
Browse files Browse the repository at this point in the history
…ustom action and scope
  • Loading branch information
GSadee committed Dec 16, 2021
1 parent c4816cd commit e45593d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
26 changes: 13 additions & 13 deletions docs/cookbook/promotions/custom-catalog-promotion-action.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
How to add a custom catalog promotion action?
=============================================

Adding a new, custom catalog promotion action to your shop should become a quite helpful extension to your own Catalog Promotions.
Adding a new, custom catalog promotion action to your shop may become a quite helpful extension to your own Catalog Promotions.
You can create your own calculator tailored to your product catalog to attract as many people as possible.

Let's try to implement the new **Catalog Promotion Action** in this cookbook that will lower the price of the product
Expand Down Expand Up @@ -32,7 +32,7 @@ The new action needs to be declared somewhere, the first step would be to extend
public const TYPE_FIXED_PRICE = 'fixed_price';
}
Now let's declare the parameter with action types, with added our additional custom action as the last one:
Now let's declare the parameter with action types, with our additional custom action added as the last one:

.. code-block:: yaml
Expand Down Expand Up @@ -106,11 +106,11 @@ And the code for the calculator itself:
}
}
Now the catalog promotion should work with your new action for programmatically and API created resources.
Let's now prepare a custom validator for a created action.
Now the catalog promotion should work with your new action for resources created both programmatically and via API.
Let's now prepare a custom validator for the newly created action.

Prepare a custom validator for a new action
-------------------------------------------
Prepare a custom validator for the new action
---------------------------------------------

We can start with configuration, declare our basic validator for this particular action:

Expand All @@ -124,7 +124,7 @@ We can start with configuration, declare our basic validator for this particular
tags:
- { name: 'sylius.catalog_promotion.action_validator', key: 'fixed_price' }
In this validator we will check the provided configuration if necessary data is provided and the configured channels exist.
In this validator, we will check the provided configuration for necessary data and if the configured channels exist.

.. code-block:: php
Expand Down Expand Up @@ -177,14 +177,14 @@ In this validator we will check the provided configuration if necessary data is
}
}
Alright we have a working basic validation, and our new type of action exists and can be created, and edited
programmatically or by API. Let's now prepare a UI part of this new feature.
Alright, we have a working basic validation, and our new type of action exists, can be created, and edited
programmatically or by API. Let's now prepare the UI part of this new feature.

Prepare a configuration form type for a new action
--------------------------------------------------
Prepare a configuration form type for the new action
----------------------------------------------------

To be able to configure a catalog promotion with your new action you will need a form type for the admin panel.
And with current implementation, as our action is channel based, you need to create 2 form types as below:
And with the current implementation, as our action is channel-based, you need to create 2 form types as below:

.. code-block:: yaml
Expand Down Expand Up @@ -307,7 +307,7 @@ The last thing is to create a template to display our new action properly. Remem
</tbody>
</table>

That's all. You will now should be able to choose the new action while creating or editing a catalog promotion.
That's all. You will now be able to choose the new action while creating or editing a catalog promotion.

Learn more
----------
Expand Down
14 changes: 7 additions & 7 deletions docs/cookbook/promotions/custom-catalog-promotion-scope.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
How to add a custom catalog promotion scope?
============================================

Adding a new, custom catalog promotion scope to your shop should become a quite helpful extension to your own Catalog Promotions.
Adding a new, custom catalog promotion scope to your shop may become a quite helpful extension to your own Catalog Promotions.
You can imagine for instance, that you have some custom way of aggregating products, or any other method of filtering them.
These products that will fulfill your specific scope will become eligible for actions of Catalog Promotion, and as we know
cheaper Products attract more customers.
Expand Down Expand Up @@ -30,7 +30,7 @@ The new Scope needs to be declared somewhere, it would be nice to extend the cur
public const TYPE_BY_PHRASE = 'by_phrase';
}
Now let's declare the parameter with scope types, with added our additional custom scope as the last one:
Now let's declare the parameter with scope types, with our additional custom scope added as the last one:

.. code-block:: yaml
Expand Down Expand Up @@ -102,8 +102,8 @@ And the code for the provider itself:

Now the Catalog Promotion should work with your new Scope for programmatically and API created resource.

Prepare a custom validator for a new scope
------------------------------------------
Prepare a custom validator for the new scope
--------------------------------------------

We can start with configuration, declare our basic validator for this particular scope:

Expand Down Expand Up @@ -143,8 +143,8 @@ keys to check as well as their corresponding values.
}
}
Alright we have a working basic validation, and our new type of scope exists and can be created, and edited
programmatically or by API. Let's now prepare a UI part of this new feature.
Alright, we have a working basic validation, and our new type of scope exists, can be created, and edited
programmatically or by API. Let's now prepare the UI part of this new feature.

Prepare a configuration form type for your new scope
----------------------------------------------------
Expand Down Expand Up @@ -238,7 +238,7 @@ The last thing is to create a template to display our new scope properly. Rememb
</table>


That's all. You will now should be able to choose the new scope while creating or editing a catalog promotion.
That's all. You will now be able to choose the new scope while creating or editing a catalog promotion.

Learn more
----------
Expand Down

0 comments on commit e45593d

Please sign in to comment.