Giter VIP home page Giter VIP logo

mautic-recommender-bundle's Introduction

image

Mautic Recommender Bundle

Mautic for e-commerce

The first product recommendations system to Mautic. Increase your customer satisfaction and spending with product recommendations. Applicable to your home page, product detail, cart page, emailing campaigns, dynamic ocntent and much more. Quick and Easy

What plugin do?

  • Recommendations items based on contact interactions
  • Abandoned cart
  • Frequently bought together
  • Customers who viewed this item also viewed
  • Special offers and product promotions
  • Related to this item
  • Customers who bought items in your cart also bought
  • Recently viewed items and featured recommendations
  • Category best sellers
  • Most wished products

Which channels do you support?

  • Emails
  • Focus (popups)
  • Dynamic content

Features

  • Segments filtering
  • Custom filtering for items/products
  • Flexible template builder
  • Custom tracking events
  • Multi channel support

Documentation: docs.mtcextendee.com

Sign in for news: mtcextendee.com

mautic-recommender-bundle's People

Contributors

kuzmany avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mautic-recommender-bundle's Issues

Recommendation in Email and Testing area

Your plugin is super great, I recently installed the master copy on mautic 2.15.2. Every thing implemented correctly as per the documentation without any issue and also imported items.

But in mautic email with dynamic insert {recommender=8} it does not send any recommendation to segment subscribers ( example abandoned cart segment).

And in testing area within recommender it does not simulate filtered recommendations template for selected contact.

Imported items are within database to confirm.

Please let me know if I am wrong somewhere.

Your help would be highly appreciated.

Stay safe and take care

Database table error

Hello,

Upgraded to Mautic v3 and installed Recommender v3 compatible i.e ''a2 branch''

Here are the database errors;

  1. when updating the database:

Executing console doctrine:schema:update --force

Updating database schema...

In AbstractMySQLDriver.php line 106:

An exception occurred while executing 'ALTER TABLE mauwr_recommender ADD CO
NSTRAINT FK_D179E67512469DE2 FOREIGN KEY (category_id) REFERENCES mauwr_cat
egories (id) ON DELETE SET NULL':

Can't create table remmo_bul.mauwr_recommender (errno: 150 "Fore
ign key constraint is incorrectly formed")

In MysqliStatement.php line 151:

Can't create table remmo_bul.mauwr_recommender (errno: 150 "Fore
ign key constraint is incorrectly formed")

doctrine:schema:update [--complete] [--dump-sql] [-f|--force] [--em [EM]] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--]

After updating with old recommender tables in database

  1. When again updating database error:

Executing console doctrine:schema:update --force

Updating database schema...

In AbstractMySQLDriver.php line 106:

An exception occurred while executing 'ALTER TABLE mauwr_oauth2_accesstoken
s CHANGE client_id client_id INT UNSIGNED NOT NULL, CHANGE user_id user_id
INT UNSIGNED NOT NULL, CHANGE token token VARCHAR(191) NOT NULL, CHANGE exp
ires_at expires_at BIGINT DEFAULT NULL, CHANGE scope scope VARCHAR(191) DEF
AULT NULL':

Cannot change column 'client_id': used in a foreign key constraint 'FK_9B1F
734B19EB6921'

In MysqliStatement.php line 151:

Cannot change column 'client_id': used in a foreign key constraint 'FK_9B1F
734B19EB6921'

doctrine:schema:update [--complete] [--dump-sql] [-f|--force] [--em [EM]] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--]


  1. When updating segment:

Executing console mautic:segments:update --batch-limit=50
Rebuilding contacts for segment 2

In AbstractMySQLDriver.php line 42:

An exception occurred while executing 'SELECT count(leadIdPrimary) count, m
ax(leadIdPrimary) maxId, min(leadIdPrimary) minId FROM (SELECT DISTINCT l.i
d as leadIdPrimary, hoxKcPGJ.lead_id AS hoxKcPGJ_lead_id FROM mauwr_leads l
LEFT JOIN mauwr_lead_lists_leads hoxKcPGJ ON hoxKcPGJ.lead_id = l.id and (
hoxKcPGJ.leadlist_id = 2) WHERE (EXISTS(SELECT NULL FROM recommender_event_
log eEiXjkDM LEFT JOIN recommender_event_log nUzLSOTP ON nUzLSOTP.lead_id =
eEiXjkDM.lead_id AND nUzLSOTP.id > eEiXjkDM.id AND nUzLSOTP.item_id = eEi
XjkDM.item_id AND ((eEiXjkDM.item_id = nUzLSOTP.item_id AND nUzLSOTP.event
_id = 3) OR nUzLSOTP.event_id = 4) WHERE (eEiXjkDM.event_id = 2) AND (eEi
XjkDM.lead_id = l.id) AND (eEiXjkDM.date_added > ?) AND (nUzLSOTP.id IS NUL
L))) AND (hoxKcPGJ.lead_id IS NULL)) sss' with params ["2020-10-29"]:

Table 'remmo_bul.recommender_event_log' doesn't exist

In MysqliStatement.php line 86:

Table 'remmo_bul.recommender_event_log' doesn't exist

mautic:segments:update [-b|--batch-limit [BATCH-LIMIT]] [-m|--max-contacts [MAX-CONTACTS]] [-i|--list-id [LIST-ID]] [-f|--force] [--bypass-locking] [-t|--timeout TIMEOUT] [-x|--lock_mode LOCK_MODE] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--]

Thanks

recommender content in email

Hey

I recently tested the recommender plugin in email and noticed that gmail completely screws up the template.

It's due to the fact that the recommender template consists of a <style> and a html structure:

-s decorated with classes.
Gmail actually scraps the <style> tag and removes the classes from the divs.

Do you happened to run into the same issue?

It seems to me that the scructure needs to be changed from <style> and classes to inline style attributes.

When deactivated, the plugin created errors on merging contacts.

When on contacts entered forms on multiple devices, the plugin (even when deactivated) prevented contacts from merging. Threw this error:

[2020-02-27 17:01:14] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Type error: Argument 1 passed to MauticPlugin\MauticRecommenderBundle\EventListener\LeadSubscriber::onLeadMerge() must be an instance of MauticPlugin\MauticRecommenderBundle\EventListener\LeadMergeEvent, instance of Mautic\LeadBundle\Event\LeadMergeEvent given" at /opt/bitnami/apps/mautic/htdocs/plugins/MauticRecommenderBundle/EventListener/LeadSubscriber.php line 120 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Type error: Argument 1 passed to MauticPlugin\\MauticRecommenderBundle\\EventListener\\LeadSubscriber::onLeadMerge() must be an instance of MauticPlugin\\MauticRecommenderBundle\\EventListener\\LeadMergeEvent, instance of Mautic\\LeadBundle\\Event\\LeadMergeEvent given at /opt/bitnami/apps/mautic/htdocs/plugins/MauticRecommenderBundle/EventListener/LeadSubscriber.php:120)"} []

Error 500 on create event

Hello,

I just installed this module on a "fresh" installation of Mautic (2.15.0).

The installation of the module is perfectly unrolled.

By cons, when I want to create a new event, I imagine the following error (in the logs):

[2019-02-25 16:08:10] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\ClassNotFoundException: "Attempted to load class "SetItemValues" from namespace "MauticPlugin\MauticRecommenderBundle\Controller\Reqs". Did you forget a "use" statement for another namespace?" at /home/mywebsite/www/plugins/MauticRecommenderBundle/Controller/RecommenderEventController.php line 114 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\ClassNotFoundException(code: 0): Attempted to load class \"SetItemValues\" from namespace \"MauticPlugin\\MauticRecommenderBundle\\Controller\\Reqs\".\nDid you forget a \"use\" statement for another namespace? at /home/mywebsite/www/plugins/MauticRecommenderBundle/Controller/RecommenderEventController.php:114)"} []

Indeed, on line 114 of the events controller, there is a reference to new Reqs\SetItemValues().

What is the problem ?

Thanks you.

recommender:recommenderEvent:viewown permission

Hey @kuzmany!

I came across an error while trying your recommender plugin.

[2019-04-05 11:57:39] mautic.CRITICAL: Uncaught PHP Exception Mautic\CoreBundle\Security\Exception\PermissionNotFoundException: "Permission not found. 'recommender:rec
ommenderEvent:viewown' given." at /var/www/html/app/bundles/CoreBundle/Security/Permissions/CorePermissions.php line 279 {"exception":"[object] (Mautic\\CoreBundle\\Se
curity\\Exception\\PermissionNotFoundException(code: 403): Permission not found. 'recommender:recommenderEvent:viewown' given. at /var/www/html/app/bundles/CoreBundle/
Security/Permissions/CorePermissions.php:279)"} []

Without full System administrator role even the dashboard gives 500 error
Even if the plugin is turned off.

I searched in the code for this so called

recommender:recommenderEvent:viewown

permission, but I could only find it in the config where the mautic.plugin.recommender.event menu requests for it.

In Security/Permissions/RecommenderPermissions.php I could only find the code which sets up recommender.recommender.[action] permissions

Did I miss something?

Can't create a New Recommender

Hi,

We've installed Mautic v2.15.1 with PHP 7.0.33. We've installed and enabled the plug-in following the steps without any problem. We've create some Events, Import Items and create a Template. We can see all this information in Recommender tables in the data madel but when we try to create a new Recommender nothing happens.

This is the complete message in the Mautic log file:

[2019-07-31 21:16:38] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE)" at /var/www/html/mautic/plugins/MauticRecommenderBundle/Form/Type/RecommenderTableOrderType.php line 150 {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) at /var/www/html/mautic/plugins/MauticRecommenderBundle/Form/Type/RecommenderTableOrderType.php:150)"} []

datamodel_image
Events
creating_new_recommender

Please, let me know if you need more info.

Regards,

Error importing items.json file

When trying to upload items.json through command php app/console mautic:recommender:import --type=items --file="http://domain.tld/path/to/items.json" as defined in instruction giving error as below:

[Symphony\Component\Debug\Exception\ClassNotFoundException]
Attempted to load class "JsonMachine" from namespace "JsonMachine".
Did you forget a "use" statement for another namespace?

mautic: recommender: import [-t|--type TYPE] [-f|--file [FILE]] [-1|--batchlimit[BATCH-LIMIT]] [-timeout [TIMEOUT]] [-h| --help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [--no-interaction] [-s|--shell] [--process-isolation] [-e|--env ENV] [--no-debug] [--]

And when executing console mautic:recommender:import --type=items --file="https://domain.tld/path/to/items.json" --batch-limit=100 --timeout=-1 day

Get error as below:

[Symfony\Component\Console\Exception\RuntimeException]
Too many arguments, expected arguments "command".

mautic:recommender:import [-t|--type TYPE] [-f|--file [FILE]] [-l|--batch-limit [BATCH-LIMIT]] [--timeout [TIMEOUT]] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-s|--shell] [--process-isolation] [-e|--env ENV] [--no-debug] [--]

Using Mautic 2.15.1 PHP - 7.2

Thanks

recommender order by SQL error

Hey,

I'm still trying to figure out how the recommandation is supposed to work. But I ran into some SQL errors while the plugin tried to assemble the recommendation in a campaign.

The cause of the error might originate from the order by settings I applied.

FireShot Capture 073 - Edit pety-proba

For these settings I got the following error:

[2019-04-16 15:53:12] mautic.ERROR: CAMPAIGN: An exception occurred while executing 'SELECT l.item_id as id FROM recommender_event_log l WHERE (l.lead_id = ?) AND (EXIS
TS(SELECT NULL FROM recommender_item_property_value lItxUpBS WHERE (lItxUpBS.item_id = l.item_id) AND (lItxUpBS.property_id = 3) AND (lItxUpBS.value = ?))) GROUP BY l.i
tem_id ORDER BY SUM(.weight) DESC LIMIT 6' with params [138526, "indukci\u00f3s"]:  SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQ
L syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') DESC LIMIT 6' at line 1 [] []

First of all the table name is missing from order by clause.
But the query also lacks a table with weight field.

Either the recommender_events table should be joined, or performance-wise it would be a better solution to store the weights of the events in the recommender_event_log records.

asynchron Mautic Event handling is not working

I uploaded an inventory and tried to send events of RecommendEvent type as described on https://docs.mtcextendee.com/installation/tracking

The mt('send', 'RecommenderEvent', { eventName: 'DetailView', itemId:'9-191' }); function was called in a handler of a JS click event. I experienced that the recommender plugin did not receive the events this way.

I tried to trace the error and concluded that the event handler code (MauticJs.recommenderWevent) in MauticRecommenderBundle/EventListener/BuildJsSubscriber.php is half wrong:

The recommenderEvent function looks like this:

MauticJS.recommenderEvent = function (params) {
        parms = {};
        var eventParams = {};

          if (typeof MauticJS.getInput === 'function') {
                queue = MauticJS.getInput('send', '{$eventLabel}');
            } else {
                return false;
            }
            if (queue) {
                for (var i=0; i<queue.length; i++) {
                    var event = queue[i];
                    // Merge user defined tracking pixel parameters.
                    if (typeof event[2] === 'object') {
                        for (var attr in event[2]) {
                            eventParams[attr] = event[2][attr];
                        }
                        parms['eventDetail'] = btoa(JSON.stringify(eventParams));
                        parms['params'] = btoa(unescape(encodeURIComponent(JSON.stringify(params.params))));
                    }
   
                    MauticJS.makeCORSRequest('POST', '{$url}', parms,.
                        function(response) {
                        },
                        function() {

                    });
    
       }
                  }
            }

document.addEventListener('eventAddedToMauticQueue', function(e) {
      if(e.detail[0] == 'send' && e.detail[1] == '{$eventLabel}'){
         MauticJS.recommenderEvent();
      }
    });

The function get an argument params then doesn't handle it ever, but always tries to get the events via MauticJS.getInput function call.

But as far as I understood the core mautic code, the BuildJSSubscriber in CoreBundle overrides how mt function calls are handled after mtc.js is loaded: instead of putting the new mautic events into a queue, the mautic events are dispatched immediately as eventAddedToMauticQueue JS event for subscribers to handle.

// Dispatch the queue event when an event is added to the queue
    if (!MauticJS.inputQueue.hasOwnProperty('push')) {
        Object.defineProperty(MauticJS.inputQueue, 'push', {
            configurable: false,
            enumerable: false,
            writable: false,
            value: function () {
                for (var i = 0, n = this.length, l = arguments.length; i < l; i++, n++) {
                    MauticJS.dispatchEvent('eventAddedToMauticQueue', arguments[i]);
                }
                return n;
            }
        });
    }

The recommender Plugin subscribes to this JS event and MauticJS.recommenderEvent(); is called, but MauticJS.recommenderEvent(); tries to get the event details from the queue instead of the argument.

So the result is that when the recommender event (mt('send', 'RecommenderEvent', { eventName: 'DetailView', itemId:'9-191' });) is called before mtc.js is loaded, it works perfectly, but when the function is called after mtc.js is loaded, it fails.

As a good example pageviews are handled like this:

m.sendPageview = function(pageview) {
        var queue = [];

        if (!pageview) {
            if (typeof m.getInput === 'function') {
                queue = m.getInput('send', 'pageview');
            } else {
                return false;
            }
        } else {
            queue.push(pageview);
        }

        if (queue) {
[...]         

empty subject in email

Hey, I ran into this issue here: mautic/mautic#7286
I debugged the code and concluded that the empty subject is caused by this recommender plugin.

In MauticRecommenderBundle/EventListener/EmailSubscriber.php the onEmailGenerate method set the subject as:

$event->setSubject($this->recommenderTokenReplacer->getRecommenderGenerator()->replaceTagsFromContent($event->getSubject()));

This line sets subject to null

In our case the plugin is only installed, but not in use, so there are no recommendations, no product catalog, etc

recommender plugin install error

Hi,
I am new to mautic, when I install recommender plugin following the instructions in the online documents,

Installation manual for developers

  1. update composer.json with private repository and access token
  2. composer require kuzmany/mautic-recommender-bundle
  3. php app/console mautic:plugins:reload
  4. php app/console doctrine:schema:update --force

I got following error "Fatal error: Uncaught Error: Class 'Mautic\ApiBundle\MauticApiBundle' not found in D:\phpstudy_pro\WWW\mautic\app\AppKernel.php:169" in the third step;

How can I solve this problem? My Mautic version is 2.16.2. Recommer bundle version is 1.3.0 .

Thank you!

nkwindforce

D:\phpstudy_pro\WWW>cd mautic

D:\phpstudy_pro\WWW\mautic>composer require kuzmany/mautic-recommender-bundle
Warning from https://mirrors.aliyun.com/composer: You are using an outdated version of Composer. Composer 2.0 is now available and you should upgrade. See https://getcomposer.org/2
Using version ^1.3 for kuzmany/mautic-recommender-bundle
./composer.json has been updated
Loading composer repositories with package information
Warning from https://mirrors.aliyun.com/composer: You are using an outdated version of Composer. Composer 2.0 is now available and you should upgrade. See https://getcomposer.org/2
Updating dependencies (including require-dev)
Package operations: 3 installs, 0 updates, 0 removals

  • Installing mautic/composer-plugin (1.0.1): Downloading (100%)
  • Installing halaxa/json-machine (0.3.3): Downloading (100%)
  • Installing kuzmany/mautic-recommender-bundle (1.3.0): Downloading (100%)
    Package guzzle/guzzle is abandoned, you should avoid using it. Use guzzlehttp/guzzle instead.
    Package phpoffice/phpexcel is abandoned, you should avoid using it. Use phpoffice/phpspreadsheet instead.
    Package piwik/device-detector is abandoned, you should avoid using it. Use matomo/device-detector instead.
    Package sensio/distribution-bundle is abandoned, you should avoid using it. No replacement was suggested.
    Writing lock file
    Generating autoload files

D:\phpstudy_pro\WWW\mautic>php app/console mautic:plugins:reload

Fatal error: Uncaught Error: Class 'Mautic\ApiBundle\MauticApiBundle' not found in D:\phpstudy_pro\WWW\mautic\app\AppKernel.php:169
Stack trace:
#0 D:\phpstudy_pro\WWW\mautic\vendor\symfony\http-kernel\Kernel.php(431): AppKernel->registerBundles()
#1 D:\phpstudy_pro\WWW\mautic\app\AppKernel.php(273): Symfony\Component\HttpKernel\Kernel->initializeBundles()
#2 D:\phpstudy_pro\WWW\mautic\vendor\symfony\framework-bundle\Console\Application.php(62): AppKernel->boot()
#3 D:\phpstudy_pro\WWW\mautic\vendor\symfony\console\Application.php(117): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 D:\phpstudy_pro\WWW\mautic\app\console(43): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 {main}
thrown in D:\phpstudy_pro\WWW\mautic\app\AppKernel.php on line 169

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.