Developer forum

Forum » Swift » Issue in DAP when downloading multiple products

Issue in DAP when downloading multiple products

Justin Sjouw Dynamicweb Employee
Justin Sjouw
Reply

Hi, 

Just would like to confirm if this is indeed an issue in the DAP (Digital Asset Portal) default js code. 

When I add only 1 product to the DAP download basket, I get al valid download, the url posted to dwapi looks like this:

https://techmar.staging.dynamicweb-cms.com/dwapi/ecommerce/products/export?ShopId=SHOP17&TemplatePath=%2FDesigns%2FSwift%2FeCom%2FProductCatalog%2FExportProductsMail.cshtml&Dpi=600&ImageFormat=&AssetCategories=Images&RecipientTokens=bfYo3muvOBk%3D&ProductIDs=PROD351

When I add more than 1 product, the product id;s are concatenated with a comma, and then I get a 204:

https://techmar.staging.dynamicweb-cms.com/dwapi/ecommerce/products/export?ShopId=SHOP17&TemplatePath=%2FDesigns%2FSwift%2FeCom%2FProductCatalog%2FExportProductsMail.cshtml&Dpi=600&ImageFormat=&AssetCategories=Images&RecipientTokens=bfYo3muvOBk%3D&ProductIDs=PROD366%2CPROD368%2CPROD351

The problem seems in the fact the dwapi/ecommerce/products/export does not split the ProductIDs parameter into seperate IDs?

Thanks,

Justin

 


Replies

 
Justin Sjouw Dynamicweb Employee
Justin Sjouw
Reply

Anyone? This is on Swift 1.26.7 and DW 9.19.2

 
Justin Sjouw Dynamicweb Employee
Justin Sjouw
Reply

For those interested, changing this to a seperate ProductIDs parameter for each products solves the isse, this is in the DownloadCart.cshtml template:

                       @*disabled this line because a comma seperated list of productIDs results in a 204 with dwapi,
                          changed to a seperate ProductIDs parameter for each ID
                          <input type="hidden" name="ProductIDs" value="@string.Join(",", productVariantIds.ToArray())">*@
                        @foreach (var productId in productVariantIds)
                        {
                            <input type="hidden" name="ProductIDs" value="@productId">
                        }

 

You must be logged in to post in the forum