X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Feefo iframe review integration (https://forum.x-cart.com/showthread.php?t=77487)

Bishmos 01-10-2020 05:07 AM

Feefo iframe review integration
 
Hi,


I'm trying to use Feefo reviews iFrame integration to send order data from the order confirmation page. I have two main problems/questions that are beyond me. Here's the iframe code:


Code:

<iframe
id="FSI_IFrame"
style="display: none; "
width="0" height="0"
src="https://api.feefo.com/api/sales/merchant?merchantidentifier=identifier"
data-feefo-email="{$order.email}"
data-feefo-orderref="#{$order.orderid}"
data-feefo-name="{$order.firstname}{$order.lastname}"
data-feefo-customerref="#{$order.orderid}”
data-feefo-feedbackdate="?????"
data-feefo-products='[{"description":"{$product.product}","productsearchcode":"{$product.productcode}","amount":"{$product.display_price}","productlink":"url","currency":"GBP","tags":{"saleschannel":"Web","productline":"games"}},]>
</iframe>



and here's the issues:

  • 'data-feefo-feedbackdate' needs to be a certain amount of days in the future from the date of order to allow for the product to be delivered (i.e. 7 days) so I can't just use {$order.date|date_format:$config.Appearance.dateti me_format}. What can I do to calculate a date in the future?
  • 'data-feefo-products' how would include more than one product? I know that they need to be comma separated but don't know how this is expressed.
I may have issues with the other values as well so feel free to let me know if you notice something stupid :-)


thanks

cflsystems 01-10-2020 05:32 AM

Re: Feefo iframe review integration
 
Code:

{* depends on your XC/smarty versions you may need to use back ticks around value; 7 * 24 * 60 * 60 = 604800 for 7 days, adjust if less or more days needed *}
{assign var="future_date" value=$order.date+604800}

{* make sure variable is actually $products and not $order.products *}
{* are you sure "amount" is price and not quantity? *}
{* replace yourdomain with your site's address *}

<iframe id="FSI_IFrame" style="display: none" width="0" height="0" src="https://api.feefo.com/api/sales/merchant?merchantidentifier=identifier"
data-feefo-email="{$order.email}"
data-feefo-orderref="#{$order.orderid}"
data-feefo-name="{$order.firstname} {$order.lastname}"
data-feefo-customerref="#{$order.orderid}"
data-feefo-feedbackdate="{$future_date|date_format:$config.Appearance.datetime_format}"
data-feefo-products=[
    {foreach from=$products item=product name=products}
    {ldelim}
        "description":"{$product.product}",
        "productsearchcode":"{$product.productcode}",
        "amount":"{$product.display_price}",
        "productlink":"https://yourdomain/product.php?product_id={$product.productid}",
        "currency":"GBP",
        "tags":{ldelim}
            "saleschannel":"Web",
            "productline":"games"
        {rdelim}
    {rdelim}
    {if not $smarty.foreach.products.last},{/if}
    {/foreach}
    ]>
</iframe>

{* check all lines for extra spaces - the forum tends to add spaces here and there *}


Bishmos 01-10-2020 06:58 AM

Re: Feefo iframe review integration
 
Hi Steve,


thanks very much for the quick reply! So in theory I can just copy this in to my order_message.tpl file? Or do I need to add the variable {assign var="future_date" value=$order.date+604800} within script tags.


thanks
Martin

cflsystems 01-10-2020 08:02 AM

Re: Feefo iframe review integration
 
You just copy it in the appropriate template and place.
The {assign ....} block is smarty code not javascript so you use it as posted.


make sure you test on order info or notification page the correct output

Bishmos 01-10-2020 08:20 AM

Re: Feefo iframe review integration
 
thanks Steve, although I'm struggling. I've got this on order_message.tpl (notification) page:


Code:

<!-- Post message handler -->
<script
  type="text/javascript"
  src="https://api.feefo.com/api/assets/js-sale-integration/javascript/feefo-js-post-message-handler.js">
</script>

<!-- Initialise the Post Message Handler -->
<script type="text/javascript">
  var FPMH = new Feefo.PostMessageHandler();
  FPMH.init();
</script>

{assign var="future_date" value=$order.date+604800}

<iframe  id="FSI_IFrame" style="display: none" width="0" height="0"  src="https://api.feefo.com/api/sales/merchant?merchantidentifier=mathmos-es" 
data-feefo-email="{$order.email}"
data-feefo-orderref="#{$order.orderid}"
data-feefo-name="{$order.firstname} {$order.lastname}"
data-feefo-customerref="#{$order.orderid}"
data-feefo-feedbackdate="{$future_date|date_format:$config.Appearance.datetime_format}"
data-feefo-products=[
    {foreach from=$products item=product name=products}
    {ldelim}
        "description":"{$product.product}",
        "productsearchcode":"{$product.productcode}",
        "amount":"{$product.display_price}",
        "productlink":"https://www.mathmos.es/product.php?product_id={$product.productid}",
        "currency":"EUR",
        "tags":{ldelim}
            "saleschannel":"Web",
            "productline":"games"
        {rdelim}
    {rdelim}
    {if not $smarty.foreach.products.last},{/if}
    {/foreach}
    ]>
</iframe>



and all I'm seeing in the iframe when I do a test order is:


Code:

<iframe  id="FSI_IFrame" style="display: none"  src="https://api.feefo.com/api/sales/merchant?merchantidentifier=mathmos-es"  data-feefo-email="" data-feefo-orderref="#" data-feefo-name=" "  data-feefo-customerref="#" data-feefo-feedbackdate="08/01/1970 01:00"  data-feefo-products="[" ]="" width="0" height="0">
</iframe>



seems to be working at grabbing a date but oddly has sent me back in time! doesn't seem to like other values though?

cflsystems 01-10-2020 08:31 AM

Re: Feefo iframe review integration
 
Then you are not adding this to the right place. It looks like the $order variable is not available
You have to read the template and what's in there to know where exactly to add it or what the variable should be. It may have to be $order.order
I don't know what you have available

Bishmos 01-13-2020 07:27 AM

Re: Feefo iframe review integration
 
ok Steve thanks. I'll have a fish around

Bishmos 01-15-2020 04:20 AM

Re: Feefo iframe review integration
 
Hello Steve (or anyone),


I got the code working using the variables you suggested and the correct details are gathered in the iframe however the javascript that sends the data isn't firing. Can you see an obvious reason this might be happening? I've tried wrapping {literal}{/literal} tags around them but it's not working:


{assign var="future_date" value=$order.order.date+86400}

<iframe id="FSI_IFrame" style="display:none;" width="0" height="0" src="https://api.feefo.com/api/sales/merchant?merchantidentifier=mathmos-es"
data-feefo-email="{$order.order.email}"
data-feefo-orderref="#{$order.order.orderid}"
data-feefo-name="{$order.order.firstname} {$order.order.lastname}"
data-feefo-customerref="#{$order.order.orderid}"
data-feefo-feedbackdate="{$future_date|date_format:$config.Ap pearance.datetime_format}"
data-feefo-products='[{ldelim}{foreach from=$order.products item=product name=products}"description":"{$product.product}"," productsearchcode":"{$product.productcode}","amoun t":"{$product.display_price}","productlink":"https ://www.mathmos.es/product.php?product_id={$product.productid}","curr ency":"EUR","tags":{ldelim}"saleschannel":"Web","p roductline":"games"{rdelim}{rdelim}{if not $smarty.foreach.products.last},{/if}{/foreach}]'>
</iframe>

<!-- Post message handler -->
<script type="text/javascript" src="https://api.feefo.com/api/assets/js-sale-integration/javascript/feefo-js-post-message-handler.js">
</script>

<!-- Initialise the Post Message Handler -->
<script type="text/javascript">
var FPMH = new Feefo.PostMessageHandler();
FPMH.init();
</script>


All times are GMT -8. The time now is 04:41 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.