1. Go to this page and download the library: Download thepublicgood/pcflib 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 / pcflib example snippets
$feed = new TPG\Pcflib\Builder();
//...
$xml = $feed->toXml();
// You can save it directly to a file as well by passing in a pathname:
$feed->toXml('pcf_feed.xml');
// You can
$feed->offers()->add((new TPG\Pcflib\Offer())->...);
$offer->category(['Books', 'Non-fiction', 'Autobiographies'],
(new TPC\Pcflib\Categories\Book)
->setFormat(TPC\Pcflib\Categories\Book::FORMAT_HARDCOVER)
->setIsbn('1234-5678-9012-3456')
->setAuthor('Job Rumble');
)
$offer->name('In Black and White: The Jake White Story')
->manufacturer('Zebra Press')
->description('In Black and White traces the life story of Springbok rugby coach Jake White, right up to and including the 2007 Rugby World Cup. [...] White's story will both absorb and astound.')
->sku(12)
->price(44.95);
)
$offer->ean($ean) // EAN barcode number
->upc($upc) // UPC code
->modelNumber($model) // Model number
->productUrl($url) // URL to a product on your website
->imageUrl($url) // URL to an image of the product on yout website
->notes($notes) // Notes about the product
->marketplace() // Set product on the marketplace
->bundle() // Set the product as a bundle
->groupId($group) // Group ID for grouping individual products
;
$offer->price(151.96, 139.50, 25);
/*
* Set a price of R151.96
* Set a sales price of R139.50
* Set a delivery cost of R25.00
*/