Version Notes
First Followprice extension version.
Download this release
Release Info
Developer | Daniel Moreira |
Extension | Fp_Followprice |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/Fp/Followprice/Block/Adminhtml/System/Config/Style.php +40 -0
- app/code/community/Fp/Followprice/Block/FollowpriceButtonAtProduct.php +47 -0
- app/code/community/Fp/Followprice/Helper/Data.php +5 -0
- app/code/community/Fp/Followprice/Model/Allignment.php +14 -0
- app/code/community/Fp/Followprice/Model/Enable.php +13 -0
- app/code/community/Fp/Followprice/Model/Observer.php +102 -0
- app/code/community/Fp/Followprice/Model/Position.php +13 -0
- app/code/community/Fp/Followprice/Model/Style.php +18 -0
- app/code/community/Fp/Followprice/controllers/IndexController.php +18 -0
- app/code/community/Fp/Followprice/etc/config.xml +89 -0
- app/code/community/Fp/Followprice/etc/system.xml +187 -0
- app/design/adminhtml/base/default/template/Fp_Followprice/system/config/style.phtml +10 -0
- app/design/frontend/base/default/layout/fp/followprice.xml +21 -0
- app/design/frontend/base/default/template/fp/followprice_button.phtml +67 -0
- app/etc/modules/Fp_Followprice.xml +9 -0
- package.xml +18 -0
app/code/community/Fp/Followprice/Block/Adminhtml/System/Config/Style.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Fp_Followprice_Block_Adminhtml_System_Config_Style extends Mage_Adminhtml_Block_System_Config_Form_Field{
|
3 |
+
const CONFIG_PATH = 'Fp_Followprice_Config/section_three/Fp_Followprice_Style';
|
4 |
+
protected $_values = null;
|
5 |
+
protected function _construct()
|
6 |
+
{
|
7 |
+
$this->setTemplate('Fp_Followprice/system/config/style.phtml');
|
8 |
+
return parent::_construct();
|
9 |
+
}
|
10 |
+
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
|
11 |
+
{
|
12 |
+
$this->setNamePrefix($element->getName())
|
13 |
+
->setHtmlId($element->getHtmlId());
|
14 |
+
return $this->_toHtml();
|
15 |
+
}
|
16 |
+
public function getValues(){
|
17 |
+
$values = array();
|
18 |
+
//get the available values (use the source model from your question)
|
19 |
+
foreach (Mage::getSingleton('Fp_Followprice/style')->toOptionArray() as $value){
|
20 |
+
$values[$value['value']] = $value['label'];
|
21 |
+
}
|
22 |
+
return $values;
|
23 |
+
}
|
24 |
+
public function getIsChecked($name){
|
25 |
+
return in_array($name, $this->getCheckedValues());
|
26 |
+
}
|
27 |
+
public function getCheckedValues(){
|
28 |
+
if (is_null($this->_values)){
|
29 |
+
$data = $this->getConfigData();
|
30 |
+
if (isset($data[self::CONFIG_PATH])){
|
31 |
+
$data = $data[self::CONFIG_PATH];
|
32 |
+
}
|
33 |
+
else{
|
34 |
+
$data = '';
|
35 |
+
}
|
36 |
+
$this->_values = explode(',', $data);
|
37 |
+
}
|
38 |
+
return $this->_values;
|
39 |
+
}
|
40 |
+
}
|
app/code/community/Fp/Followprice/Block/FollowpriceButtonAtProduct.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Fp_Followprice_Block_FollowpriceButtonAtProduct extends Mage_Core_Block_Template
|
3 |
+
{
|
4 |
+
public $product;
|
5 |
+
public $productPrice;
|
6 |
+
public $url;
|
7 |
+
public $media;
|
8 |
+
public $key;
|
9 |
+
public $position;
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Constructor. Set template.
|
13 |
+
*/
|
14 |
+
protected function _construct()
|
15 |
+
{
|
16 |
+
if (Mage::getStoreConfig('Fp_Followprice_Config/section_one/Fp_Followprice_Enable')){
|
17 |
+
$this->setTemplate('fp/followprice_button.phtml');
|
18 |
+
}
|
19 |
+
$this->product = Mage::registry('current_product');
|
20 |
+
$this->productPrice = number_format($this->product->getPrice(),2);
|
21 |
+
$this->url = $this->helper('core/url')->getCurrentUrl();
|
22 |
+
$this->media = $this->helper('catalog/image')->init($this->product, 'image');
|
23 |
+
$this->key = Mage::getStoreConfig('Fp_Followprice_Config/section_one/Fp_Followprice_Key');
|
24 |
+
$this->position = Mage::getStoreConfig('Fp_Followprice_Config/section_two/Fp_Followprice_Position');
|
25 |
+
}
|
26 |
+
|
27 |
+
protected function getProduct() {
|
28 |
+
return $this->product;
|
29 |
+
}
|
30 |
+
|
31 |
+
protected function getPUrl() {
|
32 |
+
return $this->url;
|
33 |
+
}
|
34 |
+
|
35 |
+
protected function getMedia() {
|
36 |
+
return $this->media;
|
37 |
+
}
|
38 |
+
|
39 |
+
protected function getKey() {
|
40 |
+
return $this->key;
|
41 |
+
}
|
42 |
+
|
43 |
+
protected function getPosition() {
|
44 |
+
return $this->position;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
?>
|
app/code/community/Fp/Followprice/Helper/Data.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Fp_followprice_Helper_Data extends Mage_Core_Helper_Abstract {
|
3 |
+
|
4 |
+
}
|
5 |
+
?>
|
app/code/community/Fp/Followprice/Model/Allignment.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Fp_Followprice_Model_Allignment
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
return array(
|
7 |
+
array('value'=>"", 'label'=>Mage::helper('Fp_Followprice')->__('Default')),
|
8 |
+
array('value'=>"float:left;", 'label'=>Mage::helper('Fp_Followprice')->__('Left')),
|
9 |
+
array('value'=>"float:right;", 'label'=>Mage::helper('Fp_Followprice')->__('Right'))
|
10 |
+
);
|
11 |
+
}
|
12 |
+
|
13 |
+
}
|
14 |
+
?>
|
app/code/community/Fp/Followprice/Model/Enable.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Fp_Followprice_Model_Enable
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
return array(
|
7 |
+
array('value'=>1, 'label'=>Mage::helper('Fp_Followprice')->__('Yes')),
|
8 |
+
array('value'=>0, 'label'=>Mage::helper('Fp_Followprice')->__('No')),
|
9 |
+
);
|
10 |
+
}
|
11 |
+
|
12 |
+
}
|
13 |
+
?>
|
app/code/community/Fp/Followprice/Model/Observer.php
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Fp_Followprice_Model_Observer
|
3 |
+
{
|
4 |
+
|
5 |
+
/**
|
6 |
+
* @param Varien_Event_Observer $observer
|
7 |
+
* @return Fp_Followprice_Model_Observer
|
8 |
+
*/
|
9 |
+
|
10 |
+
public function createList (Varien_Event_Observer $observer)
|
11 |
+
{
|
12 |
+
if((!Mage::registry('current_product')) && Mage::getStoreConfig('Fp_Followprice_Config/section_three/Fp_Followprice_Enablelist') && (Mage::getStoreConfig('Fp_Followprice_Config/section_one/Fp_Followprice_Enable'))) {
|
13 |
+
$block = $observer->getBlock();
|
14 |
+
if (($block instanceof Mage_Catalog_Block_Product_Price) && ($block instanceof Mage_Catalog_Block_Product_Abstract)) {
|
15 |
+
$transport = $observer->getTransport();
|
16 |
+
$html = $transport->getHtml();
|
17 |
+
|
18 |
+
$product = $block->getProduct();
|
19 |
+
$name = $product->name;
|
20 |
+
$id = $product->entity_id;
|
21 |
+
$url = $product->url;
|
22 |
+
|
23 |
+
$_product = Mage::getModel('catalog/product')->load($id);
|
24 |
+
$image = Mage::helper('catalog/image')->init($_product, 'image');
|
25 |
+
|
26 |
+
//Get category
|
27 |
+
$categoryIds = $_product->getCategoryIds();
|
28 |
+
$_category = Mage::getModel('catalog/category')->load($categoryIds[0]);
|
29 |
+
|
30 |
+
//Get button style
|
31 |
+
$style = explode(',', Mage::getStoreConfig('Fp_Followprice_Config/section_three/Fp_Followprice_Style'));
|
32 |
+
$stylearray = array(0,0,0,0);
|
33 |
+
foreach ($style as $val) {
|
34 |
+
if ($val == 1) {
|
35 |
+
$stylearray[0] = 1;
|
36 |
+
} else if ($val == 2) {
|
37 |
+
$stylearray[1] = 1;
|
38 |
+
} else if ($val == 3) {
|
39 |
+
$stylearray[2] = 1;
|
40 |
+
} else if ($val == 4) {
|
41 |
+
$stylearray[3] = 1;
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
$button_style = "";
|
46 |
+
if ($stylearray[0] == 0) {
|
47 |
+
$button_style .= "no-counter,";
|
48 |
+
}
|
49 |
+
if ($stylearray[1] == 0) {
|
50 |
+
$button_style .= "icon-link,";
|
51 |
+
}
|
52 |
+
if ($stylearray[2] == 0) {
|
53 |
+
$button_style .= "no-full-text,";
|
54 |
+
}
|
55 |
+
if ($stylearray[3] == 1) {
|
56 |
+
$button_style .= "stacked-text,";
|
57 |
+
}
|
58 |
+
|
59 |
+
$html .= '
|
60 |
+
<div class="followprice-container">
|
61 |
+
<div class="fp-button"
|
62 |
+
data-store-key="' . Mage::getStoreConfig('Fp_Followprice_Config/section_one/Fp_Followprice_Key') . '"
|
63 |
+
data-style="' . $button_style . '"
|
64 |
+
data-product-title="' . $name . '"
|
65 |
+
data-product-id="' . $id . '"
|
66 |
+
data-product-url="' . $url . '"
|
67 |
+
data-product-image="' . $image . '"
|
68 |
+
data-product-price="' . number_format($product->final_price,2) . '"
|
69 |
+
data-product-old-price="' . number_format($product->price,2) . '"
|
70 |
+
data-product-currency="' . Mage::app()->getStore()->getCurrentCurrencyCode() . '"
|
71 |
+
data-product-campaign-start="' . $_product->special_from_date . '"
|
72 |
+
data-product-campaign-end="' . $_product->special_to_date . '"
|
73 |
+
data-product-availability ="' . $_product->stock_item->is_in_stock . '"
|
74 |
+
data-product-stock="' . $_product->stock_item->stock_qty . '"
|
75 |
+
data-product-manufacture="' . $_product->getAttributeText('manufacturer') . '"
|
76 |
+
data-product-category="' . $_category->getName() . '">
|
77 |
+
</div>
|
78 |
+
<div>';
|
79 |
+
$transport->setHtml($html);
|
80 |
+
}
|
81 |
+
if ($block instanceof Mage_Catalog_Block_Product_List) {
|
82 |
+
$transport = $observer->getTransport();
|
83 |
+
$html = $transport->getHtml();
|
84 |
+
$html .= '<script>(function() { var _f = document.createElement("script");_f.type = "text/javascript"; _f.async = true; _f.src ="https://sites.followprice.co:1337/followbutton.js"; var s =document.getElementsByTagName("script")[0];s.parentNode.insertBefore(_f, s); })();</script>
|
85 |
+
<style>
|
86 |
+
.followprice-container{
|
87 |
+
width:100%;
|
88 |
+
display:iniline-block;
|
89 |
+
}
|
90 |
+
.fp-button{
|
91 |
+
display:inline-block; ' . Mage::getStoreConfig('Fp_Followprice_Config/section_three/Fp_Followprice_Allignmentlist') . '
|
92 |
+
margin-top: ' . Mage::getStoreConfig('Fp_Followprice_Config/section_three/Fp_Followprice_Margin_Toplist') . 'px;
|
93 |
+
margin-right:' . Mage::getStoreConfig('Fp_Followprice_Config/section_three/Fp_Followprice_Margin_Rightlist') . 'px;
|
94 |
+
margin-bottom:' . Mage::getStoreConfig('Fp_Followprice_Config/section_three/Fp_Followprice_Margin_Bottomlist') . 'px;
|
95 |
+
margin-left:' . Mage::getStoreConfig('Fp_Followprice_Config/section_three/Fp_Followprice_Margin_Leftlist') . 'px;
|
96 |
+
}
|
97 |
+
</style>';
|
98 |
+
$transport->setHtml($html);
|
99 |
+
}
|
100 |
+
}
|
101 |
+
}
|
102 |
+
}
|
app/code/community/Fp/Followprice/Model/Position.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Fp_Followprice_Model_Position
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
return array(
|
7 |
+
array('value'=>0, 'label'=>Mage::helper('Fp_Followprice')->__(' Below the price')),
|
8 |
+
array('value'=>1, 'label'=>Mage::helper('Fp_Followprice')->__(' Below "add to cart"')),
|
9 |
+
);
|
10 |
+
}
|
11 |
+
|
12 |
+
}
|
13 |
+
?>
|
app/code/community/Fp/Followprice/Model/Style.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Fp_Followprice_Model_Style
|
3 |
+
{
|
4 |
+
/**
|
5 |
+
* Options getter
|
6 |
+
*
|
7 |
+
* @return array
|
8 |
+
*/
|
9 |
+
public function toOptionArray()
|
10 |
+
{
|
11 |
+
return array(
|
12 |
+
array('value' => 1, 'label' => Mage::helper('adminhtml')->__('Show counter')),
|
13 |
+
array('value' => 2, 'label' => Mage::helper('adminhtml')->__('Show background')),
|
14 |
+
array('value' => 3, 'label' => Mage::helper('adminhtml')->__('Show text')),
|
15 |
+
array('value' => 4, 'label' => Mage::helper('adminhtml')->__('Multi-line text')),
|
16 |
+
);
|
17 |
+
}
|
18 |
+
}
|
app/code/community/Fp/Followprice/controllers/IndexController.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Fp_Followprice_IndexController extends Mage_Adminhtml_Controller_Action
|
3 |
+
{
|
4 |
+
public function indexAction()
|
5 |
+
{
|
6 |
+
$this->loadLayout();
|
7 |
+
|
8 |
+
//create a text block with the name of "example-block"
|
9 |
+
$block = $this->getLayout()
|
10 |
+
->createBlock('core/text', 'example-block')
|
11 |
+
->setText("<iframe id='fpr-iframe' src='https://followprice.co/business/login?ref=header' style='width:100%; height: 800px;''></iframe>");
|
12 |
+
|
13 |
+
$this->_addContent($block);
|
14 |
+
$this->_setActiveMenu('report/Followprice');
|
15 |
+
|
16 |
+
$this->renderLayout();
|
17 |
+
}
|
18 |
+
}
|
app/code/community/Fp/Followprice/etc/config.xml
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Fp_Followprice>
|
5 |
+
<version>1.0.0.0</version>
|
6 |
+
</Fp_Followprice>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<blocks>
|
10 |
+
<Fp_Followprice>
|
11 |
+
<class>Fp_Followprice_Block</class>
|
12 |
+
</Fp_Followprice>
|
13 |
+
</blocks>
|
14 |
+
<helpers>
|
15 |
+
<Fp_Followprice>
|
16 |
+
<class>Fp_Followprice_Helper</class>
|
17 |
+
</Fp_Followprice>
|
18 |
+
</helpers>
|
19 |
+
<models>
|
20 |
+
<Fp_Followprice>
|
21 |
+
<class>Fp_Followprice_Model</class>
|
22 |
+
</Fp_Followprice>
|
23 |
+
</models>
|
24 |
+
<events>
|
25 |
+
<core_block_abstract_to_html_after>
|
26 |
+
<observers>
|
27 |
+
<create_list>
|
28 |
+
<class>Fp_Followprice_Model_Observer</class>
|
29 |
+
<method>createList</method>
|
30 |
+
</create_list>
|
31 |
+
</observers>
|
32 |
+
</core_block_abstract_to_html_after>
|
33 |
+
</events>
|
34 |
+
</global>
|
35 |
+
<adminhtml>
|
36 |
+
<menu>
|
37 |
+
<report>
|
38 |
+
<children>
|
39 |
+
<followprice>
|
40 |
+
<title>Followprice</title>
|
41 |
+
<sort_order>0</sort_order>
|
42 |
+
<action>followpricedashboard</action>
|
43 |
+
</followprice>
|
44 |
+
</children>
|
45 |
+
</report>
|
46 |
+
</menu>
|
47 |
+
</adminhtml>
|
48 |
+
<admin>
|
49 |
+
<routers>
|
50 |
+
<followprice>
|
51 |
+
<use>admin</use>
|
52 |
+
<args>
|
53 |
+
<module>Fp_Followprice</module>
|
54 |
+
<frontName>followpricedashboard</frontName>
|
55 |
+
</args>
|
56 |
+
</followprice>
|
57 |
+
</routers>
|
58 |
+
</admin>
|
59 |
+
<frontend>
|
60 |
+
<layout>
|
61 |
+
<updates>
|
62 |
+
<Fp_Followprice>
|
63 |
+
<file>fp/followprice.xml</file>
|
64 |
+
</Fp_Followprice>
|
65 |
+
</updates>
|
66 |
+
</layout>
|
67 |
+
</frontend>
|
68 |
+
<adminhtml>
|
69 |
+
<acl>
|
70 |
+
<resources>
|
71 |
+
<admin>
|
72 |
+
<children>
|
73 |
+
<system>
|
74 |
+
<children>
|
75 |
+
<config>
|
76 |
+
<children>
|
77 |
+
<Fp_Followprice_Config>
|
78 |
+
<title>Followprice Configuration</title>
|
79 |
+
</Fp_Followprice_Config>
|
80 |
+
</children>
|
81 |
+
</config>
|
82 |
+
</children>
|
83 |
+
</system>
|
84 |
+
</children>
|
85 |
+
</admin>
|
86 |
+
</resources>
|
87 |
+
</acl>
|
88 |
+
</adminhtml>
|
89 |
+
</config>
|
app/code/community/Fp/Followprice/etc/system.xml
ADDED
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<Fp_Followprice translate="label" module="Fp_Followprice">
|
5 |
+
<label>Followprice</label>
|
6 |
+
<sort_order>600</sort_order>
|
7 |
+
</Fp_Followprice>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<Fp_Followprice_Config translate="label" module="Fp_Followprice">
|
11 |
+
<label>Settings</label>
|
12 |
+
<tab>Fp_Followprice</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 |
+
<section_one translate="label">
|
20 |
+
<label>Store Configuration</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>1</sort_order>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
<fields>
|
27 |
+
<Fp_Followprice_Key translate="label" module="Fp_Followprice">
|
28 |
+
<label>Store Key:</label>
|
29 |
+
<frontend_type>text</frontend_type>
|
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 |
+
</Fp_Followprice_Key>
|
35 |
+
<Fp_Followprice_Enable translate="label" module="Fp_Followprice">
|
36 |
+
<label>Enabled:</label>
|
37 |
+
<comment>Enable the Followprice button in all pages.</comment>
|
38 |
+
<frontend_type>select</frontend_type>
|
39 |
+
<source_model>Fp_Followprice/enable</source_model>
|
40 |
+
<sort_order>2</sort_order>
|
41 |
+
<show_in_default>1</show_in_default>
|
42 |
+
<show_in_website>1</show_in_website>
|
43 |
+
<show_in_store>1</show_in_store>
|
44 |
+
</Fp_Followprice_Enable>
|
45 |
+
</fields>
|
46 |
+
</section_one>
|
47 |
+
<section_two translate="label">
|
48 |
+
<label>Product Page</label>
|
49 |
+
<frontend_type>text</frontend_type>
|
50 |
+
<sort_order>2</sort_order>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>1</show_in_store>
|
54 |
+
<fields>
|
55 |
+
<Fp_Followprice_Position translate="label" module="Fp_Followprice">
|
56 |
+
<label>Position:</label>
|
57 |
+
<frontend_type>radios</frontend_type>
|
58 |
+
<source_model>Fp_Followprice/position</source_model>
|
59 |
+
<sort_order>1</sort_order>
|
60 |
+
<show_in_default>1</show_in_default>
|
61 |
+
<show_in_website>1</show_in_website>
|
62 |
+
<show_in_store>1</show_in_store>
|
63 |
+
</Fp_Followprice_Position>
|
64 |
+
<Fp_Followprice_Allignment translate="label" module="Fp_Followprice">
|
65 |
+
<label>Allignment:</label>
|
66 |
+
<frontend_type>select</frontend_type>
|
67 |
+
<source_model>Fp_Followprice/allignment</source_model>
|
68 |
+
<sort_order>2</sort_order>
|
69 |
+
<show_in_default>1</show_in_default>
|
70 |
+
<show_in_website>1</show_in_website>
|
71 |
+
<show_in_store>1</show_in_store>
|
72 |
+
</Fp_Followprice_Allignment>
|
73 |
+
<Fp_Followprice_Margin_Top translate="label" module="Fp_Followprice">
|
74 |
+
<label>Top Margin (px):</label>
|
75 |
+
<frontend_type>text</frontend_type>
|
76 |
+
<sort_order>3</sort_order>
|
77 |
+
<show_in_default>1</show_in_default>
|
78 |
+
<show_in_website>1</show_in_website>
|
79 |
+
<show_in_store>1</show_in_store>
|
80 |
+
</Fp_Followprice_Margin_Top>
|
81 |
+
<Fp_Followprice_Margin_Right translate="label" module="Fp_Followprice">
|
82 |
+
<label>Right Margin (px):</label>
|
83 |
+
<frontend_type>text</frontend_type>
|
84 |
+
<sort_order>4</sort_order>
|
85 |
+
<show_in_default>1</show_in_default>
|
86 |
+
<show_in_website>1</show_in_website>
|
87 |
+
<show_in_store>1</show_in_store>
|
88 |
+
</Fp_Followprice_Margin_Right>
|
89 |
+
<Fp_Followprice_Margin_Bottom translate="label" module="Fp_Followprice">
|
90 |
+
<label>Bottom Margin (px):</label>
|
91 |
+
<frontend_type>text</frontend_type>
|
92 |
+
<sort_order>5</sort_order>
|
93 |
+
<show_in_default>1</show_in_default>
|
94 |
+
<show_in_website>1</show_in_website>
|
95 |
+
<show_in_store>1</show_in_store>
|
96 |
+
</Fp_Followprice_Margin_Bottom>
|
97 |
+
<Fp_Followprice_Margin_Left translate="label" module="Fp_Followprice">
|
98 |
+
<label>Left Margin (px):</label>
|
99 |
+
<frontend_type>text</frontend_type>
|
100 |
+
<sort_order>6</sort_order>
|
101 |
+
<show_in_default>1</show_in_default>
|
102 |
+
<show_in_website>1</show_in_website>
|
103 |
+
<show_in_store>1</show_in_store>
|
104 |
+
</Fp_Followprice_Margin_Left>
|
105 |
+
<Fp_Followprice_Custom_Css translate="label" module="Fp_Followprice">
|
106 |
+
<label>Custom Css:</label>
|
107 |
+
<frontend_type>textarea</frontend_type>
|
108 |
+
<sort_order>7</sort_order>
|
109 |
+
<show_in_default>1</show_in_default>
|
110 |
+
<show_in_website>1</show_in_website>
|
111 |
+
<show_in_store>1</show_in_store>
|
112 |
+
</Fp_Followprice_Custom_Css>
|
113 |
+
</fields>
|
114 |
+
</section_two>
|
115 |
+
<section_three translate="label">
|
116 |
+
<label>List Page</label>
|
117 |
+
<frontend_type>text</frontend_type>
|
118 |
+
<sort_order>3</sort_order>
|
119 |
+
<show_in_default>1</show_in_default>
|
120 |
+
<show_in_website>1</show_in_website>
|
121 |
+
<show_in_store>1</show_in_store>
|
122 |
+
<fields>
|
123 |
+
<Fp_Followprice_Enablelist translate="label" module="Fp_Followprice">
|
124 |
+
<label>Enabled:</label>
|
125 |
+
<comment>Enable the Followprice button in list pages.</comment>
|
126 |
+
<frontend_type>select</frontend_type>
|
127 |
+
<source_model>Fp_Followprice/enable</source_model>
|
128 |
+
<sort_order>0</sort_order>
|
129 |
+
<show_in_default>1</show_in_default>
|
130 |
+
<show_in_website>1</show_in_website>
|
131 |
+
<show_in_store>1</show_in_store>
|
132 |
+
</Fp_Followprice_Enablelist>
|
133 |
+
<Fp_Followprice_Style translate="label" module="Fp_Followprice">
|
134 |
+
<label>Button Style:</label>
|
135 |
+
<frontend_model>Fp_Followprice/adminhtml_system_config_style</frontend_model>
|
136 |
+
<sort_order>1</sort_order>
|
137 |
+
<show_in_default>1</show_in_default>
|
138 |
+
<show_in_website>1</show_in_website>
|
139 |
+
<show_in_store>1</show_in_store>
|
140 |
+
</Fp_Followprice_Style>
|
141 |
+
<Fp_Followprice_Allignmentlist translate="label" module="Fp_Followprice">
|
142 |
+
<label>Allignment:</label>
|
143 |
+
<frontend_type>select</frontend_type>
|
144 |
+
<source_model>Fp_Followprice/allignment</source_model>
|
145 |
+
<sort_order>2</sort_order>
|
146 |
+
<show_in_default>1</show_in_default>
|
147 |
+
<show_in_website>1</show_in_website>
|
148 |
+
<show_in_store>1</show_in_store>
|
149 |
+
</Fp_Followprice_Allignmentlist>
|
150 |
+
<Fp_Followprice_Margin_Toplist translate="label" module="Fp_Followprice">
|
151 |
+
<label>Top Margin (px):</label>
|
152 |
+
<frontend_type>text</frontend_type>
|
153 |
+
<sort_order>3</sort_order>
|
154 |
+
<show_in_default>1</show_in_default>
|
155 |
+
<show_in_website>1</show_in_website>
|
156 |
+
<show_in_store>1</show_in_store>
|
157 |
+
</Fp_Followprice_Margin_Toplist>
|
158 |
+
<Fp_Followprice_Margin_Rightlist translate="label" module="Fp_Followprice">
|
159 |
+
<label>Right Margin (px):</label>
|
160 |
+
<frontend_type>text</frontend_type>
|
161 |
+
<sort_order>4</sort_order>
|
162 |
+
<show_in_default>1</show_in_default>
|
163 |
+
<show_in_website>1</show_in_website>
|
164 |
+
<show_in_store>1</show_in_store>
|
165 |
+
</Fp_Followprice_Margin_Rightlist>
|
166 |
+
<Fp_Followprice_Margin_Bottomlist translate="label" module="Fp_Followprice">
|
167 |
+
<label>Bottom Margin (px):</label>
|
168 |
+
<frontend_type>text</frontend_type>
|
169 |
+
<sort_order>5</sort_order>
|
170 |
+
<show_in_default>1</show_in_default>
|
171 |
+
<show_in_website>1</show_in_website>
|
172 |
+
<show_in_store>1</show_in_store>
|
173 |
+
</Fp_Followprice_Margin_Bottomlist>
|
174 |
+
<Fp_Followprice_Margin_Leftlist translate="label" module="Fp_Followprice">
|
175 |
+
<label>Left Margin (px):</label>
|
176 |
+
<frontend_type>text</frontend_type>
|
177 |
+
<sort_order>6</sort_order>
|
178 |
+
<show_in_default>1</show_in_default>
|
179 |
+
<show_in_website>1</show_in_website>
|
180 |
+
<show_in_store>1</show_in_store>
|
181 |
+
</Fp_Followprice_Margin_Leftlist>
|
182 |
+
</fields>
|
183 |
+
</section_three>
|
184 |
+
</groups>
|
185 |
+
</Fp_Followprice_Config>
|
186 |
+
</sections>
|
187 |
+
</config>
|
app/design/adminhtml/base/default/template/Fp_Followprice/system/config/style.phtml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<input type="hidden" name="<?php echo $this->getNamePrefix() ?>" value="" /><!-- this is send if nothing is checked -->
|
2 |
+
<ul class="checkboxes">
|
3 |
+
<?php foreach ($this->getValues() as $name => $label): ?>
|
4 |
+
<li>
|
5 |
+
<input type="checkbox" value="<?php echo $name?>" name="<?php echo $this->getNamePrefix() ?>[]" id="<?php echo $this->getHtmlId() . '_' . $name ?>"<?php echo ($this->getIsChecked($name) ? ' checked="checked"' : '') ?>/><label for="<?php echo $this->getHtmlId() . '_' . $name ?>">
|
6 |
+
<?php echo $label ?>
|
7 |
+
</label>
|
8 |
+
</li>
|
9 |
+
<?php endforeach;?>
|
10 |
+
</ul>
|
app/design/frontend/base/default/layout/fp/followprice.xml
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<layout version="1.0.0">
|
3 |
+
<catalog_product_view>
|
4 |
+
<reference name="product.info.addtocart">
|
5 |
+
<block type="Fp_Followprice/FollowpriceButtonAtProduct" name="Fp_Followprice" >
|
6 |
+
<action method="setMessage">
|
7 |
+
<message>cart</message>
|
8 |
+
</action>
|
9 |
+
</block>
|
10 |
+
</reference>
|
11 |
+
</catalog_product_view>
|
12 |
+
<catalog_product_view>
|
13 |
+
<reference name="product.info.extrahint">
|
14 |
+
<block type="Fp_Followprice/FollowpriceButtonAtProduct" name="Fp_Followprice" >
|
15 |
+
<action method="setMessage">
|
16 |
+
<message>price</message>
|
17 |
+
</action>
|
18 |
+
</block>
|
19 |
+
</reference>
|
20 |
+
</catalog_product_view>
|
21 |
+
</layout>
|
app/design/frontend/base/default/template/fp/followprice_button.phtml
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*Get store-key*/
|
3 |
+
$_key = $this->getKey();
|
4 |
+
|
5 |
+
/*Get the current product*/
|
6 |
+
$_product = $this->getProduct();
|
7 |
+
|
8 |
+
/*Get the current product URL*/
|
9 |
+
$cUrl = $this->getPUrl();
|
10 |
+
|
11 |
+
/*Get the current product image URL*/
|
12 |
+
$cMedia = $this->getMedia();
|
13 |
+
|
14 |
+
/*Get category*/
|
15 |
+
$categoryIds = $_product->getCategoryIds();
|
16 |
+
$firstCategoryId = $categoryIds[0];
|
17 |
+
$_category = Mage::getModel('catalog/category')->load($firstCategoryId);
|
18 |
+
|
19 |
+
|
20 |
+
/*Get stock info*/
|
21 |
+
$stock = $_product->stock_item;
|
22 |
+
|
23 |
+
/*Get position*/
|
24 |
+
$_position = $this->getPosition();
|
25 |
+
|
26 |
+
?>
|
27 |
+
<?php // To determine if the button comes after "price" or "add to cart" ?>
|
28 |
+
<?php if (($_position == 0 && $this->message == "price") || ($_position == 1 && $this->message == "cart")) { ?>
|
29 |
+
|
30 |
+
<script>(function() { var _f = document.createElement("script");_f.type = "text/javascript"; _f.async = true; _f.src ="https://sites.followprice.co:1337/followbutton.js"; var s =document.getElementsByTagName("script")[0];s.parentNode.insertBefore(_f, s); })();</script>
|
31 |
+
|
32 |
+
<div class='followprice-container'>
|
33 |
+
<div class="fp-button"
|
34 |
+
data-store-key="<?php echo $_key; ?>"
|
35 |
+
data-product-title="<?php echo $_product->name; ?>"
|
36 |
+
data-product-id="<?php echo $_product->entity_id; ?>"
|
37 |
+
data-product-url="<?php echo $cUrl; ?>"
|
38 |
+
data-product-image="<?php echo $cMedia; ?>"
|
39 |
+
data-product-price="<?php echo number_format($_product->final_price,2); ?>"
|
40 |
+
data-product-old-price="<?php echo number_format($_product->price,2); ?>"
|
41 |
+
data-product-currency="<?php echo Mage::app()->getStore()->getCurrentCurrencyCode(); ?>"
|
42 |
+
data-product-campaign-start="<?php echo $_product->special_from_date; ?>"
|
43 |
+
data-product-campaign-end="<?php echo $_product->special_to_date; ?>"
|
44 |
+
data-product-availability ="<?php echo $stock->is_in_stock; ?>"
|
45 |
+
data-product-stock="<?php echo $stock->stock_qty; ?>"
|
46 |
+
data-product-manufacture="<?php echo $_product->getAttributeText('manufacturer'); ?>"
|
47 |
+
data-product-category="<?php echo $_category->getName(); ?>">
|
48 |
+
</div>
|
49 |
+
</div>
|
50 |
+
<style>
|
51 |
+
.followprice-container{
|
52 |
+
width:100%;
|
53 |
+
display:inline-block;
|
54 |
+
}
|
55 |
+
.fp-button{
|
56 |
+
display:inline-block;
|
57 |
+
<?php echo Mage::getStoreConfig('Fp_Followprice_Config/section_two/Fp_Followprice_Allignment'); ?>
|
58 |
+
margin-top:<?php echo Mage::getStoreConfig('Fp_Followprice_Config/section_two/Fp_Followprice_Margin_Top'); ?>px;
|
59 |
+
margin-right:<?php echo Mage::getStoreConfig('Fp_Followprice_Config/section_two/Fp_Followprice_Margin_Right'); ?>px;
|
60 |
+
margin-bottom:<?php echo Mage::getStoreConfig('Fp_Followprice_Config/section_two/Fp_Followprice_Margin_Bottom'); ?>px;
|
61 |
+
margin-left:<?php echo Mage::getStoreConfig('Fp_Followprice_Config/section_two/Fp_Followprice_Margin_Left'); ?>px;
|
62 |
+
}
|
63 |
+
|
64 |
+
<?php echo Mage::getStoreConfig('Fp_Followprice_Config/section_two/Fp_Followprice_Custom_Css'); ?>
|
65 |
+
</style>
|
66 |
+
|
67 |
+
<?php } ?>
|
app/etc/modules/Fp_Followprice.xml
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<Fp_Followprice>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
</Fp_Followprice>
|
8 |
+
</modules>
|
9 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>Fp_Followprice</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>devel</stability>
|
6 |
+
<license uri="http://opensource.org/licenses/MIT">Massachusetts Institute of Technology License </license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Displays a button for customers to follow your products and get a facebook notification once the price drops or if there are changes in availability.</summary>
|
10 |
+
<description>Displays a button for customers to follow your products and get a facebook notification once the price drops or if there are changes in availability.</description>
|
11 |
+
<notes>First Followprice extension version.</notes>
|
12 |
+
<authors><author><name>Daniel Moreira</name><user>danielmoreira</user><email>daniel.moreira@followprice.co</email></author></authors>
|
13 |
+
<date>2015-06-16</date>
|
14 |
+
<time>15:09:21</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="Fp"><dir name="Followprice"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><file name="Style.php" hash="0ecdb2763298753653d565da26330b76"/></dir></dir></dir><file name="FollowpriceButtonAtProduct.php" hash="fbc58b2a7413a64446f95b137e47d3e7"/></dir><dir name="Helper"><file name="Data.php" hash="b57fb5daa7144cb08d3fc44010ce71eb"/></dir><dir name="Model"><file name="Allignment.php" hash="324d087936b060290b6d3545388f9b53"/><file name="Enable.php" hash="1f04e57aa590140099225d11a801240c"/><file name="Observer.php" hash="d73f34e7d481e2151ff7043a53d6cd27"/><file name="Position.php" hash="00ce4ba5ca600ee097af0aa1cd651b67"/><file name="Style.php" hash="daa0683391bb0ad1f1ae0c3de6f48c7f"/></dir><dir name="controllers"><file name="IndexController.php" hash="1d141d8bbd9b28513f598f508a89e4e0"/></dir><dir name="etc"><file name="config.xml" hash="d05053c7cb153bbaedea080b310d45c0"/><file name="system.xml" hash="127cc00f68209762c508b8396563bea2"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="base"><dir name="default"><dir name="template"><dir name="Fp_Followprice"><dir name="system"><dir name="config"><file name="style.phtml" hash="a8aa43dd93f3e775cd9c3b8a236ab318"/></dir></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="fp"><file name="followprice.xml" hash="3d12db5d746540443a877dfc1c5b5a04"/></dir></dir><dir name="template"><dir name="fp"><file name="followprice_button.phtml" hash="ac89466c4f19916fb3ec8d37e3ce54b2"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Fp_Followprice.xml" hash="ddee688a2070307d097e00b76175a18c"/></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>4.0.0</min><max>7.0.0</max></php></required></dependencies>
|
18 |
+
</package>
|