Version Notes
Extensin will help to add products to shopping cart directly from category and product page using ajax operations. User would be able to add all product types simple,configurable,bundled,grouped, virtual and downloadable from the category page itself. For the products which require options to be selected before adding to cart e.g configurable,bundled etc , a lightbox iframe window will show up showing the options to be selected by user with a ‘Add to Cart’ button.
Download this release
Release Info
Developer | Magento Core Team |
Extension | VS_Ajax |
Version | 1.0.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.0.1
- app/code/community/VS/Ajax/controllers/whishlistController.php +139 -0
- app/code/community/VS/Ajax/etc/system.xml +29 -2
- app/design/frontend/default/default/layout/ajax.xml +10 -10
- app/design/frontend/default/default/template/ajax/catalog/product/compare/sidebar.phtml +68 -0
- app/design/frontend/default/default/template/ajax/catalog/product/view/addto.phtml +57 -0
- app/design/frontend/default/default/template/ajax/catalog/product/view/list.phtml +193 -160
- js/VS/ajaxwishlist.js +48 -0
- package.xml +4 -4
app/code/community/VS/Ajax/controllers/whishlistController.php
ADDED
@@ -0,0 +1,139 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class VS_Ajax_WhishlistController extends Mage_Core_Controller_Front_Action
|
3 |
+
{
|
4 |
+
|
5 |
+
public function compareAction(){
|
6 |
+
$response = array();
|
7 |
+
|
8 |
+
if ($productId = (int) $this->getRequest()->getParam('product')) {
|
9 |
+
$product = Mage::getModel('catalog/product')
|
10 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
11 |
+
->load($productId);
|
12 |
+
|
13 |
+
if ($product->getId()/* && !$product->isSuper()*/) {
|
14 |
+
Mage::getSingleton('catalog/product_compare_list')->addProduct($product);
|
15 |
+
$response['status'] = 'SUCCESS';
|
16 |
+
$response['message'] = $this->__('The product %s has been added to comparison list.', Mage::helper('core')->escapeHtml($product->getName()));
|
17 |
+
Mage::register('referrer_url', $this->_getRefererUrl());
|
18 |
+
Mage::helper('catalog/product_compare')->calculate();
|
19 |
+
Mage::dispatchEvent('catalog_product_compare_add_product', array('product'=>$product));
|
20 |
+
$this->loadLayout();
|
21 |
+
$sidebar_block = $this->getLayout()->getBlock('catalog.compare.sidebar');
|
22 |
+
$sidebar_block->setTemplate('ajax/catalog/product/compare/sidebar.phtml');
|
23 |
+
$sidebar = $sidebar_block->toHtml();
|
24 |
+
$response['sidebar'] = $sidebar;
|
25 |
+
}
|
26 |
+
}
|
27 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
|
28 |
+
return;
|
29 |
+
}
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
protected function _getWishlist()
|
34 |
+
{
|
35 |
+
$wishlist = Mage::registry('wishlist');
|
36 |
+
if ($wishlist) {
|
37 |
+
return $wishlist;
|
38 |
+
}
|
39 |
+
|
40 |
+
try {
|
41 |
+
$wishlist = Mage::getModel('wishlist/wishlist')
|
42 |
+
->loadByCustomer(Mage::getSingleton('customer/session')->getCustomer(), true);
|
43 |
+
Mage::register('wishlist', $wishlist);
|
44 |
+
} catch (Mage_Core_Exception $e) {
|
45 |
+
Mage::getSingleton('wishlist/session')->addError($e->getMessage());
|
46 |
+
} catch (Exception $e) {
|
47 |
+
Mage::getSingleton('wishlist/session')->addException($e,
|
48 |
+
Mage::helper('wishlist')->__('Cannot create wishlist.')
|
49 |
+
);
|
50 |
+
return false;
|
51 |
+
}
|
52 |
+
|
53 |
+
return $wishlist;
|
54 |
+
}
|
55 |
+
public function addAction()
|
56 |
+
{
|
57 |
+
|
58 |
+
$response = array();
|
59 |
+
if (!Mage::getStoreConfigFlag('wishlist/general/active')) {
|
60 |
+
$response['status'] = 'ERROR';
|
61 |
+
$response['message'] = $this->__('Wishlist Has Been Disabled By Admin');
|
62 |
+
}
|
63 |
+
if(!Mage::getSingleton('customer/session')->isLoggedIn()){
|
64 |
+
$response['status'] = 'ERROR';
|
65 |
+
$response['message'] = $this->__('Please Login First');
|
66 |
+
}
|
67 |
+
|
68 |
+
if(empty($response)){
|
69 |
+
$session = Mage::getSingleton('customer/session');
|
70 |
+
$wishlist = $this->_getWishlist();
|
71 |
+
if (!$wishlist) {
|
72 |
+
$response['status'] = 'ERROR';
|
73 |
+
$response['message'] = $this->__('Unable to Create Wishlist');
|
74 |
+
}else{
|
75 |
+
|
76 |
+
$productId = (int) $this->getRequest()->getParam('product');
|
77 |
+
if (!$productId) {
|
78 |
+
$response['status'] = 'ERROR';
|
79 |
+
$response['message'] = $this->__('Product Not Found');
|
80 |
+
}else{
|
81 |
+
|
82 |
+
$product = Mage::getModel('catalog/product')->load($productId);
|
83 |
+
if (!$product->getId() || !$product->isVisibleInCatalog()) {
|
84 |
+
$response['status'] = 'ERROR';
|
85 |
+
$response['message'] = $this->__('Cannot specify product.');
|
86 |
+
}else{
|
87 |
+
|
88 |
+
try {
|
89 |
+
$requestParams = $this->getRequest()->getParams();
|
90 |
+
$buyRequest = new Varien_Object($requestParams);
|
91 |
+
|
92 |
+
$result = $wishlist->addNewItem($product, $buyRequest);
|
93 |
+
if (is_string($result)) {
|
94 |
+
Mage::throwException($result);
|
95 |
+
}
|
96 |
+
$wishlist->save();
|
97 |
+
|
98 |
+
Mage::dispatchEvent(
|
99 |
+
'wishlist_add_product',
|
100 |
+
array(
|
101 |
+
'wishlist' => $wishlist,
|
102 |
+
'product' => $product,
|
103 |
+
'item' => $result
|
104 |
+
)
|
105 |
+
);
|
106 |
+
|
107 |
+
Mage::helper('wishlist')->calculate();
|
108 |
+
|
109 |
+
$message = $this->__('%1$s has been added to your wishlist.', $product->getName(), $referer);
|
110 |
+
$response['status'] = 'SUCCESS';
|
111 |
+
$response['message'] = $message;
|
112 |
+
|
113 |
+
Mage::unregister('wishlist');
|
114 |
+
|
115 |
+
$this->loadLayout();
|
116 |
+
$toplink = $this->getLayout()->getBlock('top.links')->toHtml();
|
117 |
+
$sidebar_block = $this->getLayout()->getBlock('wishlist_sidebar');
|
118 |
+
$sidebar = $sidebar_block->toHtml();
|
119 |
+
$response['toplink'] = $toplink;
|
120 |
+
$response['sidebar'] = $sidebar;
|
121 |
+
}
|
122 |
+
catch (Mage_Core_Exception $e) {
|
123 |
+
$response['status'] = 'ERROR';
|
124 |
+
$response['message'] = $this->__('An error occurred while adding item to wishlist: %s', $e->getMessage());
|
125 |
+
}
|
126 |
+
catch (Exception $e) {
|
127 |
+
mage::log($e->getMessage());
|
128 |
+
$response['status'] = 'ERROR';
|
129 |
+
$response['message'] = $this->__('An error occurred while adding item to wishlist.');
|
130 |
+
}
|
131 |
+
}
|
132 |
+
}
|
133 |
+
}
|
134 |
+
|
135 |
+
}
|
136 |
+
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
|
137 |
+
return;
|
138 |
+
}
|
139 |
+
}
|
app/code/community/VS/Ajax/etc/system.xml
CHANGED
@@ -18,7 +18,7 @@
|
|
18 |
<show_in_store>1</show_in_store>
|
19 |
<groups>
|
20 |
<general translate="label">
|
21 |
-
<label>Ajax
|
22 |
<frontend_type>text</frontend_type>
|
23 |
<sort_order>1</sort_order>
|
24 |
<show_in_default>1</show_in_default>
|
@@ -45,7 +45,34 @@
|
|
45 |
</enabledpro>
|
46 |
</fields>
|
47 |
</general>
|
48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
</groups>
|
51 |
|
18 |
<show_in_store>1</show_in_store>
|
19 |
<groups>
|
20 |
<general translate="label">
|
21 |
+
<label>Ajax settings for add to cart button</label>
|
22 |
<frontend_type>text</frontend_type>
|
23 |
<sort_order>1</sort_order>
|
24 |
<show_in_default>1</show_in_default>
|
45 |
</enabledpro>
|
46 |
</fields>
|
47 |
</general>
|
48 |
+
<wishlistcompare translate="label">
|
49 |
+
<label>Ajax settings for add to wishlist/compare button</label>
|
50 |
+
<frontend_type>text</frontend_type>
|
51 |
+
<sort_order>1</sort_order>
|
52 |
+
<show_in_default>1</show_in_default>
|
53 |
+
<show_in_website>1</show_in_website>
|
54 |
+
<show_in_store>1</show_in_store>
|
55 |
+
<fields>
|
56 |
+
<enabled translate="label">
|
57 |
+
<label>Enabled for Product Page</label>
|
58 |
+
<frontend_type>select</frontend_type>
|
59 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
60 |
+
<sort_order>1</sort_order>
|
61 |
+
<show_in_default>1</show_in_default>
|
62 |
+
<show_in_website>1</show_in_website>
|
63 |
+
<show_in_store>1</show_in_store>
|
64 |
+
</enabled>
|
65 |
+
<enabledpro translate="label">
|
66 |
+
<label>Enabled for Category Page</label>
|
67 |
+
<frontend_type>select</frontend_type>
|
68 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
69 |
+
<sort_order>2</sort_order>
|
70 |
+
<show_in_default>1</show_in_default>
|
71 |
+
<show_in_website>1</show_in_website>
|
72 |
+
<show_in_store>1</show_in_store>
|
73 |
+
</enabledpro>
|
74 |
+
</fields>
|
75 |
+
</wishlistcompare>
|
76 |
|
77 |
</groups>
|
78 |
|
app/design/frontend/default/default/layout/ajax.xml
CHANGED
@@ -4,10 +4,14 @@
|
|
4 |
<reference name="head">
|
5 |
<action method="addJs" ifconfig="ajax/general/enabled"><script>VS/jquery-1.6.4.min.js</script></action>
|
6 |
<action method="addJs" ifconfig="ajax/general/enabled"><script>VS/noconflict.js</script></action>
|
|
|
7 |
</reference>
|
8 |
<reference name="product.info">
|
9 |
<action method="setTemplate" ifconfig="ajax/general/enabled"><template>ajax/catalog/product/view.phtml</template></action>
|
10 |
</reference>
|
|
|
|
|
|
|
11 |
<reference name="product.info.addtocart">
|
12 |
<action method="setTemplate" ifconfig="ajax/general/enabled"><template>ajax/catalog/product/view/addtocart.phtml</template></action>
|
13 |
</reference>
|
@@ -17,7 +21,7 @@
|
|
17 |
<reference name="head">
|
18 |
<action method="addJs" ifconfig="ajax/general/enabledpro"><script>VS/jquery-1.6.4.min.js</script></action>
|
19 |
<action method="addJs" ifconfig="ajax/general/enabledpro"><script>VS/noconflict.js</script></action>
|
20 |
-
|
21 |
<action method="addItem" ifconfig="ajax/general/enabledpro">
|
22 |
<type>skin_js</type>
|
23 |
<name>VS/js/fancybox/jquery.fancybox-1.3.4.js</name>
|
@@ -33,21 +37,17 @@
|
|
33 |
<action method="addCss" ifconfig="ajax/general/enabledpro">
|
34 |
<stylesheet>VS/js/fancybox/jquery.fancybox-1.3.4.css</stylesheet>
|
35 |
</action>
|
36 |
-
</reference>
|
37 |
-
|
38 |
<reference name="product_list">
|
39 |
-
<action method="setTemplate"
|
40 |
</reference>
|
41 |
</catalog_category_default>
|
42 |
|
43 |
-
<catalog_category_layered>
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
<reference name="head">
|
48 |
<action method="addJs" ifconfig="ajax/general/enabledpro"><script>VS/jquery-1.6.4.min.js</script></action>
|
49 |
<action method="addJs" ifconfig="ajax/general/enabledpro"><script>VS/noconflict.js</script></action>
|
50 |
-
|
51 |
<action method="addItem" ifconfig="ajax/general/enabledpro">
|
52 |
<type>skin_js</type>
|
53 |
<name>VS/js/fancybox/jquery.fancybox-1.3.4.js</name>
|
@@ -66,7 +66,7 @@
|
|
66 |
</reference>
|
67 |
|
68 |
<reference name="product_list">
|
69 |
-
<action method="setTemplate"
|
70 |
</reference>
|
71 |
</catalog_category_layered>
|
72 |
|
4 |
<reference name="head">
|
5 |
<action method="addJs" ifconfig="ajax/general/enabled"><script>VS/jquery-1.6.4.min.js</script></action>
|
6 |
<action method="addJs" ifconfig="ajax/general/enabled"><script>VS/noconflict.js</script></action>
|
7 |
+
<action method="addJs" ifconfig="ajax/wishlistcompare/enabled"><script>VS/ajaxwishlist.js</script></action>
|
8 |
</reference>
|
9 |
<reference name="product.info">
|
10 |
<action method="setTemplate" ifconfig="ajax/general/enabled"><template>ajax/catalog/product/view.phtml</template></action>
|
11 |
</reference>
|
12 |
+
<reference name="product.info.addto">
|
13 |
+
<action method="setTemplate" ifconfig="ajax/wishlistcompare/enabled"><template>ajax/catalog/product/view/addto.phtml</template></action>
|
14 |
+
</reference>
|
15 |
<reference name="product.info.addtocart">
|
16 |
<action method="setTemplate" ifconfig="ajax/general/enabled"><template>ajax/catalog/product/view/addtocart.phtml</template></action>
|
17 |
</reference>
|
21 |
<reference name="head">
|
22 |
<action method="addJs" ifconfig="ajax/general/enabledpro"><script>VS/jquery-1.6.4.min.js</script></action>
|
23 |
<action method="addJs" ifconfig="ajax/general/enabledpro"><script>VS/noconflict.js</script></action>
|
24 |
+
<action method="addJs" ifconfig="ajax/wishlistcompare/enabledpro"><script>VS/ajaxwishlist.js</script></action>
|
25 |
<action method="addItem" ifconfig="ajax/general/enabledpro">
|
26 |
<type>skin_js</type>
|
27 |
<name>VS/js/fancybox/jquery.fancybox-1.3.4.js</name>
|
37 |
<action method="addCss" ifconfig="ajax/general/enabledpro">
|
38 |
<stylesheet>VS/js/fancybox/jquery.fancybox-1.3.4.css</stylesheet>
|
39 |
</action>
|
40 |
+
</reference>
|
|
|
41 |
<reference name="product_list">
|
42 |
+
<action method="setTemplate"><template>ajax/catalog/product/view/list.phtml</template></action>
|
43 |
</reference>
|
44 |
</catalog_category_default>
|
45 |
|
46 |
+
<catalog_category_layered>
|
|
|
|
|
|
|
47 |
<reference name="head">
|
48 |
<action method="addJs" ifconfig="ajax/general/enabledpro"><script>VS/jquery-1.6.4.min.js</script></action>
|
49 |
<action method="addJs" ifconfig="ajax/general/enabledpro"><script>VS/noconflict.js</script></action>
|
50 |
+
<action method="addJs" ifconfig="ajax/wishlistcompare/enabledpro"><script>VS/ajaxwishlist.js</script></action>
|
51 |
<action method="addItem" ifconfig="ajax/general/enabledpro">
|
52 |
<type>skin_js</type>
|
53 |
<name>VS/js/fancybox/jquery.fancybox-1.3.4.js</name>
|
66 |
</reference>
|
67 |
|
68 |
<reference name="product_list">
|
69 |
+
<action method="setTemplate"><template>ajax/catalog/product/view/list.phtml</template></action>
|
70 |
</reference>
|
71 |
</catalog_category_layered>
|
72 |
|
app/design/frontend/default/default/template/ajax/catalog/product/compare/sidebar.phtml
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$_helper = $this->helper('catalog/product_compare');
|
3 |
+
$_items = $_helper->getItemCount() > 0 ? $_helper->getItemCollection() : null;
|
4 |
+
?>
|
5 |
+
<div class="block block-list block-compare">
|
6 |
+
<div class="block-title">
|
7 |
+
<strong><span><?php echo $this->__('Compare Products') ?>
|
8 |
+
<?php if($_helper->getItemCount() > 0): ?>
|
9 |
+
<small><?php echo $this->__('(%d)', $_helper->getItemCount()) ?></small>
|
10 |
+
<?php endif; ?>
|
11 |
+
</span></strong>
|
12 |
+
</div>
|
13 |
+
<div class="block-content">
|
14 |
+
<?php if($_helper->getItemCount() > 0): ?>
|
15 |
+
<ol id="compare-items">
|
16 |
+
<?php foreach($_items as $_index => $_item): ?>
|
17 |
+
<li class="item">
|
18 |
+
<input type="hidden" class="compare-item-id" value="<?php echo $_item->getId() ?>" />
|
19 |
+
<a href="<?php
|
20 |
+
$params = $this->getRequest()->getParams();
|
21 |
+
if($params['isAjax'] == 1){
|
22 |
+
$refererUrl = Mage::registry('referrer_url');
|
23 |
+
if (empty($refererUrl)) {
|
24 |
+
$refererUrl = Mage::getBaseUrl();
|
25 |
+
}
|
26 |
+
$deleteUrl = $this->getUrl(
|
27 |
+
'catalog/product_compare/remove',
|
28 |
+
array(
|
29 |
+
'product'=>$_item->getId(),
|
30 |
+
Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->helper('core/url')->getEncodedUrl($refererUrl)
|
31 |
+
)
|
32 |
+
);
|
33 |
+
}else{
|
34 |
+
$deleteUrl = $_helper->getRemoveUrl($_item);
|
35 |
+
}
|
36 |
+
echo $deleteUrl;
|
37 |
+
?>" title="<?php echo $this->__('Remove This Item') ?>" class="btn-remove" onclick="return confirm('<?php echo $this->__('Are you sure you would like to remove this item from the compare products?') ?>');"><?php echo $this->__('Remove This Item') ?></a>
|
38 |
+
<p class="product-name"><a href="<?php echo $this->getProductUrl($_item) ?>"><?php echo $this->helper('catalog/output')->productAttribute($_item, $_item->getName(), 'name') ?></a></p>
|
39 |
+
</li>
|
40 |
+
<?php endforeach; ?>
|
41 |
+
</ol>
|
42 |
+
<script type="text/javascript">decorateList('compare-items')</script>
|
43 |
+
<div class="actions">
|
44 |
+
<a href="<?php
|
45 |
+
$params = $this->getRequest()->getParams();
|
46 |
+
if($params['isAjax'] == 1){
|
47 |
+
$refererUrl = Mage::registry('referrer_url');
|
48 |
+
if (empty($refererUrl)) {
|
49 |
+
$refererUrl = Mage::getBaseUrl();
|
50 |
+
}
|
51 |
+
$deleteUrl = $this->getUrl(
|
52 |
+
'catalog/product_compare/clear',
|
53 |
+
array(
|
54 |
+
Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->helper('core/url')->getEncodedUrl($refererUrl)
|
55 |
+
)
|
56 |
+
);
|
57 |
+
}else{
|
58 |
+
$deleteUrl = $_helper->getClearListUrl();
|
59 |
+
}
|
60 |
+
echo $deleteUrl;
|
61 |
+
?>" onclick="return confirm('<?php echo $this->__('Are you sure you would like to remove all products from your comparison?') ?>');"><?php echo $this->__('Clear All') ?></a>
|
62 |
+
<button type="button" title="<?php echo $this->__('Compare') ?>" class="button" onclick="popWin('<?php echo $_helper->getListUrl() ?>','compare','top:0,left:0,width=820,height=600,resizable=yes,scrollbars=yes')"><span><span><?php echo $this->__('Compare') ?></span></span></button>
|
63 |
+
</div>
|
64 |
+
<?php else: ?>
|
65 |
+
<p class="empty"><?php echo $this->__('You have no items to compare.') ?></p>
|
66 |
+
<?php endif; ?>
|
67 |
+
</div>
|
68 |
+
</div>
|
app/design/frontend/default/default/template/ajax/catalog/product/view/addto.phtml
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $_product = $this->getProduct(); ?>
|
2 |
+
<?php $_wishlistSubmitUrl = $this->helper('wishlist')->getAddUrl($_product); ?>
|
3 |
+
|
4 |
+
<ul class="add-to-links">
|
5 |
+
<?php if ($this->helper('wishlist')->isAllow()) : ?>
|
6 |
+
<li><a href="#" onclick="wishlistForm.submitAjaxWishlist(this, '<?php echo $_wishlistSubmitUrl ?>','<?php echo $_product->getId()?>'); return false;" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
|
7 |
+
<?php endif; ?>
|
8 |
+
<?php
|
9 |
+
$_compareUrl = $this->helper('catalog/product_compare')->getAddUrl($_product);
|
10 |
+
?>
|
11 |
+
<?php if($_compareUrl) : ?>
|
12 |
+
<li><span class="separator">|</span> <a href="#" onclick="ajaxCompare('<?php echo $_compareUrl?>','<?php echo $_product->getId()?>'); return false;" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
|
13 |
+
<?php endif; ?>
|
14 |
+
<li><span id='ajax_loading<?php echo $_product->getId()?>' style='display:none'><img src='<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif')?>'/></span></li>
|
15 |
+
</ul>
|
16 |
+
<script type="text/javascript">
|
17 |
+
var wishlistForm = new VarienForm('product_addtocart_form');
|
18 |
+
wishlistForm.submitAjaxWishlist = function(button, url,id){
|
19 |
+
if(this.validator) {
|
20 |
+
var nv = Validation.methods;
|
21 |
+
delete Validation.methods['required-entry'];
|
22 |
+
delete Validation.methods['validate-one-required'];
|
23 |
+
delete Validation.methods['validate-one-required-by-name'];
|
24 |
+
if (this.validator.validate()) {
|
25 |
+
url = url.replace("wishlist/index","ajax/whishlist");
|
26 |
+
var data = jQuery('#product_addtocart_form').serialize();
|
27 |
+
data += '&isAjax=1';
|
28 |
+
jQuery('#ajax_loading'+id).show();
|
29 |
+
jQuery.ajax( {
|
30 |
+
url : url,
|
31 |
+
dataType : 'json',
|
32 |
+
type : 'post',
|
33 |
+
data : data,
|
34 |
+
success : function(data) {
|
35 |
+
jQuery('#ajax_loading'+id).hide();
|
36 |
+
if(data.status == 'ERROR'){
|
37 |
+
alert(data.message);
|
38 |
+
}else{
|
39 |
+
alert(data.message);
|
40 |
+
if(jQuery('.block-wishlist').length){
|
41 |
+
jQuery('.block-wishlist').replaceWith(data.sidebar);
|
42 |
+
}else{
|
43 |
+
if(jQuery('.col-right').length){
|
44 |
+
jQuery('.col-right').prepend(data.sidebar);
|
45 |
+
}
|
46 |
+
}
|
47 |
+
if(jQuery('.header .links').length){
|
48 |
+
jQuery('.header .links').replaceWith(data.toplink);
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
52 |
+
});
|
53 |
+
}
|
54 |
+
Object.extend(Validation.methods, nv);
|
55 |
+
}
|
56 |
+
}.bind(wishlistForm);
|
57 |
+
</script>
|
app/design/frontend/default/default/template/ajax/catalog/product/view/list.phtml
CHANGED
@@ -1,161 +1,194 @@
|
|
1 |
-
<?php
|
2 |
-
$_productCollection=$this->getLoadedProductCollection();
|
3 |
-
$_helper = $this->helper('catalog/output');
|
4 |
-
?>
|
5 |
-
<?php if(!$_productCollection->count()): ?>
|
6 |
-
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
|
7 |
-
<?php else: ?>
|
8 |
-
<div class="category-products">
|
9 |
-
<?php echo $this->getToolbarHtml() ?>
|
10 |
-
<?php // List mode ?>
|
11 |
-
<?php if($this->getMode()!='grid'): ?>
|
12 |
-
<?php $_iterator = 0; ?>
|
13 |
-
<ol class="products-list" id="products-list">
|
14 |
-
<?php foreach ($_productCollection as $_product): ?>
|
15 |
-
<li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
|
16 |
-
<?php // Product Image ?>
|
17 |
-
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
|
18 |
-
<?php // Product description ?>
|
19 |
-
<div class="product-shop">
|
20 |
-
<div class="f-fix">
|
21 |
-
<?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
|
22 |
-
<h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2>
|
23 |
-
<?php if($_product->getRatingSummary()): ?>
|
24 |
-
<?php echo $this->getReviewsSummaryHtml($_product) ?>
|
25 |
-
<?php endif; ?>
|
26 |
-
<?php echo $this->getPriceHtml($_product, true) ?>
|
27 |
-
<?php if($_product->isSaleable()): ?>
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
<?php
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
<?php
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
<?php
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
jQuery('#
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
</script>
|
1 |
+
<?php
|
2 |
+
$_productCollection=$this->getLoadedProductCollection();
|
3 |
+
$_helper = $this->helper('catalog/output');
|
4 |
+
?>
|
5 |
+
<?php if(!$_productCollection->count()): ?>
|
6 |
+
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
|
7 |
+
<?php else: ?>
|
8 |
+
<div class="category-products">
|
9 |
+
<?php echo $this->getToolbarHtml() ?>
|
10 |
+
<?php // List mode ?>
|
11 |
+
<?php if($this->getMode()!='grid'): ?>
|
12 |
+
<?php $_iterator = 0; ?>
|
13 |
+
<ol class="products-list" id="products-list">
|
14 |
+
<?php foreach ($_productCollection as $_product): ?>
|
15 |
+
<li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
|
16 |
+
<?php // Product Image ?>
|
17 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
|
18 |
+
<?php // Product description ?>
|
19 |
+
<div class="product-shop">
|
20 |
+
<div class="f-fix">
|
21 |
+
<?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
|
22 |
+
<h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2>
|
23 |
+
<?php if($_product->getRatingSummary()): ?>
|
24 |
+
<?php echo $this->getReviewsSummaryHtml($_product) ?>
|
25 |
+
<?php endif; ?>
|
26 |
+
<?php echo $this->getPriceHtml($_product, true) ?>
|
27 |
+
<?php if($_product->isSaleable()): ?>
|
28 |
+
|
29 |
+
<?php if(Mage::getStoreConfig('ajax/general/enabledpro')){ ?>
|
30 |
+
|
31 |
+
<?php if ( !($_product->getTypeInstance(true)->hasRequiredOptions($_product) || $_product->isGrouped()) ) { ?>
|
32 |
+
<p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocationAjax('<?php echo $this->getAddToCartUrl($_product) ?>','<?php echo $_product->getId()?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
|
33 |
+
<span id='ajax_loader<?php echo $_product->getId()?>' style='display:none'><img src='<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif')?>'/></span>
|
34 |
+
<?php } else { ?>
|
35 |
+
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="showOptions('<?php echo $_product->getId()?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
|
36 |
+
<a href='<?php echo $this->getUrl('ajax/index/options',array('product_id'=>$_product->getId()));?>' class='fancybox' id='fancybox<?php echo $_product->getId()?>' style='display:none'>Test</a>
|
37 |
+
<?php } ?>
|
38 |
+
|
39 |
+
<?php }else{ ?>
|
40 |
+
<p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
|
41 |
+
|
42 |
+
<?php } ?>
|
43 |
+
|
44 |
+
<?php else: ?>
|
45 |
+
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
|
46 |
+
<?php endif; ?>
|
47 |
+
<div class="desc std">
|
48 |
+
<?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
|
49 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>" class="link-learn"><?php echo $this->__('Learn More') ?></a>
|
50 |
+
</div>
|
51 |
+
<ul class="add-to-links">
|
52 |
+
<?php if ($this->helper('wishlist')->isAllow()) : ?>
|
53 |
+
<li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
|
54 |
+
<?php endif; ?>
|
55 |
+
<?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
|
56 |
+
<li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
|
57 |
+
<?php endif; ?>
|
58 |
+
</ul>
|
59 |
+
</div>
|
60 |
+
</div>
|
61 |
+
</li>
|
62 |
+
<?php endforeach; ?>
|
63 |
+
</ol>
|
64 |
+
<script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
|
65 |
+
|
66 |
+
<?php else: ?>
|
67 |
+
|
68 |
+
<?php // Grid Mode ?>
|
69 |
+
|
70 |
+
<?php $_collectionSize = $_productCollection->count() ?>
|
71 |
+
<?php $_columnCount = $this->getColumnCount(); ?>
|
72 |
+
<?php $i=0; foreach ($_productCollection as $_product): ?>
|
73 |
+
<?php if ($i++%$_columnCount==0): ?>
|
74 |
+
<ul class="products-grid">
|
75 |
+
<?php endif ?>
|
76 |
+
<li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
|
77 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" width="135" height="135" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
|
78 |
+
<h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
|
79 |
+
<?php if($_product->getRatingSummary()): ?>
|
80 |
+
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
|
81 |
+
<?php endif; ?>
|
82 |
+
<?php echo $this->getPriceHtml($_product, true) ?>
|
83 |
+
<div class="actions">
|
84 |
+
<?php if($_product->isSaleable()): ?>
|
85 |
+
<?php if(Mage::getStoreConfig('ajax/general/enabledpro')){ ?>
|
86 |
+
|
87 |
+
<?php if ( !($_product->getTypeInstance(true)->hasRequiredOptions($_product) || $_product->isGrouped()) ) { ?>
|
88 |
+
<p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocationAjax('<?php echo $this->getAddToCartUrl($_product) ?>','<?php echo $_product->getId()?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
|
89 |
+
<span id='ajax_loader<?php echo $_product->getId()?>' style='display:none'><img src='<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif')?>'/></span>
|
90 |
+
<?php } else { ?>
|
91 |
+
<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="showOptions('<?php echo $_product->getId()?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
|
92 |
+
<a href='<?php echo $this->getUrl('ajax/index/options',array('product_id'=>$_product->getId()));?>' class='fancybox' id='fancybox<?php echo $_product->getId()?>' style='display:none'>Test</a>
|
93 |
+
<?php } ?>
|
94 |
+
|
95 |
+
<?php }else{ ?>
|
96 |
+
<p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
|
97 |
+
|
98 |
+
<?php } ?>
|
99 |
+
<?php else: ?>
|
100 |
+
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
|
101 |
+
<?php endif; ?>
|
102 |
+
|
103 |
+
|
104 |
+
<?php if(Mage::getStoreConfig('ajax/wishlistcompare/enabledpro')){?>
|
105 |
+
<ul class="add-to-links">
|
106 |
+
<?php if ($this->helper('wishlist')->isAllow()) : ?>
|
107 |
+
<li><a href="#" onclick='ajaxWishlist("<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>","<?php echo $_product->getId()?>");return false;' class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
|
108 |
+
<?php endif; ?>
|
109 |
+
<?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
|
110 |
+
<li><span class="separator">|</span> <a href="#" onclick='ajaxCompare("<?php echo $_compareUrl ?>","<?php echo $_product->getId()?>");return false;' class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
|
111 |
+
<?php endif; ?>
|
112 |
+
</ul>
|
113 |
+
<span id='ajax_loading<?php echo $_product->getId()?>' style='display:none'><img src='<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif')?>'/></span>
|
114 |
+
|
115 |
+
<?php }else{?>
|
116 |
+
<ul class="add-to-links">
|
117 |
+
<?php if ($this->helper('wishlist')->isAllow()) : ?>
|
118 |
+
<li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
|
119 |
+
<?php endif; ?>
|
120 |
+
<?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
|
121 |
+
<li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
|
122 |
+
<?php endif; ?>
|
123 |
+
</ul>
|
124 |
+
<?php } ?>
|
125 |
+
|
126 |
+
|
127 |
+
</div>
|
128 |
+
</li>
|
129 |
+
<?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
|
130 |
+
</ul>
|
131 |
+
<?php endif ?>
|
132 |
+
<?php endforeach ?>
|
133 |
+
<script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
|
134 |
+
<?php endif; ?>
|
135 |
+
|
136 |
+
<div class="toolbar-bottom">
|
137 |
+
<?php echo $this->getToolbarHtml() ?>
|
138 |
+
</div>
|
139 |
+
</div>
|
140 |
+
<?php endif; ?>
|
141 |
+
<script type="text/javascript">
|
142 |
+
jQuery.noConflict();
|
143 |
+
jQuery(document).ready(function(){
|
144 |
+
jQuery('.fancybox').fancybox(
|
145 |
+
{
|
146 |
+
hideOnContentClick : true,
|
147 |
+
width: 382,
|
148 |
+
autoDimensions: true,
|
149 |
+
type : 'iframe',
|
150 |
+
showTitle: false,
|
151 |
+
scrolling: 'no',
|
152 |
+
onComplete: function(){
|
153 |
+
jQuery('#fancybox-frame').load(function() { // wait for frame to load and then gets it's height
|
154 |
+
jQuery('#fancybox-content').height(jQuery(this).contents().find('body').height()+30);
|
155 |
+
jQuery.fancybox.resize();
|
156 |
+
});
|
157 |
+
|
158 |
+
}
|
159 |
+
}
|
160 |
+
);
|
161 |
+
});
|
162 |
+
function showOptions(id){
|
163 |
+
jQuery('#fancybox'+id).trigger('click');
|
164 |
+
}
|
165 |
+
function setAjaxData(data,iframe){
|
166 |
+
if(data.status == 'ERROR'){
|
167 |
+
alert(data.message);
|
168 |
+
}else{
|
169 |
+
if(jQuery('.block-cart')){
|
170 |
+
jQuery('.block-cart').replaceWith(data.sidebar);
|
171 |
+
}
|
172 |
+
if(jQuery('.header .links')){
|
173 |
+
jQuery('.header .links').replaceWith(data.toplink);
|
174 |
+
}
|
175 |
+
jQuery.fancybox.close();
|
176 |
+
}
|
177 |
+
}
|
178 |
+
function setLocationAjax(url,id){
|
179 |
+
url += 'isAjax/1';
|
180 |
+
url = url.replace("checkout/cart","ajax/index");
|
181 |
+
jQuery('#ajax_loader'+id).show();
|
182 |
+
try {
|
183 |
+
jQuery.ajax( {
|
184 |
+
url : url,
|
185 |
+
dataType : 'json',
|
186 |
+
success : function(data) {
|
187 |
+
jQuery('#ajax_loader'+id).hide();
|
188 |
+
setAjaxData(data,false);
|
189 |
+
}
|
190 |
+
});
|
191 |
+
} catch (e) {
|
192 |
+
}
|
193 |
+
}
|
194 |
</script>
|
js/VS/ajaxwishlist.js
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function ajaxCompare(url,id){
|
2 |
+
url = url.replace("catalog/product_compare/add","ajax/whishlist/compare");
|
3 |
+
url += 'isAjax/1/';
|
4 |
+
jQuery('#ajax_loading'+id).show();
|
5 |
+
jQuery.ajax( {
|
6 |
+
url : url,
|
7 |
+
dataType : 'json',
|
8 |
+
success : function(data) {
|
9 |
+
jQuery('#ajax_loading'+id).hide();
|
10 |
+
if(data.status == 'ERROR'){
|
11 |
+
alert(data.message);
|
12 |
+
}else{
|
13 |
+
alert(data.message);
|
14 |
+
if(jQuery('.block-compare').length){
|
15 |
+
jQuery('.block-compare').replaceWith(data.sidebar);
|
16 |
+
}else{
|
17 |
+
if(jQuery('.col-right').length){
|
18 |
+
jQuery('.col-right').prepend(data.sidebar);
|
19 |
+
}
|
20 |
+
}
|
21 |
+
}
|
22 |
+
}
|
23 |
+
});
|
24 |
+
}
|
25 |
+
function ajaxWishlist(url,id){
|
26 |
+
url = url.replace("wishlist/index","ajax/whishlist");
|
27 |
+
url += 'isAjax/1/';
|
28 |
+
jQuery('#ajax_loading'+id).show();
|
29 |
+
jQuery.ajax( {
|
30 |
+
url : url,
|
31 |
+
dataType : 'json',
|
32 |
+
success : function(data) {
|
33 |
+
jQuery('#ajax_loading'+id).hide();
|
34 |
+
if(data.status == 'ERROR'){
|
35 |
+
alert(data.message);
|
36 |
+
}else{
|
37 |
+
alert(data.message);
|
38 |
+
if(jQuery('.block-wishlist').length){
|
39 |
+
jQuery('.block-wishlist').replaceWith(data.sidebar);
|
40 |
+
}else{
|
41 |
+
if(jQuery('.col-right').length){
|
42 |
+
jQuery('.col-right').prepend(data.sidebar);
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
46 |
+
}
|
47 |
+
});
|
48 |
+
}
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>VS_Ajax</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -10,9 +10,9 @@
|
|
10 |
<description>Extensin will help to add products to shopping cart directly from category and product page using ajax operations. User would be able to add all product types simple,configurable,bundled,grouped, virtual and downloadable from the category page itself. For the products which require options to be selected before adding to cart e.g configurable,bundled etc , a lightbox iframe window will show up showing the options to be selected by user with a ‘Add to Cart’ button.</description>
|
11 |
<notes>Extensin will help to add products to shopping cart directly from category and product page using ajax operations. User would be able to add all product types simple,configurable,bundled,grouped, virtual and downloadable from the category page itself. For the products which require options to be selected before adding to cart e.g configurable,bundled etc , a lightbox iframe window will show up showing the options to be selected by user with a ‘Add to Cart’ button.</notes>
|
12 |
<authors><author><name>virendra kumar sharma</name><user>auto-converted</user><email>bhardwajveerendra@gmail.com</email></author></authors>
|
13 |
-
<date>2012-05-
|
14 |
-
<time>
|
15 |
-
<contents><target name="magecommunity"><dir name="VS"><dir name="Ajax"><dir name="Block"><dir name="Cart"><file name="Sidebar.php" hash="864bb88bd32fd7173e0c93ab38f1a95e"/></dir><file name="Ajax.php" hash="086593f100cc5f39908670c87e4d7e34"/></dir><dir name="Helper"><file name="Data.php" hash="10b3d25f90cb15f98564f2b5acda6ed5"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Ajax"><file name="Collection.php" hash="c1adf1b37d155cd86392731425a6adae"/></dir><file name="Ajax.php" hash="73ac136326d2a74ba5b2dfc27ee809ec"/></dir><file name="Ajax.php" hash="50ab19e34a1e77f7453f8c9b4267b4a8"/><file name="Status.php" hash="c0b40c775f4ae79ddfe1ba73ad1c1498"/></dir><dir name="controllers"><file name="IndexController.php" hash="d315aa326c338fc9a8eb9c016e41611b"/></dir><dir name="etc"><file name="config.xml" hash="65a03a47e9ac642929377a3989bc45cf"/><file name="system.xml" hash="
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>VS_Ajax</name>
|
4 |
+
<version>1.0.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
10 |
<description>Extensin will help to add products to shopping cart directly from category and product page using ajax operations. User would be able to add all product types simple,configurable,bundled,grouped, virtual and downloadable from the category page itself. For the products which require options to be selected before adding to cart e.g configurable,bundled etc , a lightbox iframe window will show up showing the options to be selected by user with a ‘Add to Cart’ button.</description>
|
11 |
<notes>Extensin will help to add products to shopping cart directly from category and product page using ajax operations. User would be able to add all product types simple,configurable,bundled,grouped, virtual and downloadable from the category page itself. For the products which require options to be selected before adding to cart e.g configurable,bundled etc , a lightbox iframe window will show up showing the options to be selected by user with a ‘Add to Cart’ button.</notes>
|
12 |
<authors><author><name>virendra kumar sharma</name><user>auto-converted</user><email>bhardwajveerendra@gmail.com</email></author></authors>
|
13 |
+
<date>2012-05-08</date>
|
14 |
+
<time>06:14:29</time>
|
15 |
+
<contents><target name="magecommunity"><dir name="VS"><dir name="Ajax"><dir name="Block"><dir name="Cart"><file name="Sidebar.php" hash="864bb88bd32fd7173e0c93ab38f1a95e"/></dir><file name="Ajax.php" hash="086593f100cc5f39908670c87e4d7e34"/></dir><dir name="Helper"><file name="Data.php" hash="10b3d25f90cb15f98564f2b5acda6ed5"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Ajax"><file name="Collection.php" hash="c1adf1b37d155cd86392731425a6adae"/></dir><file name="Ajax.php" hash="73ac136326d2a74ba5b2dfc27ee809ec"/></dir><file name="Ajax.php" hash="50ab19e34a1e77f7453f8c9b4267b4a8"/><file name="Status.php" hash="c0b40c775f4ae79ddfe1ba73ad1c1498"/></dir><dir name="controllers"><file name="IndexController.php" hash="d315aa326c338fc9a8eb9c016e41611b"/><file name="whishlistController.php" hash="7d28b3cb333333b2c3e79537f683ad39"/></dir><dir name="etc"><file name="config.xml" hash="65a03a47e9ac642929377a3989bc45cf"/><file name="system.xml" hash="d6bbc0bf610fe2b1f4e6255c6746bc77"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="ajax"><dir name="catalog"><dir name="product"><dir name="compare"><file name="sidebar.phtml" hash="6e548cb3c613132cd052ce9cec52648c"/></dir><dir name="view"><file name="addto.phtml" hash="5b925dc6f57ca14d0dce3fdf72ca90c5"/><file name="addtocart.phtml" hash="067f96d19d8e2e3fb0dc8f10e8e0727f"/><file name="list.phtml" hash="df83748b6551bd2681161e1ee5d18152"/></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="23bfd9fd53fc836a633a5d2efb92479b"/><file name="default1.6.phtml" hash="55096a02fb9f5f945672036858d64268"/></dir></dir></dir></dir></dir><dir name="layout"><file name="ajax.xml" hash="953b2bc17e57f7f01c7688affbf77429"/></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="VS"><file name="ajaxwishlist.js" hash="0a8a1c06b2d3801f9ae27c5e54510485"/><file name="jquery-1.6.4.min.js" hash="9118381924c51c89d9414a311ec9c97f"/><file name="noconflict.js" hash="3179f2255b046d5f2e9a71e365287bef"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="VS_Ajax.xml" hash="89f4110e36be169d3ea567a5fadb73b5"/></dir></target><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="VS"><dir name="js"><dir name="fancybox"><file name="Thumbs.db" hash="e21601a53f0ef3c31048713a03ba13c5"/><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></dir></target></contents>
|
16 |
<compatible/>
|
17 |
<dependencies/>
|
18 |
</package>
|