PHP code example of thepublicgood / bidfeed

1. Go to this page and download the library: Download thepublicgood/bidfeed library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

thepublicgood / bidfeed example snippets




$feed = new TPG\BidFeed\Builder();

$product = new Product();

$feed->products()->push($product);

$xml = $feed->toXml();

// You can also save it directly to a file by passing a filename:
$feed->toXml('feed.xml');

// You can...
$feed->products()->push((new Product())->...);

// or add multiple products at once...
$feed->products()->push([$product1, $product2]);

$product->name($productName)
    ->code($productCode)
    ->category($category)
    ->price($price, $marketPrice)
    ->availableQuantity($quantity)
    ->description($description);

$product->gtin($productGtin)        // GTIN (GTIN-12 or GTIN-13)
    ->mpn($mpn);                    // MPN

$product->code('CODE-000111');

$product->name('My Product');

$product->description('<p>Product description</p>');

$product->category(['Electronics', 'Laptops', 'Apple']);

// Set a selling price
$product->price(199.95);

// Set a selling price and market price
$product->price(199.95, 219.95);

// Set a marketing price
$product->marketPrice(211.50);

$product->availableQuantity(10);

$product->images([$image1, $image2]);

// Add an image to the collection
$product->imageCollection()->add($imageUrl3);

$product->productAttributes([
    'Brand' => 'Apple'
]);

$product->guarantee($type, $text);
$product->warranty($type, $text);

GUARANTEE_NOT_OFFERED;      // No guarantee
GUARANTEE_MONEY_BACK_7;     // 7 day money back guarantee
GUARANTEE_MONEY_BACK_10;    // 10 day
GAURANTEE_MONEY_BACK_15;    // 15 day
GUARANTEE_MONEY_BACK_30;    // 30 day
GUARANTEE_REPLACEMENT_7;    // 7 day replacement guarantee
GUARANTEE_REPLACEMENT_10;   // 10 day
GAURANTEE_REPLACEMENT_15;   // 15 day
GUARANTEE_REPLACEMENT_30;   // 30 day

WARRANTY_NOT_OFFERED;       // No warranty
WARRANTY_REPLACEMENT;       // Replacement warranty
WARRANTY_DEALER;            // Dealers warranty
WARRANTY_MANUFACTURER;      // Manufacturers warranty