Giter Site home page Giter Site logo

syliusfeedplugin's Introduction

Sylius Feed Plugin

Latest Version Latest Unstable Version Software License Build Status

A plugin for creating all kinds of feeds to any given service. Do you want to create product feeds for your Google Merchant center? Then this is the right plugin for you.

Installation

Step 1: Download the plugin

Open a command console, enter your project directory and execute the following command to download the latest stable version of this plugin:

$ composer require setono/sylius-feed-plugin

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the plugin

Then, enable the plugin by adding the following to the list of registered plugins/bundles in the config/bundles.php file of your project:

<?php

return [
    // ...
    
    League\FlysystemBundle\FlysystemBundle::class => ['all' => true],
    Setono\SyliusFeedPlugin\SetonoSyliusFeedPlugin::class => ['all' => true],
    Setono\DoctrineORMBatcherBundle\SetonoDoctrineORMBatcherBundle::class => ['all' => true],
    
    // It is important to add plugin before the grid bundle
    Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true],
        
    // ...
];

NOTE that you must instantiate the plugin before the grid bundle, else you will see an exception like You have requested a non-existent parameter "setono_sylius_feed.model.feed.class".

Step 3: Import routing

# config/routes/setono_sylius_feed.yaml
setono_sylius_feed:
    resource: "@SetonoSyliusFeedPlugin/Resources/config/routing.yaml"

If you don't use localized URLs, use this routing file instead: @SetonoSyliusFeedPlugin/Resources/config/routing_non_localized.yaml

Step 4: Configure plugin

# config/packages/setono_sylius_feed.yaml
imports:
    - { resource: "@SetonoSyliusFeedPlugin/Resources/config/app/config.yaml" }

Step 5: Update database schema

Use Doctrine migrations to create a migration file and update the database.

$ bin/console doctrine:migrations:diff
$ bin/console doctrine:migrations:migrate

Step 6: Using asynchronous transport (optional, but recommended)

All commands in this plugin will extend the CommandInterface. Therefore you can route all commands easily by adding this to your Messenger config:

# config/packages/messenger.yaml
framework:
    messenger:
        routing:
            # Route all command messages to the async transport
            # This presumes that you have already set up an 'async' transport
            # See docs on how to setup a transport like that: https://symfony.com/doc/current/messenger.html#transports-async-queued-messages
            'Setono\SyliusFeedPlugin\Message\Command\CommandInterface': async

Usage

After setup you want to create a feed. Go to /admin/feeds/new and create a new feed. Remember to enable it and select one or more channels.

After that go to your console and run this command:

$ php bin/console setono:sylius-feed:process

If you haven't changed any configuration, there should be a feed with your products inside the /var/storage/setono_sylius_feed/feed directory.

syliusfeedplugin's People

Contributors

aureliusm avatar dependabot-preview[bot] avatar fabianaromagnoli avatar hatem20 avatar holicz avatar igormukhingmailcom avatar loevgaard avatar loocos avatar lruozzi9 avatar mbabker avatar mmenozzi avatar nettob avatar pjurasek avatar roshyo avatar techbech avatar wadjeroudi avatar zambodaniel 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

Watchers

 avatar  avatar

syliusfeedplugin's Issues

V0.4.2 cannot be installed on SyliusStandard v1.6.4

Steps to reproduce:

  • create a new project based on SyliusStandard V1.6.4
  • try to install Setono/SyliusFeedPlugin by running the command from readme

What happens:

You get the error below:

/srv/sylius # composer require setono/sylius-feed-plugin
Using version ^0.4.2 for setono/sylius-feed-plugin
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Can only install one of: thecodingmachine/safe[v1.0.0, v0.1.16].
    - Can only install one of: thecodingmachine/safe[v1.0.0, v0.1.16].
    - Can only install one of: thecodingmachine/safe[v1.0.0, v0.1.16].
    - setono/sylius-feed-plugin v0.4.2 requires thecodingmachine/safe ^1.0 -> satisfiable by thecodingmachine/safe[v1.0.0].
    - Installation request for setono/sylius-feed-plugin ^0.4.2 -> satisfiable by setono/sylius-feed-plugin[v0.4.2].
    - Installation request for thecodingmachine/safe (locked at v0.1.16) -> satisfiable by thecodingmachine/safe[v0.1.16].


Installation failed, reverting ./composer.json to its original content.
/srv/sylius # 

What should happen:

You should be able to install the plugin without errors


The Sylius version I used to reproduce this:

commit 8b20594a6d065bbeff8d487aaab4ec8bd3687ac4 (tag: v1.6.4)
Author: Kamil Kokot <[email protected]>
Date:   Thu Dec 5 15:24:52 2019 +0100

Controller of show / violation action not callable

There is a syntax error in the admin.yaml file that gives me this error:

The controller for URI "/admin/feeds/1" is not callable: Controller "setono_sylius_feed.controller.feed:showAction" does neither exist as service nor as class.

corrected as follows:
_controller: setono_sylius_feed.controller.feed:showAction -> error
_controller: setono_sylius_feed.controller.feed::showAction -> ok

is it just me? ... !

Thanks

Error compiling container with 0.5 version

Compile Error: Declaration of Setono\SyliusFeedPlugin\Normalizer\ToStringNormalizer::supportsNormalization($object, ?string $format = NULL, array $context = Array): bool must be compatible with Symfony\Component\Serializer\Normalizer\ContextAwareNormalizerInterface::supportsNormalization($data, $format = NULL, array $context = Array)

Do not process already processing feed

I am currently having a problem that my monitoring tool is getting a lot of errors; I have a cron job running; that processes the feeds every minute. From what I understand what is happening here; if the feed is already processing, and is then being processed again, then it will throw the The feed is not in a valid state. State is processing exception.

In my opinion this shouldn't really be an exception. Throwing this exception can be avoided by not processing 'already processing' feeds, right?

image

image

Remove files when feed generation errors

If the feed generation errors, but it managed to write the base feed file _feed then subsequent tries to generate the feed will fail.

Solution: Delete all temp files on error

Add possibility to filter products on feed

We have the need to filter the products to insert into the feed. We have for example a feed with all the products, but we also have one more feed that contains a few products (existing in the first one) used to make more aggressive campaigns.
Currently, the only way to achieve this need is by creating another channel with the limited collections of products enabled for that channel, but this solution is very difficult to maintain because, at every price change, for example, the store manager should change the price in both channels. If this is not done an error on the Google Ads checking is generated due to the inconsistent price between feed and website.
Another solution could be the use of a custom label, but it seems that the new Google Ads campaign type has removed the custom labels in favor of the feed_label. But it looks like they have a different purpose than the current one we need to achieve.
So, the only possible way is to create a collection of FeedFilter on the Feed entity (in the same way Sylius do with promotion rules and actions) so that can be customized by users with the addition of any custom filter. We already have reached this purpose, but applying this filter is very difficult on the plugin because of the orm-batcher and other things, for example, in our case, the filter works based on product variant codes and not on products.

So, what do you think of this? If you agree I will start to work on a PR, but so many changes and BC will be introduced I suppose and much effort should be implemented. Instead, if you don't want to introduce this kind of feature we will work on a different solution without wasting time in two. 😉

Google Shopping feed shouldn't generate separated items for "parent" products

As stated in the Google Shopping documentation https://support.google.com/merchants/answer/6324507?hl=en&ref_topic=6324338:

Use the parent SKU as the item_group_id for all variants of the same product. Don’t submit a parent SKU as a separate product. If you’d like to group variants using a parent SKU, use the parent SKU as the value for item_group_id for all products in the variant group.

But currently the generated Google Shopping feed contains separated items for both Product and ProductVariant.

We should only generate items for ProductVariants using the related Product's code as the item_group_id .

You need to set request context manually to make URLs correct

The URLs generated in the feed uses the routers request context. Hence you need to set that manually to have correct URLs. That is not feasible if you have multiple channels since the URL would be wrong. Therefore this plugin should use the channels hostname when generating URLs.

Document how to add a custom feed type

I want to implement another feed type besides Google Shopping. I am currently searching through the source code on how to do that. It would be nice if this would be documented.

LiipImagine Cache Resolve wrong domain url using command

Hello guys,

When using the php bin/console setono:sylius-feed:process command by crontab, the product image link return http://localhost/media/...
After that, either Facebook either Google will not be able to sync the products catalog.

Language and structure in the feeds not correct?

Language for the product name, description, taxon and on... is not changing with the locale like en_US / fr_FR.
The URL´s are correct.

Also the definition-structure of the xml is not correct anymore for google and bing.

BDW: How can i overwrite the GenerateFeedsCommand.php?

Flysystem issue

After upgrading Sylius to 1.12 and Symfony to 6, there is this error with flysystem:

The config parameter "setono_sylius_feed.storage.feed" references a service  
!!     League\Flysystem\Filesystem, which is not an instance of League\Flysystem\  
!!    FilesystemInterface. Fix this by creating a valid service that implements L  
!!    eague\Flysystem\FilesystemInterface.          

Also #83 is also still problematic.

I appreciate your support.

Wrong violation count

The sum of violations is wrong. It counts the total number of violations for all feeds.

image

Create filesystem abstraction

Instead of depending directly on flysystem a filesystem abstraction could be made (with adapters for flysystem, gaufrette and others).

Besides allowing different filesystem abstractions it will also allow us to have other methods in the filesystem interface, i.e.: function isDeeplinkingAvailable(): bool and function getDeeplink(): string. The latter method would generate a direct link to the feed instead of having to go through the ShowFeedAction.

Upgrade to Sylius 1.9

It's impossible to upgrade to Sylius 1.9 using Symfony 5.2 with this plugin installed. This is due to the fact that Symfony 5 requires doctrine 2 and setono/doctrine-orm-batcher-bundle is compatible with doctrine-bundle v1 only.

Upgrading to DoctrineBundle 2.0

Call to a member function getPath() on null

This bundle is getting product images as an collection and then using the one with index 0 for the feed. For some reason my collection has images but does not have image with index 0, it actually starts with 1.

It would be safer to replace this code: $imagesAware->getImages()[0] with $imagesAware->getImages()->first().

I will provide PR.

Start generation immediately on creation

When you create a feed, you'd expect the feed to be generated afterwards. Therefore: create a listener that listens to the create and update events on the feed and issue a feed generation command upon those events.

Normalizer interfering with Sylius 1.8 new api

Hi, we were trying the new api system of Sylius 1.8 (that is still under development) and we found out that something in this plugin was changing the responses of these apis. The problem is in the normalizer service (src/Resources/config/services/normalizer.xml):

    <service id="setono_sylius_feed.normalizer.to_string"
             class="Setono\SyliusFeedPlugin\Normalizer\ToStringNormalizer">
        <tag name="serializer.normalizer"/>
    </service>

Infact, the responses all contains just the "to string" normalization of the objects. Is it possible to limitate this normalizer only to the purposes of the plugin?

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.