Skip to content

Products Notifications Cronjob

Introduction

Purpose

Use this cronjob to manually generate a Products section notification (see Notifications).

INFO

The cronjob only handles notifications whose recurrence is set to "Manually".

.. image:: _static/recurrence_manually.png :height: 43px :width: 341px :scale: 100% :alt: recurrence manually

Basics

To learn more about cronjobs in general, check out the Cronjobs Intro chapter.

Setup

To learn more about setting up and using ASA2's cronjobs, see the dedicated Cronjobs Setup chapter.

Usage

Name

The internal name of this cornjob is Asa2_Module_Notifications_Cron_RepoNotifications.

Therefore, use it with the Cronjobs Setup Serverside execution like this:

text
bash script.sh Asa2_Module_Notifications_Cron_RepoNotifications

And with Cronjobs Setup Wp Cron Api and ASA2's Cron Wrapper like this:

php
$cronWrapper = new \Asa2\Cron\Wrapper('Asa2_Module_Notifications_Cron_RepoNotifications');
$cronWrapper->execute();

REST API Endpoint

The REST API endpoint name of this cronjob is product-notification.

Example:

text
https://example.com/wp-json/asa2/v1/product-notification/?token=[your-token]

Check Cronjobs Setup Rest Api for more details about running ASA2's cronjobs via URL.

Recommendations

Execute this cronjob as often as you want to be informed about the status of your products. Once a day is a good start.

Options

INFO

Without options, this cronjob will execute all notifications.

id

The option id is optional. It can be used to define the notifications to executed.

Possible values

- ID (integer): The ID of one notification rule you want to execute
- List: A comma separated list of IDs to execute multiple notification rules at once, like: 1,2,3

You can find the ID in the first column of the notifications list table in section "Notifications".

Notifications ID

text
// ID example:
bash script.sh Asa2_Module_Notifications_Cron_RepoNotifications -id=2

// List example:
bash script.sh Asa2_Module_Notifications_Cron_RepoNotifications -id=1,2,3,5

Notifications bash

php

With the php option, you can tell the ASA2 cronjob what PHP executable it should use to execute the command. With some webhosters the standard command "php" executes an outdated version and there is a special command for each version, e.g. "php74", "php81" or "/opt/php81/bin/php".

Please check which PHP version is required for the use of ASA2 here: https://bit.ly/asa2-php-version

text
bash script.sh Asa2_Module_Repo_Cron_Refresh --limit=10 --php=php74
bash script.sh Asa2_Module_Repo_Cron_Refresh --limit=10 --php=/opt/php81/bin/php

ASA2 - The Amazon Affiliate Plugin for WordPress