Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Feefo iframe review integration

 
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features
 
Thread Tools Search this Thread
  #1  
Old 01-10-2020, 05:07 AM
 
Bishmos Bishmos is offline
 

Member
  
Join Date: Jun 2011
Posts: 25
 

Default 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
__________________
X-Cart Gold v4.7.5
Reply With Quote
  #2  
Old 01-10-2020, 05:32 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 13,941
 

Default 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 *}
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following user thanks cflsystems for this useful post:
Bishmos (01-10-2020)
  #3  
Old 01-10-2020, 06:58 AM
 
Bishmos Bishmos is offline
 

Member
  
Join Date: Jun 2011
Posts: 25
 

Default 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
__________________
X-Cart Gold v4.7.5
Reply With Quote
  #4  
Old 01-10-2020, 08:02 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 13,941
 

Default 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
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #5  
Old 01-10-2020, 08:20 AM
 
Bishmos Bishmos is offline
 

Member
  
Join Date: Jun 2011
Posts: 25
 

Default 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?
__________________
X-Cart Gold v4.7.5
Reply With Quote
  #6  
Old 01-10-2020, 08:31 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 13,941
 

Default 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
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #7  
Old 01-13-2020, 07:27 AM
 
Bishmos Bishmos is offline
 

Member
  
Join Date: Jun 2011
Posts: 25
 

Default Re: Feefo iframe review integration

ok Steve thanks. I'll have a fish around
__________________
X-Cart Gold v4.7.5
Reply With Quote
  #8  
Old 01-15-2020, 04:20 AM
 
Bishmos Bishmos is offline
 

Member
  
Join Date: Jun 2011
Posts: 25
 

Default 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>
__________________
X-Cart Gold v4.7.5
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Changing and adding new features


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 08:44 PM.

   

 
X-Cart forums © 2001-2020