![]() ![]() ![]() Thus, no more code copy-pasting from our blog posts. Now, the code of the module is freely available in the public repository on. We will surely deal with this matter in a series of further related articles. In a module that has not been created as an example, Rules objects must be loaded as a special class, which will validate them against their compatibility with the current environment, i.e., a store, a customer and its group, time, date, etc. Based on it, we will validate the known object with the items from the cart―shipping address. This is for the reason that we’ll neatly specify a rule with which the Rule ID must be loaded. *It is critical to understand that the way we load our Rule model won’t fit a real-life case 100%. In case such an item gets found, we will display a block with the following message ‘You have some heavyweight items in your cart, please contact us to discuss delivery.’ on the shopping cart page. In our example, we’ll create a rule that allows defining if there is an item with the `heavy_weight` attribute value that equals 1 (true) in the shopping cart. As a result, based on this validation check, we can perform certain activities. Thus, it’s high time to figure out the importance of rules and conditions within them.Īny validation model inherits conditions that help validate an object. That was a significant part of the module, which is useless by itself if you don’t learn how to use it on the frontend. In the previous article, we took a look at the code that allows us to create a Rules model with an interface in the Admin Panel.
0 Comments
Leave a Reply. |