Primer

The “Product Package” tab in DFP Sales Manager represents groupings of your product objects that you want to sell together. As an example, you might have a product package selling specifically to a ‘sports enthusiast’ crowd that has various products targeting specific keys or audience segments. Among these, you might have some products that are optional and some which are mandatory.

ProductPackage objects, when associated with a proposal and populated with ProductPackageItems will form Packages. Packages are in effect a “shopping cart” with items that need to go through the “checkout” process before they become ProposalLineItems.

Note: These are fundamentally different from using products alone to create proposal line items, as they have additional logic regarding how the associated products in the product package must be sold.

Product packages and the sales manager catalog

Creating product packages

The “Product Package” tab in the UI is a composite of three objects: ProductPackages, ProductPackageItems, and Packages. To use all three effectively, the first step is to create a ProductPackage. This is equivalent to instantiating an empty product package in the UI Panel:

Java

Python

result = product_package_service.createProductPackages([product_package])

This new product package is actually only a component of what you see in the UI, as the product package in DFP has multiple parts. The created product package is equivalent to the top portion product package panel in the UI:

Creating product package items

In creating ProductPackageItems, you are effectively grouping, and assigning rate card restrictions to, products you wish to sell together in a product package. These objects are halfway between products and proposal line items. This is equivalent to adding products to an empty product package as created above:

Start with fetching the appropriate service and creating an empty constructor for the ProductPackageItem object:

Python

From there, the fields that you are required to set are the product from which you want to create the ProductPackageItem and the product package ID under which to group the ProductPackageItems. You can also specify if they must use this product package item when selling the product package.

Java

// Set the product from which the product package item is created.
productPackageItem.setProductId(productId);
// Set the product package that the product package item belongs to.
productPackageItem.setProductPackageId(productPackageId);
// Specify if the product package item is required for this product package.
productPackageItem.setIsMandatory(true);

Python

product_package_item = {
# Set the product from which the product package item is created.
'productId': PRODUCT_ID,
# Set the product package that the product package item belongs to.
'productPackageId': PRODUCT_PACKAGE_ID,
# Specify if the product package item is required for this
# product package.
'isMandatory': True
}

After you’ve set the required fields, you can persist the objects on the DFP server.

Java

Python

# Create the product package item on the server.
result = product_package_item_service.createProductPackageItems(
[product_package_item])

Once you’ve created these under your product package, they will appear in the UI as the list at the bottom of the product package panel:

Using product packages in a proposal

Creating a package

After creating a product package and associating product package items underneath it, you need to create a virtual ‘shopping cart’ that bridges between a product package and your proposal. This lets you fill in the specific sales values that aren’t represented by unsold products. This is represented by the Package object, and equivalently the shopping cart that’s generated from the proposal creation screen:

Java

Python

Then create a local Package object and set the required fields of Name, ProposalId, ProductPackageId, and the RateCardId that you want to associate with your ProposalLineItems.

Java

// Create a local package.
Package pkg = new Package();
pkg.setName("Package #" + new Random().nextInt(Integer.MAX_VALUE));
// Set the proposal ID for the package.
pkg.setProposalId(proposalId);
// Set the product package ID to create the package from.
pkg.setProductPackageId(productPackageId);
// Set the rate card ID the proposal line items are priced with.
pkg.setRateCardId(rateCardId);

Java

Python

# Create the package on the server.
result = package_service.createPackages([package])

Creating proposal line items from packages

Once you have a package, the last step before you can continue selling your proposal is to create proposal line items from the package. Up through this point, the product package items have not yet been added to the proposal. This requires an action to be performed with a statement filtering your packages:

At this point, you will have a proposal that contains the proposal line items sold from the product package. The package you just used to create proposal line items from will have a Status of COMPLETED. You can continue the submission process through the proposal workflow.