Installation Guide

1. Social Login Installation

a. Download this file and upload to your root Magento folder. Change the file extension from ".txt" to ".php".

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

c. For custom social login buttons, add the following onclick attribute to each button so they connect to AddShoppers. Make sure to change "network" to the social network for the button. You can use "facebook", "twitter", "google", "paypal", or "linkedin" (all lowercase).

You can add your custom button codes to the static block created in step B.

AddShoppersWidget.API.User.sign('network');
// Change NETWORK to the social network for the button, either facebook, google, twitter, paypal or linkedin
// Example: onclick="AddShoppersWidget.API.User.sign('facebook');"

d. Call the "social_login" block using this snippet where ever you want the social login buttons to appear:

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

2. Purchase Sharing of Purchased Product Installation

 

a. Open up this file: app/design/frontend/base/default/template/clearcode_addshoppers/tracking.phtml

b. Change this line:

AddShoppersTracking = <?php echo $this->getJSONConfig(); ?>;

to:

//AddShoppersTracking = <?php echo $this->getJSONConfig(); ?>;

(comment it out) It should look like this when complete: http://screencast.com/t/UEvJZyZ9bE

c. Add the following code to the bottom of your success.phtml file:

<?php
$order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
$amount = number_format($order->subtotal,2);
?>
<?php
/* get first all items assign variables for first item */
$order_items = $order->getAllItems();
foreach($order_items as $item) {
    $product = Mage::getModel('catalog/product')->load($item->getProductId());
    $prodimgurl = $product->getMediaConfig()->getMediaUrl($product->getData('image'));
    $prodname = $product->getName();
    $proddesc = $product->getData('description');
    $produrl = $product->getProductUrl();
    
    //check if has a parent grouped or config and set new info based on parent
        $parentIdConfig = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild( $item->getProductId() );
        $parentIdGrouped = Mage::getModel('catalog/product_type_grouped')->getParentIdsByChild( $item->getProductId() );
        if(isset($parentIdConfig[0])){
            $pcProduct = Mage::getModel('catalog/product')->load($parentIdConfig[0]);
            $prodimgurl = $pcProduct->getMediaConfig()->getMediaUrl($product->getData('image'));
            $produrl = $pcProduct->getProductUrl();
        }
        else if(isset($parentIdGrouped[0])){
            $pgProduct = Mage::getModel('catalog/product')->load($parentIdGrouped[0]);
            $prodimgurl = $pgProduct->getMediaConfig()->getMediaUrl($product->getData('image'));
            $produrl = $pgProduct->getProductUrl();
        }
    break;
}
?>
<?php /* if all variables are assigned then set them in addshoppers tracking */ ?>
<?php if($prodimgurl && $prodname && $proddesc && $produrl): ?>
    <script type="text/javascript">
        AddShoppersTracking = {
            async: false,
            image: <?php echo $prodimgurl; ?>,
            url: <?php echo $produrl; ?>,
            name: <?php echo $prodname; ?>,
            description: <?php echo $proddesc; ?>,
        }    
    </script>
<?php else: ?>
        <script type="text/javascript">
        AddShoppersTracking = {
            auto:true,
            image: 'https://example.com/some/url/to/an/image.jpg',
            url: 'http://www.example.com/',
            name: 'Example Name',
            description: 'Example description',
            //campaign: 'purchaseShare'
        }    
    </script>
<?php endif; ?>