Smartweb

Sync Data

Configuración de un feed de datos #

Nota: Este feed de datos de Smartweb/HostedShop está obsoleto. Esto significa que ofrecemos soporte limitado para esto. Te recomendamos encarecidamente que cambies al feed de datos SOAP API de Smartweb/HostedShop.

  1. En el SmartWeb Admin, ve a Kontrolpanel->Prisindeks

  2. Crea un nuevo Prisindex haciendo clic en Opret Eget Prisindeks en la esquina superior derecha.

  3. Dale el nombre Clerk.

  4. Usa el siguiente código para crear el Data Feed. Esto generará un enlace con el feed de productos, que se puede usar en el importador de Anotaciones HTML en my.clerk.io.

Insertar en la plantilla de inicio del feed #

{* Tamaño de imagen *}
{$imageWidth = 293}
{$imageHeight = 293}

{* Tamaño de miniatura *}
{$thumbnailWidth = 60}
{$thumbnailHeight = 60}

{* ¿El precio incluye IVA? - se establece a través de la consulta price_including_vat=true/false - predeterminado: true *}
{$priceIncludingVat = true}

{if isset($smarty.get.price_including_vat)}
    {$priceIncludingVat = ($smarty.get.price_including_vat eq "true")}
{/if}

{* Incluir productos fuera de stock - se establece a través de la consulta include_out_of_stock=true/false - predeterminado: false *}
{$includeOutOfStock = (isset($smarty.get.include_out_of_stock) && $smarty.get.include_out_of_stock eq "true")}

{* Instanciar controladores *}
{controller assign=productController type=product}
{controller assign=brandController type=user}
{controller assign=variantController type=productVariant}
{controller assign=priceController type=productPrice}
{controller assign=cartController type=cart}

{$productPageLink = PageController::link($page.productPageId)}

{* Establecer variable de fecha (ahora + 1 mes en formato Y-m-d) *}
{assign date {date('Y-m-d', strtotime("+1 months", strtotime("NOW")))}}

{collection controller=productCategory assign=categories}

{$productLink = {page id=$page.productPageId print=Link}}

{function name=renderCategories}
    {foreach $items->getData() as $item}
        {collection controller=productCategory assign=subCategories parentId=$item->Id}

        <span class="clerk-category-info"
            data-id="{$item->Id}"
            data-name="{$item->Title|unescape:"html"|clearText}"
            data-url="/{$productLink}/{$item->Handle}/"
            data-subcategories="[{if $subCategories}{foreach $subCategories->getData() as $category}{$category->Id}{if not $category@last}, {/if}{/foreach}{/if}]">
        </span>

        {call name=renderCategories items=$subCategories}
    {/foreach}
{/function}

{call renderCategories items=$categories}

{* Páginas *}
{controller type=page assign=pagecontroller primary=true}
{collection assign=subPagess controller=page parentId=$page.id  showInMenuCheck=false visibleCheck=false primary=true }

{function name=renderPages}
    {foreach $items->getData() as $Page}
        {collection assign=subPagess2 controller=page parentId=$Page->Id  showInMenuCheck=false visibleCheck=false primary=true }

        {$pageTitle     =     trim($Page->Title)}
        {$link         =     trim($pagecontroller->link($Page->Id))}
        {if $Page->Type == "text" && $Page->Visible == 0 && $Page->ShowInMenu == 0}
        <span class="clerk-pages-info"
            data-id="{$Page->Id}"
            data-type="cms"
            data-url="{$Page->Id}"
            data-title="{$Page->Title|unescape:"html"|clearText}"
            data-text="{$pagecontroller->getText($Page->Id)|unescape:"html"|clearText}">
        </span>
        <br>
        {/if}
        {call name=renderPages items=$subPagess2}
    {/foreach}
{/function}
{call renderPages items=$subPagess}

Insertar en la plantilla de ítem del feed #

{* Determinar si el producto está agotado *}
{$soldout = ($product->Soldout and !$product->AllowOutOfStockPurchase)}

{if !$soldout || $includeOutOfStock}
    {* Cargar variantes del producto *}
    {collection assign=variants controller=$variantController productId=$product->Id variantId=$product->VariantIds}
    {assign variants $variants->getData()}

    {if $product->Soldout}
        {assign stockhtml $productController->getDeliveryTime($product->DeliveryTimeId, false)|escape:'htmlall'}
    {else}
        {assign stockhtml $productController->getDeliveryTime($product->DeliveryTimeId, true)|escape:'htmlall'}
    {/if}

    {* Obtener la marca del producto *}
    {entity assign=brand controller=$brandController id=$product->ProducerId}

    {* Obtener los tipos de variante del producto *}
    {collection assign=variantTypes controller=$variantTypeController productId=$product->Id}

    {* Obtener la imagen del producto *}
    {*assign productPicture {picturePath productId=$product->Id}*}
    {entity assign=image controller=files type=shop productId=$product->Id}

    {if $image}
        {$crop = "fill"}

        {if !empty($template.settings.DESIGN_IMAGE_BACKGROUND_COLOR)}
            {$crop = $template.settings.DESIGN_IMAGE_BACKGROUND_COLOR}
        {/if}

        {$thumbnailPath = $image->thumbnail($thumbnailWidth, $thumbnailHeight, $crop)}
        {$imagePath = $image->thumbnail($imageWidth, $imageHeight, $crop)}
    {else}
        {placeholdImage assign=placeholder width=$thumbnailWidth height=$thumbnailHeight background=$template.settings.DESIGN_IMAGE_BACKGROUND_COLOR color=$template.settings.FONT_COLOR_PRIMARY text=$text.IMAGE_PLACEHOLDER_TEXT}

        {$thumbnailPath = $placeholder->getRelativeFile()}

        {placeholdImage assign=placeholder width=$imageWidth height=$imageHeight background=$template.settings.DESIGN_IMAGE_BACKGROUND_COLOR color=$template.settings.FONT_COLOR_PRIMARY text=$text.IMAGE_PLACEHOLDER_TEXT}

        {$imagePath = $placeholder->getRelativeFile()}
    {/if}

    {* Obtener la descripción corta del producto *}
    {*{assign productDescription $productController->getDescriptionShort($product->Id)}*}

    {* Si está en blanco, obtener la descripción de la lista del producto *}
   {* {if empty($productDescription)}
        {assign productDescription $productController->getDescriptionList($product->Id)}
    {/if}

    {* Si está en blanco, obtener la descripción larga del producto *}
    {*{if empty($productDescription)}
        {assign productDescription $productController->getDescription($product->Id)}
    {/if}*}

    {assign productDescription $productController->getDescription($product->Id)}

    {* Recortar la descripción a una longitud máxima de 5000 caracteres *}
    {$productDescription = $productDescription|strip_tags|unescape:"html"|trimTo:5000}
    {* Recortar la descripción a una longitud máxima de 200 caracteres *}
    {$productEmailDescription = $productDescription|strip_tags|unescape:"html"|trimTo:200}

    {* Obtener la ruta de categoría del producto *}
    {assign categoryPathTitle {categoryTitlePath product=$product separator=" > "}}



    {* Convertir la edad del producto de segundos a días *}
    {$ageInDays = ($product->Age / 60 / 60 / 24)|string_format:"%.1f"}

    <span class="clerk-product-info"

        {* Título *}
        data-name="{$product->Title|escape:'html'|clearText}"

        {* URI del enlace *}
        data-url="{itemLink product=$product}"

         {* URL del enlace sin dominio*}
        {assign productSurl {itemLink product=$product}}
        data-urls="{$productSurl|replace:'https://www.grejfreak.dk/':'/'}"

        {* ID del producto *}
        data-id="{$product->Id}"


        {* Descripción *}
        data-description="{$productDescription|clearText}"

        {* Descripción *}
        data-shortdescription="{$productEmailDescription|clearText}"

        {* Usar palabras clave SEO para palabras clave adicionales buscables *}

        {*
        {assign var="keywords" value="$productController->getTranslation($product->Id, 'seo_keywords')|lower|escape:"htmlall"|clearText"}
        {assign var="keyword_list" value=","|explode:$keywords}
        data-keywords2 = "{$keyword_list}"*}

        data-keywords="{$productController->getTranslation($product->Id, 'seo_keywords')|lower|escape:"htmlall"|clearText}"

        {* Imagen *}
        data-image="{$imagePath|solutionPath}"

        {* Miniatura *}
        data-thumbnail="{$thumbnailPath|solutionPath}"

        {* Número de artículo *}
        data-sku="{$product->ItemNumber|toUTF8}"


                {collection assign=productCustomDatas controller=productCustomData productId=$product->Id typeId=14}
        {if $productCustomDatas gt 0}
            {foreach $productCustomDatas->getData() as $productCustomData}
                data-prislabel="{$productCustomData->Title}"
            {/foreach}
        {/if}

        {collection assign=productCustomDatas controller=productCustomData productId=$product->Id typeId=15}
        {if $productCustomDatas gt 0}
            {foreach $productCustomDatas->getData() as $productCustomData}
                data-profitlabel="{$productCustomData->Title}"
            {/foreach}
        {/if}

        {collection assign=productCustomDatas controller=productCustomData productId=$product->Id typeId=12}
        {if $productCustomDatas gt 0}
            {foreach $productCustomDatas->getData() as $productCustomData}
                data-customlabel="{$productCustomData->Title|toUTF8}"
            {/foreach}
        {/if}


        {if !empty($product->Ean)}
            {* Número Ean *}
            data-ean="{$product->Ean|toUTF8}"
        {/if}

        {* Obtener la línea de precio del producto *}
        {entity assign=priceLine controller=$priceController productId=$product->Id}

        {* Obtener el texto de estado de stock del producto *}
        {$stockStatusText = {stockStatusText product=$product inStockText='en stock' notInStockText='agotado'}}


    {* verificar si el producto es Normal o variante *}
    {if $product->Type == "normal"}
        {if $product->Soldout}
            {$type="normaloutstockstatus"}
           {* {$deliveryText = "&lt;span&gt;&lt;strong&gt;NO EN STOCK&lt;/strong&gt;&lt;br&gt;Entrega 3-14 días&lt;/span&gt;"}*}
           {$deliveryText = $stockhtml}
        {else}
            {$type="normalinstockstatus"}
            {*$deliveryText = "&lt;span&gt;&lt;strong&gt;EN STOCK&lt;/strong&gt;&lt;/span&gt;&nbsp;"*}
            {$deliveryText = $stockhtml}
        {/if}

    {/if}

    {if $product->Type == "variant"}
        {if $product->Soldout}
            {$type="variantoutstockstatus"}
            {*$deliveryText = "&lt;span&gt;&lt;strong&gt;NO EN STOCK&lt;/strong&gt;&lt;br&gt;Entrega 3-14 días&lt;/span&gt;"*}
            {$deliveryText = $stockhtml}
        {else}
            {$type="variantinstockstatus"}
            {*$deliveryText = "&lt;p&gt;&lt;strong&gt;ESTADO DE STOCK&lt;/strong&gt;ELIGE VARIANTE&lt;/p&gt;"*}
            {$deliveryText = "<p><strong>{$text.VARIATION_STOCK_BOLD_MESSAGE}</strong>{$text.VARIATION_STOCK_NORMAL_MESSAGE}</p>"}
        {/if}
    {/if}

        data-stock-type ="{$type}"
        data-deliveryText ="{$deliveryText}"


        {* Precios *}
        {assign price $priceLine->PriceMinWithVat}

        {if !$priceIncludingVat}
            {assign price $priceLine->PriceMinWithoutVat}
        {/if}

        {* Precio de venta *}
        data-price="{$price}"

        {* Precio de venta - Formateado con la moneda específica del idioma iso *}
        data-pformatted="{$price|formatPrice}"

        {if $priceLine->PriceMin !== $priceLine->PriceMax}
            data-pricefrom="true"
        {/if}


        {$onSale = ($priceLine->PriceMinWithVat < $priceLine->FullPriceMinWithVat)}

        {* Si el producto tiene descuento, establecemos el precio normal como precio de lista *}
        {if $onSale}
            {assign listPrice $priceLine->FullPriceMinWithVat}

            {if !$priceIncludingVat}
                {assign listPrice $priceLine->FullPriceMinWithoutVat}
            {/if}

            {* Precio normal *}
            data-list-price="{$listPrice}"

            {* Precio normal - Formateado con la moneda específica del idioma iso *}
            data-lpformatted="{$listPrice|formatPrice}"

            {*Agregar texto con oferta *}
            data-sale-text="oferta"

             {* Agregar porcentaje si está en oferta *}
            {$priceMin = $priceLine->PriceMin}
            {$priceFull = $priceLine->FullPriceMin}
            {$diffprice = $priceLine-$priceMin}
            {$percentChange = (1 - $priceMin / $priceFull) * 100 }
            {$percentChange = (int)$percentChange}
            data-price-procent="{$percentChange}"
            data-price-procent_int="{$percentChange|formatPrice}"

        {/if}

        data-on-sale="{if $onSale}true{else}false{/if}"
        data-in-stock="{if !$soldout}true{else}false{/if}"

        data-stock-av="{if $product->Soldout}false{else}true{/if}"

        {* Edad del producto *}
        data-age="{$ageInDays}"

        {* Si el producto tiene menos de 30 días, lo consideramos nuevo *}
        {if $ageInDays lt 90}
            data-new="true"
        {/if}

        {* Marca *}
        {if !empty($brand->Title)}
            {$brandLink = "{$productPageLink}?brand={$brand->Id}-{$brand->Title|formatLink}"}

            data-brand="{$brand->Title|escape:"html"|clearText}"
            data-brand-url="{$brandLink}"
            data-brand-id="{$brand->Id}"
        {/if}

        {* Si el producto tiene variantes *}
        {if $variants}
            {*data-variants-sku="[
                {foreach $variants as $variant}
                    {if !empty($variant->ItemNumber)}
                        '{$variant->ItemNumber}'{if !$variant@last},{/if}
                    {/if}

                {/foreach}
                ]"*}
            {*
            data-variants-name="[
                {foreach $variants as $variant}
                    '{assign variantTitle {variantTitle productId=$product->Id variantId=$variant->Id}}{$variantTitle|escape:"htmlall"|clearText}'{if !$variant@last},{/if}
                {/foreach}
                ]"*}

            data-variants-ean="[
                {foreach $variants as $variant}
                    '{assign variantTitle {variantTitle productId=$product->Id variantId=$variant->Id}}{if !empty($variant->Ean)}{$variant->Ean|escape:"htmlall"}{/if}'{if !$variant@last},{/if}
                {/foreach}
                ]"

        {/if}

        {collection assign=productCustomDatas controller=productCustomData productId=$product->Id typeId=11}
        {if $productCustomDatas gt 0}
            {foreach $productCustomDatas->getData() as $productCustomData}
                data-splash="{$productCustomData->Title}"
            {/foreach}
        {/if}

        {* Array de splash *}
        {if $productCustomDatas gt 0}
        data-splasharray='[
                {foreach $productCustomDatas->getData() as $productCustomData}
                    "{$productCustomData->Title}"{if !$productCustomData@last},{/if}
                {/foreach}
        ]'
        {/if}

        {* Array de splash sin tipo de archivo *}
        {if $productCustomDatas gt 0}
        data-splasharray-simple='[
                {foreach $productCustomDatas->getData() as $productCustomData}
                    {assign splashSimple {$productCustomData->Title|toUTF8|replace:'.svg':''}}
                    "{$splashSimple}"{if !$productCustomData@last},{/if}
                {/foreach}
        ]'
        {/if}

        {* Categorías *}
        data-categories="[
            {$product->CategoryId}
                {if $product->SecondaryCategoryIds}
                    {foreach $product->SecondaryCategoryIds as $productCategory}
                        , {$productCategory}
                    {/foreach}
                {/if}
            ]">
    </span>
{/if}

Insertar en la plantilla final del feed #

{*Agregar paginación*}
{if !isset($smarty.get.length)}
    {$length = 50}
{else}
    {$length = $smarty.get.length}
{/if}

{if isset($smarty.get.start)}
    {$start = $smarty.get.start + $length}
{else}
    {$start = 0}
{/if}

{* Verificar si se deben agregar productos fuera de stock*}
{if isset($smarty.get.include_out_of_stock)}
    {$stock = $smarty.get.include_out_of_stock}
{else}
    {$stock = "false"}
{/if}

{* Crear el siguiente enlace para que el rastreador lo siga *}
{if $product->Id}
<a href="/framework/priceindex/?index=clerk&start={$start}&length={$length}&include_out_of_stock={$stock}"></a>
{/if}

Guarda el Prisindex.

Después tendrás un enlace similar a este, disponible:

https://www.mysmartwebshop.com/framework/priceindex/index=Clerk&include_out_of_stock=false

Ve a my.clerk.io -> Datos.

Bajo Método de sincronización, elige Anotaciones HTML, e inserta tu enlace.

Luego establece el Máx. Solicitudes/Sec a 1 y elige el idioma.

Por último, haz clic en Actualizar Configuración y luego en Iniciar Sincronización.

Enviando datos de pedidos con un archivo CSV #

Dado que el Prisindeks de Smartweb desafortunadamente no permite que se incluyan ventas de Smartweb, el historial de pedidos debe exportarse como un archivo CSV que luego puede convertirse y cargarse en Clerk.io.

Para descargar este archivo CSV, comienza por iniciar sesión en tu backend de Smartweb.

Luego ve a Eksport:

En la página siguiente, elige Ordrer bajo Vælg Data y elige CSV fil bajo Vælg Format, luego haz clic en Næste.

Ahora necesitas elegir qué datos incluir en el archivo CSV.

Clerk.io necesita los siguientes datos de los pedidos:

  • ID de pedido (predeterminado)

  • Fecha

  • ID de producto

  • Correo electrónico del cliente

  • ID de usuario

Todos estos se pueden verificar en los menús desplegables:

Después de verificar los campos, usa el selector de rango de fechas Efter Periode para incluir los datos de ventas desde cuando tuviste tus primeros pedidos, y haz clic en Næste:

Finalmente, haz clic en Descargar para recibir tu archivo CSV:

¡Listo! Ahora tienes tus datos de ventas de Smartweb como un archivo CSV.

Ahora solo necesitas comunicarte con el Soporte de Clerk.io, para encontrar la mejor y más segura manera de cargar el archivo en tu cuenta.

Elegir productos para importar #

El feed de Smartweb / Hostedshop te permite filtrar o incluir productos fuera de stock fácilmente, cambiando una parte simple de la URL del feed.

En my.clerk.io, ve a Sincronización de Datos.

Asegúrate de que la URL termine con &include_out_of_stock=true

Luego haz clic en Actualizar Configuración y Iniciar Sincronización para cargar todos tus productos a Clerk.io.

Al importar todos los productos, incluidos los que están fuera de stock, tendrás el atributo in_stock disponible para todos los productos, para que puedas filtrar algunos elementos de Clerk.io, para no mostrar estos.

Esta página ha sido traducida por una IA útil, por lo que puede contener errores de idioma. Muchas gracias por su comprensión.