Installation Guide

1. Install Social Analytics code

Copy and paste into the global footer template:

<script type="text/javascript">
var js = document.createElement('script'); js.type = 'text/javascript'; js.async = true; js.id = 'AddShoppers';
js.src = ('https:' == document.location.protocol ? 'https://shop.pe/widget/' : 'http://cdn.shop.pe/widget/') + 'widget_async.js#XXXXX';
document.getElementsByTagName("head")[0].appendChild(js);
</script>

2. Install ROI Tracking code

Copy and paste the following code into app/design/frontend/base/default/YOUR_THEME/checkout/success.phtml

<?php 
$order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId()); 
$amount = number_format($order->subtotal,2); 
?>
<script type="text/javascript">
AddShoppersConversion = {
        order_id: '<?php echo $this->getOrderId(); ?>',
        value: '<?php echo $amount; ?>'
};
var js = document.createElement('script'); js.type = 'text/javascript'; js.async = true; js.id = 'AddShoppers';
js.src = ('https:' == document.location.protocol ? 'https://shop.pe/widget/' : 'http://cdn.shop.pe/widget/') + 'widget_async.js#XXXXXXXX';
document.getElementsByTagName("head")[0].appendChild(js);
</script>

3. Add sharing buttons

Floating buttons: Copy and paste this code into the global footer template:

<div class="share-buttons share-buttons-tab" data-buttons="facebook,twitter,pinterest,google,email" data-style="big" data-counter="true" data-hover="false" data-promo-callout="true" data-float="left"></div>

4. Discovery Wall Installation

Copy and paste the following code where you want the Discovery Wall to appear:

<div id="AddShoppersWall"></div>

5. Social Login Installation

a. In your root Magento folder, create a new file called create.php. Copy and paste the contents of this page into that file and save.

b. Copy the contents of this page into a static block called "addshoppers_social_login" in Magento. 

c. Set up a test page with the "addshoppers_social_login" block using this snippet in the template:

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('addshoppers_social_login')->toHtml(); ?> 

6. Purchase Sharing Installation

Copy and paste the following code AFTER the ROI Tracking code (step #2) into app/design/frontend/base/default/YOUR_THEME/checkout/success.phtml:

<?php
/* get most expensive item as shared item */

$highestPrice = 0;
$order_items = $order->getAllItems();
foreach($order_items as $item) {
    $product = Mage::getModel('catalog/product')->load($item->getProductId());
    if($product->getPrice() > $highestPrice){
        $highestPrice = $product->getPrice();
        $prodimgurl = $product->getMediaConfig()->getMediaUrl($product->getData('image'));
        $prodname = $product->getName();
        $proddesc = $product->getData('description');
        $produrl = $product->getProductUrl();
    }
}
?>
<?php /* if all variables are assigned then set them in addshoppers tracking */ ?>
<?php if($prodimgurl && $prodname && $proddesc && $produrl): ?>
    <script type="text/javascript">
        AddShoppersTracking = {
            auto: true,
            header: "Share your purchase with your friends!",
            async: false,
            image: '<?php echo $prodimgurl; ?>',
            url: '<?php echo $produrl; ?>',
            name: '<?php echo $prodname; ?>',
            description: '<?php echo $proddesc; ?>',
        }    
    </script>
<?php endif; ?>

7. Add Product Schema tags

a. Open up this file: app/design/frontend/base/default/YOUR_THEME/bundle/catalog/product/view.phtml

b. Copy and paste this right after the PHP comments at the top of the file:

<div itemscope itemtype="http://schema.org/Product">
        <meta itemprop="name" content="<?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?>" />
        <meta itemprop='productID' content='<?php echo $_product->getSku() ?>' />
        <meta itemprop="url" content='<?php echo $_product->getProductUrl() ?>' />

        <div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
                <meta itemprop="price" content="<?php echo str_replace(',','',number_format($_product->getFinalPrice(),2)); ?>" />
                <meta itemprop="priceCurrency" content="USD" />
                <?php if($qty > 0): ?>
                        <meta itemprop='availability' content='InStock' />
                        <meta itemprop='itemCondition' content='<?php echo $_product->getAttributeText("condition"); ?>' />
                <?php endif; ?>
        </div>

c. At the bottom of the file, add a </div> tag.

8. Add Share for Coupon button to cart page

Copy and paste the following code into the cart page template by the coupon code box:

<div class="share-buttons share-buttons-panel" data-style="coupon" data-counter="true" data-oauth="true" data-hover="true" data-promo-callout="left"></div>

9. Install Refer a Friend

a. Configure your Refer a Friend setting in your AddShoppers dashboard under Apps > Enhance > Refer a Friend.

b. Add a new CMS page in Magento.

c. Copy and paste the following code into the HTML editor:

<div id="AddShoppersRefer"></div>