Version Notes
First public release after testing
Download this release
Release Info
| Developer | Riccardo Mastellone |
| Extension | addvert |
| Version | 1.0.0 |
| Comparing to | |
| See all releases | |
Version 1.0.0
- app/code/community/Addvert/Addvert/Block/Button.php +30 -0
- app/code/community/Addvert/Addvert/Block/OpenGraph.php +98 -0
- app/code/community/Addvert/Addvert/Block/Tracking.php +51 -0
- app/code/community/Addvert/Addvert/Helper/Data.php +22 -0
- app/code/community/Addvert/Addvert/Model/Observer.php +23 -0
- app/code/community/Addvert/Addvert/Model/Source/ButtonLayout.php +22 -0
- app/code/community/Addvert/Addvert/etc/adminhtml.xml +25 -0
- app/code/community/Addvert/Addvert/etc/config.xml +45 -0
- app/code/community/Addvert/Addvert/etc/system.xml +56 -0
- app/design/frontend/base/default/layout/addvert/addvert.xml +18 -0
- app/design/frontend/base/default/template/addvert/button.phtml +16 -0
- app/etc/modules/Addvert_Addvert.xml +9 -0
- package.xml +24 -0
app/code/community/Addvert/Addvert/Block/Button.php
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* @category Addvert
|
| 4 |
+
* @package Addvert_Addvert
|
| 5 |
+
* @author Gennaro Vietri <gennaro.vietri@gmail.com>
|
| 6 |
+
*/
|
| 7 |
+
class Addvert_Addvert_Block_Button extends Mage_Core_Block_Template
|
| 8 |
+
{
|
| 9 |
+
const SCRIPT_BASE_URL = 'http://addvert.it';
|
| 10 |
+
|
| 11 |
+
const XML_PATH_BUTTON_LAYOUT = 'addvert/addvert/button_layout';
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* @return Mage_Catalog_Model_Product
|
| 15 |
+
*/
|
| 16 |
+
protected function _getProduct()
|
| 17 |
+
{
|
| 18 |
+
return Mage::registry('current_product');
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
public function getScriptUrl()
|
| 22 |
+
{
|
| 23 |
+
return self::SCRIPT_BASE_URL . '/api/js/addvert-btn.js';
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
public function getButtonLayout()
|
| 27 |
+
{
|
| 28 |
+
return Mage::getStoreConfig(self::XML_PATH_BUTTON_LAYOUT);
|
| 29 |
+
}
|
| 30 |
+
}
|
app/code/community/Addvert/Addvert/Block/OpenGraph.php
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* @category Addvert
|
| 4 |
+
* @package Addvert_Addvert
|
| 5 |
+
* @author Gennaro Vietri <gennaro.vietri@gmail.com>
|
| 6 |
+
*/
|
| 7 |
+
class Addvert_Addvert_Block_OpenGraph extends Mage_Core_Block_Template
|
| 8 |
+
{
|
| 9 |
+
protected $_tags = null;
|
| 10 |
+
|
| 11 |
+
protected $_categories = null;
|
| 12 |
+
|
| 13 |
+
const ADDVERT_TYPE = 'product';
|
| 14 |
+
|
| 15 |
+
/**
|
| 16 |
+
* @return Mage_Catalog_Model_Product
|
| 17 |
+
*/
|
| 18 |
+
protected function _getProduct()
|
| 19 |
+
{
|
| 20 |
+
return Mage::registry('current_product');
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
/**
|
| 24 |
+
* Aggiunge i meta nell'head della scheda prodotto
|
| 25 |
+
*/
|
| 26 |
+
public function getMetaHtml()
|
| 27 |
+
{
|
| 28 |
+
$product = $this->_getProduct();
|
| 29 |
+
|
| 30 |
+
$metas = array(
|
| 31 |
+
array('property' => 'og:url', 'content' => $product->getProductUrl()),
|
| 32 |
+
array('property' => 'og:title', 'content' => $product->getName()),
|
| 33 |
+
array('property' => 'og:description', 'content' => $product->getDescription()),
|
| 34 |
+
array('property' => 'og:image', 'content' => Mage::helper('catalog/image')->init($product, 'image')),
|
| 35 |
+
array('name' => 'addvert:type', 'content' => self::ADDVERT_TYPE),
|
| 36 |
+
array('name' => 'addvert:ecommerce_id', 'content' => Mage::helper('addvert')->getEcommerceId()),
|
| 37 |
+
array('name' => 'addvert:category', 'content' => implode(',', $this->_getCategories())),
|
| 38 |
+
array('name' => 'addvert:price', 'content' => number_format(Mage::helper('core')->currency($product->getFinalPrice(), false, false), 2)),
|
| 39 |
+
);
|
| 40 |
+
|
| 41 |
+
foreach ($this->_getTags() as $tag) {
|
| 42 |
+
$metas[] = array('name' => 'addvert:tag', 'content' => $tag);
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
$metaHtml = '';
|
| 46 |
+
foreach ($metas as $meta) {
|
| 47 |
+
$metaHtml .= '<meta';
|
| 48 |
+
foreach ($meta as $attribute => $value) {
|
| 49 |
+
$metaHtml .= sprintf(' %s="%s"', $attribute, $this->escapeHtml($value));
|
| 50 |
+
}
|
| 51 |
+
$metaHtml .= ' />' . "\n";
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
return $metaHtml;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
protected function _getCategories()
|
| 58 |
+
{
|
| 59 |
+
if (null === $this->_categories) {
|
| 60 |
+
$this->_categories = array();
|
| 61 |
+
foreach ($this->_getProduct()->getCategoryCollection()->addAttributeToSelect('name') as $category) {
|
| 62 |
+
if ($category->getLevel() > 1) {
|
| 63 |
+
$this->_categories[] = $category->getName();
|
| 64 |
+
break; // @todo in questo momento le API supportano una sola categoria per volta
|
| 65 |
+
}
|
| 66 |
+
}
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
return $this->_categories;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
protected function _getTags()
|
| 73 |
+
{
|
| 74 |
+
if (null === $this->_tags) {
|
| 75 |
+
$this->_tags = array();
|
| 76 |
+
$model = Mage::getModel('tag/tag');
|
| 77 |
+
$tags = $model->getResourceCollection()
|
| 78 |
+
->addPopularity()
|
| 79 |
+
->addStatusFilter($model->getApprovedStatus())
|
| 80 |
+
->addProductFilter($this->_getProduct()->getId())
|
| 81 |
+
->setFlag('relation', true)
|
| 82 |
+
->addStoreFilter(Mage::app()->getStore()->getId())
|
| 83 |
+
->setActiveFilter()
|
| 84 |
+
->load();
|
| 85 |
+
|
| 86 |
+
foreach ($tags as $tag) {
|
| 87 |
+
$this->_tags[] = $tag->getName();
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
+
return $this->_tags;
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
protected function _toHtml()
|
| 95 |
+
{
|
| 96 |
+
return $this->getMetaHtml();
|
| 97 |
+
}
|
| 98 |
+
}
|
app/code/community/Addvert/Addvert/Block/Tracking.php
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* @category Addvert
|
| 4 |
+
* @package Addvert_Addvert
|
| 5 |
+
* @author Gennaro Vietri <gennaro.vietri@gmail.com>
|
| 6 |
+
*/
|
| 7 |
+
class Addvert_Addvert_Block_Tracking extends Mage_Core_Block_Template
|
| 8 |
+
{
|
| 9 |
+
const SCRIPT_BASE_URL = 'http://addvert.it';
|
| 10 |
+
|
| 11 |
+
protected $_order = null;
|
| 12 |
+
|
| 13 |
+
public function getOrderKey()
|
| 14 |
+
{
|
| 15 |
+
$helper = Mage::helper('addvert');
|
| 16 |
+
|
| 17 |
+
$ecommerceId = $helper->getEcommerceId();
|
| 18 |
+
$secretKey = $helper->getSecretKey();
|
| 19 |
+
|
| 20 |
+
$orderId = $this->_getOrder()->getIncrementId();
|
| 21 |
+
$orderTotal = $this->_getOrder()->getBaseSubtotalInclTax();
|
| 22 |
+
|
| 23 |
+
$url = sprintf(self::SCRIPT_BASE_URL . '/api/order/prep_total?ecommerce_id=%s&secret=%s&tracking_id=%s&total=%s', $ecommerceId, $secretKey, $orderId, $orderTotal);
|
| 24 |
+
$client = new Zend_Http_Client($url);
|
| 25 |
+
|
| 26 |
+
$response = $client->request()->getBody();
|
| 27 |
+
|
| 28 |
+
return $response;
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
public function getTrackingHtml()
|
| 32 |
+
{
|
| 33 |
+
return '<script src="' . self::SCRIPT_BASE_URL . '/api/order/send_total?key=' . $this->getOrderKey() . '"></script>';
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
protected function _toHtml()
|
| 37 |
+
{
|
| 38 |
+
return $this->getTrackingHtml();
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* @return Mage_Sales_Model_Order
|
| 43 |
+
*/
|
| 44 |
+
protected function _getOrder()
|
| 45 |
+
{
|
| 46 |
+
if (null === $this->_order) {
|
| 47 |
+
$this->_order = Mage::getModel('sales/order')->load($this->getOrderId());
|
| 48 |
+
}
|
| 49 |
+
return $this->_order;
|
| 50 |
+
}
|
| 51 |
+
}
|
app/code/community/Addvert/Addvert/Helper/Data.php
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* @category Addvert
|
| 4 |
+
* @package Addvert_Addvert
|
| 5 |
+
* @author Gennaro Vietri <gennaro.vietri@gmail.com>
|
| 6 |
+
*/
|
| 7 |
+
class Addvert_Addvert_Helper_Data extends Mage_Core_Helper_Abstract
|
| 8 |
+
{
|
| 9 |
+
const XML_PATH_ECOMMERCE_ID = 'addvert/addvert/ecommerce_id';
|
| 10 |
+
|
| 11 |
+
const XML_PATH_SECRET_KEY = 'addvert/addvert/secret';
|
| 12 |
+
|
| 13 |
+
public function getEcommerceId()
|
| 14 |
+
{
|
| 15 |
+
return Mage::getStoreConfig(self::XML_PATH_ECOMMERCE_ID);
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
public function getSecretKey()
|
| 19 |
+
{
|
| 20 |
+
return Mage::getStoreConfig(self::XML_PATH_SECRET_KEY);
|
| 21 |
+
}
|
| 22 |
+
}
|
app/code/community/Addvert/Addvert/Model/Observer.php
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* @category Addvert
|
| 4 |
+
* @package Addvert_Addvert
|
| 5 |
+
* @author Gennaro Vietri <gennaro.vietri@gmail.com>
|
| 6 |
+
*/
|
| 7 |
+
class Addvert_Addvert_Model_Observer
|
| 8 |
+
{
|
| 9 |
+
/**
|
| 10 |
+
* @param Varien_Event_Observer $observer
|
| 11 |
+
*/
|
| 12 |
+
public function registerOrderId(Varien_Event_Observer $observer)
|
| 13 |
+
{
|
| 14 |
+
$orderIds = $observer->getEvent()->getOrderIds();
|
| 15 |
+
if (empty($orderIds) || !is_array($orderIds)) {
|
| 16 |
+
return;
|
| 17 |
+
}
|
| 18 |
+
$block = Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('addvert.tracking');
|
| 19 |
+
if ($block) {
|
| 20 |
+
$block->setOrderId($orderIds[0]);
|
| 21 |
+
}
|
| 22 |
+
}
|
| 23 |
+
}
|
app/code/community/Addvert/Addvert/Model/Source/ButtonLayout.php
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* @category Addvert
|
| 4 |
+
* @package Addvert_Addvert
|
| 5 |
+
* @author Gennaro Vietri <gennaro.vietri@gmail.com>
|
| 6 |
+
*/
|
| 7 |
+
class Addvert_Addvert_Model_Source_ButtonLayout
|
| 8 |
+
{
|
| 9 |
+
public function toOptionArray()
|
| 10 |
+
{
|
| 11 |
+
return array(
|
| 12 |
+
array(
|
| 13 |
+
'value' => 'standard',
|
| 14 |
+
'label' => Mage::helper('addvert')->__('Standard')
|
| 15 |
+
),
|
| 16 |
+
array(
|
| 17 |
+
'value' => 'small',
|
| 18 |
+
'label' => Mage::helper('addvert')->__('Small')
|
| 19 |
+
),
|
| 20 |
+
);
|
| 21 |
+
}
|
| 22 |
+
}
|
app/code/community/Addvert/Addvert/etc/adminhtml.xml
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<acl>
|
| 4 |
+
<resources>
|
| 5 |
+
<all>
|
| 6 |
+
<title>Allow Everything</title>
|
| 7 |
+
</all>
|
| 8 |
+
<admin>
|
| 9 |
+
<children>
|
| 10 |
+
<system>
|
| 11 |
+
<children>
|
| 12 |
+
<config>
|
| 13 |
+
<children>
|
| 14 |
+
<addvert translate="title" module="addvert">
|
| 15 |
+
<title>Addvert</title>
|
| 16 |
+
</addvert>
|
| 17 |
+
</children>
|
| 18 |
+
</config>
|
| 19 |
+
</children>
|
| 20 |
+
</system>
|
| 21 |
+
</children>
|
| 22 |
+
</admin>
|
| 23 |
+
</resources>
|
| 24 |
+
</acl>
|
| 25 |
+
</config>
|
app/code/community/Addvert/Addvert/etc/config.xml
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Addvert_Addvert>
|
| 5 |
+
<version>0.1.0</version>
|
| 6 |
+
</Addvert_Addvert>
|
| 7 |
+
</modules>
|
| 8 |
+
<global>
|
| 9 |
+
<blocks>
|
| 10 |
+
<addvert>
|
| 11 |
+
<class>Addvert_Addvert_Block</class>
|
| 12 |
+
</addvert>
|
| 13 |
+
</blocks>
|
| 14 |
+
<helpers>
|
| 15 |
+
<addvert>
|
| 16 |
+
<class>Addvert_Addvert_Helper</class>
|
| 17 |
+
</addvert>
|
| 18 |
+
</helpers>
|
| 19 |
+
<models>
|
| 20 |
+
<addvert>
|
| 21 |
+
<class>Addvert_Addvert_Model</class>
|
| 22 |
+
</addvert>
|
| 23 |
+
</models>
|
| 24 |
+
</global>
|
| 25 |
+
<frontend>
|
| 26 |
+
<layout>
|
| 27 |
+
<updates>
|
| 28 |
+
<addvert>
|
| 29 |
+
<file>addvert/addvert.xml</file>
|
| 30 |
+
</addvert>
|
| 31 |
+
</updates>
|
| 32 |
+
</layout>
|
| 33 |
+
<events>
|
| 34 |
+
<checkout_onepage_controller_success_action>
|
| 35 |
+
<observers>
|
| 36 |
+
<addvert>
|
| 37 |
+
<type>singleton</type>
|
| 38 |
+
<class>Addvert_Addvert_Model_Observer</class>
|
| 39 |
+
<method>registerOrderId</method>
|
| 40 |
+
</addvert>
|
| 41 |
+
</observers>
|
| 42 |
+
</checkout_onepage_controller_success_action>
|
| 43 |
+
</events>
|
| 44 |
+
</frontend>
|
| 45 |
+
</config>
|
app/code/community/Addvert/Addvert/etc/system.xml
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<tabs>
|
| 4 |
+
<addvert translate="label">
|
| 5 |
+
<label>Addvert</label>
|
| 6 |
+
<sort_order>220</sort_order>
|
| 7 |
+
</addvert>
|
| 8 |
+
</tabs>
|
| 9 |
+
<sections>
|
| 10 |
+
<addvert translate="label" module="addvert">
|
| 11 |
+
<label>Addvert</label>
|
| 12 |
+
<tab>addvert</tab>
|
| 13 |
+
<show_in_default>1</show_in_default>
|
| 14 |
+
<show_in_website>1</show_in_website>
|
| 15 |
+
<show_in_store>1</show_in_store>
|
| 16 |
+
<sort_order>1000</sort_order>
|
| 17 |
+
<groups>
|
| 18 |
+
<addvert translate="label" module="addvert">
|
| 19 |
+
<label>Ecommerce integration</label>
|
| 20 |
+
<frontend_type>text</frontend_type>
|
| 21 |
+
<sort_order>0</sort_order>
|
| 22 |
+
<show_in_default>1</show_in_default>
|
| 23 |
+
<show_in_website>1</show_in_website>
|
| 24 |
+
<show_in_store>1</show_in_store>
|
| 25 |
+
<fields>
|
| 26 |
+
<ecommerce_id translate="label" module="addvert">
|
| 27 |
+
<label>Ecommerce ID</label>
|
| 28 |
+
<frontend_type>text</frontend_type>
|
| 29 |
+
<sort_order>1</sort_order>
|
| 30 |
+
<show_in_default>1</show_in_default>
|
| 31 |
+
<show_in_website>1</show_in_website>
|
| 32 |
+
<show_in_store>1</show_in_store>
|
| 33 |
+
</ecommerce_id>
|
| 34 |
+
<secret translate="label" module="addvert">
|
| 35 |
+
<label>Secret key</label>
|
| 36 |
+
<frontend_type>text</frontend_type>
|
| 37 |
+
<sort_order>2</sort_order>
|
| 38 |
+
<show_in_default>1</show_in_default>
|
| 39 |
+
<show_in_website>1</show_in_website>
|
| 40 |
+
<show_in_store>1</show_in_store>
|
| 41 |
+
</secret>
|
| 42 |
+
<button_layout translate="label" module="addvert">
|
| 43 |
+
<label>Button layout</label>
|
| 44 |
+
<frontend_type>select</frontend_type>
|
| 45 |
+
<source_model>addvert/source_buttonLayout</source_model>
|
| 46 |
+
<sort_order>3</sort_order>
|
| 47 |
+
<show_in_default>1</show_in_default>
|
| 48 |
+
<show_in_website>1</show_in_website>
|
| 49 |
+
<show_in_store>1</show_in_store>
|
| 50 |
+
</button_layout>
|
| 51 |
+
</fields>
|
| 52 |
+
</addvert>
|
| 53 |
+
</groups>
|
| 54 |
+
</addvert>
|
| 55 |
+
</sections>
|
| 56 |
+
</config>
|
app/design/frontend/base/default/layout/addvert/addvert.xml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<layout version="0.1.0">
|
| 3 |
+
<catalog_product_view>
|
| 4 |
+
<reference name="head">
|
| 5 |
+
<block type="addvert/openGraph" name="addvert.meta"/>
|
| 6 |
+
</reference>
|
| 7 |
+
<reference name="alert.urls">
|
| 8 |
+
<block type="addvert/button" name="addvert.button" template="addvert/button.phtml"/>
|
| 9 |
+
</reference>
|
| 10 |
+
</catalog_product_view>
|
| 11 |
+
<checkout_onepage_success>
|
| 12 |
+
<reference name="head">
|
| 13 |
+
<block type="addvert/tracking" name="addvert.tracking" />
|
| 14 |
+
</reference>
|
| 15 |
+
</checkout_onepage_success>
|
| 16 |
+
</layout>
|
| 17 |
+
|
| 18 |
+
|
app/design/frontend/base/default/template/addvert/button.phtml
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* @category Addvert
|
| 4 |
+
* @package Addvert_Addvert
|
| 5 |
+
* @author Gennaro Vietri <gennaro.vietri@gmail.com>
|
| 6 |
+
*/
|
| 7 |
+
/* @var $this Addvert_Addvert_Block_Button */
|
| 8 |
+
?>
|
| 9 |
+
<script type="text/javascript">
|
| 10 |
+
(function() {
|
| 11 |
+
var js = document.createElement('script'); js.type = 'text/javascript'; js.async = true;
|
| 12 |
+
js.src = '<?php echo $this->getScriptUrl() ?>';
|
| 13 |
+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(js, s);
|
| 14 |
+
})();
|
| 15 |
+
</script>
|
| 16 |
+
<div class="addvert-btn" data-width="450" data-layout="<?php echo $this->getButtonLayout(); ?>"></div>
|
app/etc/modules/Addvert_Addvert.xml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<config>
|
| 3 |
+
<modules>
|
| 4 |
+
<Addvert_Addvert>
|
| 5 |
+
<active>true</active>
|
| 6 |
+
<codePool>community</codePool>
|
| 7 |
+
</Addvert_Addvert>
|
| 8 |
+
</modules>
|
| 9 |
+
</config>
|
package.xml
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<package>
|
| 3 |
+
<name>addvert</name>
|
| 4 |
+
<version>1.0.0</version>
|
| 5 |
+
<stability>stable</stability>
|
| 6 |
+
<license uri="http://opensource.org/licenses/mit-license.php">MITL</license>
|
| 7 |
+
<channel>community</channel>
|
| 8 |
+
<extends/>
|
| 9 |
+
<summary>Integrate Addvert in your e-commerce. Visit addvert.it for more info.</summary>
|
| 10 |
+
<description>Addvert is a social platform that will increase your profits! This extension is required to integrate correctly. 
|
| 11 |
+
The documentation is available at http://addvert.it/api/doc (http://addvert.it/api/doc/en for english)
|
| 12 |
+

|
| 13 |
+
This extension will take care of 3 things:
|
| 14 |
+
- Adding some Open Graph meta tags to your products so that Addvert can parse them to get the product info
|
| 15 |
+
- Adding the 'Add' button to your product pages to allow your costumers to share them! You can choose which layout you prefer in the admin panel
|
| 16 |
+
- Tracking the orders originated from addvert.it</description>
|
| 17 |
+
<notes>First public release after testing</notes>
|
| 18 |
+
<authors><author><name>Riccardo Mastellone</name><user>riccamasty</user><email>riccardo.mastellone@gmail.com</email></author></authors>
|
| 19 |
+
<date>2013-12-25</date>
|
| 20 |
+
<time>00:12:54</time>
|
| 21 |
+
<contents><target name="magecommunity"><dir name="Addvert"><dir name="Addvert"><dir name="Block"><file name="Button.php" hash="cea48378f6d6fce3b00618467ce2f753"/><file name="OpenGraph.php" hash="46bd3dc96a168f36eac66fa02f5cd76c"/><file name="Tracking.php" hash="6478a4192ab8ae7df6d35edeedb9ef5f"/></dir><dir name="Helper"><file name="Data.php" hash="822997d8d91a8a0953cf4ce3ee8eb488"/></dir><dir name="Model"><file name="Observer.php" hash="2130aaf0e55bab3b4fd0b8addb0848b4"/><dir name="Source"><file name="ButtonLayout.php" hash="8b62501e7f0dcb700a84847c9f3ac527"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="002bc66d3ca9c3c8acc9b84bcfbe7ff0"/><file name="config.xml" hash="ba12e16fe877a7430a4278abb3bc8d44"/><file name="system.xml" hash="ce2929f890d51abe81981b43e6d0f69d"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="addvert"><file name="addvert.xml" hash="d521de855a2d7ce7879e1c35dd12b3bf"/></dir></dir><dir name="template"><dir name="addvert"><file name="button.phtml" hash="ca026c1aca9bcd7b2f2bfd4a772807a5"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Addvert_Addvert.xml" hash="fe2b78eefa501220230a15a6be8c990e"/></dir></target></contents>
|
| 22 |
+
<compatible/>
|
| 23 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
| 24 |
+
</package>
|
