Bloompcommerce - Version 2.0.1

Version Notes

Totally rewrited extension and now is safer and easy to install.

Download this release

Release Info

Developer Bloompa
Extension Bloompcommerce
Version 2.0.1
Comparing to
See all releases


Code changes from version 2.0.0 to 2.0.1

app/code/community/Bloompa/Bloompcommerce/Model/Resource/Setup.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ class Bloompa_Bloompcommerce_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup {
3
+
4
+ }
app/code/community/Bloompa/Bloompcommerce/controllers/IndexController.php CHANGED
@@ -167,8 +167,7 @@ class Bloompa_Bloompcommerce_IndexController extends Mage_Core_Controller_Front_
167
  header('Access-Control-Allow-Headers: X-Requested-With');
168
 
169
  $social_network = strtolower(trim($_POST['social_network']));
170
- $discount_value = trim($_REQUEST['set_discount']);
171
-
172
 
173
  $writeConnection = Mage::getSingleton('core/resource')->getConnection('core_write');
174
 
167
  header('Access-Control-Allow-Headers: X-Requested-With');
168
 
169
  $social_network = strtolower(trim($_POST['social_network']));
170
+ $discount_value = trim($_POST['set_discount']);
 
171
 
172
  $writeConnection = Mage::getSingleton('core/resource')->getConnection('core_write');
173
 
app/code/community/Bloompa/Bloompcommerce/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Bloompa_Bloompcommerce>
5
- <version>2.0.0</version>
6
  </Bloompa_Bloompcommerce>
7
  </modules>
8
  <frontend>
@@ -40,6 +40,7 @@
40
  <bloompcommerce_setup>
41
  <setup>
42
  <module>Bloompa_Bloompcommerce</module>
 
43
  </setup>
44
  <connection>
45
  <use>core_setup</use>
2
  <config>
3
  <modules>
4
  <Bloompa_Bloompcommerce>
5
+ <version>2.0.1</version>
6
  </Bloompa_Bloompcommerce>
7
  </modules>
8
  <frontend>
40
  <bloompcommerce_setup>
41
  <setup>
42
  <module>Bloompa_Bloompcommerce</module>
43
+ <class>Bloompa_Bloompcommerce_Model_Resource_Setup</class>
44
  </setup>
45
  <connection>
46
  <use>core_setup</use>
app/code/community/Bloompa/Bloompcommerce/sql/bloompcommerce_setup/{mysql4-install-1.5.0.php → mysql4-install-2.0.0.php} RENAMED
@@ -1,7 +1,7 @@
1
  <?php
2
  $installer = $this;
3
  $installer->startSetup();
4
- $sql=<<<SQLTEXT
5
  DROP TABLE IF EXISTS `bloompa_settings`;
6
  CREATE TABLE `bloompa_settings` (
7
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
@@ -13,9 +13,5 @@ CREATE TABLE `bloompa_settings` (
13
  INSERT INTO bloompa_settings(id,product,param,value) VALUES(NULL,'BloompCommerce','token','novo');
14
  INSERT INTO bloompa_settings(id,product,param,value) VALUES(NULL,'BloompCommerce','discount_value_facebook','5');
15
  INSERT INTO bloompa_settings(id,product,param,value) VALUES(NULL,'BloompCommerce','discount_value_twitter','5');
16
- SQLTEXT;
17
-
18
- $installer->run($sql);
19
-
20
- $installer->endSetup();
21
-
1
  <?php
2
  $installer = $this;
3
  $installer->startSetup();
4
+ $installer->run("
5
  DROP TABLE IF EXISTS `bloompa_settings`;
6
  CREATE TABLE `bloompa_settings` (
7
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
13
  INSERT INTO bloompa_settings(id,product,param,value) VALUES(NULL,'BloompCommerce','token','novo');
14
  INSERT INTO bloompa_settings(id,product,param,value) VALUES(NULL,'BloompCommerce','discount_value_facebook','5');
15
  INSERT INTO bloompa_settings(id,product,param,value) VALUES(NULL,'BloompCommerce','discount_value_twitter','5');
16
+ ");
17
+ $installer->endSetup();
 
 
 
 
app/code/community/Bloompa/Bloompcommerce/sql/bloompcommerce_setup/mysql4-install-2.0.1.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+ $installer->startSetup();
4
+ $installer->run("
5
+ DROP TABLE IF EXISTS `bloompa_settings`;
6
+ CREATE TABLE `bloompa_settings` (
7
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
8
+ `product` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '',
9
+ `param` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '',
10
+ `value` varchar(255) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '',
11
+ PRIMARY KEY (`id`)
12
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci COMMENT='Tabela com as configurações do bloompa';
13
+ INSERT INTO bloompa_settings(id,product,param,value) VALUES(NULL,'BloompCommerce','token','novo');
14
+ INSERT INTO bloompa_settings(id,product,param,value) VALUES(NULL,'BloompCommerce','discount_value_facebook','5');
15
+ INSERT INTO bloompa_settings(id,product,param,value) VALUES(NULL,'BloompCommerce','discount_value_twitter','5');
16
+ ");
17
+ $installer->endSetup();
app/design/frontend/base/default/layout/bloompcommerce.xml CHANGED
@@ -13,7 +13,7 @@
13
 
14
  <checkout_cart_index>
15
  <reference name="content">
16
- <reference name="checkout.cart.top_methods">
17
  <block type="page/html" name="bloompcommerce_cart" before="-" template="bloompcommerce/cart.phtml"/>
18
  </reference>
19
  </reference>
13
 
14
  <checkout_cart_index>
15
  <reference name="content">
16
+ <reference name="checkout.cart.methods">
17
  <block type="page/html" name="bloompcommerce_cart" before="-" template="bloompcommerce/cart.phtml"/>
18
  </reference>
19
  </reference>
app/design/frontend/base/default/template/bloompcommerce/cart.phtml ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div id="bloompa-cart-widget" style="" ></div>
2
+ <?php
3
+ $readConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
4
+ $writeConnection = Mage::getSingleton('core/resource')->getConnection('core_write');
5
+ $coupon_code = Mage::getSingleton('checkout/session')->getQuote()->getCouponCode();
6
+
7
+ if(is_null($coupon_code)):
8
+ $token = $readConnection->fetchOne("SELECT value FROM `bloompa_settings` WHERE `param`='token' AND product='BloompCommerce' LIMIT 1");
9
+ if($token!='' && $token!='novo'):
10
+ ?>
11
+ <script language="javascript" type="text/javascript">
12
+ var bcw_products = [
13
+
14
+ // INÍCIO DO LOOP DE PRODUTOS
15
+ <?php foreach( Mage::getSingleton('checkout/session')->getQuote()->getItemsCollection() as $item ) : ?>
16
+ {
17
+ prod_page_url: '<?php echo Mage::getBaseUrl().($item->_data['product']->_data['url_path']);?>', // REQUIRED VARIABLE
18
+ prod_img_url: '<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'catalog/product'.$item->_data['product']->_data['thumbnail'];?>', // REQUIRED VARIABLE
19
+ prod_title: '<?php echo $item->_data['name'];?>', // REQUIRED VARIABLE
20
+ prod_price: '<?php echo $item->_data['price'];?>' // REQUIRED VARIABLE
21
+ },
22
+ <?php endforeach; ?>
23
+ ];
24
+ </script>
25
+
26
+ <script language="javascript" type="text/javascript" src="http<?php echo (isset($_SERVER["HTTPS"]) AND $_SERVER["HTTPS"] == "on")?'s':''?>://www.bloompa.com.br/js/cart.widget-load.js" rel="sbloompa-cart-widget"></script>
27
+
28
+ <script language="javascript" type="text/javascript">
29
+ bcw.init({
30
+ token: "<?php echo $token;?>",
31
+ cart_url:"<?php echo Mage::getBaseUrl().'bloompcommerce';?>",
32
+ store_logo: '<?php echo $this->getLogoSrc()?>',
33
+ products_in_cart: bcw_products,
34
+ cart_currency: 'BRL',
35
+ cart_amount: '<?php echo Mage::getSingleton('checkout/session')->getQuote()->getSubtotal(); ?>'
36
+ });
37
+ </script>
38
+ <?php endif;?>
39
+ <?php endif; ?>
app/design/frontend/base/default/template/bloompcommerce/index.phtml ADDED
File without changes
app/design/frontend/base/default/template/bloompcommerce/order_success.phtml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $readConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
3
+ $writeConnection = Mage::getSingleton('core/resource')->getConnection('core_write');
4
+
5
+ $order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
6
+
7
+ /*****************************
8
+ * START - Delete coupon code
9
+ *****************************/
10
+ @session_start();
11
+ $customer_id = $_SESSION['bc_customer_id'];
12
+ $social_network = $_SESSION['bc_social_network'];
13
+ unset($_SESSION['bc_customer_id']);
14
+ unset($_SESSION['bc_social_network']);
15
+ $model = Mage::getModel('salesrule/rule')
16
+ ->getCollection()
17
+ ->addFieldToFilter('name', array('eq'=>sprintf('AUTO_GENERATION CUSTOMER_'.$customer_id.' - '.intval($bc_discount_percent).'%% BloompCommerce-'.$social_network.' discount')))
18
+ ->getFirstItem();
19
+ $model->delete();
20
+ /**********************
21
+ * END - Delete coupon code
22
+ **********************/
23
+
24
+
25
+ $token = $readConnection->fetchAll("SELECT * FROM `bloompa_settings` WHERE `param`='token' AND product='BloompCommerce' LIMIT 0,1");
26
+ $token = $token[0]['value'];
27
+ if($token!='' && $token!='novo'):
28
+ ?>
29
+ <!-- START - BLOOMP COMMERCE -->
30
+ <div id="bloompa-cart-widget"></div>
31
+ <script language="javascript" type="text/javascript">
32
+ var loadBCW = function(){
33
+ bcw.conversion({
34
+ token: "<?php echo $token?>",
35
+ order_id: "<?php echo $order->getId() ?>",
36
+ total_amount: "<?php echo $order->getGrandTotal() ?>"
37
+ });
38
+ };
39
+
40
+ var aHead = document.getElementsByTagName("HEAD").item(0);var aScript= document.createElement("script");aScript.type = "text/javascript";aScript.src=("https:" == document.location.protocol ? "https" : "http") + "://www.bloompa.com.br/js/cart.widget-load.js";aHead.appendChild( aScript);if (aScript.readyState){aScript.onreadystatechange=function(){if (aScript.readyState == "loaded" || aScript.readyState == "complete"){aScript.onreadystatechange = null;loadBCW();}}}else{aScript.onload=function(){loadBCW();}}
41
+ </script>
42
+ <!-- END - BLOOMP COMMERCE -->
43
+ <?php endif; ?>
app/design/frontend/base/default/template/bloompcommerce/product.phtml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $item = Mage::registry('product');
3
+ $readConnection = Mage::getSingleton('core/resource')->getConnection('core_read');
4
+ $strsql = "SELECT * FROM `bloompa_settings` WHERE `param`='token' AND product='BloompCommerce' LIMIT 0,1";
5
+ $token = $readConnection->fetchAll($strsql);
6
+ $token = $token[0]['value'];
7
+ if($token!='' && $token!='novo'):
8
+ ?>
9
+ <!-- BLOOMP COMMERCE - SOCIAL EXPRESSIONS - BEGIN -->
10
+ <div id="bloompa-social-expression-widget" style="margin-top:40px;margin-bottom:80px;"></div>
11
+ <!-- BLOOMP COMMERCE - SOCIAL EXPRESSIONS - END -->
12
+
13
+ <!-- START - BLOOMP COMMERCE -->
14
+ <div id="bloompa-product-widget"></div>
15
+ <script src="http<?php echo (isset($_SERVER["HTTPS"]) AND $_SERVER["HTTPS"] == "on")?'s':''?>://www.bloompa.com.br/js/product.widget-load.js" type="text/javascript"></script>
16
+ <script type="text/javascript">
17
+ var bcw_product = [{
18
+ prod_page_url: "<?php echo Mage::getBaseUrl().($item->_data['url_path']);?>",
19
+ prod_img_url: "<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'catalog/product'.$item->_data['thumbnail'];?>",
20
+ prod_title: "<?php echo $item->_data['name'];?>",
21
+ prod_currency: "BRL",
22
+ prod_price: "<?php echo $item->_data['price'];?>"
23
+ }];
24
+ bcw.init({token: "<?php echo $token;?>",product: bcw_product,show: true });
25
+ </script>
26
+ <!-- END - BLOOMP COMMERCE -->
27
+ <?php endif; ?>
app/etc/modules/Bloompa_Bloompcommerce.xml CHANGED
@@ -7,7 +7,7 @@
7
  <depends>
8
  <Mage_Cms />
9
  </depends>
10
- <version>1.5.0</version>
11
  </Bloompa_Bloompcommerce>
12
  </modules>
13
  </config>
7
  <depends>
8
  <Mage_Cms />
9
  </depends>
10
+ <version>2.0.1</version>
11
  </Bloompa_Bloompcommerce>
12
  </modules>
13
  </config>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Bloompcommerce</name>
4
- <version>2.0.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/gpl.html">GPL</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>E-commerce stores face a big problem; low sales conversion rates. BloompCommerce is a social behavior solution to improve e-commerce stores sales conversion rates by utilizing the power of customers social networks.</description>
11
  <notes>Totally rewrited extension and now is safer and easy to install.</notes>
12
  <authors><author><name>Bloompa</name><user>bloompa</user><email>dev@bloompa.com.br</email></author></authors>
13
- <date>2012-11-26</date>
14
- <time>03:02:53</time>
15
- <contents><target name="magecommunity"><dir name="Bloompa"><dir name="Bloompcommerce"><dir name="Block"><file name="Bc_Shopping_Cart.php" hash="60430e2631dff2d8ad989a47a1a72076"/><file name="Bc_Social_Expressions.php" hash="261d578ff77edd0dbf85bca3e1de1adf"/><file name="Index.php" hash="bfa3379f338393829181d4da5c8bf9a3"/></dir><dir name="Helper"><file name="Data.php" hash="b86464697e0f7860ce665d3483390222"/></dir><dir name="controllers"><file name="IndexController.php" hash="e54f3a9055b94421284ac2140a670dc7"/></dir><dir name="etc"><file name="config.xml" hash="7b932c03ac230b42afa9d60410aade2a"/><file name="widget.xml" hash="dec6e8cd0f603a062bc9211ae6d296de"/></dir><dir name="sql"><dir name="bloompcommerce_setup"><file name="mysql4-install-1.5.0.php" hash="d86d2032355984522a05d11e817c8f57"/></dir></dir><file name=".DS_Store" hash="0b2416f51e60c2f1fbe47fc302674013"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Bloompa_Bloompcommerce.xml" hash="69ad42c1a9aeba93d6fc652862972003"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="bloompcommerce.xml" hash="f1d3b0d59b166ea4308ea694c6b66f4f"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Bloompcommerce</name>
4
+ <version>2.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.gnu.org/licenses/gpl.html">GPL</license>
7
  <channel>community</channel>
10
  <description>E-commerce stores face a big problem; low sales conversion rates. BloompCommerce is a social behavior solution to improve e-commerce stores sales conversion rates by utilizing the power of customers social networks.</description>
11
  <notes>Totally rewrited extension and now is safer and easy to install.</notes>
12
  <authors><author><name>Bloompa</name><user>bloompa</user><email>dev@bloompa.com.br</email></author></authors>
13
+ <date>2012-11-29</date>
14
+ <time>19:36:38</time>
15
+ <contents><target name="magecommunity"><dir name="Bloompa"><dir name="Bloompcommerce"><dir name="Block"><file name="Bc_Shopping_Cart.php" hash="60430e2631dff2d8ad989a47a1a72076"/><file name="Bc_Social_Expressions.php" hash="261d578ff77edd0dbf85bca3e1de1adf"/><file name="Index.php" hash="bfa3379f338393829181d4da5c8bf9a3"/></dir><dir name="Helper"><file name="Data.php" hash="b86464697e0f7860ce665d3483390222"/></dir><dir name="Model"><dir name="Resource"><file name="Setup.php" hash="58a8f0b8dc52af2ba6ae52ac9a9df333"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="084053e03f29564fe6acc2c60b697b14"/></dir><dir name="etc"><file name="config.xml" hash="11efe4f2f56b608d4cab36994de05878"/><file name="widget.xml" hash="dec6e8cd0f603a062bc9211ae6d296de"/></dir><dir name="sql"><dir name="bloompcommerce_setup"><file name="mysql4-install-2.0.0.php" hash="0ebbe007f262265afa615e8ca3194ba0"/><file name="mysql4-install-2.0.1.php" hash="0ebbe007f262265afa615e8ca3194ba0"/></dir></dir><file name=".DS_Store" hash="0b2416f51e60c2f1fbe47fc302674013"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Bloompa_Bloompcommerce.xml" hash="a432c32a27997a2806f0317b3603c20a"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="bloompcommerce.xml" hash="012bcbe63599de83e0092fdc006b4f89"/></dir><dir name="template"><dir name="bloompcommerce"><file name="cart.phtml" hash="82f3e17fa1a94374f3210947001399a6"/><file name="index.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name="order_success.phtml" hash="8b6987797a535029bbd8bb638942ab9e"/><file name="product.phtml" hash="1eefc97bbe0ef9bb512885a2f3d8c39b"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>