This article will help you install Kiwi Sizing on your ZenCart store.

Support: will work with all version of ZenCart and PHP



Product attributes supported for matching:

WooCommerce product attributesKiwi Sizing product matching condition
Product IDProduct ID
Product Model NumberProduct SKU
Product ManufacturerProduct Brand
Product KeywordsProduct Tags
Product Category NamesProduct Categories

Install Kiwi Sizing snippet on your theme

Note this step will only affect your current theme. If you change theme, you need to repeat this step again.

Also, it is usually a good idea to back up your theme before you make any changes!


1) Open includes/templates/your_template_name/common/tpl_main_page.php


2) Copy the following code and paste it right before </body>

<?php

if($_GET['main_page']=="product_info")
{
echo ' <!-- KiwiSizing v1.0.0 Integration !-->
<script>
!function(t,n,s,e,i){function r(t){try{var s="; "+n.cookie,e=s.split("; "+t+"=");if(2==e.length)return e.pop().split(";").shift()}catch(i){}return null}t[i]=t[i]||{},t[i]._queue=[];const o="on setShopID setUserID setUserEmail setLanguage loadSizing".split(" ");for(var a=0;a<o.length;a++){const c=o[a];t[i][c]=function(){var n=Array.prototype.slice.call(arguments);return n.unshift(c),t[i]._queue.push(n),t[i]}}const l=r("_ks_scriptVersion")||t.ks_version||"";var u=n.createElement(s);n=n.getElementsByTagName(s)[0],u.async=1,void 0!==t.ks_load_async&&(u.async=t.ks_load_async),u.src=e+"?v="+l,u.id="ks-integration",n.parentNode.insertBefore(u,n)}(window,document,"script","https://cdn.static.kiwisizing.com/SizingPlugin.prod.js","ks");
</script>';
$cat_array = zen_generate_category_path($_GET['products_id'], 'product');
if(is_array($cat_array[0]) && sizeof($cat_array[0])>0)
{
   for($i=0; $i<count($cat_array[0]); $i++) 
   {
      $cat_name[] = '"'.$cat_array[0][$i][text].'"';
   }
}
$image_name[]= '"'.HTTP_SERVER.DIR_WS_CATALOG.$products_image_medium.'"';
 for ($i=0, $n=$num_images; $i<$n; $i++) {
    $file = $images_array[$i];
    $image_name[] = '"'.HTTP_SERVER.DIR_WS_CATALOG.$products_image_directory . $file.'"';
 }
$tags_names = str_replace('[','',str_replace(']','',META_TAG_KEYWORDS));
$tags_names = '"'.str_replace(', ','", "',$tags_names).'"';

echo '
<script>
ks.setShopID("REPLACE_ME_KIWI_SIZING_SHOP_ID");
ks.loadSizing({
  productData: {
    productID:"'.addslashes($_GET['products_id']).'",
    title:"'.addslashes($products_name).'",
    sku:"'.addslashes($products_model).'",
    brand:"'.addslashes($manufacturers_name).'",
    categories:['.join(",", $cat_name).'],
    tags:['.$tags_names.'],
    images:['.join(",", $image_name).'],
  },
});
</script> 
<!-- End KiwiSizing Integration !-->';
}
?>


  • Replace REPLACE_ME_KIWI_SIZING_SHOP_ID with the Shop ID of your KiwiSizing account (top right on the dashboard page). The ID looks something like integrationdemo-a71e-8c00a6ecb926

Finally, save the file changes.



Question: I still don't see the size chart!

If you don't see the size charts showing up even though product conditions are set up properly, it is most likely because we couldn't inject into the shop. You will need to update the injection selector in app settings. See this guide for support.

A good place to inject size chart in ZenCart is before class "productGeneral" or "cartAdd" class.