Version Notes
Release version
Download this release
Release Info
Developer | Sendasgift |
Extension | SaG_Button |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/SaG/Button/Block/Button.php +59 -0
- app/code/community/SaG/Button/Helper/Data.php +27 -0
- app/code/community/SaG/Button/Model/Config/Color.php +36 -0
- app/code/community/SaG/Button/Model/Config/Language.php +87 -0
- app/code/community/SaG/Button/Model/Config/Size.php +37 -0
- app/code/community/SaG/Button/etc/adminhtml.xml +23 -0
- app/code/community/SaG/Button/etc/config.xml +49 -0
- app/code/community/SaG/Button/etc/system.xml +102 -0
- app/design/frontend/base/default/layout/sagbutton.xml +27 -0
- app/design/frontend/base/default/template/sagbutton/cphead.phtml +27 -0
- app/design/frontend/base/default/template/sagbutton/pphead.phtml +31 -0
- app/etc/modules/SaG_Button.xml +9 -0
- package.xml +18 -0
app/code/community/SaG/Button/Block/Button.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SaG_Button
|
4 |
+
*
|
5 |
+
* @category SaG
|
6 |
+
* @package SaG_Button
|
7 |
+
* @author Sendasgift.com <info@sendasgift.com>
|
8 |
+
*/
|
9 |
+
|
10 |
+
class SaG_Button_Block_Button extends Mage_Core_Block_Template
|
11 |
+
{
|
12 |
+
protected $_language;
|
13 |
+
protected $_size;
|
14 |
+
protected $_color;
|
15 |
+
|
16 |
+
protected $_configNode = 'pp';
|
17 |
+
|
18 |
+
public function setConfigNode($node)
|
19 |
+
{
|
20 |
+
$this->_configNode = $node;
|
21 |
+
}
|
22 |
+
|
23 |
+
protected function _beforeToHtml()
|
24 |
+
{
|
25 |
+
$this->_language = Mage::getStoreConfig("sag_settings/{$this->_configNode}/language");
|
26 |
+
$this->_size = Mage::getStoreConfig("sag_settings/{$this->_configNode}/size");
|
27 |
+
$this->_color = Mage::getStoreConfig("sag_settings/{$this->_configNode}/color");
|
28 |
+
return parent::_beforeToHtml();
|
29 |
+
}
|
30 |
+
|
31 |
+
public function getLanguage()
|
32 |
+
{
|
33 |
+
return $this->_language;
|
34 |
+
}
|
35 |
+
|
36 |
+
public function getSize()
|
37 |
+
{
|
38 |
+
return $this->_size;
|
39 |
+
}
|
40 |
+
|
41 |
+
public function getColor()
|
42 |
+
{
|
43 |
+
return $this->_color;
|
44 |
+
}
|
45 |
+
|
46 |
+
public function getButtonImgUrl()
|
47 |
+
{
|
48 |
+
$src = "//d3tlta7dhj25xj.cloudfront.net/images/buttons/{$this->_language}";
|
49 |
+
if ($this->_size != 'default') {
|
50 |
+
$src .= '-' . $this->_size;
|
51 |
+
}
|
52 |
+
if ($this->_color != 'default') {
|
53 |
+
$src .= '-' . $this->_color;
|
54 |
+
}
|
55 |
+
$src .= '.png';
|
56 |
+
return $src;
|
57 |
+
}
|
58 |
+
|
59 |
+
}
|
app/code/community/SaG/Button/Helper/Data.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SaG_Button
|
4 |
+
*
|
5 |
+
* @category SaG
|
6 |
+
* @package SaG_Button
|
7 |
+
* @author Sendasgift.com <info@sendasgift.com>
|
8 |
+
*/
|
9 |
+
|
10 |
+
class SaG_Button_Helper_Data extends Mage_Core_Helper_Abstract
|
11 |
+
{
|
12 |
+
public function getButtonDimensions($language, $size)
|
13 |
+
{
|
14 |
+
$dimensionsMap = Mage::getModel('sagbutton/config_language')->getFullMap();
|
15 |
+
if (!$size) {
|
16 |
+
$size = 'default';
|
17 |
+
}
|
18 |
+
if (isset($dimensionsMap[$language]['size'][$size])) {
|
19 |
+
return array(
|
20 |
+
$dimensionsMap[$language]['size'][$size]['width'],
|
21 |
+
$dimensionsMap[$language]['size'][$size]['height'],
|
22 |
+
);
|
23 |
+
}
|
24 |
+
return false;
|
25 |
+
}
|
26 |
+
|
27 |
+
}
|
app/code/community/SaG/Button/Model/Config/Color.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SaG_Button
|
4 |
+
*
|
5 |
+
* @category SaG
|
6 |
+
* @package SaG_Button
|
7 |
+
* @author Sendasgift.com <info@sendasgift.com>
|
8 |
+
*/
|
9 |
+
|
10 |
+
class SaG_Button_Model_Config_Color
|
11 |
+
{
|
12 |
+
protected $_options;
|
13 |
+
|
14 |
+
public function getOptionArray()
|
15 |
+
{
|
16 |
+
return array(
|
17 |
+
'default' => Mage::helper('sagbutton')->__('Default'),
|
18 |
+
'black' => Mage::helper('sagbutton')->__('Black'),
|
19 |
+
'blue' => Mage::helper('sagbutton')->__('Blue'),
|
20 |
+
'green' => Mage::helper('sagbutton')->__('Green'),
|
21 |
+
'grey' => Mage::helper('sagbutton')->__('Grey'),
|
22 |
+
'orange' => Mage::helper('sagbutton')->__('Orange'),
|
23 |
+
'pink' => Mage::helper('sagbutton')->__('Pink'),
|
24 |
+
'red' => Mage::helper('sagbutton')->__('Red'),
|
25 |
+
);
|
26 |
+
}
|
27 |
+
|
28 |
+
public function toOptionArray($isMultiselect=false)
|
29 |
+
{
|
30 |
+
if (!$this->_options) {
|
31 |
+
$this->_options = $this->getOptionArray();
|
32 |
+
}
|
33 |
+
|
34 |
+
return $this->_options;
|
35 |
+
}
|
36 |
+
}
|
app/code/community/SaG/Button/Model/Config/Language.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SaG_Button
|
4 |
+
*
|
5 |
+
* @category SaG
|
6 |
+
* @package SaG_Button
|
7 |
+
* @author Sendasgift.com <info@sendasgift.com>
|
8 |
+
*/
|
9 |
+
|
10 |
+
class SaG_Button_Model_Config_Language
|
11 |
+
{
|
12 |
+
protected $_options;
|
13 |
+
|
14 |
+
public function getOptionArray()
|
15 |
+
{
|
16 |
+
if (!$this->_options) {
|
17 |
+
$this->_options = array();
|
18 |
+
foreach ($this->getFullMap() as $lang => $set) {
|
19 |
+
$this->_options[$lang] = $set['caption'];
|
20 |
+
}
|
21 |
+
}
|
22 |
+
return $this->_options;
|
23 |
+
}
|
24 |
+
|
25 |
+
public function toOptionArray($isMultiselect=false)
|
26 |
+
{
|
27 |
+
if (!$this->_options) {
|
28 |
+
$this->_options = $this->getOptionArray();
|
29 |
+
}
|
30 |
+
//
|
31 |
+
// $options = $this->_options;
|
32 |
+
// if(!$isMultiselect){
|
33 |
+
// array_unshift($options, Mage::helper('adminhtml')->__('--Please Select--'));
|
34 |
+
// }
|
35 |
+
|
36 |
+
return $this->_options;
|
37 |
+
}
|
38 |
+
|
39 |
+
public function getFullMap()
|
40 |
+
{
|
41 |
+
return array(
|
42 |
+
'en' => array(
|
43 |
+
'size' => array(
|
44 |
+
'mini' => array(
|
45 |
+
'width' => 90,
|
46 |
+
'height' => 22,
|
47 |
+
),
|
48 |
+
'small' => array(
|
49 |
+
'width' => 99,
|
50 |
+
'height' => 30,
|
51 |
+
),
|
52 |
+
'large' => array(
|
53 |
+
'width' => 128,
|
54 |
+
'height' => 39,
|
55 |
+
),
|
56 |
+
'default' => array(
|
57 |
+
'width' => 110,
|
58 |
+
'height' => 28,
|
59 |
+
),
|
60 |
+
),
|
61 |
+
'caption' => Mage::helper('sagbutton')->__('English')
|
62 |
+
),
|
63 |
+
'he' => array(
|
64 |
+
'size' => array(
|
65 |
+
'mini' => array(
|
66 |
+
'width' => 88,
|
67 |
+
'height' => 22,
|
68 |
+
),
|
69 |
+
'small' => array(
|
70 |
+
'width' => 94,
|
71 |
+
'height' => 30,
|
72 |
+
),
|
73 |
+
'large' => array(
|
74 |
+
'width' => 120,
|
75 |
+
'height' => 39,
|
76 |
+
),
|
77 |
+
'default' => array(
|
78 |
+
'width' => 102,
|
79 |
+
'height' => 28,
|
80 |
+
),
|
81 |
+
),
|
82 |
+
'caption' => Mage::helper('sagbutton')->__('Hebrew')
|
83 |
+
)
|
84 |
+
);
|
85 |
+
}
|
86 |
+
|
87 |
+
}
|
app/code/community/SaG/Button/Model/Config/Size.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* SaG_Button
|
4 |
+
*
|
5 |
+
* @category SaG
|
6 |
+
* @package SaG_Button
|
7 |
+
* @author Sendasgift.com <info@sendasgift.com>
|
8 |
+
*/
|
9 |
+
|
10 |
+
class SaG_Button_Model_Config_Size
|
11 |
+
{
|
12 |
+
protected $_options;
|
13 |
+
|
14 |
+
public function getOptionArray()
|
15 |
+
{
|
16 |
+
return array(
|
17 |
+
'mini' => Mage::helper('sagbutton')->__('Mini'),
|
18 |
+
'small' => Mage::helper('sagbutton')->__('Small'),
|
19 |
+
'default' => Mage::helper('sagbutton')->__('Default'),
|
20 |
+
'large' => Mage::helper('sagbutton')->__('Large'),
|
21 |
+
);
|
22 |
+
}
|
23 |
+
|
24 |
+
public function toOptionArray($isMultiselect=false)
|
25 |
+
{
|
26 |
+
if (!$this->_options) {
|
27 |
+
$this->_options = $this->getOptionArray();
|
28 |
+
}
|
29 |
+
//
|
30 |
+
// $options = $this->_options;
|
31 |
+
// if(!$isMultiselect){
|
32 |
+
// array_unshift($options, Mage::helper('adminhtml')->__('--Please Select--'));
|
33 |
+
// }
|
34 |
+
|
35 |
+
return $this->_options;
|
36 |
+
}
|
37 |
+
}
|
app/code/community/SaG/Button/etc/adminhtml.xml
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" ?>
|
2 |
+
<config>
|
3 |
+
<acl>
|
4 |
+
<resources>
|
5 |
+
<admin>
|
6 |
+
<children>
|
7 |
+
<system>
|
8 |
+
<children>
|
9 |
+
<config>
|
10 |
+
<children>
|
11 |
+
<sag_settings translate="title" module="sagbutton">
|
12 |
+
<title>Send as Gift Settings</title>
|
13 |
+
<sort_order>80</sort_order>
|
14 |
+
</sag_settings>
|
15 |
+
</children>
|
16 |
+
</config>
|
17 |
+
</children>
|
18 |
+
</system>
|
19 |
+
</children>
|
20 |
+
</admin>
|
21 |
+
</resources>
|
22 |
+
</acl>
|
23 |
+
</config>
|
app/code/community/SaG/Button/etc/config.xml
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<SaG_Button>
|
5 |
+
<version>1.0.0</version>
|
6 |
+
</SaG_Button>
|
7 |
+
</modules>
|
8 |
+
<frontend>
|
9 |
+
<layout>
|
10 |
+
<updates>
|
11 |
+
<dvall>
|
12 |
+
<file>sagbutton.xml</file>
|
13 |
+
</dvall>
|
14 |
+
</updates>
|
15 |
+
</layout>
|
16 |
+
</frontend>
|
17 |
+
<global>
|
18 |
+
<blocks>
|
19 |
+
<sagbutton>
|
20 |
+
<class>SaG_Button_Block</class>
|
21 |
+
</sagbutton>
|
22 |
+
</blocks>
|
23 |
+
<helpers>
|
24 |
+
<sagbutton>
|
25 |
+
<class>SaG_Button_Helper</class>
|
26 |
+
</sagbutton>
|
27 |
+
</helpers>
|
28 |
+
<models>
|
29 |
+
<sagbutton>
|
30 |
+
<class>SaG_Button_Model</class>
|
31 |
+
</sagbutton>
|
32 |
+
</models>
|
33 |
+
</global>
|
34 |
+
<default>
|
35 |
+
<sag_settings>
|
36 |
+
<pp>
|
37 |
+
<language>en</language>
|
38 |
+
<size>default</size>
|
39 |
+
<color>default</color>
|
40 |
+
</pp>
|
41 |
+
<cp>
|
42 |
+
<show_on_list>1</show_on_list>
|
43 |
+
<language>en</language>
|
44 |
+
<size>default</size>
|
45 |
+
<color>default</color>
|
46 |
+
</cp>
|
47 |
+
</sag_settings>
|
48 |
+
</default>
|
49 |
+
</config>
|
app/code/community/SaG/Button/etc/system.xml
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="utf-8" ?>
|
2 |
+
<config>
|
3 |
+
<sections>
|
4 |
+
<sag_settings translate="label" module="sagbutton">
|
5 |
+
<label>Send as Gift Settings</label>
|
6 |
+
<tab>catalog</tab>
|
7 |
+
<frontend_type>text</frontend_type>
|
8 |
+
<sort_order>10</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 |
+
<pp translate="label" module="sagbutton">
|
14 |
+
<label>Product Page</label>
|
15 |
+
<frontend_type>text</frontend_type>
|
16 |
+
<sort_order>10</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 |
+
<color>
|
22 |
+
<label>Color</label>
|
23 |
+
<frontend_type>select</frontend_type>
|
24 |
+
<source_model>sagbutton/config_color</source_model>
|
25 |
+
<sort_order>10</sort_order>
|
26 |
+
<show_in_default>1</show_in_default>
|
27 |
+
<show_in_website>1</show_in_website>
|
28 |
+
<show_in_store>1</show_in_store>
|
29 |
+
</color>
|
30 |
+
<size>
|
31 |
+
<label>Size</label>
|
32 |
+
<frontend_type>select</frontend_type>
|
33 |
+
<source_model>sagbutton/config_size</source_model>
|
34 |
+
<sort_order>20</sort_order>
|
35 |
+
<show_in_default>1</show_in_default>
|
36 |
+
<show_in_website>1</show_in_website>
|
37 |
+
<show_in_store>1</show_in_store>
|
38 |
+
</size>
|
39 |
+
<language>
|
40 |
+
<label>Language</label>
|
41 |
+
<frontend_type>select</frontend_type>
|
42 |
+
<source_model>sagbutton/config_language</source_model>
|
43 |
+
<sort_order>30</sort_order>
|
44 |
+
<show_in_default>1</show_in_default>
|
45 |
+
<show_in_website>1</show_in_website>
|
46 |
+
<show_in_store>1</show_in_store>
|
47 |
+
</language>
|
48 |
+
</fields>
|
49 |
+
</pp>
|
50 |
+
<cp translate="label" module="sagbutton">
|
51 |
+
<label>Category Page</label>
|
52 |
+
<frontend_type>text</frontend_type>
|
53 |
+
<sort_order>20</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 |
+
<fields>
|
58 |
+
<show_on_list>
|
59 |
+
<label>Show on Product List</label>
|
60 |
+
<frontend_type>select</frontend_type>
|
61 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
62 |
+
<sort_order>10</sort_order>
|
63 |
+
<show_in_default>1</show_in_default>
|
64 |
+
<show_in_website>1</show_in_website>
|
65 |
+
<show_in_store>1</show_in_store>
|
66 |
+
</show_on_list>
|
67 |
+
<color>
|
68 |
+
<label>Color</label>
|
69 |
+
<frontend_type>select</frontend_type>
|
70 |
+
<source_model>sagbutton/config_color</source_model>
|
71 |
+
<sort_order>20</sort_order>
|
72 |
+
<show_in_default>1</show_in_default>
|
73 |
+
<show_in_website>1</show_in_website>
|
74 |
+
<show_in_store>1</show_in_store>
|
75 |
+
<depends><show_on_list>1</show_on_list></depends>
|
76 |
+
</color>
|
77 |
+
<size>
|
78 |
+
<label>Size</label>
|
79 |
+
<frontend_type>select</frontend_type>
|
80 |
+
<source_model>sagbutton/config_size</source_model>
|
81 |
+
<sort_order>30</sort_order>
|
82 |
+
<show_in_default>1</show_in_default>
|
83 |
+
<show_in_website>1</show_in_website>
|
84 |
+
<show_in_store>1</show_in_store>
|
85 |
+
<depends><show_on_list>1</show_on_list></depends>
|
86 |
+
</size>
|
87 |
+
<language>
|
88 |
+
<label>Language</label>
|
89 |
+
<frontend_type>select</frontend_type>
|
90 |
+
<source_model>sagbutton/config_language</source_model>
|
91 |
+
<sort_order>40</sort_order>
|
92 |
+
<show_in_default>1</show_in_default>
|
93 |
+
<show_in_website>1</show_in_website>
|
94 |
+
<show_in_store>1</show_in_store>
|
95 |
+
<depends><show_on_list>1</show_on_list></depends>
|
96 |
+
</language>
|
97 |
+
</fields>
|
98 |
+
</cp>
|
99 |
+
</groups>
|
100 |
+
</sag_settings>
|
101 |
+
</sections>
|
102 |
+
</config>
|
app/design/frontend/base/default/layout/sagbutton.xml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="0.1.0">
|
3 |
+
|
4 |
+
<catalog_category_default>
|
5 |
+
<reference name="head">
|
6 |
+
<block type="sagbutton/button" name="sagbutton">
|
7 |
+
<action method="setTemplate" ifconfig="sag_settings/cp/show_on_list"><template>sagbutton/cphead.phtml</template></action>
|
8 |
+
<action method="setConfigNode" ifconfig="sag_settings/cp/show_on_list"><node>cp</node></action>
|
9 |
+
</block>
|
10 |
+
</reference>
|
11 |
+
</catalog_category_default>
|
12 |
+
|
13 |
+
<catalog_category_layered>
|
14 |
+
<reference name="head">
|
15 |
+
<block type="sagbutton/button" name="sagbutton">
|
16 |
+
<action method="setTemplate" ifconfig="sag_settings/cp/show_on_list"><template>sagbutton/cphead.phtml</template></action>
|
17 |
+
<action method="setConfigNode" ifconfig="sag_settings/cp/show_on_list"><node>cp</node></action>
|
18 |
+
</block>
|
19 |
+
</reference>
|
20 |
+
</catalog_category_layered>
|
21 |
+
|
22 |
+
<catalog_product_view>
|
23 |
+
<reference name="head">
|
24 |
+
<block type="sagbutton/button" name="sagbutton" template="sagbutton/pphead.phtml" />
|
25 |
+
</reference>
|
26 |
+
</catalog_product_view>
|
27 |
+
</layout>
|
app/design/frontend/base/default/template/sagbutton/cphead.phtml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$_buttonUrl = $this->getButtonImgUrl();
|
3 |
+
list($_width, $_height) = $this->helper('sagbutton')->getButtonDimensions($this->getLanguage(), $this->getSize());
|
4 |
+
?>
|
5 |
+
<script type="text/javascript">
|
6 |
+
document.observe("dom:loaded", function() {
|
7 |
+
$$('.product-image').each(function(el){
|
8 |
+
var img = document.createElement('img');
|
9 |
+
img = $(img);
|
10 |
+
img.setAttribute('src', "<?php echo $_buttonUrl ?>");
|
11 |
+
img.setAttribute('alt', "Send as gift");
|
12 |
+
img.setAttribute('width', "<?php echo $_width ?>");
|
13 |
+
img.setAttribute('height', "<?php echo $_height ?>");
|
14 |
+
|
15 |
+
var a = document.createElement('a');
|
16 |
+
a = $(a);
|
17 |
+
a.setAttribute('href', "http://sendasgift.com/");
|
18 |
+
a.setAttribute('onclick', "window.open(this.href + '?l=<?php echo $this->getLanguage() ?>&embed=true&url=' + encodeURIComponent(( this.hasAttribute('data-url') ? this.getAttribute('data-url') : location.href )), 'sendasgift', 'width=760,height=370,top=' + ((screen.height / 2) - 185) + ',left=' + ((screen.width / 2) - 380) + ',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0');return false;"); a.setAttribute('data-url', el.href);
|
19 |
+
a.setAttribute('data-url', el.href);
|
20 |
+
a.appendChild(img);
|
21 |
+
|
22 |
+
var div = document.createElement('div');
|
23 |
+
div.appendChild(a);
|
24 |
+
$(el.parentNode).insert(div);
|
25 |
+
})
|
26 |
+
});
|
27 |
+
</script>
|
app/design/frontend/base/default/template/sagbutton/pphead.phtml
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $_product = Mage::registry('current_product'); ?>
|
2 |
+
<meta property="og:image" content="<?php echo $this->helper('catalog/image')->init($_product, 'image'); ?>" />
|
3 |
+
<?php
|
4 |
+
$_buttonUrl = $this->getButtonImgUrl();
|
5 |
+
list($_width, $_height) = $this->helper('sagbutton')->getButtonDimensions($this->getLanguage(), $this->getSize());
|
6 |
+
?>
|
7 |
+
<script type="text/javascript">
|
8 |
+
document.observe("dom:loaded", function() {
|
9 |
+
var img = document.createElement('img');
|
10 |
+
img = $(img);
|
11 |
+
img.setAttribute('src', "<?php echo $_buttonUrl ?>");
|
12 |
+
img.setAttribute('alt', "Send as gift");
|
13 |
+
img.setAttribute('width', "<?php echo $_width ?>");
|
14 |
+
img.setAttribute('height', "<?php echo $_height ?>");
|
15 |
+
|
16 |
+
var a = document.createElement('a');
|
17 |
+
a = $(a);
|
18 |
+
a.setAttribute('href', "http://sendasgift.com/");
|
19 |
+
a.setAttribute('onclick', "window.open(this.href + '?l=<?php echo $this->getLanguage() ?>&embed=true&url=' + encodeURIComponent(( this.hasAttribute('data-url') ? this.getAttribute('data-url') : location.href )), 'sendasgift', 'width=760,height=370,top=' + ((screen.height / 2) - 185) + ',left=' + ((screen.width / 2) - 380) + ',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0');return false;");
|
20 |
+
a.appendChild(img);
|
21 |
+
|
22 |
+
var div = document.createElement('div');
|
23 |
+
div.appendChild(a);
|
24 |
+
var target = $$('.add-to-box')[0];
|
25 |
+
if (target != undefined) {
|
26 |
+
target.insert( {after: div});
|
27 |
+
} else {
|
28 |
+
$$('.price-box')[0].insert( {after: div});
|
29 |
+
}
|
30 |
+
});
|
31 |
+
</script>
|
app/etc/modules/SaG_Button.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<SaG_Button>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</SaG_Button>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>SaG_Button</name>
|
4 |
+
<version>1.0.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>Send as Gift Button</summary>
|
10 |
+
<description>Allow your customers to suggest any product as gift through Facebook, email or text message. After recipient approves and provides shipping information, we send the user back to your site to complete the purchase.</description>
|
11 |
+
<notes>Release version</notes>
|
12 |
+
<authors><author><name>Sendasgift</name><user>Sendasgift</user><email>info@sendasgift.com</email></author></authors>
|
13 |
+
<date>2012-09-07</date>
|
14 |
+
<time>07:13:19</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="SaG"><dir name="Button"><dir name="Block"><file name="Button.php" hash="885268be2ee22fe390b641867e5e6075"/></dir><dir name="Helper"><file name="Data.php" hash="789df438a1140c3743c9569e9d9da769"/></dir><dir name="Model"><dir name="Config"><file name="Color.php" hash="ed20e0940fa4bad291a589d4e8169ae1"/><file name="Language.php" hash="fa516cf6eb729750fe395ce31460d46f"/><file name="Size.php" hash="7940b2048da74fd73a0eb50de03e54aa"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="61bf58e74c8d05aebfbf53561ebaa1d8"/><file name="config.xml" hash="42c56ca713e131acdd11a508f5ca858f"/><file name="system.xml" hash="f893a26519ef52fd4cfa5132699ee1ab"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="sagbutton.xml" hash="36119c64029fcc0edc100559db0ce699"/></dir><dir name="template"><dir name="sagbutton"><file name="cphead.phtml" hash="48db004c84204d82861fa603accb747d"/><file name="pphead.phtml" hash="9a2aed0566f3da736aac38ef42ea63e2"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="SaG_Button.xml" hash="566296c5e079017ea292d8e2802811fa"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|