Addtocart_Ajax - Version 0.1.1

Version Notes

in this version you can able to add,edit,update,delete cart through ajax

Download this release

Release Info

Developer Magento Core Team
Extension Addtocart_Ajax
Version 0.1.1
Comparing to
See all releases


Code changes from version 0.1.0 to 0.1.1

app/code/local/Amar/Ajax/controllers/IndexController.php CHANGED
@@ -105,4 +105,92 @@ class Amar_Ajax_IndexController extends Mage_Checkout_CartController
105
  }
106
  }
107
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  }
105
  }
106
  }
107
  }
108
+
109
+
110
+ public function updateShoppingCartAction()
111
+ {
112
+ $id = $this->getRequest()->getParam('id');
113
+ $qty = $this->getRequest()->getParam('qty');
114
+ $proid = $this->getRequest()->getParam('proid');
115
+ $cartData = array($id => array("qty"=>$qty));
116
+ //$param = $this->getRequest()->getParam('qty');
117
+ //print_r($cartData);exit;
118
+ if($this->getRequest()->getParam('isAjax') == 1){
119
+ try{
120
+ if (is_array($cartData)) {
121
+ $filter = new Zend_Filter_LocalizedToNormalized(
122
+ array('locale' => Mage::app()->getLocale()->getLocaleCode())
123
+ );
124
+ //echo "<pre>";print_r($filter);exit;
125
+ foreach ($cartData as $index => $data) {
126
+ if (isset($data['qty'])) {
127
+ $cartData[$index]['qty'] = $filter->filter($data['qty']);
128
+ }
129
+ }
130
+ $cart = Mage::helper('checkout/cart')->getCart();
131
+ if (! $cart->getCustomerSession()->getCustomer()->getId() && $cart->getQuote()->getCustomerId()) {
132
+ $cart->getQuote()->setCustomerId(null);
133
+ }
134
+
135
+ $cartData = $cart->suggestItemsQty($cartData);
136
+ //echo "<pre>";print_r($cartData);exit;
137
+ $cart->updateItems($cartData)
138
+ ->save();
139
+ }
140
+ Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
141
+ } catch (Mage_Core_Exception $e) {
142
+ $this->_getSession()->addError(Mage::helper('core')->escapeHtml($e->getMessage()));
143
+ } catch (Exception $e) {
144
+ $this->_getSession()->addException($e, $this->__('Cannot update shopping cart.'));
145
+ Mage::logException($e);
146
+ }
147
+ $response['status'] = 'SUCCESS';
148
+ //$response['message'] = $message;
149
+ //New Code Here
150
+ $this->loadLayout();
151
+ $toplink = $this->getLayout()->getBlock('top.links')->toHtml();
152
+ $sidebar_block = $this->getLayout()->getBlock('cart_sidebar');
153
+ Mage::register('referrer_url', $this->_getRefererUrl());
154
+ $sidebar = $sidebar_block->toHtml();
155
+ $response['toplink'] = $toplink;
156
+ $response['sidebar'] = $sidebar;
157
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
158
+ return;
159
+ }
160
+
161
+ }
162
+ public function deleteAction()
163
+ {
164
+ $params = $this->getRequest()->getParams();
165
+
166
+ if($params['isAjax'] == 1){
167
+
168
+ $id = (int) $this->getRequest()->getParam('id');
169
+ if ($id) {
170
+ try {
171
+ $this->_getCart()->removeItem($id)
172
+ ->save();
173
+ //$message = $this->__('%s was deleted from your shopping cart.', Mage::helper('core')->htmlEscape($product->getName()));
174
+ $response['status'] = 'SUCCESS';
175
+ //$response['message'] = $message;
176
+ //New Code Here
177
+ $this->loadLayout();
178
+ $toplink = $this->getLayout()->getBlock('top.links')->toHtml();
179
+ $sidebar_block = $this->getLayout()->getBlock('cart_sidebar');
180
+ Mage::register('referrer_url', $this->_getRefererUrl());
181
+ $sidebar = $sidebar_block->toHtml();
182
+ $response['toplink'] = $toplink;
183
+ $response['sidebar'] = $sidebar;
184
+ } catch (Exception $e) {
185
+ $this->_getSession()->addError($this->__('Cannot remove the item.'));
186
+ Mage::logException($e);
187
+ }
188
+ $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
189
+ return;
190
+ }
191
+ }else{
192
+ return parent::deleteAction();
193
+ }
194
+ //$this->_redirectReferer(Mage::getUrl('*/*'));
195
+ }
196
  }
app/design/frontend/default/default/template/ajax/checkout/cart/sidebar/default.phtml CHANGED
@@ -1,137 +1,160 @@
1
- <?php
2
- $_item = $this->getItem();
3
- $isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
4
- $canApplyMsrp = Mage::helper('catalog')->canApplyMsrp($_item->getProduct(), Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type::TYPE_BEFORE_ORDER_CONFIRM);
5
- ?>
6
- <li class="item">
7
- <?php if ($this->hasProductUrl()): ?>
8
- <a href="<?php echo $this->getProductUrl()?>" title="<?php echo $this->htmlEscape($this->getProductName()) ?>" class="product-image"><img src="<?php echo $this->getProductThumbnail()->resize(50, 50)->setWatermarkSize('30x10'); ?>" width="50" height="50" alt="<?php echo $this->htmlEscape($this->getProductName()) ?>" /></a>
9
- <?php else: ?>
10
- <span class="product-image"><img src="<?php echo $this->getProductThumbnail()->resize(50, 50)->setWatermarkSize('30x10'); ?>" width="50" height="50" alt="<?php echo $this->htmlEscape($this->getProductName()) ?>" /></span>
11
- <?php endif; ?>
12
- <div class="product-details">
13
- <a href="<?php
14
- $params = $this->getRequest()->getParams();
15
- if($params['isAjax'] == 1){
16
- $refererUrl = Mage::registry('referrer_url');
17
- if (empty($refererUrl)) {
18
- $refererUrl = Mage::getBaseUrl();
19
- }
20
- $deleteUrl = $this->getUrl(
21
- 'checkout/cart/delete',
22
- array(
23
- 'id'=>$_item->getId(),
24
- Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->helper('core/url')->getEncodedUrl($refererUrl)
25
- )
26
- );
27
- }else{
28
- $deleteUrl = $this->getDeleteUrl();
29
- }
30
- echo $deleteUrl;
31
- ?>" title="<?php echo $this->__('Remove This Item') ?>" onclick="return confirm('<?php echo $this->__('Are you sure you would like to remove this item from the shopping cart?') ?>');" class="btn-remove"><?php echo $this->__('Remove This Item') ?></a>
32
- <?php if ($isVisibleProduct): ?>
33
- <a href="<?php echo $this->getConfigureUrl() ?>" title="<?php echo $this->__('Edit item') ?>" class="btn-edit"><?php echo $this->__('Edit item')?></a>
34
- <?php endif ?>
35
- <p class="product-name"><?php if ($this->hasProductUrl()): ?><a href="<?php echo $this->getProductUrl() ?>"><?php endif; ?><?php echo $this->htmlEscape($this->getProductName()) ?><?php if ($this->hasProductUrl()): ?></a><?php endif; ?></p>
36
- <strong><?php echo $this->getQty() ?></strong> x
37
-
38
- <?php if ($canApplyMsrp): ?>
39
-
40
- <span class="map-cart-sidebar-item"><?php echo $this->__('See price before order confirmation.'); ?></span>
41
-
42
- <?php else: ?>
43
-
44
- <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
45
- <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
46
- <?php echo $this->__('Excl. Tax'); ?>:
47
- <?php endif; ?>
48
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
49
- <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
50
- <?php else: ?>
51
- <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
52
- <?php endif; ?>
53
- <?php if (Mage::helper('weee')->getApplied($_item)): ?>
54
- <br />
55
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
56
- <small>
57
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
58
- <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span><br />
59
- <?php endforeach; ?>
60
- </small>
61
- <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
62
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
63
- <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span><br />
64
- <?php endforeach; ?>
65
- <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
66
- <small>
67
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
68
- <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
69
- <?php endforeach; ?>
70
- </small>
71
- <?php endif; ?>
72
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
73
- <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span>
74
- <?php endif; ?>
75
- <?php endif; ?>
76
- <?php endif; ?>
77
-
78
-
79
-
80
- <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
81
- <?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
82
- <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
83
- <br /><?php echo $this->__('Incl. Tax'); ?>:
84
- <?php endif; ?>
85
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
86
- <?php echo $this->helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?>
87
- <?php else: ?>
88
- <?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?>
89
- <?php endif; ?>
90
- <?php if (Mage::helper('weee')->getApplied($_item)): ?>
91
- <br />
92
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
93
- <small>
94
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
95
- <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span><br />
96
- <?php endforeach; ?>
97
- </small>
98
- <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
99
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
100
- <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span><br />
101
- <?php endforeach; ?>
102
- <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
103
- <small>
104
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
105
- <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
106
- <?php endforeach; ?>
107
- </small>
108
- <?php endif; ?>
109
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
110
- <span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?></span>
111
- <?php endif; ?>
112
- <?php endif; ?>
113
- <?php endif; ?>
114
-
115
- <?php endif; //Can apply MSRP ?>
116
-
117
- <?php if ($_options = $this->getOptionList()):?>
118
- <div class="truncated">
119
- <div class="truncated_full_value">
120
- <dl class="item-options">
121
- <?php foreach ($_options as $_option) : ?>
122
- <dt><?php echo $this->htmlEscape($_option['label']) ?></dt>
123
- <dd>
124
- <?php if (is_array($_option['value'])): ?>
125
- <?php echo nl2br(implode("\n", $_option['value'])) ?>
126
- <?php else: ?>
127
- <?php echo $_option['value'] ?>
128
- <?php endif; ?>
129
- </dd>
130
- <?php endforeach; ?>
131
- </dl>
132
- </div>
133
- <a href="#" onclick="return false;" class="details"><?php echo $this->__('Details') ?></a>
134
- </div>
135
- <?php endif; ?>
136
- </div>
137
- </li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-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 design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ $_item = $this->getItem();
29
+ $isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
30
+ ?>
31
+ <li class="item">
32
+ <?php if ($this->hasProductUrl()): ?>
33
+ <a href="<?php echo $this->getProductUrl()?>" title="<?php echo $this->htmlEscape($this->getProductName()) ?>" class="product-image"><img src="<?php echo $this->getProductThumbnail()->resize(50, 50)->setWatermarkSize('30x10'); ?>" width="50" height="50" alt="<?php echo $this->htmlEscape($this->getProductName()) ?>" /></a>
34
+ <?php else: ?>
35
+ <span class="product-image"><img src="<?php echo $this->getProductThumbnail()->resize(50, 50)->setWatermarkSize('30x10'); ?>" width="50" height="50" alt="<?php echo $this->htmlEscape($this->getProductName()) ?>" /></span>
36
+ <?php endif; ?>
37
+ <div class="product-details">
38
+ <div class="close-but" style="float:right">
39
+
40
+ <a href="#" onclick="ajaxdeletepro('<?php echo $this->getDeleteUrl() ?>','<?php echo $_item->getId(); ?>')" ><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN); ?>frontend/default/default/images/btn_remove.gif" alt="" /></a>
41
+ </div>
42
+ <span id='ajax_loader1' style='display:none'><img src='<?php echo $this->getSkinUrl('images/loading.gif')?>'/></span>
43
+ <p class="product-name"><?php if ($this->hasProductUrl()): ?><a href="<?php echo $this->getProductUrl() ?>"><?php endif; ?><?php echo $this->htmlEscape($this->getProductName()) ?><?php if ($this->hasProductUrl()): ?></a><?php endif; ?></p>
44
+ <span class="prod-descript">ITEM NO : <?php echo $_item->getSku(); ?></span><br />
45
+ <span class="quantity-txt">Quantity :</span>
46
+ <?php $product = Mage::getModel('catalog/product')->load($_item->getProductId()); ?>
47
+
48
+ <input type="text" value="<?php echo $this->getQty() ?>" size="2px" name="qty" onchange="ajaxupdatepro('<?php echo $this->getUrl('checkout/cart/updatePost') ?>','<?php echo $_item->getId(); ?>',this.value,'<?php echo $_item->getProductId(); ?>')" class="qty-counts" id="qty-counts"/>
49
+ <!--span class="qty-counts"><strong><?php //echo $this->getQty() ?></strong></span><br /-->
50
+ <div class="price-box">
51
+ <span class="price-txt">
52
+ <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
53
+ <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
54
+ <?php else: ?>
55
+ <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()) ?>
56
+ <?php endif; ?>
57
+
58
+ <?php // echo $this->helper('checkout')->formatPrice($item->getPrice()); ?>
59
+ <?php //echo $this->helper('checkout')->formatPrice($_item->getBaseRowTotal()) ?>
60
+ </span>
61
+ </div>
62
+
63
+ <?php if ($_options = $this->getOptionList()):?>
64
+ <div class="truncated">
65
+ <div class="truncated_full_value">
66
+ <dl class="item-options">
67
+ <?php foreach ($_options as $_option) : ?>
68
+ <dt><?php echo $this->htmlEscape($_option['label']) ?></dt>
69
+ <dd>
70
+ <?php if (is_array($_option['value'])): ?>
71
+ <?php echo nl2br(implode("\n", $_option['value'])) ?>
72
+ <?php else: ?>
73
+ <?php echo $_option['value'] ?>
74
+ <?php endif; ?>
75
+ </dd>
76
+ <?php endforeach; ?>
77
+ </dl>
78
+ </div>
79
+ <a href="#" onclick="return false;" class="details"><?php echo $this->__('Details') ?></a>
80
+ </div>
81
+ <?php endif; ?>
82
+ <div class="err-msg">
83
+
84
+ <?php $msg1=array("id"=>"","type"=>"","text"=>""); ?>
85
+ <?php if ($messages = $this->getMessages()): ?>
86
+ <?php foreach ($messages as $message): ?>
87
+ <p class="item-msg <?php echo $message['type'] ?>">* <?php echo $message['text'] ?></p>
88
+ <?php array_push($msg1[id],$msg1[id]=$_item->getId()); ?>
89
+ <?php array_push($msg1[type],$msg1[type]=$message['type']); ?>
90
+ <?php array_push($msg1[text],$msg1[text]=$message['text']); ?>
91
+ <?php //Mage::getSingleton('core/session')->setTypeMagento($msg1); ?>
92
+ <?php endforeach; ?>
93
+ <?php
94
+ $session = Mage::getSingleton("core/session", array("name"=>"frontend"));
95
+ // set data
96
+ $session->setData($_item->getId(), $msg1);
97
+ ?>
98
+ <?php endif; ?>
99
+
100
+ </div>
101
+ </div>
102
+ </li>
103
+ <script type="text/javascript">
104
+ function ajaxdeletepro(url,id)
105
+ {
106
+ url += 'isAjax/1';
107
+ url = url.replace("checkout/cart","ajax/index");
108
+ //jQuery('#ajax_loader'+id).show();
109
+ try {
110
+ jQuery.ajax( {
111
+ url : url,
112
+ dataType : 'json',
113
+ success : function(data) {
114
+ //alert(data);
115
+ jQuery('#ajax_loader1').hide();
116
+ if(jQuery('.block-cart')){
117
+ jQuery('.block-cart').replaceWith(data.sidebar);
118
+ }
119
+ if(jQuery('.header .links')){
120
+ jQuery('.header .links').replaceWith(data.toplink);
121
+ }
122
+
123
+ // setAjaxData(data,false);
124
+ }
125
+ });
126
+ } catch (e) {
127
+ }
128
+ }
129
+
130
+ </script>
131
+ <script type="text/javascript">
132
+ function ajaxupdatepro(url,id,qty,proid)
133
+ {
134
+ url += 'isAjax/1';
135
+ var data = '&id='+id+'&qty='+qty+'&proid='+proid;
136
+ url = url.replace("checkout/cart/updatePost","ajax/index/updateShoppingCart");
137
+ //jQuery('#ajax_loader'+id).show();
138
+ try {
139
+ jQuery.ajax( {
140
+ url : url,
141
+ dataType : 'json',
142
+ data : data,
143
+ type : 'post',
144
+ success : function(data) {
145
+ //alert(data);
146
+ jQuery('#ajax_loader1').hide();
147
+ if(jQuery('.block-cart')){
148
+ jQuery('.block-cart').replaceWith(data.sidebar);
149
+ }
150
+ if(jQuery('.header .links')){
151
+ jQuery('.header .links').replaceWith(data.toplink);
152
+ }
153
+
154
+ // setAjaxData(data,false);
155
+ }
156
+ });
157
+ } catch (e) {
158
+ }
159
+ }
160
+ </script>
app/design/frontend/default/default/template/ajax/checkout/cart/sidebar/default1.5.phtml DELETED
@@ -1,153 +0,0 @@
1
- <?php
2
- /**
3
- * Magento
4
- *
5
- * NOTICE OF LICENSE
6
- *
7
- * This source file is subject to the Academic Free License (AFL 3.0)
8
- * that is bundled with this package in the file LICENSE_AFL.txt.
9
- * It is also available through the world-wide-web at this URL:
10
- * http://opensource.org/licenses/afl-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 design
22
- * @package base_default
23
- * @copyright Copyright (c) 2010 Magento Inc. (http://www.magentocommerce.com)
24
- * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
- */
26
- ?>
27
- <?php
28
- $_item = $this->getItem();
29
- $isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
30
- ?>
31
- <li class="item">
32
- <?php if ($this->hasProductUrl()): ?>
33
- <a href="<?php echo $this->getProductUrl()?>" title="<?php echo $this->htmlEscape($this->getProductName()) ?>" class="product-image"><img src="<?php echo $this->getProductThumbnail()->resize(50, 50)->setWatermarkSize('30x10'); ?>" width="50" height="50" alt="<?php echo $this->htmlEscape($this->getProductName()) ?>" /></a>
34
- <?php else: ?>
35
- <span class="product-image"><img src="<?php echo $this->getProductThumbnail()->resize(50, 50)->setWatermarkSize('30x10'); ?>" width="50" height="50" alt="<?php echo $this->htmlEscape($this->getProductName()) ?>" /></span>
36
- <?php endif; ?>
37
- <div class="product-details">
38
- <a href="<?php
39
- $params = $this->getRequest()->getParams();
40
- if($params['isAjax'] == 1){
41
- $refererUrl = Mage::registry('referrer_url');
42
- if (empty($refererUrl)) {
43
- $refererUrl = Mage::getBaseUrl();
44
- }
45
- $deleteUrl = $this->getUrl(
46
- 'checkout/cart/delete',
47
- array(
48
- 'id'=>$_item->getId(),
49
- Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->helper('core/url')->getEncodedUrl($refererUrl)
50
- )
51
- );
52
- }else{
53
- $deleteUrl = $this->getDeleteUrl();
54
- }
55
- echo $deleteUrl;
56
- ?>" title="<?php echo $this->__('Remove This Item') ?>" onclick="return confirm('<?php echo $this->__('Are you sure you would like to remove this item from the shopping cart?') ?>');" class="btn-remove"><?php echo $this->__('Remove This Item') ?></a>
57
- <?php if ($isVisibleProduct): ?>
58
- <a href="<?php echo $this->getConfigureUrl() ?>" title="<?php echo $this->__('Edit item') ?>" class="btn-edit"><?php echo $this->__('Edit item')?></a>
59
- <?php endif ?>
60
- <p class="product-name"><?php if ($this->hasProductUrl()): ?><a href="<?php echo $this->getProductUrl() ?>"><?php endif; ?><?php echo $this->htmlEscape($this->getProductName()) ?><?php if ($this->hasProductUrl()): ?></a><?php endif; ?></p>
61
- <strong><?php echo $this->getQty() ?></strong> x
62
-
63
- <?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
64
- <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
65
- <?php echo $this->__('Excl. Tax'); ?>:
66
- <?php endif; ?>
67
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
68
- <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
69
- <?php else: ?>
70
- <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
71
- <?php endif; ?>
72
- <?php if (Mage::helper('weee')->getApplied($_item)): ?>
73
- <br />
74
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
75
- <small>
76
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
77
- <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span><br />
78
- <?php endforeach; ?>
79
- </small>
80
- <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
81
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
82
- <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span><br />
83
- <?php endforeach; ?>
84
- <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
85
- <small>
86
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
87
- <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
88
- <?php endforeach; ?>
89
- </small>
90
- <?php endif; ?>
91
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
92
- <span class="nobr"><?php echo Mage::helper('weee')->__('Total'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span>
93
- <?php endif; ?>
94
- <?php endif; ?>
95
- <?php endif; ?>
96
-
97
-
98
-
99
- <?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
100
- <?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
101
- <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
102
- <br /><?php echo $this->__('Incl. Tax'); ?>:
103
- <?php endif; ?>
104
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales')): ?>
105
- <?php echo $this->helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?>
106
- <?php else: ?>
107
- <?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?>
108
- <?php endif; ?>
109
- <?php if (Mage::helper('weee')->getApplied($_item)): ?>
110
- <br />
111
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales')): ?>
112
- <small>
113
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
114
- <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span><br />
115
- <?php endforeach; ?>
116
- </small>
117
- <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
118
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
119
- <span class="nobr"><small><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></small></span><br />
120
- <?php endforeach; ?>
121
- <?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales')): ?>
122
- <small>
123
- <?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
124
- <span class="nobr"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span><br />
125
- <?php endforeach; ?>
126
- </small>
127
- <?php endif; ?>
128
- <?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales')): ?>
129
- <span class="nobr"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>:<br /> <?php echo $this->helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?></span>
130
- <?php endif; ?>
131
- <?php endif; ?>
132
- <?php endif; ?>
133
- <?php if ($_options = $this->getOptionList()):?>
134
- <div class="truncated">
135
- <div class="truncated_full_value">
136
- <dl class="item-options">
137
- <?php foreach ($_options as $_option) : ?>
138
- <dt><?php echo $this->htmlEscape($_option['label']) ?></dt>
139
- <dd>
140
- <?php if (is_array($_option['value'])): ?>
141
- <?php echo nl2br(implode("\n", $_option['value'])) ?>
142
- <?php else: ?>
143
- <?php echo $_option['value'] ?>
144
- <?php endif; ?>
145
- </dd>
146
- <?php endforeach; ?>
147
- </dl>
148
- </div>
149
- <a href="#" onclick="return false;" class="details"><?php echo $this->__('Details') ?></a>
150
- </div>
151
- <?php endif; ?>
152
- </div>
153
- </li>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Addtocart_Ajax</name>
4
- <version>0.1.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>Add to cart from category page and product page by ajax</summary>
10
- <description>Add to cart from category page and product page by ajax</description>
11
- <notes>Stable</notes>
12
  <authors><author><name>jaimin</name><user>auto-converted</user><email>jaimin85india@yahoo.com</email></author></authors>
13
- <date>2012-07-13</date>
14
- <time>06:00:04</time>
15
- <contents><target name="magelocal"><dir name="Amar"><dir name="Ajax"><dir name="Block"><dir name="Cart"><file name="Sidebar.php" hash="74de7e281c51e840752008496cbf66e5"/></dir><file name="Ajax.php" hash="82b0803da6b60940db5864583298bd18"/></dir><dir name="Helper"><file name="Data.php" hash="660bbdae27b010bf4ae1a98f77b29146"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Ajax"><file name="Collection.php" hash="dc04a2420e42fe2fd9f055dc1535d90f"/></dir><file name="Ajax.php" hash="741578ba427e5fd713e8a72eb2a38be9"/></dir><file name="Ajax.php" hash="9b24bb66a0bf277b20e0edfe3c91565e"/><file name="Status.php" hash="d62c02c844f40cf339fb79eb7646e2d0"/></dir><dir name="controllers"><file name="IndexController.php" hash="355bbeb5bda1e59ed707f4adf17b44d7"/></dir><dir name="etc"><file name="config.xml" hash="cb3c8fac9c8e71d64949860fee8b637b"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="ajax.xml" hash="af1376c2be569c69be380a2ed088cefc"/></dir><dir name="template"><dir name="ajax"><dir name="catalog"><dir name="product"><dir name="view"><file name="addtocart.phtml" hash="067f96d19d8e2e3fb0dc8f10e8e0727f"/><file name="list.phtml" hash="fe643aec2db3fc4627cc5a62ff55e224"/></dir><file name="options.phtml" hash="726ff1f880ce50d91131d799a6bf6f67"/><file name="view.phtml" hash="d9da8bfcbc27f206ff99e35d0d845e6a"/></dir></dir><dir name="checkout"><dir name="cart"><dir name="sidebar"><file name="default.phtml" hash="55096a02fb9f5f945672036858d64268"/><file name="default1.5.phtml" hash="23bfd9fd53fc836a633a5d2efb92479b"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="jquery"><file name="jquery-1.6.4.min.js" hash="9118381924c51c89d9414a311ec9c97f"/><file name="noconflict.js" hash="3179f2255b046d5f2e9a71e365287bef"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="js"><dir name="fancybox"><file name="blank.gif" hash="325472601571f31e1bf00674c368d335"/><file name="fancy_close.png" hash="6e2879a324a76e9972ebc98201aae1d8"/><file name="fancy_loading.png" hash="b1d54c240cf06e7f41e372d56919b738"/><file name="fancy_nav_left.png" hash="3f3e406102152cd8236383568a40ba35"/><file name="fancy_nav_right.png" hash="216e4bde5bddeeaa60dc3d692890a68e"/><file name="fancy_shadow_e.png" hash="fd4f491080d29fade5080877f1ba4c8b"/><file name="fancy_shadow_n.png" hash="18cde16379b2ceadef714d9b346d09ec"/><file name="fancy_shadow_ne.png" hash="63adf788acf193d4e4f3642d7d793125"/><file name="fancy_shadow_nw.png" hash="c820c878aedb7a7f9ebd7135a58e7c65"/><file name="fancy_shadow_s.png" hash="9b9e5c888028aaef40fe5b6a363f1e29"/><file name="fancy_shadow_se.png" hash="a8afd5a008884380ee712d177105268f"/><file name="fancy_shadow_sw.png" hash="f81cc0fee5581d76ad3cebe47e7e791b"/><file name="fancy_shadow_w.png" hash="59b0e63eb059e58d932cfd53da4d87e6"/><file name="fancy_title_left.png" hash="1582ac2d3bef6a6445bf02ceca2741cd"/><file name="fancy_title_main.png" hash="38dad6c1ed4bdc81c0bec721b2deb8c2"/><file name="fancy_title_over.png" hash="b886fd165d4b7ac77d41fb52d87ffc60"/><file name="fancy_title_right.png" hash="6cbe0c935511e7f9a2555ccb6a7324c4"/><file name="fancybox-x.png" hash="168696d8a694214090ef90e029cdf393"/><file name="fancybox-y.png" hash="36a58859beb9a6b19322a37466b9f78e"/><file name="fancybox.png" hash="11e57e492ee0311540967cc7a1e6e3e2"/><file name="jquery.easing-1.3.pack.js" hash="def257dbb0ab805c4996fd8abb1a6b49"/><file name="jquery.fancybox-1.3.4.css" hash="4fbb2e045b3bc26aaf4b16d06a7580bf"/><file name="jquery.fancybox-1.3.4.js" hash="e7fc2f8a70f0a9f966207c3f71130721"/><file name="jquery.fancybox-1.3.4.pack.js" hash="8bc36a08c46719377528d962966ce37c"/><file name="jquery.mousewheel-3.0.4.pack.js" hash="3b0a821567b463e70bcc1e90ed2bc9b6"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Amar_Ajax.xml" hash="80c00dfb6dde5b0162ef06b17a31a7a3"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Addtocart_Ajax</name>
4
+ <version>0.1.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
+ <summary>add,edit,update,delete cart through ajax</summary>
10
+ <description>add,edit,update,delete cart through ajax</description>
11
+ <notes>in this version you can able to add,edit,update,delete cart through ajax</notes>
12
  <authors><author><name>jaimin</name><user>auto-converted</user><email>jaimin85india@yahoo.com</email></author></authors>
13
+ <date>2012-09-09</date>
14
+ <time>17:59:17</time>
15
+ <contents><target name="magelocal"><dir name="Amar"><dir name="Ajax"><dir name="Block"><dir name="Cart"><file name="Sidebar.php" hash="74de7e281c51e840752008496cbf66e5"/></dir><file name="Ajax.php" hash="82b0803da6b60940db5864583298bd18"/></dir><dir name="Helper"><file name="Data.php" hash="660bbdae27b010bf4ae1a98f77b29146"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Ajax"><file name="Collection.php" hash="dc04a2420e42fe2fd9f055dc1535d90f"/></dir><file name="Ajax.php" hash="741578ba427e5fd713e8a72eb2a38be9"/></dir><file name="Ajax.php" hash="9b24bb66a0bf277b20e0edfe3c91565e"/><file name="Status.php" hash="d62c02c844f40cf339fb79eb7646e2d0"/></dir><dir name="controllers"><file name="IndexController.php" hash="d8473b37ba9ac3d08aded8eb4ddead80"/></dir><dir name="etc"><file name="config.xml" hash="cb3c8fac9c8e71d64949860fee8b637b"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="ajax.xml" hash="af1376c2be569c69be380a2ed088cefc"/></dir><dir name="template"><dir name="ajax"><dir name="catalog"><dir name="product"><dir name="view"><file name="addtocart.phtml" hash="067f96d19d8e2e3fb0dc8f10e8e0727f"/><file name="list.phtml" hash="fe643aec2db3fc4627cc5a62ff55e224"/></dir><file name="options.phtml" hash="726ff1f880ce50d91131d799a6bf6f67"/><file name="view.phtml" hash="d9da8bfcbc27f206ff99e35d0d845e6a"/></dir></dir><dir name="checkout"><dir name="cart"><dir name="sidebar"><file name="default.phtml" hash="524418c7b28bd18e3d09ec3ad94b82f8"/></dir></dir></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Amar_Ajax.xml" hash="80c00dfb6dde5b0162ef06b17a31a7a3"/></dir></target><target name="mage"><dir name="js"><dir name="jquery"><file name="jquery-1.6.4.min.js" hash="9118381924c51c89d9414a311ec9c97f"/><file name="noconflict.js" hash="3179f2255b046d5f2e9a71e365287bef"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="js"><dir name="fancybox"><file name="blank.gif" hash="325472601571f31e1bf00674c368d335"/><file name="fancy_close.png" hash="6e2879a324a76e9972ebc98201aae1d8"/><file name="fancy_loading.png" hash="b1d54c240cf06e7f41e372d56919b738"/><file name="fancy_nav_left.png" hash="3f3e406102152cd8236383568a40ba35"/><file name="fancy_nav_right.png" hash="216e4bde5bddeeaa60dc3d692890a68e"/><file name="fancy_shadow_e.png" hash="fd4f491080d29fade5080877f1ba4c8b"/><file name="fancy_shadow_n.png" hash="18cde16379b2ceadef714d9b346d09ec"/><file name="fancy_shadow_ne.png" hash="63adf788acf193d4e4f3642d7d793125"/><file name="fancy_shadow_nw.png" hash="c820c878aedb7a7f9ebd7135a58e7c65"/><file name="fancy_shadow_s.png" hash="9b9e5c888028aaef40fe5b6a363f1e29"/><file name="fancy_shadow_se.png" hash="a8afd5a008884380ee712d177105268f"/><file name="fancy_shadow_sw.png" hash="f81cc0fee5581d76ad3cebe47e7e791b"/><file name="fancy_shadow_w.png" hash="59b0e63eb059e58d932cfd53da4d87e6"/><file name="fancy_title_left.png" hash="1582ac2d3bef6a6445bf02ceca2741cd"/><file name="fancy_title_main.png" hash="38dad6c1ed4bdc81c0bec721b2deb8c2"/><file name="fancy_title_over.png" hash="b886fd165d4b7ac77d41fb52d87ffc60"/><file name="fancy_title_right.png" hash="6cbe0c935511e7f9a2555ccb6a7324c4"/><file name="fancybox-x.png" hash="168696d8a694214090ef90e029cdf393"/><file name="fancybox-y.png" hash="36a58859beb9a6b19322a37466b9f78e"/><file name="fancybox.png" hash="11e57e492ee0311540967cc7a1e6e3e2"/><file name="jquery.easing-1.3.pack.js" hash="def257dbb0ab805c4996fd8abb1a6b49"/><file name="jquery.fancybox-1.3.4.css" hash="4fbb2e045b3bc26aaf4b16d06a7580bf"/><file name="jquery.fancybox-1.3.4.js" hash="e7fc2f8a70f0a9f966207c3f71130721"/><file name="jquery.fancybox-1.3.4.pack.js" hash="8bc36a08c46719377528d962966ce37c"/><file name="jquery.mousewheel-3.0.4.pack.js" hash="3b0a821567b463e70bcc1e90ed2bc9b6"/></dir></dir></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>