Fancy_Product_Compare - Version 0.1.2

Version Notes

Fancy Product Compare extension released.

Download this release

Release Info

Developer Arvind Bhardwaj
Extension Fancy_Product_Compare
Version 0.1.2
Comparing to
See all releases


Version 0.1.2

app/code/local/Arvfc/Fancycompare/Block/Fancycompare.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Arvfc_Fancycompare_Block_Fancycompare extends Mage_Core_Block_Template
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ return parent::_prepareLayout();
7
+ }
8
+
9
+ public function getFancycompare()
10
+ {
11
+ if (!$this->hasData('fancycompare')) {
12
+ $this->setData('fancycompare', Mage::registry('fancycompare'));
13
+ }
14
+ return $this->getData('fancycompare');
15
+
16
+ }
17
+ }
app/code/local/Arvfc/Fancycompare/Block/Product/Compare/List.php ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Catalog
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ /**
29
+ * Catalog products compare block
30
+ *
31
+ * @category Mage
32
+ * @package Mage_Catalog
33
+ * @author Magento Core Team <core@magentocommerce.com>
34
+ */
35
+ class Arvfc_Fancycompare_Block_Product_Compare_List extends Mage_Catalog_Block_Product_Compare_List
36
+ {
37
+ /**
38
+ * Product Compare items collection
39
+ *
40
+ * @var Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Compare_Item_Collection
41
+ */
42
+ protected $_items;
43
+
44
+ /**
45
+ * Compare Products comparable attributes cache
46
+ *
47
+ * @var array
48
+ */
49
+ protected $_attributes;
50
+
51
+ /**
52
+ * Flag which allow/disallow to use link for as low as price
53
+ *
54
+ * @var bool
55
+ */
56
+ protected $_useLinkForAsLowAs = false;
57
+
58
+ /**
59
+ * Customer id
60
+ *
61
+ * @var null|int
62
+ */
63
+ protected $_customerId = null;
64
+
65
+ /**
66
+ * Retrieve url for adding product to wishlist with params
67
+ *
68
+ * @param Mage_Catalog_Model_Product $product
69
+ * @return string
70
+ */
71
+ public function getAddToWishlistUrl($product)
72
+ {
73
+ $continueUrl = Mage::helper('core')->urlEncode($this->getUrl('customer/account'));
74
+ $urlParamName = Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED;
75
+
76
+ $params = array(
77
+ $urlParamName => $continueUrl
78
+ );
79
+
80
+ return $this->helper('wishlist')->getAddUrlWithParams($product, $params);
81
+ }
82
+
83
+ /**
84
+ * Preparing layout
85
+ *
86
+ * @return Mage_Catalog_Block_Product_Compare_List
87
+ */
88
+ protected function _prepareLayout()
89
+ {
90
+ $headBlock = $this->getLayout()->getBlock('head');
91
+ if ($headBlock) {
92
+ $headBlock->setTitle(Mage::helper('catalog')->__('Products Comparison List') . ' - ' . $headBlock->getDefaultTitle());
93
+ }
94
+ return parent::_prepareLayout();
95
+ }
96
+
97
+ /**
98
+ * Retrieve Product Compare items collection
99
+ *
100
+ * @return Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Compare_Item_Collection
101
+ */
102
+ public function getItems()
103
+ {
104
+ if (is_null($this->_items)) {
105
+ Mage::helper('catalog/product_compare')->setAllowUsedFlat(false);
106
+
107
+ $this->_items = Mage::getResourceModel('catalog/product_compare_item_collection')
108
+ ->useProductItem(true)
109
+ ->setStoreId(Mage::app()->getStore()->getId());
110
+
111
+ if (Mage::getSingleton('customer/session')->isLoggedIn()) {
112
+ $this->_items->setCustomerId(Mage::getSingleton('customer/session')->getCustomerId());
113
+ } elseif ($this->_customerId) {
114
+ $this->_items->setCustomerId($this->_customerId);
115
+ } else {
116
+ $this->_items->setVisitorId(Mage::getSingleton('log/visitor')->getId());
117
+ }
118
+
119
+ $this->_items
120
+ ->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
121
+ ->loadComparableAttributes()
122
+ ->addMinimalPrice()
123
+ ->addTaxPercents();
124
+
125
+ Mage::getSingleton('catalog/product_visibility')
126
+ ->addVisibleInSiteFilterToCollection($this->_items);
127
+ }
128
+
129
+ return $this->_items;
130
+ }
131
+
132
+ /**
133
+ * Retrieve Product Compare Attributes
134
+ *
135
+ * @return array
136
+ */
137
+ public function getAttributes()
138
+ {
139
+ if (is_null($this->_attributes)) {
140
+ $this->_attributes = $this->getItems()->getComparableAttributes();
141
+ }
142
+
143
+ return $this->_attributes;
144
+ }
145
+
146
+ /**
147
+ * Retrieve Product Attribute Value
148
+ *
149
+ * @param Mage_Catalog_Model_Product $product
150
+ * @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
151
+ * @return string
152
+ */
153
+ public function getProductAttributeValue($product, $attribute)
154
+ {
155
+ if (!$product->hasData($attribute->getAttributeCode())) {
156
+ return Mage::helper('catalog')->__('N/A');
157
+ }
158
+
159
+ if ($attribute->getSourceModel()
160
+ || in_array($attribute->getFrontendInput(), array('select','boolean','multiselect'))
161
+ ) {
162
+ //$value = $attribute->getSource()->getOptionText($product->getData($attribute->getAttributeCode()));
163
+ $value = $attribute->getFrontend()->getValue($product);
164
+ } else {
165
+ $value = $product->getData($attribute->getAttributeCode());
166
+ }
167
+ return ((string)$value == '') ? Mage::helper('catalog')->__('No') : $value;
168
+ }
169
+
170
+ /**
171
+ * Retrieve Print URL
172
+ *
173
+ * @return string
174
+ */
175
+ public function getPrintUrl()
176
+ {
177
+ return $this->getUrl('*/*/*', array('_current'=>true, 'print'=>1));
178
+ }
179
+
180
+ /**
181
+ * Setter for customer id
182
+ *
183
+ * @param int $id
184
+ * @return Mage_Catalog_Block_Product_Compare_List
185
+ */
186
+ public function setCustomerId($id)
187
+ {
188
+ $this->_customerId = $id;
189
+ return $this;
190
+ }
191
+ }
app/code/local/Arvfc/Fancycompare/Helper/Data.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Arvfc_Fancycompare_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+
6
+ }
app/code/local/Arvfc/Fancycompare/controllers/IndexController.php ADDED
@@ -0,0 +1,254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Arvfc_Fancycompare_IndexController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+ $this->loadLayout();
7
+ $this->renderLayout();
8
+ }
9
+
10
+ /**
11
+ * Show compare list
12
+ */
13
+ public function showAction()
14
+ {
15
+ echo $this->getLayout()->createBlock('fancycompare/product_compare_list')->setTemplate('fancycompare/fclist.phtml')->toHtml();
16
+ }
17
+
18
+ /**
19
+ * Add item to compare list
20
+ */
21
+ public function addtocompareAction()
22
+ {
23
+ $productId = (int) $this->getRequest()->getParam('product');
24
+ if ($productId
25
+ && (Mage::getSingleton('log/visitor')->getId() || Mage::getSingleton('customer/session')->isLoggedIn())
26
+ ) {
27
+ $_items = Mage::helper('catalog/product_compare')->getItemCollection();
28
+ foreach($_items as $_index => $_item) {
29
+ if ($_item->getId() == $productId) {
30
+ echo json_encode(array('status'=>'success'));
31
+ return;
32
+ }
33
+ }
34
+ $product = Mage::getModel('catalog/product')
35
+ ->setStoreId(Mage::app()->getStore()->getId())
36
+ ->load($productId);
37
+
38
+ if ($product->getId()/* && !$product->isSuper()*/) {
39
+ Mage::getSingleton('catalog/product_compare_list')->addProduct($product);
40
+ Mage::dispatchEvent('catalog_product_compare_add_product', array('product'=>$product));
41
+ }
42
+
43
+ Mage::helper('catalog/product_compare')->calculate();
44
+ $data = $this->getproductFCData($product);
45
+ echo json_encode(array('status'=>'success', 'pData'=>$data, 'pid'=>$productId));
46
+ return;
47
+ } else {
48
+ $result = array('status' => 'error',
49
+ 'message' => 'An error occurred while adding item to compare.',);
50
+ echo json_encode($result);
51
+ exit;
52
+ }
53
+ }
54
+
55
+ public function getproductFCData($_product)
56
+ {
57
+ $str = '
58
+ <div class="thumb_holder">
59
+ <img class="thumbnail" src="'.$_product->getThumbnailUrl().'">
60
+ </div>
61
+ <p class="description">
62
+ <a href="'.$_product->getProductUrl().'" class="product-name">
63
+ '.$_product->getName().'</a></p>
64
+ <a href="javascript:;" class="fc_remove"><span class="delete" title="Remove"></span></a>
65
+ ';
66
+ return $str;
67
+ }
68
+
69
+ /**
70
+ * Remove item from compare list
71
+ */
72
+ public function removeAction()
73
+ {
74
+ if ($productId = (int) $this->getRequest()->getParam('product')) {
75
+ $product = Mage::getModel('catalog/product')
76
+ ->setStoreId(Mage::app()->getStore()->getId())
77
+ ->load($productId);
78
+
79
+ if($product->getId()) {
80
+ /** @var $item Mage_Catalog_Model_Product_Compare_Item */
81
+ $item = Mage::getModel('catalog/product_compare_item');
82
+ if(Mage::getSingleton('customer/session')->isLoggedIn()) {
83
+ $item->addCustomerData(Mage::getSingleton('customer/session')->getCustomer());
84
+ } elseif ($this->_customerId) {
85
+ $item->addCustomerData(
86
+ Mage::getModel('customer/customer')->load($this->_customerId)
87
+ );
88
+ } else {
89
+ $item->addVisitorId(Mage::getSingleton('log/visitor')->getId());
90
+ }
91
+
92
+ $item->loadByProduct($product);
93
+
94
+ if($item->getId()) {
95
+ $item->delete();
96
+ /*Mage::getSingleton('catalog/session')->addSuccess(
97
+ $this->__('The product %s has been removed from comparison list.', $product->getName())
98
+ );*/
99
+ Mage::dispatchEvent('catalog_product_compare_remove_product', array('product'=>$item));
100
+ Mage::helper('catalog/product_compare')->calculate();
101
+
102
+ $_cnt = Mage::helper('catalog/product_compare')->getItemCount();
103
+ echo json_encode(array('status'=>'success', 'fc_count'=>$_cnt));
104
+ return;
105
+ }
106
+ }
107
+ }
108
+ }
109
+
110
+ /**
111
+ * Remove all items from comparison list
112
+ */
113
+ public function clearAction()
114
+ {
115
+ $result = array();
116
+ $items = Mage::getResourceModel('catalog/product_compare_item_collection');
117
+
118
+ if (Mage::getSingleton('customer/session')->isLoggedIn()) {
119
+ $items->setCustomerId(Mage::getSingleton('customer/session')->getCustomerId());
120
+ } elseif ($this->_customerId) {
121
+ $items->setCustomerId($this->_customerId);
122
+ } else {
123
+ $items->setVisitorId(Mage::getSingleton('log/visitor')->getId());
124
+ }
125
+
126
+ try {
127
+ $items->clear();
128
+ Mage::helper('catalog/product_compare')->calculate();
129
+ } catch (Mage_Core_Exception $e) {
130
+ $result['status'] = 'error';
131
+ $result['message'] = 'An error occurred while clearing comparison list.';
132
+ echo json_encode($result);
133
+ return;
134
+ } catch (Exception $e) {
135
+ $result['status'] = 'error';
136
+ $result['message'] = 'An error occurred while clearing comparison list.';
137
+ echo json_encode($result);
138
+ return;
139
+ }
140
+ echo json_encode(array('status'=>'success'));
141
+ return;
142
+ }
143
+
144
+ /**
145
+ * Add items to cart
146
+ */
147
+ public function addtocartAction()
148
+ {
149
+ try{
150
+ $result = array();
151
+ $productId = (int) $this->getRequest()->getParam('product');
152
+ if (!$productId) {
153
+ $result['status'] = 'error';
154
+ $result['message'] = 'Invalid product.';
155
+ echo json_encode($result);
156
+ exit;
157
+ }
158
+ $qty = '1';
159
+
160
+ $product = Mage::getSingleton('catalog/product')->load($productId);
161
+ $session = Mage::getSingleton('core/session', array('name'=>'frontend'));
162
+ $cart = Mage::helper('checkout/cart')->getCart();
163
+ $cart->addProduct($product, $qty);
164
+
165
+ $session->setLastAddedProductId($product->getId());
166
+ $session->setCartWasUpdated(true);
167
+ $cart->save();
168
+ Mage::dispatchEvent('checkout_cart_add_product_complete',
169
+ array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse())
170
+ );
171
+
172
+ $result['status']="success";
173
+ $result['message']="Added!";
174
+ echo json_encode($result);
175
+ } catch (Exception $e) {
176
+ $result['status'] = 'error';
177
+ $result['message'] = $e->getMessage();
178
+ echo json_encode($result);
179
+ }
180
+ }
181
+
182
+ /**
183
+ * Add items to wishlist
184
+ */
185
+ public function addtowishlistAction()
186
+ {
187
+ if (!Mage::helper('customer')->isLoggedIn()) {
188
+ $result = array('status' => 'error',
189
+ 'message' => 'You are not logged in.');
190
+ echo json_encode($result);
191
+ exit;
192
+ }
193
+ $wishlist = Mage::helper('wishlist')->getWishlist();
194
+ if (!$wishlist) {
195
+ $result = array('status' => 'error',
196
+ 'message' => 'An error occurred while adding item to wishlist.');
197
+ echo json_encode($result);
198
+ exit;
199
+ }
200
+
201
+ $productId = (int) $this->getRequest()->getParam('product');
202
+ if (!$productId) {
203
+ $result = array('status' => 'error',
204
+ 'message' => 'An error occurred while adding item to wishlist.');
205
+ echo json_encode($result);
206
+ exit;
207
+ }
208
+
209
+ $product = Mage::getModel('catalog/product')->load($productId);
210
+ if (!$product->getId() || !$product->isVisibleInCatalog()) {
211
+ $result = array('status' => 'error',
212
+ 'message' => 'An error occurred while adding item to wishlist.');
213
+ echo json_encode($result);
214
+ exit;
215
+ }
216
+
217
+ try {
218
+ $result = $wishlist->addNewItem($product);
219
+ if (is_string($result)) {
220
+ $result = array('status' => 'error',
221
+ 'message' => 'An error occurred while adding item to wishlist.');
222
+ echo json_encode($result);
223
+ exit;
224
+ }
225
+ $wishlist->save();
226
+ Mage::dispatchEvent(
227
+ 'wishlist_add_product',
228
+ array(
229
+ 'wishlist' => $wishlist,
230
+ 'product' => $product,
231
+ 'item' => $result
232
+ )
233
+ );
234
+ Mage::helper('wishlist')->calculate();
235
+
236
+ $result = array('status' => 'success',
237
+ 'message' => 'Added to wishlist.');
238
+ echo json_encode($result);
239
+ exit;
240
+ }
241
+ catch (Mage_Core_Exception $e) {
242
+ $result = array('status' => 'error',
243
+ 'message' => 'An error occurred while adding item to wishlist.');
244
+ echo json_encode($result);
245
+ exit;
246
+ }
247
+ catch (Exception $e) {
248
+ $result = array('status' => 'error',
249
+ 'message' => 'An error occurred while adding item to wishlist.');
250
+ echo json_encode($result);
251
+ exit;
252
+ }
253
+ }
254
+ }
app/code/local/Arvfc/Fancycompare/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
+ <fancycompareconfig translate="title" module="fancycompare">
12
+ <title>Fancycompare Config</title>
13
+ <sort_order>100</sort_order>
14
+ </fancycompareconfig>
15
+ </children>
16
+ </config>
17
+ </children>
18
+ </system>
19
+ </children>
20
+ </admin>
21
+ </resources>
22
+ </acl>
23
+ </config>
app/code/local/Arvfc/Fancycompare/etc/config.xml ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Arvfc_Fancycompare>
5
+ <version>0.1.2</version>
6
+ </Arvfc_Fancycompare>
7
+ </modules>
8
+ <frontend>
9
+ <routers>
10
+ <fancycompare>
11
+ <use>standard</use>
12
+ <args>
13
+ <module>Arvfc_Fancycompare</module>
14
+ <frontName>fancycompare</frontName>
15
+ </args>
16
+ </fancycompare>
17
+ </routers>
18
+ <layout>
19
+ <updates>
20
+ <fancycompare>
21
+ <file>fancycompare.xml</file>
22
+ </fancycompare>
23
+ </updates>
24
+ </layout>
25
+ </frontend>
26
+ <admin>
27
+ <routers>
28
+ <fancycompare>
29
+ <use>admin</use>
30
+ <args>
31
+ <module>Arvfc_Fancycompare</module>
32
+ <frontName>fancycompare</frontName>
33
+ </args>
34
+ </fancycompare>
35
+ </routers>
36
+ </admin>
37
+ <adminhtml>
38
+ <acl>
39
+ <resources>
40
+ <all>
41
+ <title>Allow Everything</title>
42
+ </all>
43
+ <admin>
44
+ <children>
45
+ <Arvfc_Fancycompare>
46
+ <title>Fancycompare Module</title>
47
+ <sort_order>10</sort_order>
48
+ </Arvfc_Fancycompare>
49
+ </children>
50
+ </admin>
51
+ </resources>
52
+ </acl>
53
+ <layout>
54
+ <updates>
55
+ <fancycompare>
56
+ <file>fancycompare.xml</file>
57
+ </fancycompare>
58
+ </updates>
59
+ </layout>
60
+ </adminhtml>
61
+ <global>
62
+ <blocks>
63
+ <fancycompare>
64
+ <class>Arvfc_Fancycompare_Block</class>
65
+ </fancycompare>
66
+ <!-- Override product compare block -->
67
+ <catalog>
68
+ <rewrite>
69
+ <product_compare_list>Arvfc_Fancycompare_Block_Product_Compare_List</product_compare_list>
70
+ </rewrite>
71
+ </catalog>
72
+ </blocks>
73
+ <helpers>
74
+ <fancycompare>
75
+ <class>Arvfc_Fancycompare_Helper</class>
76
+ </fancycompare>
77
+ </helpers>
78
+ </global>
79
+ <default>
80
+ <fancycompareconfig>
81
+ <fancycompare_group>
82
+ <fancycompare_load_jq>1</fancycompare_load_jq>
83
+ </fancycompare_group>
84
+ </fancycompareconfig>
85
+ </default>
86
+ </config>
app/code/local/Arvfc/Fancycompare/etc/system.xml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <config>
3
+ <tabs>
4
+ <fancycompare_tab module="fancycompare" translate="label">
5
+ <label>Fancycompare Config</label>
6
+ <sort_order>100</sort_order>
7
+ </fancycompare_tab>
8
+ </tabs>
9
+ <sections>
10
+ <fancycompareconfig module="fancycompare" translate="label">
11
+ <label>Configuration</label>
12
+ <sort_order>200</sort_order>
13
+ <show_in_default>1</show_in_default>
14
+ <show_in_website>1</show_in_website>
15
+ <show_in_store>1</show_in_store>
16
+ <tab>fancycompare_tab</tab>
17
+ <groups>
18
+ <fancycompare_group translate="label">
19
+ <label>Fancycompare Config</label>
20
+ <!--<comment>This is example of custom configuration.</comment>-->
21
+ <sort_order>10</sort_order>
22
+ <show_in_default>1</show_in_default>
23
+ <show_in_website>1</show_in_website>
24
+ <show_in_store>1</show_in_store>
25
+ <fields>
26
+ <fancycompare_load_jq translate="label comment">
27
+ <label>Load External jQuery</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
+ <comment>Set to No if external jQuery file should not be loaded (in case you already have jQuery added in your site).</comment>
35
+ </fancycompare_load_jq>
36
+ </fields>
37
+ </fancycompare_group>
38
+ </groups>
39
+ </fancycompareconfig>
40
+ </sections>
41
+ </config>
app/design/adminhtml/default/default/layout/fancycompare.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.1">
3
+ <fancycompare_adminhtml_fancycompare_index>
4
+ <reference name="content">
5
+ <block type="fancycompare/adminhtml_fancycompare" name="fancycompare" />
6
+ </reference>
7
+ </fancycompare_adminhtml_fancycompare_index>
8
+ </layout>
app/design/frontend/default/default/layout/fancycompare.xml ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.1">
3
+ <default>
4
+ <reference name="head">
5
+ <block type="core/text" name="google.cdn.jquery">
6
+ <action method="setText" ifconfig="fancycompareconfig/fancycompare_group/fancycompare_load_jq">
7
+ <text>
8
+ <![CDATA[<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script><script type="text/javascript">jQuery.noConflict();</script>]]>
9
+ </text>
10
+ </action>
11
+ </block>
12
+ <action method="addCss">
13
+ <stylesheet>fancycompare/css/fc.css</stylesheet>
14
+ </action>
15
+ </reference>
16
+ <reference name="compare">
17
+ <block type="catalog/product_compare_sidebar" before="cart_sidebar" name="catalog.compare.sidebar">
18
+ <action method="setTemplate">
19
+ <template>fancycompare/fancycompare.phtml</template>
20
+ </action>
21
+ </block>
22
+ </reference>
23
+ <reference name="footer">
24
+ <block type="fancycompare/fancycompare" name="fancycompare" after="-" template="fancycompare/fc_footer.phtml" />
25
+ </reference>
26
+ </default>
27
+ <fancycompare_index_index>
28
+ <reference name="content">
29
+ <block type="fancycompare/fancycompare" name="fancycompare" template="fancycompare/fancycompare.phtml" />
30
+ </reference>
31
+ </fancycompare_index_index>
32
+ <fancycompare_index_show>
33
+ <reference name="content">
34
+ <block type="fancycompare/product_compare_list" name="fancycompare.show" template="fancycompare/fclist.phtml" />
35
+ </reference>
36
+ </fancycompare_index_show>
37
+ </layout>
app/design/frontend/default/default/template/fancycompare/fancycompare.phtml ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* @var $this Mage_Catalog_Block_Product_Compare_Sidebar */
3
+ ?>
4
+ <?php
5
+ $_helper = $this->helper('catalog/product_compare');
6
+ $_items = $_helper->getItemCount() > 0 ? $_helper->getItemCollection() : null;
7
+ $fc_count = 4;
8
+ ?>
9
+
10
+ <style type="text/css">
11
+ </style>
12
+
13
+ <?php if ($_helper->getItemCount() < 1): ?>
14
+ <?php $display = 'display:none'; ?>
15
+ <?php endif; ?>
16
+ <div id="fc_parent" class="scroll" style="<?php echo $display ?>">
17
+ <div class="compare-items">
18
+ <?php $i = 1; ?>
19
+ <?php foreach($_items as $_index => $_item): ?>
20
+ <?php if ($i < 5): ?>
21
+ <?php $_product = Mage::getSingleton('catalog/product')->load($_item->getId()); ?>
22
+ <div class="compare-item" id="fc_<?php echo $_item->getId() ?>">
23
+ <div class="thumb_holder">
24
+ <img class="thumbnail" src="<?php echo $_product->getThumbnailUrl() ?>">
25
+ </div>
26
+ <p class="description"><a href="<?php echo $this->getProductUrl($_item) ?>" class="product-name"><?php echo $this->helper('catalog/output')->productAttribute($_item, $_item->getName(), 'name') ?></a></p>
27
+ <a href="<?php echo $_helper->getRemoveUrl($_item) ?>" class="fc_remove"><span class="delete" title="Remove"></span></a>
28
+ </div>
29
+ <?php $i++; ?>
30
+ <?php endif; ?>
31
+ <?php endforeach; ?>
32
+ <?php $diff = $fc_count - $_helper->getItemCount() ?>
33
+ <?php for ($i = 0; $i < $diff; $i++): ?>
34
+ <div class="compare-item empty_item">
35
+ <div class="thumb_holder">
36
+ <img class="thumbnail">
37
+ </div>
38
+ <p class="description">Add Another Item</p>
39
+ </div>
40
+ <?php endfor; ?>
41
+ </div>
42
+ <div class="compare-controls">
43
+ <button type="button" title="<?php echo $this->__('Compare') ?>" class="button fc_compare_btn" ><span><span><?php echo $this->__('Compare') ?></span></span></button>
44
+ <span id="fc_close" class="fc_close" title="Close & clear compare items"></span>
45
+ </div>
46
+ </div>
47
+
48
+ <div id="fc_r">
49
+ <div id="fc_result_par">
50
+ <div id="fc_result"></div>
51
+ </div>
52
+ <div class="fc_r_cl">
53
+ <span title="Close" class="fc_close"></span>
54
+ </div>
55
+ </div>
56
+
57
+ <script type="text/javascript">
58
+ var fc_count = '<?php echo $fc_count ?>';
59
+ var fc_base_url = '<?php echo $this->getUrl('fancycompare/index') ?>';
60
+ </script>
app/design/frontend/default/default/template/fancycompare/fc_footer.phtml ADDED
@@ -0,0 +1,261 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+ jQuery(document).ready(function() {
3
+ var fc_parent = jQuery("#fc_parent");
4
+ var fc_result = jQuery("#fc_result");
5
+ var fc_loaded = 0;
6
+
7
+ centerFC('fc_parent', "hor");
8
+ function centerFC(ID, align) {
9
+ var el = jQuery("#"+ID);
10
+ var _width = el.width();
11
+ var m = "-" + parseFloat(_width/2) + 'px';
12
+ if (align == "hor") {
13
+ var cssObj = {'marginLeft':m, 'marginRight':m, 'left': '50%'};
14
+ } else if (align == "hor_vert") {
15
+ var _height = el.height();
16
+ var mh = "-" + parseFloat(_height/2) + 'px';
17
+ var cssObj = {'marginLeft':m, 'marginRight':m, 'left': '50%', 'marginTop':mh, 'marginBottom':mh, 'top': '50%'};
18
+ if (ID == "fc_r") {
19
+ jQuery("#fc_result_par").css('max-height', _height+'px');
20
+ }
21
+ }
22
+ el.css(cssObj);
23
+ }
24
+
25
+ /** Compare the items **/
26
+ jQuery(document).on("click", ".fc_compare_btn", function(e) {
27
+ e.preventDefault();
28
+ var _this = jQuery(this);
29
+ var item_count = jQuery(".compare-items .compare-item").filter(":visible").not(".empty_item").length;
30
+ if (item_count <= 1) {
31
+ return false;
32
+ }
33
+ if (fc_loaded) {
34
+ jQuery("#fc_r").show();
35
+ /*Show/hide the floating bar*/
36
+ jQuery("#fc_parent").toggle();
37
+ return false;
38
+ }
39
+ jQuery.ajax({
40
+ url: fc_base_url + "show",
41
+ type: "POST",
42
+ async: false,
43
+ beforeSend: function() {
44
+ _this.attr("disabled", "disabled");
45
+ _this.find("span span").text("Please wait...");
46
+ }
47
+ }).done(function(data) {
48
+ var par = jQuery("#fc_r");
49
+ par.show().find("#fc_result").html(data);
50
+ _this.removeAttr("disabled");
51
+ _this.find("span span").text("Compare");
52
+ fc_loaded = 1;
53
+ centerFC("fc_r", "hor_vert");
54
+
55
+ /*Hide the floating bar*/
56
+ jQuery("#fc_parent").hide();
57
+ });
58
+ });
59
+
60
+ /** Close compare popup box **/
61
+ jQuery(document).on("click", ".fc_r_cl", function(e) {
62
+ e.preventDefault();
63
+ jQuery("#fc_r").hide();
64
+ /*Show the floating bar*/
65
+ jQuery("#fc_parent").show();
66
+ addEmptyFCItem();
67
+ });
68
+
69
+ /** Add to cart **/
70
+ jQuery(document).on("click", "#fc_result .btn-cart", function(e) {
71
+ e.preventDefault();
72
+ var _this = jQuery(this);
73
+ var item = jQuery(this).closest("td");
74
+ var ID = item.attr("id").split("fc_atc_");
75
+ var pid = jQuery.trim(ID[1]);
76
+ if (!pid || pid == "" || pid == "undefined") {
77
+ return false;
78
+ }
79
+ jQuery.ajax({
80
+ url: fc_base_url + "addtocart",
81
+ type: "POST",
82
+ dataType: "json",
83
+ data: "product="+pid,
84
+ beforeSend: function() {
85
+ _this.find("span span").text("Adding...");
86
+ }
87
+ }).done(function(data) {
88
+ if(data) {
89
+ if (data.status == "success") {
90
+ _this.attr("disabled", "disabled");
91
+ _this.find("span span").text("In Cart");
92
+ }
93
+ }
94
+ });
95
+ });
96
+
97
+ /** Add to wishlist **/
98
+ jQuery(document).on("click", "#fc_result .link-wishlist", function(e) {
99
+ e.preventDefault();
100
+ var _this = jQuery(this);
101
+ var item = jQuery(this).closest("td");
102
+ var ID = item.attr("id").split("fc_atc_");
103
+ var pid = jQuery.trim(ID[1]);
104
+ if (!pid || pid == "" || pid == "undefined") {
105
+ return false;
106
+ }
107
+ _this.text("Adding...");
108
+ addToWishlist(pid).done(function(data) {
109
+ if(data) {
110
+ if (data.status == "success") {
111
+ _this.hide();
112
+ } else if (data.status == "error") {
113
+ _this.text("Add to Wishlist");
114
+ alert(data.message);
115
+ }
116
+ }
117
+ });
118
+ });
119
+ function addToWishlist(pid) {
120
+ return jQuery.ajax({
121
+ url: fc_base_url + "addtowishlist",
122
+ type: "POST",
123
+ dataType: "json",
124
+ data: "product="+pid
125
+ })
126
+ }
127
+
128
+ /** Add to compare **/
129
+ jQuery(document).on("click", ".link-compare", function(e) {
130
+ var _this = jQuery(this);
131
+ var href = _this.attr("href").split("add/product/");
132
+ var pid = parseInt(href[1], 10);
133
+ if (jQuery("#fc_r").is(':visible')) {
134
+ return false;
135
+ }
136
+ if (!pid || pid == "" || pid == "undefined") {
137
+ return true;
138
+ } else {
139
+ e.preventDefault();
140
+ _this.text("Adding...");
141
+ addToCompare(pid).done(function(data) {
142
+ if(data) {
143
+ if (data.status == "success") {
144
+ _this.hide();
145
+ if (data.pData && data.pid) {
146
+ jQuery("#fc_parent").show().find(".compare-item.empty_item:first").html(data.pData).removeClass("empty_item").attr("id", "fc_"+data.pid);
147
+ } else {
148
+ jQuery("#fc_parent").show();
149
+ }
150
+ fc_loaded = 0;
151
+ } else if (data.status == "error") {
152
+ _this.text("Add to Compare");
153
+ alert(data.message);
154
+ }
155
+ }
156
+ });
157
+ }
158
+ });
159
+ function addToCompare(pid) {
160
+ return jQuery.ajax({
161
+ url: fc_base_url + "addtocompare",
162
+ type: "POST",
163
+ dataType: "json",
164
+ data: "product="+pid
165
+ })
166
+ }
167
+
168
+ /** Remove the item from compare list **/
169
+ jQuery(document).on("click", ".fc_remove", function(e) {
170
+ e.preventDefault();
171
+ var item = jQuery(this).closest(".compare-item");
172
+ var pid = jQuery.trim(item.attr("id")).split("fc_");
173
+ if (!pid[1] || pid[1] == "" || pid[1] == "undefined") {
174
+ return false;
175
+ } else {
176
+ removeItem(pid[1]).done(function(data) {
177
+ if(data) {
178
+ if (data.status == "success") {
179
+ item.hide("slow", function() {
180
+ addEmptyFCItem();
181
+ });
182
+ fc_loaded = 0;
183
+ }
184
+ }
185
+ });
186
+ }
187
+ });
188
+ jQuery(document).on("click", ".btn-remove.fc_rm", function(e) {
189
+ e.preventDefault();
190
+ var TD = jQuery(this).closest("td");
191
+ var ID = TD.attr("id").split("_");
192
+ if (ID[2] && ID[2] != "" && ID[2] != "undefined") {
193
+ removeItem(ID[2]).done(function(data) {
194
+ if(data) {
195
+ if (data.status == "success") {
196
+ var ind = TD.index();
197
+ ind = ind - 1;
198
+ jQuery("#product_comparison").find("tr").each(function() {
199
+ if (data.fc_count <= 2) {
200
+ jQuery("#product_comparison").find(".btn-remove.fc_rm").hide();
201
+ }
202
+ jQuery(this).find("td:eq("+ind+")").remove();
203
+ jQuery("#product_comparison").find("colgroup col:eq("+ind+")").remove();
204
+ centerFC("fc_r", "hor_vert");
205
+ });
206
+ fc_loaded = 0;
207
+ /** Remove item from floating bar **/
208
+ jQuery("#fc_parent").find("#fc_" + ID[2]).remove();
209
+ }
210
+ }
211
+ });
212
+ }
213
+ });
214
+ function removeItem(pid) {
215
+ return jQuery.ajax({
216
+ url: fc_base_url + "remove",
217
+ type: "POST",
218
+ dataType: "json",
219
+ data: "product="+pid
220
+ });
221
+ }
222
+ function addEmptyFCItem() {
223
+ var item_count = jQuery(".compare-items").find(".compare-item").filter(':visible').length;
224
+ var diff = fc_count - item_count;
225
+ if (diff > 0) {
226
+ var htm = '<div class="compare-item empty_item">';
227
+ htm += '<div class="thumb_holder">';
228
+ htm += '<img class="thumbnail">';
229
+ htm += '</div>';
230
+ htm += '<p class="description">Add Another Item</p>';
231
+ htm += '</div>';
232
+ for (var i=0; i<diff; i++) {
233
+ jQuery(".compare-items").append(htm);
234
+ }
235
+ }
236
+ }
237
+
238
+ /** Close & clear the compare floating bar **/
239
+ jQuery(document).on("click", "#fc_close", function(e) {
240
+ e.preventDefault();
241
+ jQuery.ajax({
242
+ url: fc_base_url + "clear",
243
+ type: "POST",
244
+ dataType: "json"
245
+ }).done(function(data) {
246
+ if(data) {
247
+ if (data.status == "success") {
248
+ jQuery("#fc_parent").slideUp();
249
+ } else if (data.status == "error") {
250
+ alert(data.message);
251
+ }
252
+ }
253
+ });
254
+ });
255
+
256
+ function cl(str) {
257
+ console.log(str);
258
+ }
259
+
260
+ });
261
+ </script>
app/design/frontend/default/default/template/fancycompare/fclist.phtml ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_total=$this->getItems()->getSize() ?>
2
+ <?php if($_total): ?>
3
+ <table class="data-table compare-table" id="product_comparison">
4
+ <?php $_i=0 ?>
5
+ <?php foreach($this->getItems() as $_item): ?>
6
+ <?php if($_i++%10==0): ?>
7
+ <col width="1" />
8
+ <?php endif; ?>
9
+ <col width="<?php echo floor(100/$_total); ?>%" />
10
+ <?php endforeach; ?>
11
+ <?php if ($_total>2): ?>
12
+ <thead>
13
+ <tr>
14
+ <?php $_i=0 ?>
15
+ <?php foreach($this->getItems() as $_item): ?>
16
+ <?php if($_i++%10==0): ?>
17
+ <th>&nbsp;</th>
18
+ <?php endif; ?>
19
+ <td class="a-right" id="fc_rm_<?php echo $_item->getId() ?>"><a href="#" class="btn-remove fc_rm" title="<?php echo $this->__('Remove This Item') ?>"><?php echo $this->__('Remove This Item') ?></a></td>
20
+ <?php endforeach; ?>
21
+ </tr>
22
+ </thead>
23
+ <?php endif ?>
24
+ <tbody>
25
+ <tr class="product-shop-row">
26
+ <?php $_i=0 ?>
27
+ <?php foreach($this->getItems() as $_item): ?>
28
+ <?php if($_i++%10==0): ?>
29
+ <th>&nbsp;</th>
30
+ <?php endif; ?>
31
+ <td>
32
+ <a class="product-image" href="#" onclick="setPLocation('<?php echo $this->getProductUrl($_item) ?>', true)" title="<?php echo $this->stripTags($_item->getName(), null, true) ?>"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'small_image')->resize(125, 125); ?>" width="125" height="125" alt="<?php echo $this->stripTags($_item->getName(), null, true) ?>" /></a>
33
+ <h2 class="product-name"><a href="#" onclick="setPLocation('<?php echo $this->getProductUrl($_item) ?>', true)" title="<?php echo $this->stripTags($_item->getName(), null, true) ?>"><?php echo $this->helper('catalog/output')->productAttribute($_item, $_item->getName(), 'name') ?></a></h2>
34
+ <?php echo $this->getReviewsSummaryHtml($_item, 'short') ?>
35
+ <?php echo $this->getPriceHtml($_item, true, '-compare-list-top') ?>
36
+ <!--
37
+ <?php if($_item->isSaleable()): ?>
38
+ <p id="<?php echo $_item->getId() ?>"><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
39
+ <?php else: ?>
40
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
41
+ <?php endif; ?>
42
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
43
+ <ul class="add-to-links">
44
+ <li><a href="<?php echo $this->getAddToWishlistUrl($_item) ?>" class="link-wishlist" onclick="setPLocation(this.href, true)"><?php echo $this->__('Add to Wishlist') ?></a></li>
45
+ </ul>
46
+ <?php endif; ?>
47
+ -->
48
+ </td>
49
+ <?php endforeach; ?>
50
+ </tr>
51
+ </tbody>
52
+ <tbody>
53
+ <?php foreach ($this->getAttributes() as $_attribute): ?>
54
+ <tr>
55
+ <?php $_i=0 ?>
56
+ <?php foreach($this->getItems() as $_item): ?>
57
+ <?php if($_i++%10==0): ?>
58
+ <th><span class="nobr"><?php echo $_attribute->getStoreLabel() ?></span></th>
59
+ <?php endif; ?>
60
+ <td>
61
+ <?php switch ($_attribute->getAttributeCode()) {
62
+ case "price": ?>
63
+ <?php echo $this->getPriceHtml($_item, true, '-compare-list-' . $_attribute->getCode()) ?>
64
+ <?php break;
65
+ case "small_image": ?>
66
+ <img src="<?php echo $this->helper('catalog/image')->init($_item, 'small_image')->resize(125, 125); ?>" width="125" height="125" alt="<?php echo $this->htmlEscape($_item->getName()) ?>" title="<?php echo $this->htmlEscape($_item->getName()) ?>" />
67
+ <?php break;
68
+ case "date":
69
+ echo substr($this->getProductAttributeValue($_item, $_attribute),0,10);
70
+ break;
71
+ default: ?>
72
+ <div class="std">
73
+ <?php echo $this->helper('catalog/output')->productAttribute($_item, $this->getProductAttributeValue($_item, $_attribute), $_attribute->getAttributeCode()) ?>
74
+ </div>
75
+ <?php break;
76
+ } ?>
77
+ </td>
78
+ <?php endforeach; ?>
79
+ </tr>
80
+ <?php endforeach; ?>
81
+ </tbody>
82
+ <tbody>
83
+ <tr class="add-to-row">
84
+ <?php $_i=0 ?>
85
+ <?php foreach($this->getItems() as $_item): ?>
86
+ <?php if($_i++%10==0): ?>
87
+ <th>&nbsp;</th>
88
+ <?php endif; ?>
89
+ <td id="fc_atc_<?php echo $_item->getId() ?>">
90
+ <?php echo $this->getPriceHtml($_item, true, '-compare-list-bottom') ?>
91
+ <?php if($_item->isSaleable()): ?>
92
+ <p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
93
+ <?php else: ?>
94
+ <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
95
+ <?php endif; ?>
96
+ <?php if ($this->helper('wishlist')->isAllow()) : ?>
97
+ <ul class="add-to-links">
98
+ <li><a href="<?php echo $this->getAddToWishlistUrl($_item);?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
99
+ </ul>
100
+ <?php endif; ?>
101
+ </td>
102
+ <?php endforeach; ?>
103
+ </tr>
104
+ </tbody>
105
+ </table>
106
+ <script type="text/javascript">
107
+ jQuery(document).ready(function(){
108
+ var _w = jQuery("#fc_r").outerWidth();
109
+ var m = "-" + parseFloat(_w/2) + 'px';
110
+ var cssObj = {'marginLeft':m, 'marginRight':m, 'left': '50%'};
111
+ jQuery("#fc_r").css(cssObj);
112
+ });
113
+ decorateTable('product_comparison');
114
+
115
+ /**
116
+ * Send remove item request, after that reload windows
117
+ */
118
+ /*
119
+ function removeItem(url)
120
+ {
121
+ new Ajax.Request(url, {
122
+ parameters: {isAjax: 1, method: 'POST'},
123
+ onLoading: function(){$('compare-list-please-wait').show();},
124
+ onSuccess: function(transport) {
125
+ $('compare-list-please-wait').hide();
126
+ window.location.reload();
127
+ window.opener.location.reload();
128
+ }
129
+ });
130
+ }
131
+ */
132
+ </script>
133
+ <?php else: ?>
134
+ <script type="text/javascript">window.close();</script>
135
+ <?php endif; ?>
app/etc/modules/Arvfc_Fancycompare.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Arvfc_Fancycompare>
5
+ <active>false</active>
6
+ <codePool>local</codePool>
7
+ </Arvfc_Fancycompare>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Fancy_Product_Compare</name>
4
+ <version>0.1.2</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">Open Software License (OSL)</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Fancy Product Compare Magento extension allows the visitors on your Magento store to compare the products in a very convenient way. Product comparison is done in a fancy popup window where user can add the product to cart or wishlist.</summary>
10
+ <description>Fancy Product Compare Magento extension allows the visitors on your Magento store to compare the products in a very convenient way. Product comparison is done in a fancy popup window where user can add the product to cart or wishlist.&#xD;
11
+ &#xD;
12
+ Here are the features of this extension:&#xD;
13
+ Beautiful UI &#xD;
14
+ AJAXified product compare&#xD;
15
+ AJAXified add to wishlist &#xD;
16
+ AJAXified add to cart</description>
17
+ <notes>Fancy Product Compare extension released.</notes>
18
+ <authors><author><name>Arvind Bhardwaj</name><user>Arvind07</user><email>bhardwajsonheight@gmail.com</email></author></authors>
19
+ <date>2013-04-08</date>
20
+ <time>04:59:38</time>
21
+ <contents><target name="mageetc"><dir name="modules"><file name="Arvfc_Fancycompare.xml" hash="468d48244d5befc65467e6218caa6bcb"/></dir></target><target name="magelocal"><dir name="Arvfc"><dir name="Fancycompare"><dir name="Block"><file name="Fancycompare.php" hash="5d3be8cbfe6358ab0b2367127453d9b1"/><dir name="Product"><dir name="Compare"><file name="List.php" hash="695aa1f353a0c7f532279f70d6774257"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="ebca955fa96e3b4df3cf06c199513b4d"/></dir><dir name="controllers"><file name="IndexController.php" hash="f1b2603b13866c5b21729c066d026324"/></dir><dir name="etc"><file name="adminhtml.xml" hash="193ea0c9a4df972af658e4372759a846"/><file name="config.xml" hash="4050607b2e3016afa558a70232dccfe3"/><file name="system.xml" hash="7026fa926d3047439fa91f6042eaa498"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="fancycompare.xml" hash="926b49fb28acb3149d0fb97138b670d8"/></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="fancycompare.xml" hash="30686366e7aa4187fccd51d84c221c30"/></dir><dir name="template"><dir name="fancycompare"><file name="fancycompare.phtml" hash="8ba276131388b0b767d086e71385872f"/><file name="fc_footer.phtml" hash="b1214fb613f93059d64aa92cbebf0c61"/><file name="fclist.phtml" hash="9ec09c4eab174e96b7bfe4abd704aefd"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="fancycompare"><dir name="css"><file name="fc.css" hash="8b843f5305c0a40df69b1e99027b83c8"/></dir><dir name="images"><file name="fc_add_item.jpg" hash="454c2f17a96a516428b3775fdb3c50e6"/><file name="fc_close_icon.png" hash="b76b906503ba64b8b61931fbe4754fda"/><file name="fc_item_close.gif" hash="346e26eece27449a2f224aef76ae372e"/></dir></dir></dir></dir></dir></target></contents>
22
+ <compatible/>
23
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
24
+ </package>
skin/frontend/default/default/fancycompare/css/fc.css ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #fc_parent {
2
+ width: 712px;
3
+ border: 1px solid red;
4
+ margin-bottom: 10px;
5
+ z-index: 40;
6
+ background-color: #d7eaf0;
7
+ border: 1px solid #a9d9e7;
8
+ font-size: 11px;
9
+ margin: 6px 6px 0 0;
10
+ overflow: visible;
11
+ }
12
+ #fc_parent.static {
13
+
14
+ }
15
+ #fc_parent.scroll {
16
+ position: fixed;
17
+ top: 0;
18
+ }
19
+ #fc_parent .compare-items {
20
+ float: left;
21
+ height: 68px;
22
+ overflow: hidden;
23
+ }
24
+ .compare-items .compare-item {
25
+ background-color: #e7f2f6;
26
+ float: left;
27
+ height: 58px;
28
+ width: 130px;
29
+ position: relative;
30
+ margin: 4px 18px 0 5px;
31
+ }
32
+ .compare-items .compare-item .thumb_holder {
33
+ border: 1px solid #a9d9e7;
34
+ background-color: #FFF;
35
+ display: block;
36
+ float: left;
37
+ height: 50px;
38
+ margin: 3px 4px 3px 3px;
39
+ width: 43px;
40
+ }
41
+ .compare-items .compare-item.empty_item .thumb_holder {
42
+ background: url("../images/fc_add_item.jpg") no-repeat scroll 0 4px white;
43
+ }
44
+ .compare-items .compare-item .thumb_holder IMG {
45
+ max-height: 42px;
46
+ max-width: 42px;
47
+ margin: 6px auto 0;
48
+ display: block;
49
+ }
50
+ .compare-items .compare-item P {
51
+ display: block;
52
+ height: 54px;
53
+ margin-top: 3px;
54
+ overflow: hidden;
55
+ text-align: left;
56
+ width: 72px;
57
+ }
58
+ .compare-items .compare-item.empty_item P {
59
+ color: #999;
60
+ }
61
+ .compare-item .delete, .compare-cart-wrapper .close {
62
+ background: url("../images/fc_item_close.gif") transparent;
63
+ cursor: pointer;
64
+ display: block;
65
+ height: 16px;
66
+ position: absolute;
67
+ right: -8px;
68
+ bottom: -7px;
69
+ width: 17px;
70
+ }
71
+ #fc_parent .compare-controls {
72
+ float: right;
73
+ height: 68px;
74
+ left: -5px;
75
+ position: relative;
76
+ text-align: left;
77
+ width: 90px;
78
+ }
79
+ #fc_parent button {
80
+ margin: 22px 10px 0 0;
81
+ }
82
+ .fc_close {
83
+ background: url("../images/fc_close_icon.png") transparent;
84
+ height: 16px;
85
+ width: 16px;
86
+ cursor: pointer;
87
+ right: -12px;
88
+ top: -4px;
89
+ display: block;
90
+ position: absolute;
91
+ bottom: -4px;
92
+ }
93
+ #fc_r {
94
+ position: fixed;
95
+ min-height: 40%;
96
+ max-height: 80%;
97
+ min-width: 40%;
98
+ max-width: 80%;
99
+ display: none;
100
+ box-shadow: 0 1px 30px #000000;
101
+ background-color: #ffffff;
102
+ border: 1px solid #eeeeee;
103
+ border-radius: 5px;
104
+ overflow: visible;
105
+ z-index: 10;
106
+ }
107
+ #fc_result_par {
108
+ overflow: auto;
109
+ }
110
+ #fc_result {
111
+ padding:5px;
112
+ }
113
+ #fc_r .fc_r_cl {
114
+ float: right;
115
+ height: 100%;
116
+ position: absolute;
117
+ right: 4px;
118
+ top: -5px;
119
+ }
skin/frontend/default/default/fancycompare/images/fc_add_item.jpg ADDED
Binary file
skin/frontend/default/default/fancycompare/images/fc_close_icon.png ADDED
Binary file
skin/frontend/default/default/fancycompare/images/fc_item_close.gif ADDED
Binary file