kilylabs / google-shopping-feed

Google Shopping Feed API(已解决命名空间问题)

1.1.4.1 2016-10-28 12:26 UTC

This package is auto-updated.

Last update: 2024-09-10 07:01:23 UTC


README

### composer

{
    "require": {
        "lukesnowden/google-shopping-feed": "dev-master"
    }
}

### 使用方法

use LukeSnowden\GoogleShoppingFeed\Containers\GoogleShopping;

GoogleShopping::title('Test Feed');
GoogleShopping::link('http://example.com/');
GoogleShopping::description('Our Google Shopping Feed');

foreach( $products as $product ) {

	$item = GoogleShopping::createItem();
	$item->id($id);
	$item->title($title);
	$item->price($price);
	$item->mpn($SKU);
	$item->sale_price($salePrice);
	$item->link($link);
	$item->image_link($imageLink);
	...
	...

	/** create a variant */
	$variant = $item->variant();
	$variant->size($variant::LARGE);
	$variant->color('Red');

	/**
	 * One thing to note, if creating variants, delete the initial object after you've done,
	 * Google no longer needs it!
	 *
	 * $item->delete();
	 *
	 */

}

// boolean value indicates output to browser
GoogleShopping::asRss(true);

### 类别分类法

返回类别列表。该列表每日从谷歌文档更新

$googleCategories = GoogleShopping::categories();