Download the PHP package walkwizus/magento2-module-virtual-attribute-sales-rule without Composer

On this page you can find all versions of the php package walkwizus/magento2-module-virtual-attribute-sales-rule. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package magento2-module-virtual-attribute-sales-rule

Walkwizus Virtual Attribute Sales Rule for Magento 2

Overview

The Virtual Attribute Sales Rule module for Magento 2 allows you to add virtual attributes to cart price rules conditions. This extension enhances the flexibility of your promotional rules by introducing dynamic attributes that can be used in three key areas:

Create more sophisticated and targeted promotional rules without core code modifications.

Features

Requirements

Installation

Using Composer (Recommended)

  1. In your Magento 2 root directory, run the following command:

  2. Enable the module:

  3. Run the Magento setup upgrade:

  4. Compile the code (in production mode):

  5. Clear the cache:

Usage

Step 1: Create Your Attribute Classes

Create new classes that implement Walkwizus\VirtualAttributeSalesRule\Api\Data\VirtualAttributeInterface. Your classes must implement these methods:

Supported Attribute Types

The following types can be returned by the getType() method:

Type Description
string A text value
numeric A number (integer or float)
date A date value
select A single selection from a list of options
boolean A true/false value
multiselect Multiple selections from a list of options

Note: For 'select' and 'multiselect' types, you must implement the getOptionSource() method to provide the available options.

Step 2: Add your attributes to di.xml

Create a di.xml file in your module's etc directory with the following structure:

Replace Your\Module\Model\VirtualAttribute\YourAttribute with your actual attribute class paths, and attribute_code with the code you want to use for each attribute.

Important: Make sure each attribute_code is unique and does not conflict with any existing Magento attribute codes, as this could cause unexpected behavior or errors in your rules.

Implementation Examples

Here are examples of virtual attributes implementation for different section types:

Product Attribute Example

Cart Attribute Example

Cart Item Attribute Example

Select/Multiselect Example

Step 3: Use in Sales Rules

After installing your module and implementing your virtual attributes:

  1. Go to Marketing > Promotions > Cart Price Rules in the Magento admin
  2. Create or edit a rule
  3. In the "Conditions" tab, you'll see your virtual attributes available in the respective sections:
    • Product attributes in the "Product attribute combination" condition
    • Cart attributes in the "Cart attribute" condition
    • Cart item attributes in the "Product attribute" condition (with "(Virtual Attribute)" suffix)

Support

For issues and support, please create an issue on the GitHub repository.


All versions of magento2-module-virtual-attribute-sales-rule with dependencies

PHP Build Version
Package Version
Requires magento/framework Version ^103
php Version ^8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package walkwizus/magento2-module-virtual-attribute-sales-rule contains the following files

Loading the files please wait ....