Magento Shareasale Affiliate feed Import

Sometime back when I was blogging on my blog, I had written an article how to load shareasale affiliate data feed into Magento shopping setup.
I was unable to share the code at that time . I want to share the code as well as scripts I developed as part of my experiments with Magento store.

Magento works on a Modular architecture with a clearly defined MVC model.Magento defines parsers,importers,models as seperate classes and the view loaders simply load once everything is loaded into the Mage core.

Shareasale data actually consists of the below columns in the datafeed files

‘UPC ‘

We can create a Parser,saveLoader, and a DataImporter so that the columns are parsed into an array of records in Magento saved as a Record and Imported into the database.

But there exists some hidden difficulities whenloading data from SAS to Magento, ie Showing the imported data in the Shop.Well we need to define the level definition and layer definitions to load the data into the shop.

Actually the shop can be show in List,Grid,Gallery formats.To accompany all this we need to have the proper image loaded when we are in gallery or list mode so that the catalogue shows the proper image rather than blank image.

We open the file Layer.php where we actually add a line to load the image as shown.

In the function ” public function prepareProductCollection($collection) “
we need to add one line ” ->addAttributeToSelect(‘image_small’) ” just below addTaxpercents as below

     * Initialize product collection
     * @param Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $collection
     * @return Mage_Catalog_Model_Layer
    public function prepareProductCollection($collection)
            ->addAttributeToSelect('image_small')         //->addStoreFilter()


        return $this;

We need to modify the files view.phtml,addtocart.phtml,media.phtml,list.phtml files to show the images,deeplink_url,thumbnail,small_image,large_image everything in the shop.

The item image can be accessed using the product configuration

getData('image_small'); ?>

getData can be used to access anydata that is configured but does not have a mapping with the product catalogue.