Version Notes
basic functionality
Download this release
Release Info
Developer | Magento Core Team |
Extension | Svitla_IBoughtIt |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/community/Svitla/Iboughtit/Block/Email.php +20 -0
- app/code/community/Svitla/Iboughtit/Block/Iboughtit.php +17 -0
- app/code/community/Svitla/Iboughtit/Block/Script.php +82 -0
- app/code/community/Svitla/Iboughtit/Block/Social.php +6 -0
- app/code/community/Svitla/Iboughtit/Helper/Data.php +67 -0
- app/code/community/Svitla/Iboughtit/Model/Iboughtit.php +10 -0
- app/code/community/Svitla/Iboughtit/Model/Status.php +15 -0
- app/code/community/Svitla/Iboughtit/etc/config.xml +73 -0
- app/code/community/Svitla/Iboughtit/etc/system.xml +199 -0
- app/design/frontend/base/default/layout/iboughtit.xml +34 -0
- app/design/frontend/base/default/template/iboughtit/items.phtml +47 -0
- app/design/frontend/base/default/template/iboughtit/social.phtml +8 -0
- app/etc/modules/Svitla_Iboughtit.xml +9 -0
- package.xml +18 -0
app/code/community/Svitla/Iboughtit/Block/Email.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Svitla_Iboughtit_Block_Email extends Mage_Core_Block_Template {
|
4 |
+
|
5 |
+
protected function _toHtml(){
|
6 |
+
$rez='';
|
7 |
+
if(Mage::helper('iboughtit')->isActive()){
|
8 |
+
$site=(Mage::helper('iboughtit')->isUseSandbox()?'go.furiouspro.com/IboughtIt':'furiouspro.com/IboughtIt');
|
9 |
+
if(Mage::helper('iboughtit')->getEmail()==1){
|
10 |
+
$rez.='<a target="_blank" href="http://'.$site.'/merchant/claim_discount?pid='.Mage::helper('iboughtit')->getAccountId().'"><span style="text-decoration: none;"><img border="0" src="http://'.$site.'/image/'.Mage::helper('iboughtit')->getAccountId().'/email" /> </span></a>';
|
11 |
+
}
|
12 |
+
elseif(Mage::helper('iboughtit')->getEmail()==2){
|
13 |
+
$rez.='<a target="_blank" href="http://'.$site.'/merchant/claim_discount?pid='.Mage::helper('iboughtit')->getAccountId().'">'.Mage::helper('iboughtit')->__('Share your purchase with friends and make them smile').'</a>';
|
14 |
+
}
|
15 |
+
}
|
16 |
+
Mage::log($rez);
|
17 |
+
return $rez;
|
18 |
+
}
|
19 |
+
|
20 |
+
}
|
app/code/community/Svitla/Iboughtit/Block/Iboughtit.php
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Svitla_Iboughtit_Block_Iboughtit extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
public function _prepareLayout()
|
5 |
+
{
|
6 |
+
return parent::_prepareLayout();
|
7 |
+
}
|
8 |
+
|
9 |
+
public function getIboughtit()
|
10 |
+
{
|
11 |
+
if (!$this->hasData('iboughtit')) {
|
12 |
+
$this->setData('iboughtit', Mage::registry('iboughtit'));
|
13 |
+
}
|
14 |
+
return $this->getData('iboughtit');
|
15 |
+
|
16 |
+
}
|
17 |
+
}
|
app/code/community/Svitla/Iboughtit/Block/Script.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Svitla_Iboughtit_Block_Script extends Mage_Core_Block_Template {
|
4 |
+
|
5 |
+
const DEFAULT_ANCHOR = 'buttons-set';
|
6 |
+
|
7 |
+
protected function _toHtml() {
|
8 |
+
|
9 |
+
$res = '';
|
10 |
+
|
11 |
+
if ($this->getAnchorClass() && $this->getAnchorClass() != self::DEFAULT_ANCHOR) {
|
12 |
+
$anchorClass = $this->getAnchorClass();
|
13 |
+
$res = parent::_toHtml();
|
14 |
+
} else {
|
15 |
+
$anchorClass = self::DEFAULT_ANCHOR;
|
16 |
+
}
|
17 |
+
|
18 |
+
if (Mage::helper('iboughtit')->isActive()) {
|
19 |
+
$aResult=array();
|
20 |
+
$orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
21 |
+
$order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
|
22 |
+
|
23 |
+
if (Mage::helper('iboughtit')->isAutoplace()) {
|
24 |
+
$res.='
|
25 |
+
<script language="javascript" type="text/javascript">
|
26 |
+
$$(\'.' . $anchorClass . '\').each(function(el){Element.insert(el,{before:\'<div id="ssFrame" style="float:left;"></div>\'});});
|
27 |
+
</script>';
|
28 |
+
}
|
29 |
+
|
30 |
+
$aResult['partner_id']=$this->escapeHtml(Mage::helper('iboughtit')->getAccountId());
|
31 |
+
$aResult['store_type']='Magento';
|
32 |
+
$aResult['store_currency']=Mage::app()->getStore()->getCurrentCurrencyCode();
|
33 |
+
$aResult['order_id']=$orderId;
|
34 |
+
$aResult['ssFrame_width']=Mage::helper('iboughtit')->getWidth();
|
35 |
+
$aResult['ssFrame_height']=Mage::helper('iboughtit')->getHeight();
|
36 |
+
$aResult['auto_popup']=Mage::helper('iboughtit')->isPopup();
|
37 |
+
$aResult['sandbox']=Mage::helper('iboughtit')->isUseSandbox();
|
38 |
+
|
39 |
+
//$itemQty = count($order->getAllVisibleItems());
|
40 |
+
foreach ($order->getAllVisibleItems() as $key=>$item) {
|
41 |
+
$productId = $item->getProductId();
|
42 |
+
$product = Mage::getModel('catalog/product')->load($productId);
|
43 |
+
$categoryIds = $product->getCategoryIds();
|
44 |
+
$productCategory = $this->fetchCategories($categoryIds);
|
45 |
+
|
46 |
+
$aResult['items'][$key]['prod_id']=$productId;
|
47 |
+
$aResult['items'][$key]['prod_category']=$productCategory;
|
48 |
+
$aResult['items'][$key]['prod_price']=sprintf("%.2f", $product->getPrice());
|
49 |
+
$aResult['items'][$key]['prod_currency']=Mage::app()->getStore()->getCurrentCurrencyCode();
|
50 |
+
$aResult['items'][$key]['prod_title']=$this->escapeHtml($product->getName());
|
51 |
+
$aResult['items'][$key]['prod_img_url']=$this->helper('catalog/image')->init($product, 'thumbnail');
|
52 |
+
$aResult['items'][$key]['prod_page_url']=$product->getProductUrl();
|
53 |
+
}
|
54 |
+
}
|
55 |
+
if(is_array($aResult) && count($aResult)>0){
|
56 |
+
$sParams=json_encode($aResult);
|
57 |
+
$sParams=Mage::getModel('core/url')->escape($sParams);
|
58 |
+
}
|
59 |
+
$res.='<iframe name="iboughtit" id="iboughtit" src="http://furiouspro.com/IboughtIt/share?params='.$sParams.'"></iframe>';
|
60 |
+
//Mage::log($sParams);
|
61 |
+
//Mage::log($res);
|
62 |
+
return $res;
|
63 |
+
}
|
64 |
+
|
65 |
+
protected function getAnchorClass() {
|
66 |
+
return Mage::helper('iboughtit')->getAnchorClass();
|
67 |
+
}
|
68 |
+
|
69 |
+
private function fetchCategories($categories){
|
70 |
+
|
71 |
+
$productCategory = '';
|
72 |
+
if(count($categories) > 0){
|
73 |
+
foreach($categories as $categoryId) {
|
74 |
+
$catResource = Mage::getModel('catalog/category')->load($categoryId);
|
75 |
+
$catNamesArray[] = $catResource->getName();
|
76 |
+
}
|
77 |
+
$productCategory = implode(',', $catNamesArray);
|
78 |
+
}
|
79 |
+
return $productCategory;
|
80 |
+
}
|
81 |
+
|
82 |
+
}
|
app/code/community/Svitla/Iboughtit/Block/Social.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Svitla_Iboughtit_Block_Social extends Mage_Core_Block_Template
|
4 |
+
{
|
5 |
+
|
6 |
+
}
|
app/code/community/Svitla/Iboughtit/Helper/Data.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Svitla_Iboughtit_Helper_Data extends Mage_Catalog_Helper_Data {
|
4 |
+
|
5 |
+
private $_config = null;
|
6 |
+
private $_adv_config = null;
|
7 |
+
|
8 |
+
const PATH_TO_CONFIG = 'iboughtit/general';
|
9 |
+
const PATH_TO_CONFIG_ADVANCED = 'iboughtit/advanced';
|
10 |
+
|
11 |
+
public function getConfig() {
|
12 |
+
if (!$this->_config) {
|
13 |
+
$this->_config = new Varien_Object;
|
14 |
+
$this->_config->setData(Mage::getStoreConfig(self::PATH_TO_CONFIG, Mage::app()->getStore()));
|
15 |
+
}
|
16 |
+
return $this->_config;
|
17 |
+
}
|
18 |
+
|
19 |
+
public function getAdvancedConfig() {
|
20 |
+
if (!$this->_adv_config) {
|
21 |
+
$this->_adv_config = new Varien_Object;
|
22 |
+
$this->_adv_config->setData(Mage::getStoreConfig(self::PATH_TO_CONFIG_ADVANCED, Mage::app()->getStore()));
|
23 |
+
}
|
24 |
+
return $this->_adv_config;
|
25 |
+
}
|
26 |
+
|
27 |
+
public function getAccountId() {
|
28 |
+
return $this->getConfig()->getAccountId();
|
29 |
+
}
|
30 |
+
|
31 |
+
public function getEmail() {
|
32 |
+
return $this->getConfig()->getEmail();
|
33 |
+
}
|
34 |
+
|
35 |
+
public function isActive() {
|
36 |
+
return ($this->getConfig()->getEnabled() && $this->getAccountId());
|
37 |
+
}
|
38 |
+
|
39 |
+
public function isUseSandbox() {
|
40 |
+
return false; //$this->getConfig()->getSandbox();
|
41 |
+
}
|
42 |
+
|
43 |
+
public function isAutoplace() {
|
44 |
+
return $this->getAdvancedConfig()->getAuto();
|
45 |
+
}
|
46 |
+
|
47 |
+
public function isPopup() {
|
48 |
+
return $this->getAdvancedConfig()->getPopup();
|
49 |
+
}
|
50 |
+
|
51 |
+
public function getUrl() {
|
52 |
+
return $this->getAdvancedConfig()->getUrl();
|
53 |
+
}
|
54 |
+
|
55 |
+
public function getWidth() {
|
56 |
+
return $this->getAdvancedConfig()->getWidth();
|
57 |
+
}
|
58 |
+
|
59 |
+
public function getHeight() {
|
60 |
+
return $this->getAdvancedConfig()->getHeight();
|
61 |
+
}
|
62 |
+
|
63 |
+
public function getAnchorClass() {
|
64 |
+
return $this->getConfig()->getAnchorCssClass();
|
65 |
+
}
|
66 |
+
|
67 |
+
}
|
app/code/community/Svitla/Iboughtit/Model/Iboughtit.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Svitla_Iboughtit_Model_Iboughtit extends Mage_Core_Model_Abstract
|
4 |
+
{
|
5 |
+
public function _construct()
|
6 |
+
{
|
7 |
+
parent::_construct();
|
8 |
+
$this->_init('iboughtit/iboughtit');
|
9 |
+
}
|
10 |
+
}
|
app/code/community/Svitla/Iboughtit/Model/Status.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Svitla_Iboughtit_Model_Status extends Varien_Object
|
4 |
+
{
|
5 |
+
const STATUS_ENABLED = 1;
|
6 |
+
const STATUS_DISABLED = 2;
|
7 |
+
|
8 |
+
static public function getOptionArray()
|
9 |
+
{
|
10 |
+
return array(
|
11 |
+
self::STATUS_ENABLED => Mage::helper('iboughtit')->__('Enabled'),
|
12 |
+
self::STATUS_DISABLED => Mage::helper('iboughtit')->__('Disabled')
|
13 |
+
);
|
14 |
+
}
|
15 |
+
}
|
app/code/community/Svitla/Iboughtit/etc/config.xml
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<config>
|
4 |
+
<modules>
|
5 |
+
<Svitla_Iboughtit>
|
6 |
+
<version>0.1.0</version>
|
7 |
+
</Svitla_Iboughtit>
|
8 |
+
</modules>
|
9 |
+
<global>
|
10 |
+
<models>
|
11 |
+
<iboughtit>
|
12 |
+
<class>Svitla_Iboughtit_Model</class>
|
13 |
+
</iboughtit>
|
14 |
+
</models>
|
15 |
+
<blocks>
|
16 |
+
<iboughtit>
|
17 |
+
<class>Svitla_Iboughtit_Block</class>
|
18 |
+
</iboughtit>
|
19 |
+
</blocks>
|
20 |
+
<helpers>
|
21 |
+
<iboughtit>
|
22 |
+
<class>Svitla_Iboughtit_Helper</class>
|
23 |
+
</iboughtit>
|
24 |
+
</helpers>
|
25 |
+
</global>
|
26 |
+
<frontend>
|
27 |
+
<layout>
|
28 |
+
<updates>
|
29 |
+
<iboughtit>
|
30 |
+
<file>iboughtit.xml</file>
|
31 |
+
</iboughtit>
|
32 |
+
</updates>
|
33 |
+
</layout>
|
34 |
+
</frontend>
|
35 |
+
<!-- Maybe we can remove this block (adminhtml) -->
|
36 |
+
<adminhtml>
|
37 |
+
<acl>
|
38 |
+
<resources>
|
39 |
+
<admin>
|
40 |
+
<children>
|
41 |
+
<system>
|
42 |
+
<children>
|
43 |
+
<config>
|
44 |
+
<children>
|
45 |
+
<iboughtit>
|
46 |
+
<title>IBoughtIt to Magento Integration</title>
|
47 |
+
</iboughtit>
|
48 |
+
</children>
|
49 |
+
</config>
|
50 |
+
</children>
|
51 |
+
</system>
|
52 |
+
</children>
|
53 |
+
</admin>
|
54 |
+
</resources>
|
55 |
+
</acl>
|
56 |
+
</adminhtml>
|
57 |
+
<default>
|
58 |
+
<iboughtit>
|
59 |
+
<general>
|
60 |
+
<enabled>0</enabled>
|
61 |
+
<email>1</email>
|
62 |
+
<sandbox>0</sandbox>
|
63 |
+
<anchor_css_class>buttons-set</anchor_css_class>
|
64 |
+
</general>
|
65 |
+
<advanced>
|
66 |
+
<width>300</width>
|
67 |
+
<height>250</height>
|
68 |
+
<popup>1</popup>
|
69 |
+
<auto>1</auto>
|
70 |
+
</advanced>
|
71 |
+
</iboughtit>
|
72 |
+
</default>
|
73 |
+
</config>
|
app/code/community/Svitla/Iboughtit/etc/system.xml
ADDED
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<iboughtit>
|
5 |
+
<label>IBoughtIt</label>
|
6 |
+
<tab>sales</tab>
|
7 |
+
<frontend_type>text</frontend_type>
|
8 |
+
<sort_order>305</sort_order>
|
9 |
+
<show_in_default>1</show_in_default>
|
10 |
+
<show_in_website>1</show_in_website>
|
11 |
+
<show_in_store>1</show_in_store>
|
12 |
+
<groups>
|
13 |
+
<general translate="label">
|
14 |
+
<label>IBoughtIt</label>
|
15 |
+
<frontend_type>text</frontend_type>
|
16 |
+
<sort_order>600</sort_order>
|
17 |
+
<show_in_default>1</show_in_default>
|
18 |
+
<show_in_website>1</show_in_website>
|
19 |
+
<show_in_store>1</show_in_store>
|
20 |
+
<fields>
|
21 |
+
<account_id translate="label">
|
22 |
+
<label>IBoughtIt Account ID</label>
|
23 |
+
<frontend_type>text</frontend_type>
|
24 |
+
<sort_order>10</sort_order>
|
25 |
+
<show_in_default>1</show_in_default>
|
26 |
+
<show_in_website>1</show_in_website>
|
27 |
+
<show_in_store>1</show_in_store>
|
28 |
+
<comment>To enable this extension you will need a IBoughtIt Account ID.Click on Get Account ID below to register your store and get your Account ID.
|
29 |
+
</comment>
|
30 |
+
</account_id>
|
31 |
+
<api_wizard translate="button_label">
|
32 |
+
<label></label>
|
33 |
+
<frontend_type>Hidden</frontend_type>
|
34 |
+
<sort_order>20</sort_order>
|
35 |
+
<comment><![CDATA[<button id="iboughtit_general_api_wizard" type="button" class="scalable" onclick="javascript:window.open('http://furiouspro.com/IboughtIt/retailers/signup?cart=magento', 'apiwizard','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, ,left=100, top=100, width=1100, height=600'); return false;" ><span> Get Account ID</span></button>]]>
|
36 |
+
</comment>
|
37 |
+
<show_in_default>1</show_in_default>
|
38 |
+
<show_in_website>1</show_in_website>
|
39 |
+
<show_in_store>1</show_in_store>
|
40 |
+
</api_wizard>
|
41 |
+
<enabled translate="label">
|
42 |
+
<label>Enable IBoughtIt</label>
|
43 |
+
<frontend_type>select</frontend_type>
|
44 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
45 |
+
<sort_order>30</sort_order>
|
46 |
+
<show_in_default>1</show_in_default>
|
47 |
+
<show_in_website>1</show_in_website>
|
48 |
+
<show_in_store>1</show_in_store>
|
49 |
+
</enabled>
|
50 |
+
<anchor_css_class translate="label">
|
51 |
+
<label>Anchor class for css to position the IBoughtIt sharing banner</label>
|
52 |
+
<frontend_type>text</frontend_type>
|
53 |
+
<sort_order>40</sort_order>
|
54 |
+
<show_in_default>1</show_in_default>
|
55 |
+
<show_in_website>1</show_in_website>
|
56 |
+
<show_in_store>1</show_in_store>
|
57 |
+
<comment><![CDATA[Use the anchor text class to position the IBoughtIt sharing banner on the order confirmation page. Leave blank for default value <b>('buttons-set')</b> ]]>
|
58 |
+
</comment>
|
59 |
+
</anchor_css_class>
|
60 |
+
<email translate="label">
|
61 |
+
<label>Add to Confirmation Email</label>
|
62 |
+
<frontend_type>select</frontend_type>
|
63 |
+
<source_model>iboughtit/email</source_model>
|
64 |
+
<sort_order>50</sort_order>
|
65 |
+
<show_in_default>0</show_in_default>
|
66 |
+
<show_in_website>0</show_in_website>
|
67 |
+
<show_in_store>0</show_in_store>
|
68 |
+
</email>
|
69 |
+
<js_script>
|
70 |
+
<label></label>
|
71 |
+
<frontend_type>Hidden</frontend_type>
|
72 |
+
<sort_order>999</sort_order>
|
73 |
+
<comment><![CDATA[
|
74 |
+
<script type='text/javascript'>
|
75 |
+
function checkLabel(event){
|
76 |
+
if($('iboughtit_general_account_id').value != ''){
|
77 |
+
// Input Id is not empty
|
78 |
+
if ( $$('tr#row_iboughtit_general_api_wizard')[0] == undefined) {
|
79 |
+
$$('button#iboughtit_general_api_wizard')[0].hide();
|
80 |
+
}
|
81 |
+
else{
|
82 |
+
$$('tr#row_iboughtit_general_api_wizard')[0].hide();
|
83 |
+
}
|
84 |
+
|
85 |
+
if ( $$('tr#row_iboughtit_general_enabled')[0] == undefined) {
|
86 |
+
$$('select#iboughtit_general_enabled')[0].up().up().show();
|
87 |
+
}
|
88 |
+
else{
|
89 |
+
$$('tr#row_iboughtit_general_enabled')[0].show();
|
90 |
+
}
|
91 |
+
|
92 |
+
if ( $$('tr#row_iboughtit_general_anchor_css_class')[0] == undefined) {
|
93 |
+
$$('input#iboughtit_general_anchor_css_class')[0].up().up().show();
|
94 |
+
}
|
95 |
+
else{
|
96 |
+
$$('tr#row_iboughtit_general_anchor_css_class')[0].show();
|
97 |
+
}
|
98 |
+
}
|
99 |
+
else
|
100 |
+
// Input Id is empty
|
101 |
+
{
|
102 |
+
if ( $$('tr#row_iboughtit_general_api_wizard')[0] == undefined) {
|
103 |
+
$$('button#iboughtit_general_api_wizard')[0].show();
|
104 |
+
}
|
105 |
+
else{
|
106 |
+
$$('tr#row_iboughtit_general_api_wizard')[0].show();
|
107 |
+
}
|
108 |
+
|
109 |
+
if ( $$('tr#row_iboughtit_general_enabled')[0] == undefined) {
|
110 |
+
$$('select#iboughtit_general_enabled')[0].up().up().hide();
|
111 |
+
}
|
112 |
+
else{
|
113 |
+
$$('#row_iboughtit_general_enabled')[0].hide();
|
114 |
+
}
|
115 |
+
if ( $$('tr#row_iboughtit_general_anchor_css_class')[0] == undefined) {
|
116 |
+
$$('input#iboughtit_general_anchor_css_class')[0].up().up().hide();
|
117 |
+
}
|
118 |
+
else{
|
119 |
+
$$('tr#row_iboughtit_general_anchor_css_class')[0].hide();
|
120 |
+
}
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
//hide this comment row
|
125 |
+
if ( $$('tr#row_iboughtit_general_js_script')[0] != undefined)
|
126 |
+
$$('tr#row_iboughtit_general_js_script')[0] .hide();
|
127 |
+
|
128 |
+
checkLabel();
|
129 |
+
|
130 |
+
$('iboughtit_general_account_id').observe('keyup', function(ev) {
|
131 |
+
checkLabel();
|
132 |
+
});
|
133 |
+
|
134 |
+
</script> ]]>
|
135 |
+
</comment>
|
136 |
+
<show_in_default>1</show_in_default>
|
137 |
+
<show_in_website>1</show_in_website>
|
138 |
+
<show_in_store>1</show_in_store>
|
139 |
+
</js_script>
|
140 |
+
<sandbox translate="label">
|
141 |
+
<label>Use Sandbox</label>
|
142 |
+
<frontend_type>select</frontend_type>
|
143 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
144 |
+
<sort_order>60</sort_order>
|
145 |
+
<show_in_default>1</show_in_default>
|
146 |
+
<show_in_website>1</show_in_website>
|
147 |
+
<show_in_store>1</show_in_store>
|
148 |
+
</sandbox>
|
149 |
+
</fields>
|
150 |
+
</general>
|
151 |
+
<advanced translate="label">
|
152 |
+
<label>IBoughtIt (Advanced Settings)</label>
|
153 |
+
<comment><![CDATA[<b style="color:red;">For advanced users</b>]]></comment>
|
154 |
+
<frontend_type>text</frontend_type>
|
155 |
+
<sort_order>10</sort_order>
|
156 |
+
<show_in_default>0</show_in_default>
|
157 |
+
<show_in_website>0</show_in_website>
|
158 |
+
<show_in_store>0</show_in_store>
|
159 |
+
<fields>
|
160 |
+
<width translate="label">
|
161 |
+
<label>Frame Width</label>
|
162 |
+
<frontend_type>text</frontend_type>
|
163 |
+
<sort_order>20</sort_order>
|
164 |
+
<show_in_default>0</show_in_default>
|
165 |
+
<show_in_website>0</show_in_website>
|
166 |
+
<show_in_store>0</show_in_store>
|
167 |
+
</width>
|
168 |
+
<height translate="label">
|
169 |
+
<label>Frame Height</label>
|
170 |
+
<frontend_type>text</frontend_type>
|
171 |
+
<sort_order>30</sort_order>
|
172 |
+
<show_in_default>0</show_in_default>
|
173 |
+
<show_in_website>0</show_in_website>
|
174 |
+
<show_in_store>0</show_in_store>
|
175 |
+
</height>
|
176 |
+
<popup translate="label">
|
177 |
+
<label>Autopopup Block</label>
|
178 |
+
<frontend_type>select</frontend_type>
|
179 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
180 |
+
<sort_order>50</sort_order>
|
181 |
+
<show_in_default>0</show_in_default>
|
182 |
+
<show_in_website>0</show_in_website>
|
183 |
+
<show_in_store>0</show_in_store>
|
184 |
+
</popup>
|
185 |
+
<auto translate="label">
|
186 |
+
<label>Place Block Automatically</label>
|
187 |
+
<frontend_type>select</frontend_type>
|
188 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
189 |
+
<sort_order>60</sort_order>
|
190 |
+
<show_in_default>0</show_in_default>
|
191 |
+
<show_in_website>0</show_in_website>
|
192 |
+
<show_in_store>0</show_in_store>
|
193 |
+
</auto>
|
194 |
+
</fields>
|
195 |
+
</advanced>
|
196 |
+
</groups>
|
197 |
+
</iboughtit>
|
198 |
+
</sections>
|
199 |
+
</config>
|
app/design/frontend/base/default/layout/iboughtit.xml
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
|
4 |
+
<checkout_multishipping_success translate="label">
|
5 |
+
<reference name="before_body_end">
|
6 |
+
<block type="iboughtit/script" name="iboughtit_success" />
|
7 |
+
</reference>
|
8 |
+
</checkout_multishipping_success>
|
9 |
+
|
10 |
+
<checkout_onepage_success translate="label">
|
11 |
+
<reference name="content">
|
12 |
+
<block type="iboughtit/script" name="iboughtit_success" after="-">
|
13 |
+
<action method="setTemplate">
|
14 |
+
<template>iboughtit/social.phtml</template>
|
15 |
+
</action>
|
16 |
+
</block>
|
17 |
+
</reference>
|
18 |
+
<!--
|
19 |
+
<reference name="before_body_end">
|
20 |
+
<block type="iboughtit/script" name="iboughtit_success" />
|
21 |
+
</reference>
|
22 |
+
-->
|
23 |
+
</checkout_onepage_success>
|
24 |
+
|
25 |
+
<sales_email_order_items>
|
26 |
+
<reference name="items" >
|
27 |
+
<action method="setTemplate">
|
28 |
+
<template>iboughtit/items.phtml</template>
|
29 |
+
</action>
|
30 |
+
<block type="iboughtit/email" name="iboughtit_email" />
|
31 |
+
</reference>
|
32 |
+
</sales_email_order_items>
|
33 |
+
|
34 |
+
</layout>
|
app/design/frontend/base/default/template/iboughtit/items.phtml
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
<?php $_order = $this->getOrder() ?>
|
3 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%" style="border:1px solid #bebcb7; background:#f8f7f5;">
|
4 |
+
<thead>
|
5 |
+
<tr>
|
6 |
+
<th align="left" bgcolor="#d9e5ee" style="padding:3px 9px"><?php echo $this->__('Item') ?></th>
|
7 |
+
<th align="left" bgcolor="#d9e5ee" style="padding:3px 9px"><?php echo $this->__('Sku') ?></th>
|
8 |
+
<th align="center" bgcolor="#d9e5ee" style="padding:3px 9px"><?php echo $this->__('Qty') ?></th>
|
9 |
+
<th align="right" bgcolor="#d9e5ee" style="padding:3px 9px"><?php echo $this->__('Subtotal') ?></th>
|
10 |
+
</tr>
|
11 |
+
</thead>
|
12 |
+
|
13 |
+
<?php $i=0; foreach ($_order->getAllItems() as $_item): ?>
|
14 |
+
<?php if($_item->getParentItem()) continue; else $i++; ?>
|
15 |
+
<tbody<?php echo $i%2 ? ' bgcolor="#eeeded"' : '' ?>>
|
16 |
+
<?php echo $this->getItemHtml($_item) ?>
|
17 |
+
</tbody>
|
18 |
+
<?php endforeach; ?>
|
19 |
+
|
20 |
+
<tbody>
|
21 |
+
<?php echo $this->getChildHtml('order_totals') ?>
|
22 |
+
</tbody>
|
23 |
+
</table>
|
24 |
+
|
25 |
+
<br />
|
26 |
+
<p><?php echo $this->getChildHtml('iboughtit_email') ?></p>
|
27 |
+
<br />
|
28 |
+
<br />
|
29 |
+
<table cellspacing="0" cellpadding="0" border="0" width="100%" style="border:1px solid #bebcb7; background:#f8f7f5;">
|
30 |
+
<thead>
|
31 |
+
<tr>
|
32 |
+
<th align="left" bgcolor="#d9e5ee" style="padding:3px 9px"><strong><?php echo $this->__('Gift Message for this Order') ?></strong></th>
|
33 |
+
</tr>
|
34 |
+
</thead>
|
35 |
+
|
36 |
+
<tbody>
|
37 |
+
<?php if($_order->getGiftMessageId() && $_giftMessage = $this->helper('giftmessage/message')->getGiftMessage($_order->getGiftMessageId())): ?>
|
38 |
+
<tr>
|
39 |
+
<td colspan="4" align="left" style="padding:3px 9px">
|
40 |
+
<strong><?php echo $this->__('From:'); ?></strong> <?php echo $this->htmlEscape($_giftMessage->getSender()) ?>
|
41 |
+
<br /><strong><?php echo $this->__('To:'); ?></strong> <?php echo $this->htmlEscape($_giftMessage->getRecipient()) ?>
|
42 |
+
<br /><strong><?php echo $this->__('Message:'); ?></strong><br /> <?php echo $this->htmlEscape($_giftMessage->getMessage()) ?>
|
43 |
+
</td>
|
44 |
+
</tr>
|
45 |
+
<?php endif; ?>
|
46 |
+
</tbody>
|
47 |
+
</table>
|
app/design/frontend/base/default/template/iboughtit/social.phtml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
<?php $anchorClass = $this->getAnchorClass(); ?>
|
3 |
+
|
4 |
+
<div class="<?php echo $anchorClass ?>" style ="clear: both; margin: 4em 0 0;padding: 8px 0 0; text-align: right;"></div>
|
5 |
+
|
6 |
+
|
7 |
+
|
8 |
+
|
app/etc/modules/Svitla_Iboughtit.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Svitla_Iboughtit>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Svitla_Iboughtit>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Svitla_IBoughtIt</name>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Extension to recommend goods over social networks</summary>
|
10 |
+
<description>Extension to recommend goods over social networks</description>
|
11 |
+
<notes>basic functionality</notes>
|
12 |
+
<authors><author><name>Svitla</name><user>auto-converted</user><email>okhokhliuk@svitla.com</email></author></authors>
|
13 |
+
<date>2012-05-31</date>
|
14 |
+
<time>07:14:39</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Svitla"><dir name="Iboughtit"><dir name="Block"><file name="Email.php" hash="e7e795b17873abea52b0c6156cb593d5"/><file name="Iboughtit.php" hash="bb8f4f72f0e88546f961230ddc8c385b"/><file name="Script.php" hash="0e934c9e543c24abf21304cde83eab2c"/><file name="Social.php" hash="fb546910c18fc4f808b6c0cb24157d23"/></dir><dir name="Helper"><file name="Data.php" hash="2765c7cf6b02b28d7840357df1b3ca9a"/></dir><dir name="Model"><file name="Iboughtit.php" hash="88ca3383b67908168a717ebc3781f635"/><file name="Status.php" hash="7f7e065cb80e95c5344731957f160d10"/></dir><dir name="etc"><file name="config.xml" hash="4e5057a9286e358f6ee56507e4dd1985"/><file name="system.xml" hash="dc77118758c06e679586fab81947e6ec"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Svitla_Iboughtit.xml" hash="cb2ee7f8f58fb73c60f85ddf977a5f41"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="iboughtit"><file name="items.phtml" hash="9cb99903e94603bb162fcdcbab09af84"/><file name="social.phtml" hash="6ee40c4b5d1a41b98a0a1f8e9bad67d1"/></dir></dir><dir name="layout"><file name="iboughtit.xml" hash="04ae3aa0fe3bd8a4421006ca7b2b0a98"/></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies/>
|
18 |
+
</package>
|