Coder Social home page Coder Social logo

nonnatee / pimcore-bundle-google-facebook-feed Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rohitrajv5/pimcore-bundle-google-facebook-feed

0.0 0.0 0.0 20 KB

Generate Google Feed & Facebook Catelogue Feed in Pimcore

License: MIT License

JavaScript 1.27% PHP 98.73%

pimcore-bundle-google-facebook-feed's Introduction

PimcoreFeedBundle

PimcoreFeedBundle use to generate feed from your product class

Installation

Install with comporser

composer install rohitrajv5/pimcore-bundle-google-facebook-feed

Enable PimcoreFeedBundle bundle

bin/console pimcore:bundle:enable PimcoreFeedBundle

Install assets

bin/console assets:install web
use following packages in your controller
use PimcoreFeedBundle\Service\Feed;
use PimcoreFeedBundle\Service\Item;
use PimcoreFeedBundle\Service\FacebookProductItem;
use PimcoreFeedBundle\Service\SimpleXMLElement;
use PimcoreFeedBundle\Service\Channel;

Add following actions in your controller

    const BASE_URL = "YOUR URL";
    const CHANNEL_TITLE = "YOUR TITLE";
    
    public function googleFeedAction(Request $request)
    {        
        $products = new DataObject\Product\Listing(); // Search listing from your product class        
        $products =  $products->load();        
        header ("Content-Type:text/xml");        
        $feed = new Feed();
        $channel = new Channel();
        $channel
            ->title(CHANNEL_TITLE)
            ->description(BASE_URL)
            ->url(BASE_URL.'/google-feed')
            ->appendTo($feed);
        $item = new Item();
        foreach($products as $product)
        {           
            /**
            You can call your own getter to map the values in array
            */
            $item
                ->title($product->getTitle())
                ->description($product->getDescription())
                ->url($product->getImageUrl())
                ->enclosure($product->getImageUrl(), 4889, 'image/jpeg')
                ->appendTo($channel);
        } 
        echo $feed;                      
    }
    public function facebookFeedAction()
    {
        header ("Content-Type:text/xml"); 
        $feed = new Feed();
        $channel = new Channel();
        $channel
            ->title(CHANNEL_TITLE)
            ->description(BASE_URL)
            ->url(BASE_URL.'/facebook-feed')
            ->appendTo($feed);

        // Product feed item
        $item = new FacebookProductItem();
        $products = new DataObject\Product\Listing();  // Search listing from your product class         
        $products =  $products->load();        
        foreach($products as $product)
        {
            /**
            You can call your own getter to map the values in array
            */
            $item
                ->id($product->getId())
                ->title($product->getTitle())
                ->description($product->getDescription())
                ->url(BASE_URL.$product->getHandle())
                ->availability('in stock') 
                ->condition('new') 
                ->googleProductCategory('Apparel & Accessories > Clothing > Underwear & Socks')
                ->imageLink($product->getImageUrl())
                ->brand($product->getBrand())             
                ->appendTo($channel);
        } 
        echo $feed; 
        
    }

Document Changes!

Create 2 document as follows:

alt text

Set Controller & Action. Respectively for both documents

alt text

Save & Publish

You are done !

Navigate to Google & Facebook Feed urls!

Google: http://[YOUR_APPLICATION_URL]/google-feed
Facebook: http://[YOUR_APPLICATION_URL]/facebook-feed

Facebook Feed:!

alt text

Google Feed:!

alt text

Features!

  • Plugin will generate Facebook & Google Feeds
  • Public url will be directly accessible by Google & Facebook

License

GPL-3.0+

pimcore-bundle-google-facebook-feed's People

Contributors

rohitrajv5 avatar

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.