How to use Data Feed Manager for WooCommerce?
STEP 1: Configure your data feeds with Data Feed Manager
To create and configure your data feeds, go to:
WyomindData Feed Manager
Your data feeds will be listed according to IDs.
You will find the name of the file, its path as well as the link to the data feed file. You should also get a message that sums up the number of products exported and the number of errors and warnings in your data feed.
The status of your data feed will vary according to the situation:
- Pending: the data feed has never been generated or the scheduled hour is passed (waiting for the execution of the cron task)
- Succeeded: successful generation of the data feed, manually or automatically (the generation corresponds with a schedule)
- Hold: in the process of generation (latency, indeterminate status)
- Processing: generation progression percentage
- Error: the generation is stopped
From the Action you'll be able to:
- Edit
- Generate
- Delete
Click on Create a new data feed to configure your data feed as you want.
The Tool Box
When creating a data feed, you should see a black box on your screen. The Simple Google Shopping plugin includes that tool to help you configure your feed and see what is wrong.
The toolbox is inevitably a very useful tool. This will help you to configure your data feed more quickly.
Below are the different options for the toolbox.
Preview

Library

Configuration
In that first tab is the main configuration of the data feed. To customize your feed, you'll find several fields to fill in.
- Data Feed Name
You can add a name to your data feed. - File Name
Enter a name for the file. - Directory path
Define the path where you want the data feed to be generated.
/feeds
Template
This is where you will configure your XML pattern.
Categories - filter type
In the Categories tab, you can filter your categories according to two different ways:
- Exclude all products from the selected categories.
- Include all products from the selected categories.
Category - selection and mapping
In that subtab, you can select and map your categories to Google ones. This step is very important so that Google can make a link between their product categories and yours.
What is category mapping?
The Google product taxonomy is a tree of categories that will help you generate values for the Google product category attribute listing all possibilities.
Categories names you are using in your WooCommerce shop aren't always the same as the ones used by Google Merchant to reference your products.
This means you have to find out which Google Merchant categories have the best matching with yours, according to the Google product taxonomy.
For example, if you're selling furniture like coffee tables, you'll have a Coffee table category in your WooCommerce back-office. But Google Merchant doesn't handle this kind of category. The closest Google product category could be Kitchen & Dining Room Table.
So this should appear this way in your data feed:
<g:google_product_category>Furniture > Desks & Tables > Kitchen & Dining Room Tables</g:google_product_category>
How to map your categories to Google ones?
Data Feed Manager provides you with an easy way to input Google product categories that are matching yours.
In your data feed configuration, go to the Categories tab. Then, in the Category selection and mapping section, you'll find a tree view of all your categories.
First, select the Google Taxonomy source on which the category mapping is based.
Taxonomy files for the main countries are directly included in the plugin to allow you to map your categories more easily. You can also have a look at the below documentation to know how to add a new taxonomy file.
For each category, you have a little arrow followed by mapped as.
There, you'll be able to start typing a keyword in order to display a list of all categories including that keyword. You simply need to select the one you need.
Once all your categories are mapped, you can click on the Save button.
Here are a few guidelines for choosing the most appropriate category:
- Use the category that best describes your item. To do this, first determine the primary function of the products you are submitting. For specific items like MP3 Players, select the MP3 Players category. While some MP3 players can also serve different functions, like those that contain a clock, they are primarily MP3 Players.
- Use only one category. For some products, more than one category might be relevant. For example, an adapter to allow an MP3 player to be used in a car could be in both categories Motor Vehicles > Audio & Video and Electronics > Audio > Audio Accessories > MP3 Player Accessories. In such cases, you should choose the category that seems the most appropriate to you, but do not include more than one.
- Use the most specific category possible. Being specific will help improve your data quality and in turn ensure that offers are presented in the right category. When viewing the taxonomy, try to navigate to the most specific category that still covers all the products being submitted. For instance, if you are submitting MP3 player chargers use the category MP3 Player Chargers. Conversely, if you are submitting multiple types of chargers use the category Chargers.
How to include the Google category in the XML template?
Finally, so that the Google category is retrieved in your data feed, you must add the following attribute to the XML template:
<g:google_product_category>{{product.google_product_category | parent.google_product_category}}</g:google_product_category>
Read also: https://support.google.com/merchants/answer/6324406?hl=en
How to add a taxonomy file?
With Data Feed Manager, you have the possibility to change the file on which the category mapping is based.
From that page, choose the language you want to use for your taxonomy at the bottom right. Then, in the Downloadable taxonomy, open the Plain Text link that contains full category names.
Save that file and paste it in:
wp-contentpluginsWyomind_SimpleGoogleShoppingdataGoogleTaxonomies
Don't forget to apply the permissions 644 to the file.
You'll then be able to choose that specific taxonomy from your data feed configuration.
Filters
Data Feed Manager for WooCommerce also allows you to filter your products on several levels according to their visibilities or types for example.
Product Visibilities
First of all, you can choose to include products to your feed according to their visibilities:
- Shop and search results
- Shop only
- Search results only
- Hidden
Product Types
Then, choose the type of products that will be included in the feed:
- Simple products
- Virtual products
- Downloadable products
- Grouped products
- External products
- Variable products
- Children of a variable product
Advanced Filters
Here again, you have the possibility to configure your advanced filters according to several options.
- LIKE / NOT LIKE
name like %shirt: will include all products whose name ends with 'shirt'.
name like Apple%: will include all products whose name starts with 'Apple'.
name like %women%: will include all products whose name contains the 'women' character string.
name not like %shirt: won't include any product whose name ends with 'shirt'.
name not like Apple%: won't include any product whose name starts with 'Apple'.
name not like %women%: won't include any product whose name contains the 'women' character string.
- IS NULL / IS NOT NULL
Color is null: will include all products that don't have color. Color is not null: will include all products whose color is not null.
- IN / NOT IN
Size in S L: will include only products from these 2 sizes.
Size not in S L: will include all products whose size is not S or L.
Cron Schedule
Data Feed Manager for WooCommerce provides you with a fully configurable schedule in the Cron Schedule tab of each data feed.
You just have to tick the days and hours when you want your data feed to be generated.
STEP 2: Generate and download the data feeds
Generate the data feeds manually
Data Feed Manager allows you to generate the data feeds manually or automatically.
Manually
You can generate your data feeds manually from the action the data feeds grid.
You also have the possibility to do it from the configuration panel by clicking on Generate.
With the cron tasks
You need to select a least one day and frame from the Cron schedule tab for each data feed that must be updated.
Download the generated data feed
When a data feed is ready to be downloaded, the link is displayed in:
- the data feeds grid
- the data feed page after it has been generated
To download the data feed, select Save link as after clicking on the link (right-click).
Manage your data feed templates with Data Feed Manager
10 Things to know when creating an XML data feed with Data Feed Manager
- An XML data feed is using opening and closing tags that include a value.
<g:id>123456</g:id> <price>45.99 USD</price>
- A data feed template is made of several tags including dynamic or fixed values.
<g:id>{{product.sku}}</g:id> <g:brand>Fixed Brand</g:brand>
- Dynamic values are called variables and use the attribute codes of your WooCommerce website preceded with the object. The variable must be enclosed using double brackets.
<g:id>{{product.sku}}</g:id> <price>{{parent.price}}</price>
- You can include some fixed values between every opening and closing tag. Fixed values are simply text.
<g:brand>YOUR BRAND</g:brand>
- You have also the possibility to add several variables and fixed values in tag.
<title>{{parent.name}}, available in {{product.color}} for only ${{product.price}}</title>
- Some attributes like price, image, or may have further configuration options or parameters that will correspond to your specific data feed needs.
<price>{{product.price currency=EUR vat_rate=20}}</price>
- You're allowed to use PHP code if you want to customize the pattern. Check how to add PHP scripts to your patterns.
<tag>{{product.name output="wyomind_strtolower($self)"}}</tag>
- The syntactic coloration in Data Feed Manager will also help you to avoid many errors in your pattern.
- You can use one or more fallback variables in case the previous is empty or null. If attributeA exists then the value will be attributeA, otherwise, the value will be attributeB...
{{product.color | product.colour}}
- CDATA is recommended. CDATA stands for Character Data. It means that the data in between these tags include data that could be interpreted as XML markup but should not be (Wikipedia article).
<description> <![CDATA[<p>Fantastic <b>Watch</b>, that not only tells you what time it is,but also gives the weather trends</p>]]> </description>
How is a variable structured?
To modify your pattern as you want, before anything you need to respect a particular syntax.
Indeed, in order to retrieve attributes, the Data Feed Manager plugin uses a specific structure. Then it is essential that you know how the variable is built to be able to configure your data feed according to your needs.
The above screen details the different components of a variable.
- Defines what is the target for the attribute to retrieve.
- Defines the code of the attribute to retrieve.
- parameters
Defines some additional parameters for specific attributes such as the currency or the VAT rate. - Defines the different values available for the previous parameter.
Attribute specifications
The data feed pattern is totally customizable.
OBJECTS
In order to retrieve the value of an attribute, you need to define which object is targeted. Below are the different types of objects that you can use.
{{product.attribute_code}}
Retrieves the attribute for the product.
For example:
{{product.sku}}
{{product.color}}
{{parent.attribute_code}}
Retrieves the parent attribute value.
The parent value is retrieved only if the simple (item) product is associated with a parent if not, nothing is retrieved.
The parent product may be a grouped product. The first parent product that matches the simple product is used to get the attribute value.
For example:
{{parent.product_type}}
{{grouped.attribute_code}}
Retrieves the first grouped parent attribute value.
The grouped product value is retrieved only if the simple product is associated a grouped if not, nothing is retrieved.
For example:
{{grouped.url}}
PRODUCT IDENTIFIERS
You'll find below the attributes most commonly used to identify the products in data feeds patterns.
{{object.sku}}
Retrieves the of the product.
For example:
{{product.sku}}
{{object.id}}
Retrieves the id of the product.
For example:
{{product.id}}
BASIC INFORMATION
You'll find below the attributes that are generally used to define basic information about products in the data feeds.
{{object.visibility}}
Retrieves the visibility of the product.
For example:
{{product.visibility}}
{{object.name}}
Retrieves the name of the product.
For example:
{{product.name}}
{{object.description}}
Retrieves the description of the product.
For example:
{{product.description}}
{{object.short_description}}
Retrieves the short description of the product.
For example:
{{product.short_description}}
CATEGORIES
To retrieve the categories of your products, you can check the below attributes.
{{object.google_product_category}}
Retrieves the Google category that you have assigned (in the Categories section) to the first category found for the product (index 0).
For example:
{{product.google_product_category}}
{{object.categories}}
Display the category paths in which the product may be found in your WooCommerce store.
All category paths are listed under the categories attribute from the shortest to the longest path as in the below example:
- Default Category
- Default CategorySales
- Default CategoryClothes
- Default CategoryClothesMen
- Default CategoryClothesMenPants
- Default CategorySalesSpring and Summer Sales
In order to display a specific category path you have the possibility to use a parameter with this attribute:
- nth: display the nth category path, if not specified the 1st category is used by default. Negative values are allowed.
For example:
{{product.categories nth="1"}}
Shows the first category Default Category
{{product.categories nth="-1"}}
Shows the last category path: Default CategorySalesSpring and Summer Sales
{{product.categories nth="-2"}}
Shows the before last category path: Default CategorYClothesMenPants
{{object.category_mapping}}
Retrieves any new category that you have assigned (in the Categories tab) to the item’s own product category. If no mapping is assigned to the first category found, the second category will be used, etc…
You also have the possibility to use some parameters with this attribute:
- index = index of the category mapping
For example:
{{product.category_mapping index=0}}
{{product.category_mapping index=1}}
{{product.category_mapping index=2}}
{{product.category_mapping index=3}}
{{product.category_mapping index=4}}
This will retrieve a maximum of 5 category mappings in 5 separate tags.
LINKS
Below are listed the attributes that are generally used to retrieve any kind of link.
{{object.image_link}}
Retrieves the product’s main image.
You also have the possibility to use some parameters with this attribute:
- nth= index of any additional images to retrieve. By default 0 (the main image).
For example:
{{product.image_link nth="2"}}
{{object.url}}
Retrieves the product’s canonical absolute .
For example:
{{product.url}}
{{object.host}}
Retrieves the host url, for example, https://www.website.com.
For example:
{{product.host}}
AVAILABILITY
The below attributes are often used to retrieve the availability of your products, for the quantity.
{{object.backorders}}
Retrieves yes or no if the product uses backorders.
For example:
{{product.backorders}}
{{object.manage_stock}}
Retrieves yes or no if the product manages stocks.
For example:
{{product.manage_stock}}
{{object.qty}}
Retrieves the available quantity.
The quantity retrieved for variable products is based on the sum of variations.
You also have the possibility to use a parameter with this attribute:
- float = is the number of decimals.
For example:
{{product.qty float=1}}
{{object.is_in_stock}}
Retrieves either "in stock" if the product is in stock, or "out of stock" if the product is out of stock.
You also have the possibility to use some parameters with this attribute:
- in_stock = value to retrieve if the product is in stock
- out_of_stock = value to retrieve if the product is out of stock
For example:
{{product.is_in_stock in_stock="In stock" out_of_stock="No more Stock"}}
{{object.availability}}
Retrieves either "in stock" if the product is in stock, "out of stock" if the product is out of stock, or "available for order" if the product is .
You also have the possibility to use some parameters with this attribute:
- in_stock = value to retrieve if the product is in stock
- out_of_stock = value to retrieve if the product is out of stock
- = value to retrieve if the product is
For example:
{{product.availability in_stock="Currently in stock" out_of_stock="Out of stock" backorderable="Available for order"}}
PRICES AND PROMOTIONS
Below is a list of the price attributes that you can use in your feed pattern. For most of them, you can add some parameters in order to define the currency used or the VAT to apply for example.
{{object.price}}
Retrieves the best price among all the prices defined.
If prices are exclusive of VAT and the product is liable to a unique VAT rate, the price retrieved will include this rate. Otherwise, the price exclusive of tax is retrieved.
For example:
{{product.price}}
You also have the possibility to use some parameters with this attribute:
- currency = automatically converts the original product price to a specified currency. It uses an exchange rate that you have already stored in your admin panel. By default, your local currency is used.
- vat_rate = is a floating value between 0.00 and 100.00 that represents an arbitrary VAT rate to apply. This parameter rewrites the VAT rule for the product except if the product doesn't have any tax class.
Here are some examples:
To convert the prices to EUR and apply a 20% VAT rate:
{{product.price currency=EUR vat_rate=20}}
To convert the prices to USD and not apply any VAT rate:
{{product.price currency=USD vat_rate=0}}
If the prices of your catalog are already including VAT:
{{product.price currency=USD}}
To use an ISO2 code corresponding to one of the countries for which you specified a VAT rate in your tax settings:
{{product.price currency=EUR vat_rate=FR}}
This code may also be completed by an area code:
{{product.price currency=USD vat_rate=US/NY}}
To deduce the VAT corresponding to a country/area:
{{product.price currency=GBP vat_rate=-GB}}
To retrieve prices including different price values for variation products associated with a variable one:
{{parent.price currency=EUR vat_rate=20}}
{{object.min_price}}
Retrieves the minimum price.
This attribute is used for variable products.
If prices are exclusive of VAT and the product is liable to a unique VAT rate, the price retrieved will include this rate. Otherwise, the price exclusive of tax is retrieved.
For example:
{{product.min_price}}
{{object.max_price}}
Retrieves the maximum price.
This attribute is used for variable products.
If prices are exclusive of VAT and the product is liable to a unique VAT rate, the price retrieved will include this rate. Otherwise, the price exclusive of tax is retrieved.
For example:
{{product.max_price}}
{{object.regular_price}}
Retrieves the base price and ignores any other existing price value.
For example:
{{product.regular_price}}
{{object.has_special_price}}
Retrieves either yes if a special price exists or no if it does not.
You also have the possibility to use some parameters with this attribute:
- yes = value to retrieve if a special price exists.
- no = value to retrieve if no special price exists.
For example:
{{product.has_special_price yes="Special price" no="No special price"}}
{{object.sale_price}}
Retrieves the sale price.
For example:
{{product.sale_price}}
{{object.sale_price_effective_date}}
Retrieves the sale price effective dates.
For example:
{{product.sale_price_effective_date}}
{{object.sale_price_from}}
Retrieves the starting date for the sale price.
For example:
{{product.sale_price_from}}
{{object.sale_price_to}}
Retrieves the ending date for the sale price.
For example:
{{product.sale_price_to}}
{{object.tax_status}}
Retrieves the tax status.
For example:
{{product.tax_status}}
{{object.tax_class}}
Retrieves the tax class.
For example:
{{product.tax_class}}
PRODUCT VARIANTS
In the case where you're using product variations (color, size, or gender) then you can use the following attributes. Attention, these attributes are examples and can differ according to the configuration of your WooCommerce store.
{{object.color}}
Retrieves the color of the product.
For example:
{{product.color}}
{{object.size}}
Retrieves the size of the product.
For example:
{{product.size}}
GENERAL PARAMETERS
Below are listed all the parameters that you can use with any attribute in your data feeds.
{{object.attribute prefix="value"}}
The prefix is what will be displayed before the attribute value only if it is not null, nothing is retrieved.
Below is an example:
To add the currency symbol before the price and not retrieve anything when the value of the attribute is null:
{{product.price prefix="$"}}
{{object.attribute suffix="value"}}
The suffix is what will be displayed after the attribute value only if it is not , nothing is retrieved.
Below is an example:
To add the currency code after the price and not retrieve anything when the value of the attribute is null:
{{product.price suffix=" USD"}}
{{object.attribute as="myVariable"}}
The as allows you to store the value of a given attribute into a variable for later use in one of your PHP scripts or in a condition (see if parameter).
Here are a few examples:
Display the product name and store the value in a variable $name:
<!-- Product name is displayed and stored under a new variable "name" -->
<name>{{product.name as="name"}}</name>
$name can be then used in a PHP script later in the template:
<?php
/* If variable $name is equal to "Apple", then display "Apple" then display "Banana"
*/
if($name=="Apple") return $name;else return "Banana";
?>
Store the visibility of a product and use it in a condition for another attribute
<!-- Product visibility is stored under a new variable "visibility" and the attribute doesn't display -->
{{product.visibility as="visibility" output="null"}}
<!-- If the product is hidden then we display the parent product url, otherwise we use the product url-->
<url>{{parent.url if="visibility==hidden" | product.url}}</url>
{{object.attribute if="condition"}}
The if parameter allows you to define one or more necessary conditions to display the given attribute in the data feed.
One condition is built with 3 items :
- the variable to check :
a product attribute
a variable previously stores thanks to the as parameter (see as parameter) - the comparison statement
== equal
<= lower or equal to
=> hieght or equal to
< lower than
> higher than
!= different from - the value
Example:
<!-- Product description will be displayed only if product sku is banana -->
<name>{{product.description if="product.sku==banana"}}</name>
{{object.attribute output="functions"}}
The output parameter allows you to define the output format for a given attribute.
You can use the basic functions (see basic functions), the improved functions (see improved functions), or any functions.
You must refer to the attribute by using the $ as the function's parameter.
Example :
<!-- Get the product name with the first letter of each word in uppercase -->
<name>{{product.name output="ucwords($self)"}}</name>
If you want to use several functions, they must be imbricated as you do with PHP:
Example :
<!-- Remove all html tags from the description and limit the description to the first 100 characters -->
<name>{{product.description output="substr(strip_tags($self),0,100)"}}</name>
You can also use null to display an empty string or you can use any string to display a specific message:
Example :
<!-- If product price is greater than $10 then display "Free Shipping"-->
<shipping_cost>{{product.price if="product.price>10" output="'Free Shipping'"}}</shipping_cost>
BASIC FUNCTIONS
You can use any of the native attributes that are defined in your WooCommerce back-office and also any attribute you have defined for your products (eg: name, description, short_description, weight, size, color…) apart from those which generate XML.
The syntax to use in order to include functions in the variables is:
{{object.attribute output=”function(parameters)”}}
You can also apply one or more functions to all of these attributes by using the following syntax:
{{object.attribute output=”function1(function2(function3($self,parameters)))”}}
All options are executed in the written order:
<title>{{product.name}}</title>
<title>{{product.name output="strtoupper($self)"}}</title>
<title>{{product.name output="strtoupper(substr($self,15,'...'))"}}</title>
This will produce:
<title>V-Neck T-Shirt</title>
<title>V-NECK T-SHIRT</title>
<title>V-NECK T-SHI...</title>
float($self,$decimal)
Converts a numeric value to a floating number.
You need to define some parameters:
- decimal = number of floating numbers. By default: 0
For example:
<g:shipping_weight> {{product.weight output="float($self,2)"}}kg </g:shipping_weight>
cleaner($self)
Removes all characters that don't belong to the UTF-8 charset.
For example:
<g:title>{{product.name output="cleaner($self)"}}</g:title>
inline($self)
Removes all EOL characters from the value.
For example:
<description> {{product.description output="inline($self)"}} </description>
IMPROVED FUNCTIONS
The improved functions are used in the same way as the basic functions but offer more possibilities. They are a rewrite of the native functions but have been improved for a specific use of the Data Feed Manager plugin.
strtoupper($self)
Transforms the value to uppercase.
For example:
<g:title>{{product.name output="strtoupper($self)"}}</g:title>
strtolower($self)
Transforms the value to lowercase.
For example:
<tag>{{product.name output="strtolower($self)"}}</tag>
implode($separator,$self)
Joins all array elements in a string.
You need to define some parameters:
- separator = string used between each value. By
This function may be useful for multi-select attributes like climate, activity general...
For example:
<activity> {{product.activity_general output="implode('-',$self)"}} </activity>
Will give: Outdoor-Running-Warmup-Lounge-Gym
html_entity_decode($self)
Converts all HTML entities to their applicable characters.
For example:
<description> {{product.description output="html_entity_decode($self)"}} </description>
strip_tags($self)
Removes all HTML tags.
For example:
<description> {{product.description output="strip_tags($self)"}} </description>
htmlentities($self)
Converts all applicable characters to HTML entities.
For example:
<description> {{product.description output="htmlentities($self)"}} </description>
substr($self,$length,$end)
Truncates the value.
You need to define some parameters:
- length = maximum length of the value
- end = string that will be added at the end of the string. By default: ...
For example:
<description> {{product.description output="substr($self,50,'...')"}} </description>
If there are HTML tags in your descriptions, you may need to use this function as well:
<description> {{product.description output="strip_tags(substr($self,50,'...'))"}} </description>
API PHP for Data Feed Manager
With Simple Google you can use PHP scripts in different ways to fully customize and control the data feed output.
- Inline PHP scripts
Scripts that are added directly to the data feed template surrounded by PHP tags (<? ... ?>).Those scripts are used with Data Feed Manager only.
API coding standards
The Data Feed Manager PHP API uses the exact same syntax and standards as any PHP coding.
Attribute calls
For performance reasons, Data Feed Manager only loads in the collection of products the attributes that are explicitly required in the data feed template.
This means that only the attributes that are called using the template placeholders, {{scope.attribute_code}}, will be added to the collection of products.
As a consequence, when you try to access the value of an attribute from the $product object, you must be sure that the attribute has been added to the collection.
Most of the time when the returned value is null for a given attribute, it means the attribute is not loaded in the collection of products.
The best way to be sure that all the attributes you need are well loaded in the is to add at the beginning of your template a simple script that lists all the attributes required.
<?php
/* list of required attributes
* {{product.attribute_1}} {{product.attribute_2}} {{product.attribute_3}} {{product.attribute_4}}...
*/
?>
Then you should be able to get the values of these attributes in your PHP script:
<?php
return $product->getAttribute1();
?>
<?php
return $product->getAttribute2()
;?>
<?php
return $product->getAttribute3();
?>
...
PHP functions in attribute calls
You can use any PHP function to apply in the attribute calls even if the function requires one or more additional arguments, for instance:
{{product.name output="str_replace('Apple','Banana',$self)"}}
You can use several consecutive functions:
{{product.ean output="str_pad(str_replace('X','0',$self),10,'0',STR_PAD_LEFT)"}}
Conditional values
To output values based on different conditions, use PHP conditional statements:
- if/else
<?php /* attribute {{product.sku}} required */ if ($product->getSku()=="abc") { return "Alphabetic"; } elseif($product->getSku()=="123") { return "Numeric"; } else{return "Mixed"; } ?>
- switch/case
<?php /* attribute {{product.sku}} required */ switch($product->getSku()){ case "abc": return "Alphabetic"; break; case "123": return "Numeric"; break; default: return "Mixed";} ?>
Opening and closing tags
When using the PHP API inline directly in your data feed template, you must use the opening and closing PHP tags (<? ... ?>)
<?php
if($product->getData('size')=="X-Large") {return "XL";
}
?>
Outputting a value
Return
Any value that you want to output in your data feed, must be returned with the return instruction.
<?php
return "Don't miss! ".$product->getTitle();
?>
/* This script adds for each product in data feed a new ouput line
* Don't miss! Iphone 5
* Don't miss! Galaxy note 7
* ...
*/
Variables scope
All variables available in PHP scripts have a local scope, which means they can't be shared between several scripts.
If you wish to share a variable with different scripts all along the data feed generation process, then the variable must be set as a global variable.
<?php global $increment;$increment++;return $increment;
/* This script will output a incremental $variable* 1* 2* 3* ...*
/?>
API Objects, Variables and Methods
Object $product
is an instance of Mage_Catalog_Model_Product. It contains all methods available by default and some others to Data Feed Manager.
The list below includes the main methods available to use:
- $product->getCategoriesArray()
Retrieves an array of arrays that describes the categories to which belongs the products - $product->getCategoryIds()
Lists all category ids in which the product may be found - $product->getVisibility()
Returns the visibility of the product (1 = not visible individually, 2 = catalog, 3 = search, 4 = catalog and search) - $product->getStatus()
Returns the status of the product (1 = enabled, 2 = disabled) - $product->getData($attributeCode)
Returns the value of the given attribute code - $product->getAttributeText($attributeCode)
Returns the textual value of the given attribute code
Object $this
$this is an instance of Wyomind_simplegoogleshopping_Model_Feed.
It provides a few useful methods:
- $this->hasParent($product, $type="parent")
Returns a Boolean value whether a product has a parent from the given type (parent, grouped, variable) or not.
- $this->getParent($product, $type="parent", $strict=false)
Returns a product object of the given parent type (parent, grouped, variable) if available or the product object passed as parameter when $strict parameter is set on false. - $this->skip()
Skips the current product, to filter out some products based on specific conditions.