Developing custom feeds

Developing custom feeds

This feature is available from version 2.1.1 - contact us for upgrades

The Shopping Feeds extension has a great degree of flexibility, but if your store has needs beyond what our extension provides via our feed templates, then you have the possibility of creating your own feed type with custom coded features that fit your store.

Check our newest templates

We add new templates often, so check our page to see an up-to-date list! Maybe we've already added what you need.
https://xtensiongalaxy.com/rocket-shopping-feeds.html 

When to consider a custom feed

  • you need to integrate with an unsupported 3rd party
  • your store has custom product types
  • your store has customizations to core features (prices, taxes, product types etc)
  • your feed needs columns with additional logic, that our directives do not cover


Start here

The Generic feed type can fit many different workflows and you can use it to integrate with various providers. 

It offers the same flexibility as all our feeds but without any specifics that the providers impose.

It is a good start for a custom feed


Custom code - starter module

Download for v2.1.1+

If you need to edit code, here's a starter module for a new custom feed type which already integrates with our extension.

Introduction

A custom feed type will appear among other feeds in your Shopping Feeds admin grid. You can add as many feeds of this type as you want.

It will start off as a Generic feed, so if you can make this feed type work for you, then we recommend it, since it's a lot easier. However, if you hit limits and you need to touch code, read on!


Development

Your custom feed type will require coding skills to set up and develop; it can add and change a lot of the core functionality, but please keep in mind that it's not something to complete in a day.

Compared to patching our code, this approach is compatible with future upgrades. No need to worry that your changes will be overwritten.
Upgrades won't always be 100% stress-free, but we strive to provide you with a full list of changes and bug-fixes


Supported extension versions

To create custom feed types extension version 2.2.x. Please contact us to upgrade
If you cannot upgrade, reach out and we can provide guidance.

Starter module

Download starter module for v2.1.1+

or

https://github.com/rocketweb/Company_Feeds

You can install the module with Modman, or you can manually download and install it in your Magento.

To register your new feed type, you'll need to rewrite one of our modules. We've already done this for you and packaged it into a starter module.

Here's what you need to get your feed to register correctly:

  • Install the module from our repo
  • register your feed name: edit names and labels in Company/Feeds/Model/Feed/Type.php
  • rename the module and files with your Company and module names, just as you would do for a regular new magento module
  • create the feed xml file in our module. This has to be under our module's directory for now, but upgrades won't overwrite your file
    • this has to be under app/code/community/RocketWeb/ShoppingFeeds/etc/feeds/myfeed.xml
    • to get started, just edit our sample, or copy from generic.xml
    • You need to add two very important nodes:
      • <module>Company_Feeds</module> # Your module name, as defined in app/etc/modules/Your_Module.xml
      • <models>companyfeeds</models> # models handle from your config.xml; we'll use this with Mage::getModel()
  • Back in your module, in Model/Feed/Type.php, you can change the Taxonomy URL if you need it; see below
  • After a cache clear, you should be able to add a new feed based on your Custom Feed Type

Your module may have more than one feed type. Be sure to duplicate the example code to register it properly, create another xml file and you're set.


Features

Here's what you can expect to accomplish easily with the starter module in place:


Custom taxonomies

If your feed requires custom taxonomy mappings for Categories, then you can easily replace the Google / Bing etc. URLs with your own list by making a custom feed type.

  • The taxonomy file format is txt, one line per category; lines starting with # are comments and will be discarded
  • For the taxonomy URL, you can use a web URL, or a file link such as: "file:///full/path/to/file.txt" (the protocol is always needed)
  • The taxonomy file will be cached in var/cache

Modify existing directives

Most feed work is done in directives - these are functions that you can tie to a column in your feed, and are part of different classes based on product type. So for example the mapDirectivePrice() function is on a different class for Configurables than associated products.

You can overwrite these functions in your module; we've done an example for the Configurable Associated class: the ID directive will be composed of the parent sku and the child sku. Look in 

Company_Feeds_Model_Map_Myfeed_Product_Configurable_Associated::mapDirectiveId()

You can overwrite any directive by creating the corresponding class. Your feed falls back on the Generic feed type, so look there for guidance on how to name your classes.

There's no need to use <rewrite> to overwrite our code, like you would in Magento. As long as the class names mirror the ones in our Generic module, we can automatically find and use them.


New Directives

You can also add new directives to existing product types: just add a method named mapDirectiveName to the class. This function, like all directives, should receive one parameter: an array of column options. See our example function:

Company_Feeds_Model_Map_Myfeed_Product_Abstract::mapDirectiveMyDirective()

Register your new directive

For this to work, you need to register your new directive to a feed type, in the feed xml. Look at our example in "app/code/community/RocketWeb/ShoppingFeeds/etc/feeds/myfeed.xml"

You'll then be able to map your directive to any feed column of this type.