Please follow along with this integration guide for more even more details such as giving us a product feed: https://help.shopperapproved.com/en/articles/2511246-shopper-approved-seller-product-review-integration-overview
You can then follow below to see where to place the code on Magento.
Note: If you are collecting product reviews, it is important to provide us with a product feed before adding the code.
Step 1 - Add the survey code
Place the Thank you page code on your theme’s success.phtml template file via FTP access.
Common Locations:
app/design/frontend/{your_vendor_name}/{your_theme_name}/Magento_Checkout/templates/success.phtml
app/design/frontend/{your_vendor_name}/{your_theme_name}/Magento_InventoryInStorePickupFrontend/templates/success.phtml
Thank You Page Code (Seller and Product Review code)
Thank You Page Code (Seller and Product Review code)
Note: Please update the siteID and siteToken values to your own. You will also need to update the product ID variables.
<!-- Shopper Approved TY Page Code -->
<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$order = $objectManager->create('Magento\Sales\Model\Order')->loadByIncrementId($block->getOrderId());
if ($order->getCustomerIsGuest() && $order->getBillingAddress()) {
$customerName = $order->getBillingAddress()->getName();
//Use $order->getCustomerName() as a last resort
if (!trim($customerName)) {
$customerName = $order->getCustomerName();
}
} else {
$customerName = $order->getCustomerName();
}
$customerEmail = $order->getCustomerEmail();
$countryCode = $order->getShippingAddress()->getCountryId();
$customerCountry = $objectManager->create('\Magento\Directory\Model\Country')->load($countryCode)->getName();
$orderItems = $order->getAllVisibleItems();
$orderItemData = [];
?>
<script type="text/javascript">
var sa_products = {}; //declare sa_products object
var itemtitle; //set variable for product name
<?php foreach ($orderItems as $item) {
$productSku = $item->getSku();
$productSku = str_replace('"', "", $productSku);
$productSku = str_replace("'", "", $productSku);
$productSku = str_replace(" ", "", $productSku);
?>
sa_products['<?= $productSku; ?>'] = '<?= $block->escapeHtml($item->getName()); ?>'; //populate sa_products object with key value pair of 'productid':'productname'
<?php } ?>
</script>
<script type="text/javascript">var siteID = xxxx; var siteToken = "xxxx"; var sa_values = { "site":siteID, "token":siteToken, 'orderid':'<?= $block->getOrderId(); ?>', 'name':'<?= $customerName; ?>', 'email':'<?= $customerEmail; ?>', 'country':'<?= $customerCountry; ?>', 'state':'<?= $block->escapeHtml($order->getShippingAddress()->getRegionCode()); ?>' }; function saLoadScript(src) { var js = window.document.createElement("script"); js.src = src; js.type = "text/javascript"; document.getElementsByTagName("head")[0].appendChild(js); } var d = new Date(); saLoadScript("https://www.shopperapproved.com/thankyou/rate/" + siteID + ".js?d=" + d.getTime()); </script>
<!-- END Shopper Approved TY Page Code -->
Once you collect seller reviews, you will want to place a dedicated seller reviews page on your site to display those reviews.
Step 2 - Add a seller reviews page
Location: Magento Dashboard > Content > Pages > Add New Page
Enter the ‘Page Title’ and ‘Edit with Page Builder’ to integrate the reviews page code.
2. Add the reviews page code snippet inside of the Page builder.
Output:
3. Add a Reviews page link in the footer.
Go to your Magento Dashboard > Content > Blocks > and select the available footer blocks where you want to add the reviews page link.
For this example, select the ‘Footer Cms Content’ block, edit it with Page Builder to add the html code for the reviews link.
Output:
Step 3 - Add a Seal
Go to your Magento Dashboard > Content > Blocks > and choose the available footer and header blocks where you want to display your seal.
Step 4 - Add a Rotating Widget
Placement is typically above the footer on the home page.
Go to Magento Dashboard > Content > Pages > URL Key: home
2. Get the rotating widget code from the SA dashboard and add it through the HTML widget on the page builder.
Output:
Once you collect product reviews, you will want to display product reviews on collection pages and product pages.
Step 5 - Add Category Code
"Cannon" Script or group 2.0 script
Typically this code is placed before the ending body tag </body>
Location:
app/design/frontend/{your_vendor_name}/{your_theme_name}/Magento_Theme/templates/html/footer.phtml
Please read the comments on the source below on what to change.
<script type="text/javascript">
var currentURL=window.location.href;if(currentURL.indexOf("checkout/onepage/success")==-1){
function saLoadScript(src) { var js = window.document.createElement('script'); js.src = src; js.type = 'text/javascript'; document.getElementsByTagName("head")[0].appendChild(js); } saLoadScript("https://www.shopperapproved.com/widgets/group2.0/xxxxx.js"); // Change this to your site's category code.
}
</script>
Star "Targets"
These tags will be found by the Cannon script and will be updated with the reviews and star rating of the product. Typically, you can put the code below the product title.
Locations:
app/design/frontend/{your_vendor_name}/{your_theme_name}/Magento_Catalog/templates/product/list.phtml
app/design/frontend/{your_vendor_name}/{your_theme_name}/Magento_Catalog/templates/product/grid.phtml
Output:
Step 5 - Add Product Page Code
Overall Star Rating Code
This code is for the stars and review count that is typically placed at the top of your product page next to the product name and pricing.
Location:
app/design/frontend/{your_vendor_name}/{your_theme_name}/Magento_Catalog/templates/product/view/detail_layout.phtml
Output:
Product Page Review Widget
This code is for your Product Review Widget that is typically placed toward the bottom of your product pages.
Location:
app/design/frontend/{your_vendor_name}/{your_theme_name}/Magento_Catalog/templates/product/view/detail_layout.phtml
Output:
If you are also using our Q&A service, please see here for how to integrate Q&A to your Magento site.
https://app.intercom.com/a/apps/taxyni8e/knowledge-hub/article/10915835
If you have any questions, please reach out to [email protected].