HardikAjaxCart - Version 2.0.1

Version Notes

Finally, added bundle product add to cart from listing page via ajax.

Also, fixed compare product stopped working issue.

Download this release

Release Info

Developer Hardik Gajjar
Extension HardikAjaxCart
Version 2.0.1
Comparing to
See all releases


Code changes from version 2.0.0 to 2.0.1

app/code/local/Hardik/Ajaxcart/Model/Observer.php CHANGED
@@ -63,7 +63,7 @@ class Hardik_Ajaxcart_Model_Observer {
63
  $_response = Mage::getModel('ajaxcart/response');
64
 
65
  $product = Mage::registry('current_product');
66
- if (!$product->isConfigurable()){return false;exit;}
67
 
68
  //append configurable options block
69
  $_response->addConfigurableOptionsBlock($_response);
63
  $_response = Mage::getModel('ajaxcart/response');
64
 
65
  $product = Mage::registry('current_product');
66
+ if (!$product->isConfigurable() && !$product->getTypeId() == 'bundle'){return false;exit;}
67
 
68
  //append configurable options block
69
  $_response->addConfigurableOptionsBlock($_response);
app/code/local/Hardik/Ajaxcart/Model/Response.php CHANGED
@@ -41,6 +41,14 @@ class Hardik_Ajaxcart_Model_Response extends Mage_Catalog_Block_Product_Abstract
41
  $_product = Mage::registry('current_product');
42
 
43
  $layout->getUpdate()->addHandle('ajaxcart_configurable_options');
 
 
 
 
 
 
 
 
44
  $layout->getUpdate()->load();
45
  $layout->generateXml();
46
  $layout->generateBlocks();
@@ -51,6 +59,14 @@ class Hardik_Ajaxcart_Model_Response extends Mage_Catalog_Block_Product_Abstract
51
  $res .= $value->toHtml();
52
  }
53
 
 
 
 
 
 
 
 
 
54
  if (!empty($res)) {
55
  $_response->setConfigurableOptionsBlock($res);
56
  }
@@ -61,6 +77,11 @@ class Hardik_Ajaxcart_Model_Response extends Mage_Catalog_Block_Product_Abstract
61
  $res = '';
62
 
63
  $layout->getUpdate()->addHandle('ajaxcart_grouped_options');
 
 
 
 
 
64
  $layout->getUpdate()->load();
65
  $layout->generateXml();
66
  $layout->generateBlocks();
41
  $_product = Mage::registry('current_product');
42
 
43
  $layout->getUpdate()->addHandle('ajaxcart_configurable_options');
44
+
45
+ if ($_product->getTypeId() == 'bundle')
46
+ $layout->getUpdate()->addHandle('ajaxcart_bundle_options');
47
+
48
+ // set unique cache ID to bypass caching
49
+ $cacheId = 'LAYOUT_'.Mage::app()->getStore()->getId().md5(join('__', $layout->getUpdate()->getHandles()));
50
+ $layout->getUpdate()->setCacheId($cacheId);
51
+
52
  $layout->getUpdate()->load();
53
  $layout->generateXml();
54
  $layout->generateBlocks();
59
  $res .= $value->toHtml();
60
  }
61
 
62
+ if ($_product->getTypeId() == 'bundle') {
63
+ $value = $layout->getBlock('product.info.bundle');
64
+
65
+ if ($value) {
66
+ $res .= $value->toHtml();
67
+ }
68
+ }
69
+
70
  if (!empty($res)) {
71
  $_response->setConfigurableOptionsBlock($res);
72
  }
77
  $res = '';
78
 
79
  $layout->getUpdate()->addHandle('ajaxcart_grouped_options');
80
+
81
+ // set unique cache ID to bypass caching
82
+ $cacheId = 'LAYOUT_'.Mage::app()->getStore()->getId().md5(join('__', $layout->getUpdate()->getHandles()));
83
+ $layout->getUpdate()->setCacheId($cacheId);
84
+
85
  $layout->getUpdate()->load();
86
  $layout->generateXml();
87
  $layout->generateBlocks();
app/code/local/Hardik/Ajaxcart/etc/config.xml CHANGED
@@ -7,7 +7,7 @@
7
  <config>
8
  <modules>
9
  <Hardik_Ajaxcart>
10
- <version>2.0.0</version>
11
  </Hardik_Ajaxcart>
12
  </modules>
13
  <global>
7
  <config>
8
  <modules>
9
  <Hardik_Ajaxcart>
10
+ <version>2.0.1</version>
11
  </Hardik_Ajaxcart>
12
  </modules>
13
  <global>
app/design/frontend/base/default/layout/ajaxcart.xml CHANGED
@@ -30,6 +30,10 @@
30
  <action method="addJs">
31
  <script>varien/configurable.js</script>
32
  </action>
 
 
 
 
33
 
34
  <action method="addItem">
35
  <type>js_css</type>
@@ -129,6 +133,16 @@
129
  </block>
130
  </reference>
131
  </ajaxcart_configurable_options>
 
 
 
 
 
 
 
 
 
 
132
  <ajaxcart_grouped_options translate="label" module="catalog">
133
  <reference name="content">
134
  <block type="catalog/product_view" name="ajaxcart.grouped.options"
30
  <action method="addJs">
31
  <script>varien/configurable.js</script>
32
  </action>
33
+ <action method="addItem">
34
+ <type>skin_js</type>
35
+ <name>js/bundle.js</name>
36
+ </action>
37
 
38
  <action method="addItem">
39
  <type>js_css</type>
133
  </block>
134
  </reference>
135
  </ajaxcart_configurable_options>
136
+ <ajaxcart_bundle_options>
137
+ <reference name="content">
138
+ <block type="bundle/catalog_product_view_type_bundle" name="product.info.bundle" as="product_type_data" template="bundle/catalog/product/view/type/bundle.phtml">
139
+ <action method="addPriceBlockType"><type>bundle</type><block>bundle/catalog_product_price</block><template>bundle/catalog/product/price.phtml</template></action>
140
+ <block type="bundle/catalog_product_price" name="bundle.prices" as="bundle_prices" template="bundle/catalog/product/view/price.phtml">
141
+ <action method="setMAPTemplate"><tmpl>catalog/product/price_msrp_item.phtml</tmpl></action>
142
+ </block>
143
+ </block>
144
+ </reference>
145
+ </ajaxcart_bundle_options>
146
  <ajaxcart_grouped_options translate="label" module="catalog">
147
  <reference name="content">
148
  <block type="catalog/product_view" name="ajaxcart.grouped.options"
package.xml CHANGED
@@ -1,18 +1,20 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>HardikAjaxCart</name>
4
- <version>2.0.0</version>
5
  <stability>stable</stability>
6
  <license>OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>provides ajax cart functionality. It is highly customizable.</summary>
10
  <description>Now, it provides ajax add to cart functionality for configurable and group products too.</description>
11
- <notes>Now, it provides ajax add to cart functionality for configurable and group products too.</notes>
 
 
12
  <authors><author><name>Hardik Gajjar</name><user>hardik_krishinc</user><email>hardik.gajjar@krishinc.com</email></author></authors>
13
- <date>2013-03-09</date>
14
- <time>06:19:57</time>
15
- <contents><target name="mageetc"><dir name="modules"><file name="Hardik_Ajaxcart.xml" hash="81451d4f81af3650b8151344bbc1e865"/></dir></target><target name="magelocal"><dir name="Hardik"><dir name="Ajaxcart"><dir name="Block"><dir name="Adminhtml"><file name="Info.php" hash="8fab3b7d0b1390dcc80a037c66b1ba7f"/><file name="Url.php" hash="ed7b1ff4b0f4ad33d45cfd301dba4227"/></dir></dir><dir name="Helper"><file name="Data.php" hash="773174c4f49cccc57be68acb1e0027e5"/></dir><dir name="Model"><file name="Observer.php" hash="02e26817e97a3551aa073c8c94b95d7c"/><file name="Response.php" hash="868b38cbc9982d6d08640113304bc4ef"/></dir><dir name="controllers"><dir name="Checkout"><file name="CartController.php" hash="8e0e56d6627539bb6a342df80a80af9f"/></dir></dir><dir name="etc"><file name="config.xml" hash="672e7a86f4930c6957f3084bfff6a37e"/><file name="system.xml" hash="70e92e5d3c03d7b462e72ba3a8eaca1f"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="ajaxcart.xml" hash="8dc157b66eb88903fa06d4494b198580"/></dir><dir name="template"><dir name="ajaxcart"><file name="configurable_options.phtml" hash="c1d55b5cea9ba6fc2568251d99c3b789"/><file name="grouped_options.phtml" hash="7409b93efccff6dbabd5c4c8a19b0cda"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="ajaxcart"><file name="ajaxcart.js" hash="2e6949c43c3bd312158da4e4107785ec"/><file name="growler.css" hash="c13a01e28cb4eb98b1fbc4a419d906cf"/><file name="growler.js" hash="816d275972bbe9c048033643755fb194"/><file name="modalbox.css" hash="9dfad4d258cbfe5af951f1bc7f7f82c7"/><file name="modalbox.js" hash="7aa6bdceed4379c80f47788ae21f1464"/></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>HardikAjaxCart</name>
4
+ <version>2.0.1</version>
5
  <stability>stable</stability>
6
  <license>OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>provides ajax cart functionality. It is highly customizable.</summary>
10
  <description>Now, it provides ajax add to cart functionality for configurable and group products too.</description>
11
+ <notes>Finally, added bundle product add to cart from listing page via ajax.&#xD;
12
+ &#xD;
13
+ Also, fixed compare product stopped working issue.</notes>
14
  <authors><author><name>Hardik Gajjar</name><user>hardik_krishinc</user><email>hardik.gajjar@krishinc.com</email></author></authors>
15
+ <date>2013-07-13</date>
16
+ <time>08:39:06</time>
17
+ <contents><target name="mageetc"><dir name="modules"><file name="Hardik_Ajaxcart.xml" hash="81451d4f81af3650b8151344bbc1e865"/></dir></target><target name="magelocal"><dir name="Hardik"><dir name="Ajaxcart"><dir name="Block"><dir name="Adminhtml"><file name="Info.php" hash="8fab3b7d0b1390dcc80a037c66b1ba7f"/><file name="Url.php" hash="ed7b1ff4b0f4ad33d45cfd301dba4227"/></dir></dir><dir name="Helper"><file name="Data.php" hash="773174c4f49cccc57be68acb1e0027e5"/></dir><dir name="Model"><file name="Observer.php" hash="13e2cb8fea9e79dc84593b1174d7ec5a"/><file name="Response.php" hash="b4508819058f7fd656a4e65fab9fe4c9"/></dir><dir name="controllers"><dir name="Checkout"><file name="CartController.php" hash="8e0e56d6627539bb6a342df80a80af9f"/></dir></dir><dir name="etc"><file name="config.xml" hash="7b2d34f0f2543bcbf51961c42edf7479"/><file name="system.xml" hash="70e92e5d3c03d7b462e72ba3a8eaca1f"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="ajaxcart.xml" hash="14885283aa1764dc7aba659ac16d73a3"/></dir><dir name="template"><dir name="ajaxcart"><file name="configurable_options.phtml" hash="c1d55b5cea9ba6fc2568251d99c3b789"/><file name="grouped_options.phtml" hash="7409b93efccff6dbabd5c4c8a19b0cda"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="ajaxcart"><file name="ajaxcart.js" hash="e5aacc5eaa0458dd5ca9d57b05cc6adf"/><file name="growler.css" hash="c13a01e28cb4eb98b1fbc4a419d906cf"/><file name="growler.js" hash="816d275972bbe9c048033643755fb194"/><file name="modalbox.css" hash="9dfad4d258cbfe5af951f1bc7f7f82c7"/><file name="modalbox.js" hash="7aa6bdceed4379c80f47788ae21f1464"/><file name="spinner.gif" hash="58625c045f515052999e13aed5059b07"/></dir></dir></dir></dir></target></contents>
18
  <compatible/>
19
  <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
20
  </package>
skin/frontend/base/default/ajaxcart/ajaxcart.js CHANGED
@@ -213,7 +213,7 @@ var ajaxcart = {
213
  document.location.reload(true);
214
  }
215
  } catch(e) {
216
- //window.location.href = url;
217
  //document.location.reload(true);
218
  }
219
  }
@@ -276,6 +276,9 @@ var ajaxcart = {
276
  }
277
  });
278
  _this.bindEvents();
 
 
 
279
  } catch(e) {
280
  console.log(e);
281
  }
@@ -287,12 +290,16 @@ var ajaxcart = {
287
  try {
288
  var _this = this;
289
  //$$('body')[0].insert({bottom: new Element('div', {id: 'modalboxOptions'}).update(block)});
290
- Modalbox.show(new Element('div', {
291
  id: 'modalboxOptions'
292
- }).update(block),
 
 
 
293
  {
294
  title: 'Please Select Options',
295
- width: 300,
 
296
  afterLoad: function() {
297
  _this.extractScripts(block);
298
  _this.bindEvents();
@@ -335,6 +342,8 @@ var setLocation = (function() {
335
  };
336
  })();
337
 
 
 
338
  document.observe("dom:loaded", function() {
339
  ajaxcart.initialize();
340
  });
213
  document.location.reload(true);
214
  }
215
  } catch(e) {
216
+ window.location.href = url;
217
  //document.location.reload(true);
218
  }
219
  }
276
  }
277
  });
278
  _this.bindEvents();
279
+
280
+ // show details tooltip
281
+ truncateOptions();
282
  } catch(e) {
283
  console.log(e);
284
  }
290
  try {
291
  var _this = this;
292
  //$$('body')[0].insert({bottom: new Element('div', {id: 'modalboxOptions'}).update(block)});
293
+ var element = new Element('div', {
294
  id: 'modalboxOptions'
295
+ }).update(block);
296
+
297
+ var viewport = document.viewport.getDimensions();
298
+ Modalbox.show(element,
299
  {
300
  title: 'Please Select Options',
301
+ width: 510,
302
+ height: viewport.height,
303
  afterLoad: function() {
304
  _this.extractScripts(block);
305
  _this.bindEvents();
342
  };
343
  })();
344
 
345
+ setPLocation = setLocation;
346
+
347
  document.observe("dom:loaded", function() {
348
  ajaxcart.initialize();
349
  });
skin/frontend/base/default/ajaxcart/spinner.gif ADDED
Binary file