Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


...


...

width50%

Table of Contents

Warning

Firefox user notice:

Please use another web browser to view this document.

Sorry for the inconvenience.

...

width30%

...

Image Modified

Magento 2 Gift Card generates virtual, physical, and combined gift card products with custom layout, content, configurable amounts, delivery dates, etc. Virtual cards are delivered to users by email and used as gift codes at checkout. The physical ones are sent by post and can be applied as a gift code on a retail website or in a specified location. Finally, combined carts are given both by post and email.

Compatibility: Magento Open Source 2.3.X - 2.4.X, Magento Commerce 2.3.X - 2.4.X

Product Page

Thank you for choosing Aheadworks!

Installing Gift Card

...

Panel
borderWidth2px
borderStylesolid

1. Backup your web directory and store database

Panel
borderWidth2px
borderStylesolid

2. Download the Gift Card installation package

Panel
borderWidth2px
borderStylesolid

 3. Upload contents of the Gift Card installation package to your store root directory

...

borderWidth2px
borderStylesolid

 4. In SSH console of your server navigate to your store root folder:

No Format
cd path_to_the_store_root_folder

run the following command: :

No Format
php -f bin/magento module:enable  Aheadworks_Giftcard

then:

No Format
php -f bin/magento setup:upgrade

after:

No Format
php -f bin/magento setup:static-content:deploy
Panel
borderWidth2px
borderStylesolid

5. Flush store cache; log out from the backend and log in again

Note

Make sure the installation is done from the FTP administrator account. Otherwise, set 775 permissions to the store root directory after the extension is deployed.

...

width50%

...

borderWidth2px
borderStylesolid

If you are installing an extension from Aheadworks for the first time, you need to add our composer repository to your Magento store:

Panel
borderWidth2px
borderStylesolid

1. Login to your ssh console and navigate to your store folder:

Panel
borderWidth2px
borderStylesolid
cd path_to_the_store_root_folder

Run the following command:

Panel
borderWidth2px
borderStylesolid

composer config repositories.aheadworks composer https://dist.aheadworks.com/

After the command was executed successfully, you can use the composer to install the products.

...

borderWidth2px
borderStylesolid

To install the extension:

2. Login to your ssh console and navigate to your store folder:

Panel
borderWidth2px
borderStylesolid
cd path_to_the_store_root_folder

...

borderWidth2px
borderStylesolid

 3. Run the following command to install the latest version of the extension:

Panel
borderWidth2px
borderStylesolid
composer require aheadworks/module-giftcard

if you need to install a specific version, run this command:

Panel
borderWidth2px
borderStylesolid
composer require aheadworks/module-giftcard:<version>
Tip

Specify the version of the extension in <version>

Panel
borderWidth2px
borderStylesolid

When prompted, enter Public Key (Username) and Private Key (Password):
Image Removed

Note

Both Public Key (Username) and Private Key (Password) can be found in My Projects and Licenses in your personal account on our site:

Image Removed

...

borderWidth2px
borderStylesolid

4. Enable the extension:

Panel
borderWidth2px
borderStylesolid
php -f bin/magento module:enable <Module_Name>
Tip

Add the product name in <Module_Name>

Next, register the extension:

Panel
borderWidth2px
borderStylesolid
bin/magento setup:upgrade

Recompile your Magento store if you are in the Production mode:

Panel
borderWidth2px
borderStylesolid
bin/magento setup:di:compile

To verify that the extension is enabled, run this command:

Panel
borderWidth2px
borderStylesolid
bin/magento module:status

Clean store cache, by running the following command:

Panel
borderWidth2px
borderStylesolid
bin/magento cache:clean

Log out and Log in the backend again.

...

borderWidth2px
borderStylesolid

To upgrade the extension:

5. To update or upgrade an extension:

Download the updated extension file. Take note of the module-name and version. Export the contents to your Magento root.

If a composer package exists for the extension, run one of the following.

Code Block
titleUpdate per module name:
composer update aheadworks/module-giftcard
Code Block
titleUpdater per version:
composer require aheadworks/module-giftcard:<version>

Run the following commands to upgrade, deploy, and clean the cache.

Panel
borderWidth2px
borderStylesolid
php bin/magento setup:upgrade --keep-generated
php bin/magento setup:static-content:deploy
php bin/magento cache:clean

Set up cron

...

width50%

The gift cards are sent to recipients with the cron launch.

If you have already configured cron jobs for your Magento installation then you can skip this step. Read the following instructions on setting cron job for your Magento store: Magento user guide.

Generally, it would be enough to run in SSH console of your server: 

Code Block
languagebash
crontab -e

And insert the following line:  

Code Block
*/3 * * * * php -c <ini-file-path> <your Magento install dir>/bin/magento cron:run
*/3 * * * * php -c <ini-file-path> <your Magento install dir>/update/cron.php
*/3 * * * * php -c <ini-file-path> <your Magento install dir>/bin/magento setup:cron:run

Remember to confirm on exit the request to save the changes.

Introducing M2 Gift Card

...

About M2 Gift Card

The Gift Card extension by Aheadworks introduces the gift card functionality for Magento 2 stores. The gift cards act as regular Magento 2 products with some specific settings, that control the gift card behavior. In comparison to the default Magento 2 Commerce gift card functionality, the extension offers much more flexibility and management options for the gift card products:

  • Three types if gift cards: virtual, physical, combined;
  • Gift card import and export;
  • Gift card patterns;
  • Gift card pool for convenient distribution and management;
  • Delivery date;
  • Personal notes;
  • Email notifications;
  • Magento API and GraphQL support;
  • Responsive design;
  • Integration with Smart One Step Checkout.

What's new?

The present version of the extension (1.4.0) brings about the following new features:

  • Uninstall script to clean up module data from the database upon its removal
  • Gift card information in pdf-invoices
  • GraphQL support for queries from third-party software
  • Getting gift card details via order API

...

Aheadworks didn't define 'processorPool' for 'Magento\Sales\Model\Order\ProductOption'. Gift card data is saved in product_options.

Thereby, the items within the order do not show the details of gift cards used. Add 'processorPool' to di.xml to fix this issue.

Code Block
<type name="Magento\Sales\Model\Order\ProductOption">
    <arguments>
        <argument name="processorPool" xsi:type="array">
            <item name="aw_giftcard" xsi:type="object">Aheadworks\Giftcard\Model\Product\Option\Processor</item>
        </argument>
    </arguments>
</type>

M2 Gift Card Glossary

...

  • Gift card - a gift card product that can be purchased from the store;
  • Gift card code/gift code - a unique number of the gift card that can be entered at the checkout;
  • Gift card pool - a set of the gift card codes combined by certain criteria. The pool can be assigned to the gift card product so all gift card codes will be drawn from it.

Configuring M2 Gift Card

...

Once installed the Gift Card extension introduces its sections to Products > Gift Card by Aheadworks and Stores > Configuration > Aheadworks extensions > Gift Card.

Gift Card by Aheadworks section contains all sections for the gift card management, while Gift Card settings section defines default behavior of the extension.

Before creating gift cards it is advised to configure the extension settings first, as these control overall extension performance

General settings

To access general extension settings proceed to Stores > Configuration > Aheadworks extensions > Gift Card

Image Removed

General settings are represented with a single field Gift Card Expire After (days). It controls after how many days from the order completion the gift card will not be available for use.

Email Settings

Image Removed

Gift Card Notification Email Sender defines from which email address available at the store all notifications will be sent.

Gift Card Code Pattern

Image Removed

Gift Card Code Pattern section defines according to which pattern ALL gift card codes are created at the store, if not overridden on gift card pool level. The following settings are available:

  • Code Length - defines how many symbols the gift card code will contain;
  • Code Format - defines the format:
    • Alphanumeric;
    • Alphabetic;
    • Numeric.
  • Code Prefix - defines the first symbols of EVERY gift card code generated;
  • Code Suffix - defines the last symbols of EVERY gift card code generated;
  • Dash Every X Characters - defines if the symbols of the gift card code are separated by a dash, every X symbols.

Gift Card Code Pattern is also available from the Gift Card Pool settings. When reading about Gift Card Pools consider these options.

Note

Gift Cards do not support Customizable Options of native Magento 2 products.

Creating a gift card product

...

There are two ways of creating Gift Card Products: from the Products > Catalog screen or Products > Gift Card by Aheadworks > Gift Card Products.

For the purpose of demonstration, we will only describe creating gift cards from the Gift Card Product grid.

Gift Card Product grid

Gift Card Product grid is the management center of all gift card products created.

Image Removed

Whether you want to create a gift card product or check how well your gift card products perform - you can do it right from here.

To add a new gift card product, click on the Image Removed button.

Adding gift card product

The gift card product shares all the setting a native Magento product has, with the exception of a single section. First, configure the product just as you did with every other Magento product. Then, proceed to the Gift Card Information section.

Gift Card Information section contains numerous gift card settings. For convenience purposes these settings will be split into two blocks in the other they appear.

Image Removed

  • Card Type - defines the type of the card:
    • Virtual - when purchased the gift card is sent via email;
    • Physical - requires to be shipped and delivered to a customer, no email sent;
    • Combined - requires to be shipped to the customer and is sent via email.
  • Pool - defines a Gift Card Pool the gift card code will be taken from. If no pull is specified, the gift card will be generated according to the extension settings;
  • Card Description - defines the gift card product description - it is displayed below the product short description before gift card options.

Image Removed

  • Expires After (days) - defines after how many days from order completion the gift card becomes inactive, overrides extension settings if specified;
  • Custom Message Fields - defines if the field to submit a custom message to the gift card is available for a customer;
  • Email Templates - a single gift card product can feature different gift card images and email templates to cover different occasions (you can refer to the demo store as an example). Each template added defines new gift card image and text.
  • Amounts - defines the amounts the gift card is available for purchase with;
  • Allow Open Amount - defines if customers can specify gift card amount manually, comes with the limitation options - Open Amount Min/Max Value;

Once done with the gift card options click Image Removed button. Congratulations! The gift card product has been created and is now available at the store.

Info

How Discounts are Applied to Gift Cards in the Admin Area

If you order gift card products from the backend 'Orders' page with the 'Custom Price' parameter enabled, the following logic is implemented:

  • The amount set as a custom price will be added to the gift card balance;
  • If you need to sell a gift card with a total cost of, say, $100 for, say, $80 (e.g. with 20% off), the best way to achieve this is to apply a coupon code. In this case, a customer will receive a gift card with the amount of $100, but will have to pay "$100 - 20% = $80".

Gift card codes

...

When the gift card product is purchased a gift card code is created. It is not the only way to create a gift card code though. The gift card codes can be created manually from the Products > Gift Card by Aheadworks > Gift Card Codes grid and via Gift Card Pools. This section covers gift card management at the Gift Card Codes grid.

Image Removed

Gift Card Codes grid comes with the same control elements as Gift Card Product grid with addition of Image Removedand Image Removedbuttons, that, as comes from their names, allow importing and exporting gift card codes.

Gift Card Codes grid offers an overview of all the gift card codes available. Here you can find required gift card code, check its balance, see the order the card has been applied to and customer details. This section offers all the information the store administrator might need to the gift card management.

To create a gift card code click on the Image Removed button.

Creating gift card code

Gift card codes share some of the settings with the gift card products, refer to the 1229127734 section for reference. However, some settings, as the sender and recipient are unique as gift cards are supposed to belong to the particular customer.

Delivery date

Image Removed

This section controls when the gift card is delivered.

  • Delivery Date - defines the date of the card delivery;
  • Delivery Date Timezone - defines the timezone of the delivery date to consider time differences if you are working worldwide;
  • Website - defines the website of the gift card.

Sender Details

Image Removed

This section controls from which email address and from whom the gift card is sent. For example, you want to congratulate your customer on holidays or edit the existing gift card for the recipient.

Recipient Details

Image Removed

Here the store owner is suggested specifying all the recipient details, editing message and selecting email template the gift card code is sent with.

Once done setting up the gift card code, there are several options, the store administrator can:

  • Save and Send Gift Card;
  • Save;
  • Save and Continue Edit;
  • Reset;
  • Back.

Gift Card Pools

...

Gift Card Pools are sets of gift card codes, that may differ by the code pattern, event, or any reason you want. For example, you can have a pool of cards you will be selling for Christmas, a pool for Valentine's day, and a pool of cards you have distributed in your physical store.

Using Gift Card Pools

The main reason for using gift card pools is management - instead of having a long list of all the gift cards for different occasions, different balance etc., you can combine gift cards into pools.

Click Image Removed button to create a code pool.

  1. The pool settings override extension settings in terms of the gift card code pattern. In the Code Pattern, you specify the look of the codes that will belong to this particular pool.
  2. Next, you can import codes from the .csv file, in case you have a set of already generated codes, and you want them to belong to this pool.
  3. The last section of the code pool is Manage Pool Codes, here you can find and delete codes belonging to the pool.

Once the pool is created it can be assigned to the gift card products. When the gift card product with an assigned pool is purchased, a gift card code is taken from the pool. When the pool is empty the new codes will be generated according to the pool's pattern. If you want to prevent new codes from being generated it is advised to set gift card product quantity equal to the number of codes available in the pool.

Importing gift codes

...

If you have previously issued gift card codes for your physical store, or while using a third-party extension, you can import these codes to the extension.

There are two ways to import gift card codes, to the gift card code grid, and to a particular pool. The process behind importing codes is similar to both scenarios. For the user guide purposes, we will refer to the gift card pool import.

Importing existing code(s)

All codes are imported via .csv files. Depending on whether you are importing to the Gift Card Code grid or to the Gift Card Pool, .csv files will differ.

Note

Make sure you specify the following columns:

'Type'
'Code'
'Sender Name'
'Sender Email'
'Recipient Name'
'Recipient Email'
'Website'

to help the module to retrieve the code list correctly.

To avoid unwanted mistakes use the easiest way of composing the gift card codes which is to export existing codes first.

...

Email templates

...

Depending on gift card product settings, every gift card can be assigned a particular email template. The extension offers a set of sample email templates that can be edited in the Marketing > Communication > Email Templates.

There are two peculiarities with the Gift Card email templates and Magento templates in general.

First

Gift Card images are introduced to the email templates with the following variable:

Code Block
languagexml
var card_image_base_url|raw

So the full line of code may look like:

Code Block
languagexml
<img src="{{var card_image_base_url|raw}}default.png"> </img>

Second

Due to a Magento issue variable "var logo_url" in the backend preview always returns the Luma logo instead of an active logo. This may be confusing.

That's why we suggest updating the store with the following fix: https://github.com/magento/magento2/issues/6275

The issue does NOT affect the actual emails sent, only the store logo in the preview.

Uninstalling Gift Card

...

width50%

Manual Removal

...

borderWidth2px
borderStylesolid

1. Disable the module by executing the following commands:

No Format
php bin/magento module:disable Aheadworks_Giftcard
php bin/magento setup:upgrade

...

borderWidth2px
borderStylesolid

2. Remove the extension files from the following folder:

No Format
app/code/Aheadworks/Giftcard

...

width50%

Automatic Removal (via Composer)

...

borderWidth2px
borderStylesolid

1. Disable the module by executing the following commands:

No Format
php bin/magento module:uninstall Aheadworks_Giftcard

...

Warning

For more information follow the product user manual on our website

Product Page

Thank you for choosing Aheadworks!



Need Customization?

You can always find the latest version of the software, full documentation, demos, screenshots, and reviews on http://aheadworks.com
License agreement: https://aheadworks.com/end-user-license-agreement
Contact Us: https://aheadworks.com/contact
Copyright © 2021 Aheadworks Co. http://www.aheadworks.com