Follow

Produktfeed med og uden varianter (Hostedshop)

Hvis du har en webshop, hvor nogen af dine produkter har varianter og andre ikke har, så kan du opleve udfordringer med tracking, da nogen produkter sender et produktId uden variant og nogen produkter sender en produktvariant med. 

For at undgå fejl har vi lavet "produktfeed skabelon", som du kan bruge ovre på din webshop, så du får begge produkttyper med.

 

For at lave et produktfeed, skal du vælge "Prisportaler" i menuen til venstre, og dernæst vælge "Opret egen prisportal":

 

Når du har valgt "Opret egen prisportal" skal du navngive dit nye feed og under "Baser på" skal vælge "Facebook Products Ads":

 

 

Når du gemmer, bliver du sendt over til strukturen for dit nye feed. Alt dette ligner en masse kode. 

Indholdet i "Feed item template" skal du blot erstatte med alt fra den grå boks nedenfor. 

Herefter vælger du "Gem" og kopierer linket for dit nye feed ind i dit produktfeed i Heyloyalty.

 

Hvis du valgte at oprette et "Google Product Ads"-produktfeed'et ved opsætningen, kan du erstatte dette produktfeed link, og så vil din mapping allerede være lavet. 

Husk at importere dit produktfeed i Heyloyalty efter du har skiftet linket:

 

 

 

Kopier alt nedenstående

{*

# Description
Responsible for outputting a product in the facebook xml format

## Date last modified
2021-03-22

*}

{* Fetch the brand of the product *}
{$brand = null}
{if $product->ProducerId}
{entity assign=brand controller=$brandController id=$product->ProducerId}
{/if}

{* Fetch the picture of the product *}
{assign productPicture {picturePath productId=$product->Id}}

{*** Description ***}
{* Attempt to fetch the short description of the product *}
{$productDescription = $productController->getDescriptionShort($product->Id)|toUTF8}

{if $smarty.get.descriptionType === 'long' || empty($productDescription)}
{* Attempt to fetch the long description of the product *}
{$longProductDescription = $productController->getDescription($product->Id)|toUTF8}
{* Assign specific decription or fall back to last available description*}
{$productDescription = (empty($longProductDescription)) ? $productDescription : $longProductDescription}
{/if}

{if $smarty.get.descriptionType === 'list' || empty($productDescription)}
{* Attempt to fetch the list description of the product *}
{$shortProductDescription = $productController->getDescriptionList($product->Id)|toUTF8}
{* Assign specific decription or fall back to last available description*}
{$productDescription = (empty($shortProductDescription)) ? $productDescription : $shortProductDescription}
{/if}

{* Trim the description to a max length of 5000 characters *}
{$productDescription = $productDescription|truncate:5000}
{*** /Description ***}

{* Fetch the category path of the product *}
{assign categoryPathTitle {categoryTitlePath product=$product separator=" > " asUTF8=true}}

{* Fetch the price line of the product *}
{entity assign=priceLine controller=$priceController productId=$product->Id productDiscountGroupId=$product->DiscountGroupId productTypeId=$product->Type cacheProduct=true}

{* Fetch the stock status text of the product *}
{$stockStatusText = {stockStatusText product=$product inStockText='in stock' notInStockText='out of stock'}}

{* Fetch the delivery price estimate of the product *}
{assign deliveryEstimate $cartController->productDeliveryEstimate($priceLine->PriceMinWithVat, $priceLine->PriceMinWithVat, $params, $product)}

<item>
{* Product id *}
<g:id>{$product->Id}</g:id>
{* Product Title *}
<g:title><![CDATA[{$product->Title|toUTF8}]]></g:title>
{* Product ean *}
<g:gtin><![CDATA[{$product->Ean|toUTF8}]]></g:gtin>
{* Link URI *}
<link>{itemLink product=$product}</link>
{* Description *}
<g:description><![CDATA[{$productDescription}]]></g:description>
{* Condition *}
<g:condition>new</g:condition>
{* Availability *}
<g:availability><![CDATA[{$stockStatusText|toUTF8}]]></g:availability>
{* Google Category ID *}
{if !empty($product->IndexLink)}
<g:google_product_category><![CDATA[{$product->IndexLink}]]></g:google_product_category>
{/if}
{* Category *}
<g:product_type><![CDATA[{$categoryPathTitle}]]></g:product_type>

{* Price in english format with two decimals, followed by currency code *}
<g:price>{$priceLine->FullPriceMinWithVat|numberFormatEnglish} {$general.currencyIso}</g:price>

{* If the product is discounted *}
{if $priceLine->PriceMinWithVat < $priceLine->FullPriceMinWithVat}
{* Sales price in english format with two decimals, followed by currency code *}
<g:sale_price>{$priceLine->PriceMinWithVat|numberFormatEnglish} {$general.currencyIso}</g:sale_price>
{/if}

{* If the product has a brand specified *}
{if !empty($brand->Title)}
{* Brand title *}
<g:brand><![CDATA[{$brand->Title|toUTF8}]]></g:brand>
{/if}

{* If the product has a picture *}
{if !empty($productPicture)}
{* Picture *}
<g:image_link><![CDATA[{$productPicture}]]></g:image_link>
{/if}

{* Delivery information *}
{if $deliveryEstimate->PriceWithVat > 0}
{$shippingPrice = "{$deliveryEstimate->PriceWithVat|numberFormatEnglish} {$general.currencyIso}"}
{else}
{$shippingPrice = "0.0 {$general.currencyIso}"}
{/if}
<g:shipping>{$general.deliveryCountryIso}::Ground:{$shippingPrice}</g:shipping>

{* If the product has a non-zero weight *}
{if $product->Weight > 0}
{* Weight of the product *}
<g:shipping_weight>{$product->Weight} kg</g:shipping_weight>
{/if}

{* If the product has an Supplier item number *}
{if !empty($product->SupplierItemNumber)}
{* Supplier item number *}
<g:mpn><![CDATA[{$product->SupplierItemNumber|toUTF8}]]></g:mpn>
{/if}

{* End product *}
</item>

{* Load variants of the product *}
{collection assign=variants controller=$variantController productId=$product->Id variantId=$product->VariantIds}
{assign variants $variants->getData()}

{* Begin product *}
{if empty($variants)}

{else}

{foreach $variants as $variant}

{* Fetch title of the variant *}
{assign variantTitle {variantTitle productId=$product->Id variantId=$variant->Id}}

{* Fetch the price line of the variant *}
{entity assign=priceLine controller=$priceController productId=$product->Id variantId=$variant->Id productDiscountGroupId=$product->DiscountGroupId productTypeId=$product->Type cacheProduct=true}

{* Fetch the delivery price estimate of the variant *}
{assign deliveryEstimate $cartController->productDeliveryEstimate($priceLine->PriceMinWithVat, $priceLine->PriceMinWithVat, $params, $product, $variant)}

{* Fetch the stock status text of the variant *}
{$stockStatusText = {stockStatusText product=$product variant=$variant inStockText='in stock' notInStockText='out of stock'}}

{* Fetch the picture of the variant *}
{$picture = {picturePath productId=$product->Id variantId=$variant->Id defaultPicture=$productPicture}}

{* Begin variant *}
<item>
{* Variant id *}
<g:id>{$product->Id}-{$variant->Id}</g:id>
{* Variant group identifier *}
<g:item_group_id>{$product->Id}</g:item_group_id>
{* Variant Title *}
<g:title><![CDATA[{$variantTitle|toUTF8}]]></g:title>
{* Variant ean *}
<g:gtin><![CDATA[{$variant->Ean|toUTF8}]]></g:gtin>
{* Link URI *}
<link>{itemLink product=$product variant=$variant}</link>
{* Description *}
<g:description><![CDATA[{$productDescription}]]></g:description>
{* Condition *}
<g:condition>new</g:condition>
{* Availability *}
<g:availability><![CDATA[{$stockStatusText|toUTF8}]]></g:availability>
{* Google Category ID *}
{if !empty($product->IndexLink)}
<g:google_product_category><![CDATA[{$product->IndexLink}]]></g:google_product_category>
{/if}
{* Category *}
<g:product_type><![CDATA[{$categoryPathTitle}]]></g:product_type>

{* Price in english format with two decimals, followed by currency code *}
<g:price>{$priceLine->FullPriceMinWithVat|numberFormatEnglish} {$general.currencyIso}</g:price>

{if $priceLine->PriceMinWithVat < $priceLine->FullPriceMinWithVat}
{* Sales price in english format with two decimals, followed by currency code *}
<g:sale_price>{$priceLine->PriceMinWithVat|numberFormatEnglish} {$general.currencyIso}</g:sale_price>
{/if}

{* If the product has a brand specified *}
{if !empty($brand->Title)}
{* Brand title *}
<g:brand><![CDATA[{$brand->Title|toUTF8}]]></g:brand>
{/if}

{* If the product has a picture *}
{if !empty($picture)}
{* Picture *}
<g:image_link><![CDATA[{$picture}]]></g:image_link>
{/if}

{* Delivery information *}
{if $deliveryEstimate->PriceWithVat > 0}
{$shippingPrice = "{$deliveryEstimate->PriceWithVat|numberFormatEnglish} {$general.currencyIso}"}
{else}
{$shippingPrice = "0.0 {$general.currencyIso}"}
{/if}
<g:shipping>{$general.deliveryCountryIso}::Ground:{$shippingPrice}</g:shipping>

{* If the variant has a non-zero weight *}
{if $variant->Weight > 0}
{* Weight of the variant *}
<g:shipping_weight>{$variant->Weight} kg</g:shipping_weight>
{/if}

{* If the variant has an Supplier item number *}
{if !empty($variant->SupplierItemNumber)}
{* Supplier item number *}
<g:mpn><![CDATA[{$variant->SupplierItemNumber|toUTF8}]]></g:mpn>
{/if}

{* End variant *}
</item>
{/foreach}
{/if}

 

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk