Jump to content
DataKick

[Free Module] Conseqs - execute action when something happens

Recommended Posts

Posted (edited)

CONSEQS

Actions have consequences. Automate your shop 

 

execute custom action when something happens

 

 

This free module will allow you to easily automate our shop. Its something like IFFT or Zapier that runs inside your PrestaShop. 

You can use it to execute action when something interesting happens.

 


 

TAKE A TEST DRIVE

You can try this module on my demo account

Front Office  /  Back Office

 


 

USE CASES

What you can use this for?

 

  • send email to my email address when new order is created
  • send email to administrator when product stock quantity dropped below 3
  • when user navigates to url that contains string '/invalid-keyword' then redirect to '/sorry-not-available' url
  • when employee logs in to back office, then log this information into access.txt file 
  • when user ends up on 404 page, then log the current url address to text file
  • send copy of all outgoing emails to your email address
  • create voucher for customers who submit a review
  • ..and much more

 


 

DOWNLOAD

You can download latest version of this free module here

version for prestashop 1.7

version for prestashop 1.6

 

 

Edited by DataKick (see edit history)
  • Like 2

Share this post


Link to post
Share on other sites

This looks interesting. Can I use this module to put customers to B2B group if valid VAT number is entered when customer sign up?

Share this post


Link to post
Share on other sites
1 hour ago, Lina008 said:

This looks interesting. Can I use this module to put customers to B2B group if valid VAT number is entered when customer sign up?

Yes, it's very easy. You can create new rule that will run when new Address is created AND its VAT number is not empty. If these condition are met, then run action Assign customer to group. Customer ID will be taken from Address: Customer ID, and enter constant value for Group.

Similarly, you can do this when address is updated. Just create another rule, and use trigger After record has been updated instead of After record has been created

I hope this helps. Here are some screenshots that might make it more clear:

Trigger definition:

01.png.d8be014b9ae2b60c6e5fbef9b8fbc159.png

Conditions

02.png.c1e639e846ece6450b5341fed93ce470.png

Action

03.png.71f7b29854091013b87ff4a9256950c4.png

Share this post


Link to post
Share on other sites
On 6/12/2019 at 3:20 PM, DataKick said:
  • send email to administrator when product stock quantity dropped below 3

Nice module. I don't understand how can do this, can you halp?

 

Share this post


Link to post
Share on other sites

Hello,

how I can grant loyalty points for submitting review?

Share this post


Link to post
Share on other sites
21 hours ago, fourarrow said:

Nice module. I don't understand how can do this, can you help?

send email to administrator when product stock quantity dropped below 3

You need to select Stock quantity changed trigger. That will execute every time stock quantity is adjusted. Because you want to react only on situation when quantity is < 3 you will need to create appropriate condition. And last thing - action. Select Send email. You will need to choose email template. If none of existing email templates work for you, simply create new one (copy existing email template under new name and modify it). In action settings, you will have to provide values to all email {placeholders}. You can provide constants, or bind the value to data provided by trigger (like current quantity)

image.png.0499e8e449aee8010a7331f5cd3788c1.png

Share this post


Link to post
Share on other sites
13 hours ago, lukash4 said:

how I can grant loyalty points for submitting review?

It really depends on what review module and loyalty module are you using.

At the moment, conseqs support revws module out of the box, and also standard prestashop's loyalty module. If you have these two modules installed, you can simply bind them together:

  1. choose Revws: Review approved trigger
  2. in conditions, add Review: ID Customer > 0 to ignore reviews created by guests
  3. choose Award loyalty points action
    • bind Customer ID to Review: ID Customer - to give loyalty points to correct customer
    • set Awarded points to some constant value according your reward strategy

Save and you are done. If you use different review module, or different loyalty module, you can still do this. But you will have to use generic triggers (based on measure) and actions (execute sql script). Or, even better, send me copy of these modules and I'll add support for them.

PS: you can also download this file and import it to you conseqs module. It contains this rule prepared for you: award_loyalty_points_when_revws__review_approved.json

image.png.b579b4abcb1b0f69ac509b42c82f643a.png

 

Share this post


Link to post
Share on other sites
6 hours ago, DataKick said:

It really depends on what review module and loyalty module are you using.

At the moment, conseqs support revws module out of the box, and also standard prestashop's loyalty module. If you have these two modules installed, you can simply bind them together:

  1. choose Revws: Review approved trigger
  2. in conditions, add Review: ID Customer > 0 to ignore reviews created by guests
  3. choose Award loyalty points action
    • bind Customer ID to Review: ID Customer - to give loyalty points to correct customer
    • set Awarded points to some constant value according your reward strategy

Save and you are done. If you use different review module, or different loyalty module, you can still do this. But you will have to use generic triggers (based on measure) and actions (execute sql script). Or, even better, send me copy of these modules and I'll add support for them.

PS: you can also download this file and import it to you conseqs module. It contains this rule prepared for you: award_loyalty_points_when_revws__review_approved.json

 

 

Thanks, but I have error:

Failed to import file award_loyalty_points_when_revws__review_approved.json: Action awardLoyaltyPoints does not exists

 

Share this post


Link to post
Share on other sites
11 minutes ago, lukash4 said:

Thanks, but I have error:


Failed to import file award_loyalty_points_when_revws__review_approved.json: Action awardLoyaltyPoints does not exists

 

You either don't have latest version of conseqs module (0.3.1), or you don't have loyalty module installed, or enabled.

  • Like 1

Share this post


Link to post
Share on other sites
4 hours ago, DataKick said:

You either don't have latest version of conseqs module (0.3.1), or you don't have loyalty module installed, or enabled.

 👍 you're right, I've had loyalty points off on the development version 😀

Share this post


Link to post
Share on other sites

After completing cron tasks I have an error - points are accrued on the client's account. What could be the cause of the error? loyalty.png.d17b3bfa0f0ffaaeb37c3e74a1098d2f.png

Share this post


Link to post
Share on other sites
12 minutes ago, lukash4 said:

After completing cron tasks I have an error - points are accrued on the client's account. What could be the cause of the error? 

Hmm, this is a bug in loyalty module. I have tested the integration against a slightly different version of this module (thirtybees fork), in which this bug is fixed.

Good news is that this is not an actual error. The problem is that LoyaltyModule::save method should return boolean value (true or false), to indicate result of save operation. PrestaShop's version doesn't do that -- method doesn't return anything, and my code interprets this as a failure. But in fact, save operation was successful.

The correct way to fix this is to fix loyalty module. But that will not happen, because prestashop doesn't accept pull requests for this module anymore. So, I'll update my own code, and remove this check. This will be in the next version.

Meanwhile, you can do this: Modify file /modules/loyalty/LoyaltyModule.php (line 57-60) and change

	public function save($nullValues = false, $autodate = true)
	{
		parent::save($nullValues, $autodate);
		$this->historize();
	}

to

	public function save($nullValues = false, $autodate = true)
	{
		parent::save($nullValues, $autodate);
		$this->historize();
		return true;
	}

 

  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)

I've just released new version 0.4.0

PACKAGE REPOSITORY

There are some automations that almost every merchant using my module created. For example, everyone created their own version of reward for review rule.

Even though rule creation process is very simple and easy to understand, this repetition seems unnecessary. So I decided to come up with list of prepared solutions that you can simply import to your store and modify.

You will find new tab named Packages that will let you browse through packages stored on central repository. At the moment there are only few packages, but I'll add more. Also, if you create some cool automation, please export it, and send it to me (conseqs@getdatakick.com). After careful validation and verification, I will add it to the repository. This needs to be manual process to prevent any hacking attempt

 

image.thumb.png.f1e2d29018a36a6b4b823013020217c9.png

NEW CONDITIONS

There are two new conditions you can use to build your rules

  • starts with - evaluates to true if text starts with specific prefix
  • ends with - evaluates to true if text ends with specific suffix

BUGFIXES

There is also one bugfix related to Award loyalty points action. Loyalty module contains a bug that resulted in error log being generated every time this action run. The action finished successfully, though

Edited by DataKick (see edit history)
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

nice, package repository. I can see cancel unpaid orders. can this set to spesific group? and using hour instead days?

I will buy this module.

 

cool solution there are package repository, because I'm just merchant that have limited knowledge about technical stuff.

can it implement to datakick module? I can't use properly this module because too complex for me.

Share this post


Link to post
Share on other sites
Posted (edited)
2 hours ago, dosbiner said:

nice, package repository. I can see cancel unpaid orders. can this set to spesific group? and using hour instead days?

I will buy this module.

Yes, that can be done. However, it's not particularly easy task. But I can prepare the automation rule for you, if you send me information:

- group ID this should apply to

- order age (in hours) when it should be canceled

The reason why it's not an easy task is that there is no real-time trigger. Normally, conseqs reacts on some user input. For example, when user creates order, or when employee approves review. These are real-time events, so that's very easy to detect and react to. However, in this scenario, there is no real-time event that we could subscribe to. Order age is something that is changing with time.

The only way to react on these *time based* events is to define a Measure - it is basically some SQL query that conseqs periodically executes (say every hour) and store its results into database. Then it compares current values with previous one. If there is a change in value, it can trigger some action.

To implement your solution, we need to create SQL query that will calculate 'Age of orders in hours', and we can react on changes to this measured values. Sql to do this looks like this one:

SELECT o.id_order, FLOOR(TIME_TO_SEC(TIMEDIFF(NOW(), o.date_add)) / 3600) AS `age` 
FROM ps_orders AS o
WHERE FLOOR(TIME_TO_SEC(TIMEDIFF(NOW(), o.date_add)) / 3600) < 24

This will return id_order and its age in hours for all orders created within last 24 hours. Every time some row in this result changes, it *can* trigger some rule. We just need to make sure to react on interesting events, for example when age changes from 4 hours to 5 hours. And that's what rule's conditions are for.

This measure mechanism can be used to measure different things. For example, we can measure 'Customer lifetime value', or  'Profitability by Category by Month', etc... For example, we can create rule to send notification email when monthly category profitability drops below some threshold. 

I know this all sounds complicated. Measures are definitely advanced mechanisms, and I don't expect ordinary merchants to be able to use them. But some tech savvy merchants should be able to understand them, and apply them -- and hopefully share their solution with the community 

 

Quote

cool solution there are package repository, because I'm just merchant that have limited knowledge about technical stuff.

can it implement to datakick module? I can't use properly this module because too complex for me.

What integration exactly would you like with datakick module? I can imagine action to 'Generate XML file'  or 'Generate CSV file'. This could be useful, for example, to generate csv file with order information every time an order is created.

 

Edited by DataKick (see edit history)

Share this post


Link to post
Share on other sites

Thank you for this nice module. I have some question for you.

I want to give access to some CMS pages only to customers that bought one specific virtual product (course). For this I have paid module that restrict access only one customer group. This works ok, but I have to add my customers to this group manually. I wanted to use this conseqences module to do this automatically, but I can't figure out how to do that. Could you help please?

Share this post


Link to post
Share on other sites
On 6/24/2019 at 10:28 AM, kaczmar said:

Thank you for this nice module. I have some question for you.

I want to give access to some CMS pages only to customers that bought one specific virtual product (course). For this I have paid module that restrict access only one customer group. This works ok, but I have to add my customers to this group manually. I wanted to use this conseqences module to do this automatically, but I can't figure out how to do that. Could you help please?

Yes, this can be done. 

Strangely enough, there isn't any trigger that would execute when some specific product is purchased. I will add this trigger to the next version, as it's definitely useful to have. And it would make this use case very easy to implement.

But even without it it can be implemented. You just need to come up with sql that will return list of two columns

  • id customer - number customer id
  • access - column that has value 1 if customer should have access to the CMS, 0 otherwise

If you don't know how to prepare such sql query, just send me an email, I'll help you. Once you have this query, you can use it to define Measure, and you can use Measure value changed trigger to react when access changes for any customer. 

It sounds complicated, I know. I'm right now writing a tutorial that explains this more in depth. I'll publish it tomorrow

Share this post


Link to post
Share on other sites

Hi again. I want send email to my drop shipping  when order in status 'approved'.  This work with your module but I want to send products information too. How can I? Thankyou much

Share this post


Link to post
Share on other sites
On 7/15/2019 at 7:22 AM, fourarrow said:

Hi again. I want send email to my drop shipping  when order in status 'approved'.  This work with your module but I want to send products information too. How can I? Thankyou much

I suggest you to first create new email template (html and txt file inside /mails/). You can copy for example order confirmation template and adjust it according your needs (you will probably want to remove bunch of text and stuff).

Inside this new template, make sure to insert placeholder {products}.

Then create new conseqs rule:

1) Trigger: order status changed

2) Condition: new status == 'your status'  (you want to send email only when order status is changed to this one)

3) Action: Send email, and select your new template. Now bind all email templates placeholders, and for {products} use Order: Products - Email format

image.png.73d27457d48af6520c440223a8b598f1.png

The {products} placeholder in email template will be replaced with table of all products in your order

That's it.  I hope this helps a bit

 

Share this post


Link to post
Share on other sites

New version 0.5.0 has just been released:

FEATURES:

  • New trigger: After conseqs rule - executed immediately after another rule. This allows you to chain your rules and create more sophisticated flows
  • New trigger: Product purchased - this trigger is executed when your customer purchase specific product
  • Recognize id_cart_rule columns as CartRule objects
  • Added baseDir to context variables, so you can use it to find files relative to your prestashop installation

BUGFIXES:

  • fixed annoying bug with saving 0 value inside number parameter
  • fixed problems with loading / displaying rules with invalid settings

Share this post


Link to post
Share on other sites

Hi,
It's possible to add an up-selling?
Like "When Product is add to cart" -> "after X minutes" -> "send e-mail to the customer"?

Thank you
 

Share this post


Link to post
Share on other sites

You can do this using measures. You will need measure that calculates information: Product X is in unordered cart for at least X minutes. Value of this measure will start at 0, and switch to 1 after the X minutes pass. It will switch back to 0 if customer convert cart to order.

You can use Measure changed trigger to detect these two changes: from 0 -> 1 and from 1 -> 0, and react accordingly

Sql to define measure can look like this:

SELECT 
  c.id_cart AS id_cart, 
  now() > date_add(cp.date_add, INTERVAL 60 MINUTE) AS meas 
FROM <PREFIX>cart_product cp 
INNER JOIN <PREFIX>cart c ON (cp.id_cart = c.id_cart) 
LEFT join <PREFIX>orders o ON (o.id_cart = c.id_cart) 
WHERE id_product = 1 
AND o.id_order IS NULL

This will find all non-ordered carts containing product with id 1. If the product was added in the last 60 minutes, the 'meas' column will return 0, otherwise it will return 1.

Once you define measure using such sql, you can react on changes of 'meas' column -- for example send email to customer, delete product from cart, generate voucher, etc

 

Share this post


Link to post
Share on other sites

Hello

when i insall module for ps 1.6 ... have got error 500 
store.getdatakick.com/en/module/datakickweb/api:1 Failed to load resource: the server responded with a status of 500 ()

 

Share this post


Link to post
Share on other sites

Oh, I'm terribly sorry about that. There was an error in my license server. Please try again now

PS: it looks like this error was present for more than 2 week, during which period many people downloaded the module, but obviously couldn't use it. You are the only one who bothered to report this critical error. I thank you very much for that. I'm glad there are still some people who cares enough 

Edited by DataKick (see edit history)

Share this post


Link to post
Share on other sites

Hello,

Great module, I've been looking for a long time

I have idea to rewards Old registered customers.
For this purpose and create new group with cheaper shipping cost.

Someboy know how to create rules for this action?
1. First idea.
When customers spend 1000 $ in my shop. module automaticly change his group at new with cheaper shippng cost.
2. Secound idea
When order have status delivered change customer group at new with cheaper shippng cost.

Share this post


Link to post
Share on other sites
17 minutes ago, Mabcin said:

Hello,

Great module, I've been looking for a long time

I have idea to rewards Old registered customers.
For this purpose and create new group with cheaper shipping cost.

Someboy know how to create rules for this action?
1. First idea.
When customers spend 1000 $ in my shop. module automaticly change his group at new with cheaper shippng cost.
2. Secound idea
When order have status delivered change customer group at new with cheaper shippng cost.

We can use Measures for this. We can create measure that will track customer lifetime value -- amount he spent. For this, we can use sql like this:

SELECT id_customer, SUM(total_paid_real / conversion_rate) AS `spent` 
FROM ps_orders 
WHERE valid 
GROUP BY id_customer

Now conseqs module will have information about how much money every customer in the system spent. We can create rule that reacts on change in this information. For example, rule that will be executed when Old Value < 1000 and New Value >= 1000.

Here's such rule - you can import it to your conseqs, and adjust to your needs:

assign_customer_to_group_after_spending_$1000.json

 

Edited by DataKick (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

Wow, Always fast answer. :)

 DataKick can you tell me how to create this secound idea if it's not big problem for you?

Share this post


Link to post
Share on other sites
7 minutes ago, Mabcin said:

Wow, Always fast answer. :)

 DataKick can you tell me how to create this secound idea if it's not big problem for you?

This one is fairly simple, as there exists trigger that reacts on Order status change. All you need to do is wire it together with assign customer to group action

1) Trigger

1.png.275489826d47fb5013ed1775443d4678.png

2) Conditions

2.png.13b676e3a2f1f7273aa2e6503f4b61b8.png

3) Action

3.png.8f00c508e3249049b79055122ad667d6.png

  • Thanks 1

Share this post


Link to post
Share on other sites

thanks, one more time. 
I am going to test the module and translate too. 

Nice it's working but i find one problem.
Because when group is change does not uncheck old group, and when i create new order i see the old list of shipping cost and new list with cheaper shipping cost

Stały klient it's regular customer/old customer
Klient it's customer
image.png.e2c5589f256e1656bf9df3f02bf9091e.png

Edited by Mabcin (see edit history)

Share this post


Link to post
Share on other sites
19 hours ago, Mabcin said:

thanks, one more time. 
I am going to test the module and translate too. 

Nice it's working but i find one problem.
Because when group is change does not uncheck old group, and when i create new order i see the old list of shipping cost and new list with cheaper shipping cost

Stały klient it's regular customer/old customer
Klient it's customer
 

In current version there is no build-in action to remove customer from group. I've created it and will be part of the next version of the module. Meanwhile, you can download this file and put it into /modules/conseqs/actions/ directory

remove-customer-group.php

Then go to your conseqs module, and you should be able to see Remove customer from group action.

If you need to perform two actions at once (remove customer from group and assign to new group), you will need to create two rules. You can use After conseqs rule trigger for the second one -- this allows you to chain multiple rules to run in sequence. Hope it makes sense

Share this post


Link to post
Share on other sites

New version 0.6.0 has just been released. You can now use following new actions to create your rules:

  • Remove customer from group
  • Associate product with category
  • Remove product from category

You can now create rules like

  • add product to Featured category when its price is > $100
  • remove product from category Featured when it is sold out
  • When customer purchase product Club membership then add customer into group Premium,and remove customer from group Customer
  • Like 1

Share this post


Link to post
Share on other sites

Hi @DataKick

can you tell me how to add one more conditions to:

On 9/4/2019 at 7:01 PM, Mabcin said:

2. Secound idea
When order have status delivered change customer group at new with cheaper shippng cost.

because i want to invite people to write opinion about products and my shop. 
I need add condition "when revw approved"
1.  When order have status delivered - is done 
2. change customer group at new with cheaper shippng cost. - is done.
3. when write review and it's approved - not done 

Share this post


Link to post
Share on other sites

Hello! This module really works well, but I ask for your help!

I made it so that if a user buys a certain amount more, for example, 1000, he is transferred to a group of users for whom a discount is assigned.
Everything is cool, but it only works when the user makes an order worth more than 1000 at a time.

How can I make the plug-in consider the total spent amount of the user from this moment, and only then fulfill the conditions ??
I beg for help!

Share this post


Link to post
Share on other sites

Super module! Congratulations !
I would like to ask you, for sending an email for abandoned baskets that would be the rules or what they should look like.

Thanks

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More