Version Notes
Kulmage_Adwords is used to add google adwords in magento website.
This version is stable
Download this release
Release Info
Developer | Kuldip |
Extension | kulmage_google_gdwords |
Version | 1.1.0 |
Comparing to | |
See all releases |
Version 1.1.0
- app/code/community/Kulmage/Adwords/Block/Adwords.php +54 -0
- app/code/community/Kulmage/Adwords/Helper/Data.php +35 -0
- app/code/community/Kulmage/Adwords/etc/config.xml +62 -0
- app/code/community/Kulmage/Adwords/etc/system.xml +80 -0
- app/design/frontend/default/default/layout/kulmage_adwords.xml +15 -0
- app/etc/modules/Kulmage_Adwords.xml +9 -0
- package.xml +21 -0
app/code/community/Kulmage/Adwords/Block/Adwords.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* @package Kulmage Google Adwords
|
5 |
+
* @author Kuldip, Magento Developer
|
6 |
+
*/
|
7 |
+
class Kulmage_Adwords_Block_Adwords extends Mage_Core_Block_Abstract
|
8 |
+
{
|
9 |
+
|
10 |
+
public function __construct()
|
11 |
+
{
|
12 |
+
parent::__construct();
|
13 |
+
$this->setGoogleConversionId(Mage::getStoreConfig('adwordsmodule/kulmage/google_conversion_id'));
|
14 |
+
$this->setGoogleConversionLanguage(Mage::getStoreConfig('adwordsmodule/kulmage/google_conversion_language'));
|
15 |
+
$this->setGoogleConversionFormat(Mage::getStoreConfig('adwordsmodule/kulmage/google_conversion_format'));
|
16 |
+
$this->setGoogleConversionColor(Mage::getStoreConfig('adwordsmodule/kulmage/google_conversion_color'));
|
17 |
+
$this->setGoogleConversionLabel(Mage::getStoreConfig('adwordsmodule/kulmage/google_conversion_label'));
|
18 |
+
}
|
19 |
+
|
20 |
+
|
21 |
+
protected function _toHtml()
|
22 |
+
{
|
23 |
+
$html = "";
|
24 |
+
|
25 |
+
if(Mage::helper('kulmage_adwords')->isTrackingAllowed()){
|
26 |
+
|
27 |
+
$this->setAmount(Mage::helper('kulmage_adwords')->getOrderTotal());
|
28 |
+
$html .= '
|
29 |
+
<!-- Google Code for Purchase Conversion Page -->
|
30 |
+
<script type="text/javascript">
|
31 |
+
/* <![CDATA[ */
|
32 |
+
var google_conversion_id = '.$this->getGoogleConversionId().';
|
33 |
+
var google_conversion_language = "'.$this->getGoogleConversionLanguage().'";
|
34 |
+
var google_conversion_format = "'.$this->getGoogleConversionFormat().'";
|
35 |
+
var google_conversion_color = "'.$this->getGoogleConversionColor().'";
|
36 |
+
var google_conversion_label = "'.$this->getGoogleConversionLabel().'";
|
37 |
+
var google_conversion_value = 0;
|
38 |
+
if ('.$this->getAmount().') {
|
39 |
+
google_conversion_value = '.$this->getAmount().';
|
40 |
+
}
|
41 |
+
/* ]]> */
|
42 |
+
</script>
|
43 |
+
<script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js">
|
44 |
+
</script>
|
45 |
+
<noscript>
|
46 |
+
<div style="display:inline;">
|
47 |
+
<img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/'.$this->getGoogleConversionId().'/?value='.$this->getAmount().'&label='.$this->getGoogleConversionLabel().'&guid=ON&script=0"/>
|
48 |
+
</div>
|
49 |
+
</noscript>';
|
50 |
+
}
|
51 |
+
|
52 |
+
return $html;
|
53 |
+
}
|
54 |
+
}
|
app/code/community/Kulmage/Adwords/Helper/Data.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
*
|
4 |
+
* @package Kulmage Google Adwords
|
5 |
+
* @author Kuldip, Magento Developer
|
6 |
+
*/
|
7 |
+
class Kulmage_Adwords_Helper_Data extends Mage_Core_Helper_Abstract
|
8 |
+
{
|
9 |
+
|
10 |
+
public function getOrderTotal()
|
11 |
+
{
|
12 |
+
$orderId = (int) Mage::getSingleton('checkout/session')->getLastOrderId();
|
13 |
+
|
14 |
+
$resurce = Mage::getModel('sales/order')->getResource();
|
15 |
+
$select = $resurce->getReadConnection()->select()
|
16 |
+
->from(array('o' => $resurce->getTable('sales/order')), 'subtotal')
|
17 |
+
->where('o.entity_id=?', $orderId)
|
18 |
+
;
|
19 |
+
|
20 |
+
$result = $resurce->getReadConnection()->fetchRow($select);
|
21 |
+
|
22 |
+
if($result['subtotal'] > 0)
|
23 |
+
return round($result['subtotal'],2);
|
24 |
+
else
|
25 |
+
return 1;
|
26 |
+
}
|
27 |
+
|
28 |
+
|
29 |
+
public function isTrackingAllowed()
|
30 |
+
{
|
31 |
+
return Mage::getStoreConfigFlag('adwordsmodule/kulmage/enabled');
|
32 |
+
}
|
33 |
+
|
34 |
+
|
35 |
+
}
|
app/code/community/Kulmage/Adwords/etc/config.xml
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
*
|
4 |
+
*
|
5 |
+
* @package Kulmage Google Adwords
|
6 |
+
* @author Kuldip, Magento Developer
|
7 |
+
*
|
8 |
+
-->
|
9 |
+
<config>
|
10 |
+
<modules>
|
11 |
+
<Kulmage_Adwords>
|
12 |
+
<version>1.0.0</version>
|
13 |
+
</Kulmage_Adwords>
|
14 |
+
</modules>
|
15 |
+
<global>
|
16 |
+
<blocks>
|
17 |
+
<kulmage_adwords>
|
18 |
+
<class>Kulmage_Adwords_Block</class>
|
19 |
+
</kulmage_adwords>
|
20 |
+
</blocks>
|
21 |
+
<helpers>
|
22 |
+
<kulmage_adwords>
|
23 |
+
<class>Kulmage_Adwords_Helper</class>
|
24 |
+
</kulmage_adwords>
|
25 |
+
</helpers>
|
26 |
+
</global>
|
27 |
+
|
28 |
+
<frontend>
|
29 |
+
<layout>
|
30 |
+
<updates>
|
31 |
+
<kulmage_adwords>
|
32 |
+
<file>kulmage_adwords.xml</file>
|
33 |
+
</kulmage_adwords>
|
34 |
+
</updates>
|
35 |
+
</layout>
|
36 |
+
</frontend>
|
37 |
+
|
38 |
+
<adminhtml>
|
39 |
+
<acl>
|
40 |
+
<resources>
|
41 |
+
<all>
|
42 |
+
<title>Allow Everything</title>
|
43 |
+
</all>
|
44 |
+
<admin>
|
45 |
+
<children>
|
46 |
+
<system>
|
47 |
+
<children>
|
48 |
+
<config>
|
49 |
+
<children>
|
50 |
+
<adwordsmodule>
|
51 |
+
<title>Kulmage Adwords</title>
|
52 |
+
</adwordsmodule>
|
53 |
+
</children>
|
54 |
+
</config>
|
55 |
+
</children>
|
56 |
+
</system>
|
57 |
+
</children>
|
58 |
+
</admin>
|
59 |
+
</resources>
|
60 |
+
</acl>
|
61 |
+
</adminhtml>
|
62 |
+
</config>
|
app/code/community/Kulmage/Adwords/etc/system.xml
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<kulmage translate="label" module="kulmage_adwords">
|
5 |
+
<label>Kulmage Adwords</label>
|
6 |
+
<sort_order>199</sort_order>
|
7 |
+
</kulmage>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<adwordsmodule translate="label" module="kulmage_adwords">
|
11 |
+
<label>Google Adwords</label>
|
12 |
+
<tab>kulmage</tab>
|
13 |
+
<frontend_type>text</frontend_type>
|
14 |
+
<sort_order>100</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<kulmage translate="label">
|
20 |
+
<label>Adwords settings</label>
|
21 |
+
<show_in_default>1</show_in_default>
|
22 |
+
<show_in_website>1</show_in_website>
|
23 |
+
<show_in_store>1</show_in_store>
|
24 |
+
<sort_order>10</sort_order>
|
25 |
+
<fields>
|
26 |
+
<enabled translate="label">
|
27 |
+
<label>Allow Adwords Tracking</label>
|
28 |
+
<frontend_type>select</frontend_type>
|
29 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
30 |
+
<sort_order>1</sort_order>
|
31 |
+
<show_in_default>1</show_in_default>
|
32 |
+
<show_in_website>1</show_in_website>
|
33 |
+
<show_in_store>1</show_in_store>
|
34 |
+
</enabled>
|
35 |
+
<google_conversion_id translate="label">
|
36 |
+
<label>Google conversion id</label>
|
37 |
+
<frontend_type>text</frontend_type>
|
38 |
+
<sort_order>2</sort_order>
|
39 |
+
<show_in_default>1</show_in_default>
|
40 |
+
<show_in_website>1</show_in_website>
|
41 |
+
<show_in_store>1</show_in_store>
|
42 |
+
</google_conversion_id>
|
43 |
+
<google_conversion_language translate="label">
|
44 |
+
<label>Google language</label>
|
45 |
+
<frontend_type>text</frontend_type>
|
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 |
+
</google_conversion_language>
|
51 |
+
<google_conversion_format translate="label">
|
52 |
+
<label>Google conversion format</label>
|
53 |
+
<frontend_type>text</frontend_type>
|
54 |
+
<sort_order>3</sort_order>
|
55 |
+
<show_in_default>1</show_in_default>
|
56 |
+
<show_in_website>1</show_in_website>
|
57 |
+
<show_in_store>1</show_in_store>
|
58 |
+
</google_conversion_format>
|
59 |
+
<google_conversion_color translate="label">
|
60 |
+
<label>Google conversion color</label>
|
61 |
+
<frontend_type>text</frontend_type>
|
62 |
+
<sort_order>4</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 |
+
</google_conversion_color>
|
67 |
+
<google_conversion_label translate="label">
|
68 |
+
<label>Google conversion label</label>
|
69 |
+
<frontend_type>text</frontend_type>
|
70 |
+
<sort_order>5</sort_order>
|
71 |
+
<show_in_default>1</show_in_default>
|
72 |
+
<show_in_website>1</show_in_website>
|
73 |
+
<show_in_store>1</show_in_store>
|
74 |
+
</google_conversion_label>
|
75 |
+
</fields>
|
76 |
+
</kulmage>
|
77 |
+
</groups>
|
78 |
+
</adwordsmodule>
|
79 |
+
</sections>
|
80 |
+
</config>
|
app/design/frontend/default/default/layout/kulmage_adwords.xml
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
*
|
4 |
+
*
|
5 |
+
* @package Kulmage Google Adwords
|
6 |
+
* @author Kuldip, Magento Developer
|
7 |
+
*
|
8 |
+
-->
|
9 |
+
<layout version="0.1.0">
|
10 |
+
<checkout_onepage_success>
|
11 |
+
<reference name="content">
|
12 |
+
<block type="kulmage_adwords/adwords" name="kulmage.adwords" />
|
13 |
+
</reference>
|
14 |
+
</checkout_onepage_success>
|
15 |
+
</layout>
|
app/etc/modules/Kulmage_Adwords.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Kulmage_Adwords>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Kulmage_Adwords>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>kulmage_google_gdwords</name>
|
4 |
+
<version>1.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>Kulmage_Adwords is used to add google adwords in magento website</summary>
|
10 |
+
<description>Kulmage_Adwords is used to add google adwords in magento website.
|
11 |
+
you can manage it from admin just add credential from admin and thats it you can check adwords data in success page by view source</description>
|
12 |
+
<notes>Kulmage_Adwords is used to add google adwords in magento website.
|
13 |
+

|
14 |
+
This version is stable</notes>
|
15 |
+
<authors><author><name>Kuldip</name><user>kuldipsinh</user><email>er.kuldipsinh@gmail.com</email></author></authors>
|
16 |
+
<date>2012-12-03</date>
|
17 |
+
<time>04:30:28</time>
|
18 |
+
<contents><target name="magecommunity"><dir name="Kulmage"><dir name="Adwords"><dir name="Block"><file name="Adwords.php" hash="2778007f87b1b6be193e3434b58c7e2a"/></dir><dir name="Helper"><file name="Data.php" hash="51fccc45f1569d8ff2723b1bc0a1904d"/></dir><dir name="etc"><file name="config.xml" hash="93a7df2290a266b54d176c87a4b196c0"/><file name="system.xml" hash="0195be66bdec3df0665704e2c401b66e"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Kulmage_Adwords.xml" hash="8a83b1bbad56e45846620d92f31f320f"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="kulmage_adwords.xml" hash="f0cb4564a6c971c6d5797c1b5d198a9b"/></dir></dir></dir></dir></target></contents>
|
19 |
+
<compatible/>
|
20 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
21 |
+
</package>
|