Version Notes
This module was tested in Magento Commerce version 1.4.0.1 and 1.5.0.1, and work in this version smoothly. Also test in Firefox 3.6, Chrome, Opera and IE 7,8,9.
Download this release
Release Info
Developer | Magento Core Team |
Extension | PSystem_AjaxQuickCart |
Version | 1.0.0 |
Comparing to | |
See all releases |
Version 1.0.0
- app/code/community/PSystem/AjaxQuickCart/Block/Headerjs.php +61 -0
- app/code/community/PSystem/AjaxQuickCart/Block/Layerjs.php +34 -0
- app/code/community/PSystem/AjaxQuickCart/Block/Refresh.php +30 -0
- app/code/community/PSystem/AjaxQuickCart/Block/Refresh/Response.php +91 -0
- app/code/community/PSystem/AjaxQuickCart/Model/Observer.php +115 -0
- app/code/community/PSystem/AjaxQuickCart/controllers/ViewcartController.php +51 -0
- app/code/community/PSystem/AjaxQuickCart/etc/adminhtml.xml +28 -0
- app/code/community/PSystem/AjaxQuickCart/etc/config.xml +61 -0
- app/code/community/PSystem/AjaxQuickCart/etc/system.xml +107 -0
- app/design/frontend/default/default/layout/ps_ajaxquickcart.xml +80 -0
- app/design/frontend/default/default/template/ajaxquickcart/quickcart/product.phtml +113 -0
- app/design/frontend/default/default/template/ajaxquickcart/viewcart/cart.phtml +86 -0
- app/design/frontend/default/default/template/ajaxquickcart/viewcart/item/default.phtml +224 -0
- app/design/frontend/default/default/template/ajaxquickcart/viewcart/noItems.phtml +18 -0
- app/etc/modules/PSystem_AjaxQuickCart.xml +20 -0
- js/pascalsystem/ajaxquickcart.js +156 -0
- package.xml +22 -0
- skin/frontend/default/default/css/pascalsystem/ajaxquickcart.css +15 -0
app/code/community/PSystem/AjaxQuickCart/Block/Headerjs.php
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category PSystem
|
4 |
+
* @package PSystem_AjaxQuickCart
|
5 |
+
* @author Pascal System <info@pascalsystem.pl>
|
6 |
+
* @version 1.0.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Pascal Quick Cart Ajax Header JavaScripts
|
11 |
+
*
|
12 |
+
* @category PSystem
|
13 |
+
* @package PSystem_AjaxQuickCart
|
14 |
+
* @author Pascal System <info@pascalsystem.pl>
|
15 |
+
* @version 1.0.0
|
16 |
+
*/
|
17 |
+
class PSystem_AjaxQuickCart_Block_Headerjs extends Mage_Core_Block_Abstract {
|
18 |
+
/**
|
19 |
+
* Get html code
|
20 |
+
*
|
21 |
+
* @return string
|
22 |
+
*/
|
23 |
+
public function _toHtml() {
|
24 |
+
$disableViewCart = Mage::getStoreConfig('psajaxquickcart/viewcart/disable');
|
25 |
+
$disableQuickCart = Mage::getStoreConfig('psajaxquickcart/quickcart/disable');
|
26 |
+
$html = '';
|
27 |
+
if (!$disableViewCart || !$disableQuickCart) {
|
28 |
+
$html.= '<script type="text/javascript">'."\n";
|
29 |
+
if (!$disableViewCart) {
|
30 |
+
if (!$selectorViewCart = Mage::getStoreConfig('psajaxquickcart/viewcart/selector')) {
|
31 |
+
$selectorViewCart = '.top-link-cart';
|
32 |
+
}
|
33 |
+
$html.= 'PS.AjaxQuickCart.initView(\''.$selectorViewCart.'\',\''.$this->getUrl('ajaxquickcart/viewcart/index').'\');';
|
34 |
+
}
|
35 |
+
if (!$disableQuickCart) {
|
36 |
+
$conf = array(
|
37 |
+
'list' => array(
|
38 |
+
'selector' => Mage::getStoreConfig('psajaxquickcart/quickcart/selectorlist'),
|
39 |
+
'attribute' => Mage::getStoreConfig('psajaxquickcart/quickcart/attributelist'),
|
40 |
+
'match' => Mage::getStoreConfig('psajaxquickcart/quickcart/matchlist'),
|
41 |
+
),
|
42 |
+
'single' => array(
|
43 |
+
'selector' => Mage::getStoreConfig('psajaxquickcart/quickcart/selectorsingle'),
|
44 |
+
)
|
45 |
+
);
|
46 |
+
if (empty($conf['list']['selector']))
|
47 |
+
$conf['list']['selector'] = ".actions .btn-cart";
|
48 |
+
if (empty($conf['list']['attribute']))
|
49 |
+
$conf['list']['attribute'] = "onclick";
|
50 |
+
if (empty($conf['list']['match']))
|
51 |
+
$conf['list']['match'] = "setLocation('###URL###')";
|
52 |
+
if (empty($conf['single']['selector']))
|
53 |
+
$conf['single']['selector'] = ".add-to-cart .btn-cart";
|
54 |
+
|
55 |
+
$html.= 'PS.AjaxQuickCart.initQuick('.Mage::helper('core')->jsonEncode($conf).');';
|
56 |
+
}
|
57 |
+
$html.= '</script>'."\n";
|
58 |
+
}
|
59 |
+
return $html;
|
60 |
+
}
|
61 |
+
}
|
app/code/community/PSystem/AjaxQuickCart/Block/Layerjs.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category PSystem
|
4 |
+
* @package PSystem_AjaxQuickCart
|
5 |
+
* @author Pascal System <info@pascalsystem.pl>
|
6 |
+
* @version 1.0.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Pascal Quick Cart Ajax Layer JavaScripts
|
11 |
+
*
|
12 |
+
* @category PSystem
|
13 |
+
* @package PSystem_AjaxQuickCart
|
14 |
+
* @author Pascal System <info@pascalsystem.pl>
|
15 |
+
* @version 1.0.0
|
16 |
+
*/
|
17 |
+
class PSystem_AjaxQuickCart_Block_Layerjs extends Mage_Core_Block_Abstract {
|
18 |
+
/**
|
19 |
+
* Get html code
|
20 |
+
*
|
21 |
+
* @return string
|
22 |
+
*/
|
23 |
+
public function _toHtml() {
|
24 |
+
$selector = Mage::getStoreConfig('psajaxquickcart/quickcart/selectorsingle');
|
25 |
+
if (empty($selector))
|
26 |
+
$selector = ".add-to-cart .btn-cart";
|
27 |
+
|
28 |
+
$html = '<script type="text/javascript">'."\n";
|
29 |
+
$html.= 'PS.AjaxQuickCart.initLayerQuick(\''.$selector.'\');';
|
30 |
+
$html.= '</script>'."\n";
|
31 |
+
|
32 |
+
return $html;
|
33 |
+
}
|
34 |
+
}
|
app/code/community/PSystem/AjaxQuickCart/Block/Refresh.php
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category PSystem
|
4 |
+
* @package PSystem_AjaxQuickCart
|
5 |
+
* @author Pascal System <info@pascalsystem.pl>
|
6 |
+
* @version 1.0.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Pascal Quick Cart Ajax refresh data JavaScripts
|
11 |
+
*
|
12 |
+
* @category PSystem
|
13 |
+
* @package PSystem_AjaxQuickCart
|
14 |
+
* @author Pascal System <info@pascalsystem.pl>
|
15 |
+
* @version 1.0.0
|
16 |
+
*/
|
17 |
+
class PSystem_AjaxQuickCart_Block_Refresh extends Mage_Core_Block_Abstract {
|
18 |
+
/**
|
19 |
+
* Get html code
|
20 |
+
*
|
21 |
+
* @return string
|
22 |
+
*/
|
23 |
+
public function _toHtml() {
|
24 |
+
$html = '<script type="text/javascript">'."\n";
|
25 |
+
$html.= 'PS.AjaxQuickCart.refresh(\''.$this->getUrl('ajaxquickcart/viewcart/refresh').'\');';
|
26 |
+
$html.= '</script>'."\n";
|
27 |
+
|
28 |
+
return $html;
|
29 |
+
}
|
30 |
+
}
|
app/code/community/PSystem/AjaxQuickCart/Block/Refresh/Response.php
ADDED
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category PSystem
|
4 |
+
* @package PSystem_AjaxQuickCart
|
5 |
+
* @author Pascal System <info@pascalsystem.pl>
|
6 |
+
* @version 1.0.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Pascal Quick Cart Ajax refresh response data
|
11 |
+
*
|
12 |
+
* @category PSystem
|
13 |
+
* @package PSystem_AjaxQuickCart
|
14 |
+
* @author Pascal System <info@pascalsystem.pl>
|
15 |
+
* @version 1.0.0
|
16 |
+
*/
|
17 |
+
class PSystem_AjaxQuickCart_Block_Refresh_Response extends Mage_Core_Block_Abstract {
|
18 |
+
/**
|
19 |
+
* List block with selector
|
20 |
+
*
|
21 |
+
* @var array
|
22 |
+
*/
|
23 |
+
protected $_responseBlock = array();
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Add response block
|
27 |
+
*
|
28 |
+
* @param string $selector
|
29 |
+
* @param string $blockName
|
30 |
+
* @return PSystem_AjaxQuickCart_Block_Refresh_Response
|
31 |
+
*/
|
32 |
+
public function addResponseBlock($selector, $blockName) {
|
33 |
+
$this->_responseBlock[$selector] = $blockName;
|
34 |
+
return $this;
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Remove response block by selector
|
39 |
+
*
|
40 |
+
* @param string $selector
|
41 |
+
* @return PSystem_AjaxQuickCart_Block_Refresh_Response
|
42 |
+
*/
|
43 |
+
public function removeBlockBySelector($selector) {
|
44 |
+
unset($this->_responseBlock[$selector]);
|
45 |
+
return $this;
|
46 |
+
}
|
47 |
+
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Remove response block by block name
|
51 |
+
*
|
52 |
+
* @param string $blockName
|
53 |
+
* @return PSystem_AjaxQuickCart_Block_Refresh_Response
|
54 |
+
*/
|
55 |
+
public function removeBlockByBlockName($blockName) {
|
56 |
+
if (in_array($blockName, $this->_responseBlock)) {
|
57 |
+
$res = array_search($blockName, $this->_responseBlock);
|
58 |
+
if (is_array($res)) {
|
59 |
+
foreach ($res as $_singleRes) {
|
60 |
+
unset($this->_responseBlock[$_singleRes]);
|
61 |
+
}
|
62 |
+
} else {
|
63 |
+
unset($this->_responseBlock[$res]);
|
64 |
+
}
|
65 |
+
}
|
66 |
+
return $this;
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Prepare html
|
71 |
+
*
|
72 |
+
* @return string
|
73 |
+
*/
|
74 |
+
public function _toHtml() {
|
75 |
+
$dataArr = array();
|
76 |
+
if (is_array($this->_responseBlock)) {
|
77 |
+
$layout = $this->getLayout();
|
78 |
+
foreach ($this->_responseBlock as $_blockSelector => $_blockName) {
|
79 |
+
if ($_renderBlock = $layout->getBlock($_blockName)) {
|
80 |
+
if (isset($dataArr[$_blockName]))
|
81 |
+
continue;
|
82 |
+
$dataArr[$_blockName] = array(
|
83 |
+
'selector' => $_blockSelector,
|
84 |
+
'html' => $_renderBlock->toHtml()
|
85 |
+
);
|
86 |
+
}
|
87 |
+
}
|
88 |
+
}
|
89 |
+
return Mage::helper('core')->jsonEncode($dataArr);
|
90 |
+
}
|
91 |
+
}
|
app/code/community/PSystem/AjaxQuickCart/Model/Observer.php
ADDED
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category PSystem
|
4 |
+
* @package PSystem_AjaxQuickCart
|
5 |
+
* @author Pascal System <info@pascalsystem.pl>
|
6 |
+
* @version 1.0.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Pascal Quick Cart Ajax Observer
|
11 |
+
*
|
12 |
+
* @category PSystem
|
13 |
+
* @package PSystem_AjaxQuickCart
|
14 |
+
* @author Pascal System <info@pascalsystem.pl>
|
15 |
+
* @version 1.0.0
|
16 |
+
*/
|
17 |
+
class PSystem_AjaxQuickCart_Model_Observer extends Mage_Core_Block_Abstract {
|
18 |
+
/**
|
19 |
+
* After try add product to cart
|
20 |
+
*
|
21 |
+
* @return void
|
22 |
+
*/
|
23 |
+
public function postDispatchAddToCart(Varien_Event_Observer $event) {
|
24 |
+
/* @var $action Mage_Checkout_CartController */
|
25 |
+
$action = $event->getControllerAction();
|
26 |
+
|
27 |
+
if (!$ajaxRequest = $action->getRequest()->getHeader('X-Requested-With')) {
|
28 |
+
return;
|
29 |
+
}
|
30 |
+
|
31 |
+
/* @var $baseObserver PSystem_Base_Model_Observer */
|
32 |
+
$baseObserver = Mage::getModel('psbase/observer');
|
33 |
+
|
34 |
+
/* @var $checkout Mage_Checkout_Model_Session */
|
35 |
+
$checkout = Mage::getSingleton('checkout/session');
|
36 |
+
/* @var $msg Mage_Core_Model_Message_Collection */
|
37 |
+
$msg = $checkout->getMessages(true);
|
38 |
+
$isError = (count($msg->getItems('success'))==0)?true:false;
|
39 |
+
|
40 |
+
if ($isError) {
|
41 |
+
$productId = intval($action->getRequest()->getParam('product'));
|
42 |
+
/* @var $product Mage_Catalog_Model_Product */
|
43 |
+
$product = Mage::getModel('catalog/product')->load($productId);
|
44 |
+
if ($productId && ($product->getId() == $productId)) {
|
45 |
+
Mage::register('product', $product);
|
46 |
+
Mage::register('current_product', $product);
|
47 |
+
} else {
|
48 |
+
$product = false;
|
49 |
+
}
|
50 |
+
|
51 |
+
/* @var $layout Mage_Core_Model_Layout */
|
52 |
+
$layout = $action->getLayout();
|
53 |
+
|
54 |
+
if ($product) {
|
55 |
+
$productType = $product->getTypeId();
|
56 |
+
$updater = $layout->getUpdate();
|
57 |
+
$updater->addHandle('catalog_product_view');
|
58 |
+
$updater->addHandle('PRODUCT_TYPE_'.$productType);
|
59 |
+
$updater->addHandle('ajaxquickcart_product_view');
|
60 |
+
$updater->addHandle('PRODUCT_TYPE_ajaxquickcart_'.$productType);
|
61 |
+
}
|
62 |
+
$action->loadLayout();
|
63 |
+
|
64 |
+
if ($product && ($block = $layout->getBlock('product.info')) && ($content = $layout->getBlock('content'))) {
|
65 |
+
$content->unsetChildren();
|
66 |
+
$content->append($block);
|
67 |
+
}
|
68 |
+
} else {
|
69 |
+
$layout = $action->loadLayout()->getLayout();
|
70 |
+
}
|
71 |
+
|
72 |
+
$baseObserver->postdispatch($event);
|
73 |
+
exit;
|
74 |
+
}
|
75 |
+
|
76 |
+
/**
|
77 |
+
* Check is load only options on catalog_product_view page
|
78 |
+
*
|
79 |
+
* @param Varien_Event_Observer $event
|
80 |
+
* @return void
|
81 |
+
*/
|
82 |
+
public function preDispatchCatalogProductView(Varien_Event_Observer $event) {
|
83 |
+
/* @var $action Mage_Core_Controller_Varien_Action */
|
84 |
+
$action = $event->getAction();
|
85 |
+
if ($action->getFullActionName() != 'catalog_product_view') {
|
86 |
+
return;
|
87 |
+
}
|
88 |
+
|
89 |
+
/* @var $request Mage_Core_Controller_Request_Http */
|
90 |
+
$request = $action->getRequest();
|
91 |
+
if ((!$ajaxRequest = $action->getRequest()->getHeader('X-Requested-With'))
|
92 |
+
|| (!$request->getParams('ajaxquickcartoption'))) {
|
93 |
+
return;
|
94 |
+
}
|
95 |
+
|
96 |
+
if (!$productId = intval($request->getParam('id')))
|
97 |
+
return;
|
98 |
+
/* @var $product Mage_Catalog_Model_Product */
|
99 |
+
$product = Mage::getModel('catalog/product')->load($productId);
|
100 |
+
if ($product->getId() != $productId)
|
101 |
+
return;
|
102 |
+
|
103 |
+
$productType = $product->getTypeId();
|
104 |
+
|
105 |
+
/* @var $update Mage_Core_Model_Layout_Update */
|
106 |
+
$update = $action->getLayout()->getUpdate();
|
107 |
+
/*$update->addUpdate('<reference name="product.info">
|
108 |
+
<action method="setTemplate"><template>ajaxquickcart/quickcart/product.phtml</template></action>
|
109 |
+
</reference>');*/
|
110 |
+
$update->addHandle('ajaxquickcart_product_view');
|
111 |
+
$update->addHandle('PRODUCT_TYPE_ajaxquickcart_'.$productType);
|
112 |
+
|
113 |
+
//tu i u gory dodac obsluge add to cart w jakis sposob na warstwie
|
114 |
+
}
|
115 |
+
}
|
app/code/community/PSystem/AjaxQuickCart/controllers/ViewcartController.php
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category PSystem
|
4 |
+
* @package PSystem_AjaxQuickCart
|
5 |
+
* @author Pascal System <info@pascalsystem.pl>
|
6 |
+
* @version 1.0.0
|
7 |
+
*/
|
8 |
+
|
9 |
+
/**
|
10 |
+
* @see Mage_Checkout_CartController
|
11 |
+
*/
|
12 |
+
require_once 'Mage/Checkout/controllers/CartController.php';
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Pascal Quick Cart Ajax Header JavaScripts
|
16 |
+
*
|
17 |
+
* @category PSystem
|
18 |
+
* @package PSystem_AjaxQuickCart
|
19 |
+
* @author Pascal System <info@pascalsystem.pl>
|
20 |
+
* @version 1.0.0
|
21 |
+
*/
|
22 |
+
class PSystem_AjaxQuickCart_ViewcartController extends Mage_Checkout_CartController {
|
23 |
+
/**
|
24 |
+
* Index action display only products in cart
|
25 |
+
*
|
26 |
+
* @return void
|
27 |
+
*/
|
28 |
+
public function indexAction() {
|
29 |
+
$this->loadLayout()
|
30 |
+
->_initLayoutMessages('checkout/session')
|
31 |
+
->_initLayoutMessages('catalog/session')
|
32 |
+
;
|
33 |
+
$this->renderLayout();
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Refresh box with items in cart
|
38 |
+
*
|
39 |
+
* @return void
|
40 |
+
*/
|
41 |
+
public function refreshAction() {
|
42 |
+
/* @var $layout Mage_Core_Model_Layout */
|
43 |
+
$layout = $this->loadLayout()->getLayout();
|
44 |
+
/* @var $ajaxBlock PSystem_AjaxQuickCart_Block_Refresh_Response */
|
45 |
+
if (($ajaxBlock = $layout->getBlock('ajax.response'))
|
46 |
+
&& ($ajaxBlock instanceof PSystem_AjaxQuickCart_Block_Refresh_Response)) {
|
47 |
+
echo $ajaxBlock->toHtml();
|
48 |
+
exit;
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
app/code/community/PSystem/AjaxQuickCart/etc/adminhtml.xml
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category PSystem
|
5 |
+
* @package PSystem_AjaxQuickCart
|
6 |
+
* @author Pascal System <info@pascalsystem.pl>
|
7 |
+
* @version 1.0.0
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<acl>
|
12 |
+
<resources>
|
13 |
+
<admin>
|
14 |
+
<children>
|
15 |
+
<system>
|
16 |
+
<children>
|
17 |
+
<config>
|
18 |
+
<children>
|
19 |
+
<psajaxquickcart />
|
20 |
+
</children>
|
21 |
+
</config>
|
22 |
+
</children>
|
23 |
+
</system>
|
24 |
+
</children>
|
25 |
+
</admin>
|
26 |
+
</resources>
|
27 |
+
</acl>
|
28 |
+
</config>
|
app/code/community/PSystem/AjaxQuickCart/etc/config.xml
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category PSystem
|
5 |
+
* @package PSystem_AjaxQuickCart
|
6 |
+
* @author Pascal System <info@pascalsystem.pl>
|
7 |
+
* @version 1.0.0
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<PSystem_AjaxQuickCart>
|
13 |
+
<version>1.0.0</version>
|
14 |
+
</PSystem_AjaxQuickCart>
|
15 |
+
</modules>
|
16 |
+
<global>
|
17 |
+
<blocks>
|
18 |
+
<ajaxquickcart>
|
19 |
+
<class>PSystem_AjaxQuickCart_Block</class>
|
20 |
+
</ajaxquickcart>
|
21 |
+
</blocks>
|
22 |
+
<events>
|
23 |
+
<controller_action_postdispatch_checkout_cart_add>
|
24 |
+
<observers>
|
25 |
+
<psajaxquickcart_addtocart>
|
26 |
+
<type>singleton</type>
|
27 |
+
<class>PSystem_AjaxQuickCart_Model_Observer</class>
|
28 |
+
<method>postDispatchAddToCart</method>
|
29 |
+
</psajaxquickcart_addtocart>
|
30 |
+
</observers>
|
31 |
+
</controller_action_postdispatch_checkout_cart_add>
|
32 |
+
<controller_action_layout_load_before>
|
33 |
+
<observers>
|
34 |
+
<psajaxquickcart_catalogproductview>
|
35 |
+
<type>singleton</type>
|
36 |
+
<class>PSystem_AjaxQuickCart_Model_Observer</class>
|
37 |
+
<method>preDispatchCatalogProductView</method>
|
38 |
+
</psajaxquickcart_catalogproductview>
|
39 |
+
</observers>
|
40 |
+
</controller_action_layout_load_before>
|
41 |
+
</events>
|
42 |
+
</global>
|
43 |
+
<frontend>
|
44 |
+
<layout>
|
45 |
+
<updates>
|
46 |
+
<psajaxquickcart module="PSystem_AjaxQuickCart">
|
47 |
+
<file>ps_ajaxquickcart.xml</file>
|
48 |
+
</psajaxquickcart>
|
49 |
+
</updates>
|
50 |
+
</layout>
|
51 |
+
<routers>
|
52 |
+
<ajaxquickcart>
|
53 |
+
<use>standard</use>
|
54 |
+
<args>
|
55 |
+
<module>PSystem_AjaxQuickCart</module>
|
56 |
+
<frontName>ajaxquickcart</frontName>
|
57 |
+
</args>
|
58 |
+
</ajaxquickcart>
|
59 |
+
</routers>
|
60 |
+
</frontend>
|
61 |
+
</config>
|
app/code/community/PSystem/AjaxQuickCart/etc/system.xml
ADDED
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category PSystem
|
5 |
+
* @package PSystem_AjaxQuickCart
|
6 |
+
* @author Pascal System <info@pascalsystem.pl>
|
7 |
+
* @version 1.0.0
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<sections>
|
12 |
+
<psajaxquickcart translate="label" module="psbase">
|
13 |
+
<label>Ajax Quick Cart</label>
|
14 |
+
<tab>psystem</tab>
|
15 |
+
<frontend_type>text</frontend_type>
|
16 |
+
<sort_order>10</sort_order>
|
17 |
+
<show_in_default>1</show_in_default>
|
18 |
+
<show_in_website>1</show_in_website>
|
19 |
+
<show_in_store>1</show_in_store>
|
20 |
+
<groups>
|
21 |
+
<viewcart translate="label">
|
22 |
+
<label>View Cart</label>
|
23 |
+
<show_in_default>1</show_in_default>
|
24 |
+
<show_in_website>1</show_in_website>
|
25 |
+
<show_in_store>1</show_in_store>
|
26 |
+
<sort_order>5</sort_order>
|
27 |
+
<fields>
|
28 |
+
<disable translate="label,comment">
|
29 |
+
<label>Disable</label>
|
30 |
+
<comment><![CDATA[disable quick view cart]]></comment>
|
31 |
+
<frontend_type>select</frontend_type>
|
32 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
33 |
+
<sort_order>5</sort_order>
|
34 |
+
<show_in_default>1</show_in_default>
|
35 |
+
<show_in_website>0</show_in_website>
|
36 |
+
<show_in_store>0</show_in_store>
|
37 |
+
</disable>
|
38 |
+
<selector>
|
39 |
+
<label>Seletor</label>
|
40 |
+
<comment><![CDATA[Selector for view cart link<br />default: .top-link-cart]]></comment>
|
41 |
+
<frontend_type>text</frontend_type>
|
42 |
+
<sort_order>10</sort_order>
|
43 |
+
<show_in_default>1</show_in_default>
|
44 |
+
<show_in_website>0</show_in_website>
|
45 |
+
<show_in_store>0</show_in_store>
|
46 |
+
</selector>
|
47 |
+
</fields>
|
48 |
+
</viewcart>
|
49 |
+
<quickcart>
|
50 |
+
<label>Quick Cart</label>
|
51 |
+
<show_in_default>1</show_in_default>
|
52 |
+
<show_in_website>1</show_in_website>
|
53 |
+
<show_in_store>1</show_in_store>
|
54 |
+
<sort_order>10</sort_order>
|
55 |
+
<fields>
|
56 |
+
<disable translate="label,comment">
|
57 |
+
<label>Disable</label>
|
58 |
+
<comment><![CDATA[disable quick cart]]></comment>
|
59 |
+
<frontend_type>select</frontend_type>
|
60 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
61 |
+
<sort_order>5</sort_order>
|
62 |
+
<show_in_default>1</show_in_default>
|
63 |
+
<show_in_website>0</show_in_website>
|
64 |
+
<show_in_store>0</show_in_store>
|
65 |
+
</disable>
|
66 |
+
<selectorlist>
|
67 |
+
<label>Seletor List</label>
|
68 |
+
<comment><![CDATA[Selector for quick cart<br />default: .actions .btn-cart]]></comment>
|
69 |
+
<frontend_type>text</frontend_type>
|
70 |
+
<sort_order>20</sort_order>
|
71 |
+
<show_in_default>1</show_in_default>
|
72 |
+
<show_in_website>0</show_in_website>
|
73 |
+
<show_in_store>0</show_in_store>
|
74 |
+
</selectorlist>
|
75 |
+
<attributelist>
|
76 |
+
<label>Element List attribute</label>
|
77 |
+
<comment><![CDATA[Attribute with add to cart link<br />default: onclick]]></comment>
|
78 |
+
<frontend_type>text</frontend_type>
|
79 |
+
<sort_order>30</sort_order>
|
80 |
+
<show_in_default>1</show_in_default>
|
81 |
+
<show_in_website>0</show_in_website>
|
82 |
+
<show_in_store>0</show_in_store>
|
83 |
+
</attributelist>
|
84 |
+
<matchlist>
|
85 |
+
<label>Value List attriubte match</label>
|
86 |
+
<comment><![CDATA[Match for attribute value<br />default: setLocation('###URL###')]]></comment>
|
87 |
+
<frontend_type>text</frontend_type>
|
88 |
+
<sort_order>40</sort_order>
|
89 |
+
<show_in_default>1</show_in_default>
|
90 |
+
<show_in_website>0</show_in_website>
|
91 |
+
<show_in_store>0</show_in_store>
|
92 |
+
</matchlist>
|
93 |
+
<selectorsingle>
|
94 |
+
<label>Seletor Product Page</label>
|
95 |
+
<comment><![CDATA[Selector for quick cart<br />default: .add-to-cart .btn-cart]]></comment>
|
96 |
+
<frontend_type>text</frontend_type>
|
97 |
+
<sort_order>50</sort_order>
|
98 |
+
<show_in_default>1</show_in_default>
|
99 |
+
<show_in_website>0</show_in_website>
|
100 |
+
<show_in_store>0</show_in_store>
|
101 |
+
</selectorsingle>
|
102 |
+
</fields>
|
103 |
+
</quickcart>
|
104 |
+
</groups>
|
105 |
+
</psajaxquickcart>
|
106 |
+
</sections>
|
107 |
+
</config>
|
app/design/frontend/default/default/layout/ps_ajaxquickcart.xml
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category PSystem
|
5 |
+
* @package PSystem_AjaxQuickCart
|
6 |
+
* @author Pascal System <info@pascalsystem.pl>
|
7 |
+
* @version 1.0.0
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<layout version="1.0.0">
|
11 |
+
<default>
|
12 |
+
<reference name="head">
|
13 |
+
<action method="addCss"><stylesheet>css/pascalsystem/ajaxquickcart.css</stylesheet></action>
|
14 |
+
<action method="addJs"><script>pascalsystem/ajaxquickcart.js</script></action>
|
15 |
+
|
16 |
+
<action method="addJs"><script>varien/product.js</script></action>
|
17 |
+
<action method="addJs"><script>varien/configurable.js</script></action>
|
18 |
+
<action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/><!--<if/><condition>can_load_calendar_js</condition>--></action>
|
19 |
+
<action method="addItem"><type>js</type><name>calendar/calendar.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
|
20 |
+
<action method="addItem"><type>js</type><name>calendar/calendar-setup.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
|
21 |
+
|
22 |
+
<block type="ajaxquickcart/headerjs" name="psajaxquickcart.headerjs" />
|
23 |
+
</reference>
|
24 |
+
</default>
|
25 |
+
|
26 |
+
<ajaxquickcart_viewcart_index>
|
27 |
+
<reference name="root">
|
28 |
+
<action method="setTemplate"><template>ajaxquickcart/viewcart/empty.phtml</template></action>
|
29 |
+
</reference>
|
30 |
+
<reference name="content">
|
31 |
+
<block type="checkout/cart" name="checkout.cart">
|
32 |
+
<action method="setCartTemplate"><value>ajaxquickcart/viewcart/cart.phtml</value></action>
|
33 |
+
<action method="setEmptyTemplate"><value>ajaxquickcart/viewcart/noItems.phtml</value></action>
|
34 |
+
<action method="chooseTemplate"/>
|
35 |
+
<action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>ajaxquickcart/viewcart/item/default.phtml</template></action>
|
36 |
+
<action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>ajaxquickcart/viewcart/item/default.phtml</template></action>
|
37 |
+
<action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>ajaxquickcart/viewcart/item/default.phtml</template></action>
|
38 |
+
<block type="checkout/cart_totals" name="checkout.cart.totals" as="totals" template="checkout/cart/totals.phtml"/>
|
39 |
+
|
40 |
+
</block>
|
41 |
+
<block type="ajaxquickcart/refresh" name="psajaxquickcart.refresh" as="ajaxquickrefresh" />
|
42 |
+
</reference>
|
43 |
+
</ajaxquickcart_viewcart_index>
|
44 |
+
|
45 |
+
<checkout_cart_add>
|
46 |
+
<update handle="ajaxquickcart_viewcart_index" />
|
47 |
+
</checkout_cart_add>
|
48 |
+
|
49 |
+
<ajaxquickcart_product_view>
|
50 |
+
<reference name="product.info">
|
51 |
+
<action method="setTemplate"><template>ajaxquickcart/quickcart/product.phtml</template></action>
|
52 |
+
<block type="ajaxquickcart/layerjs" name="psajaxquickcart.layerjs" as="ajaxquickjs" />
|
53 |
+
</reference>
|
54 |
+
</ajaxquickcart_product_view>
|
55 |
+
|
56 |
+
<PRODUCT_TYPE_ajaxquickcart_simple>
|
57 |
+
</PRODUCT_TYPE_ajaxquickcart_simple>
|
58 |
+
|
59 |
+
<PRODUCT_TYPE_ajaxquickcart_configurable>
|
60 |
+
</PRODUCT_TYPE_ajaxquickcart_configurable>
|
61 |
+
|
62 |
+
<PRODUCT_TYPE_ajaxquickcart_grouped>
|
63 |
+
</PRODUCT_TYPE_ajaxquickcart_grouped>
|
64 |
+
|
65 |
+
<PRODUCT_TYPE_ajaxquickcart_virtual>
|
66 |
+
</PRODUCT_TYPE_ajaxquickcart_virtual>
|
67 |
+
|
68 |
+
<ajaxquickcart_viewcart_refresh>
|
69 |
+
<block type="ajaxquickcart/refresh_response" name="ajax.response">
|
70 |
+
<action method="addResponseBlock">
|
71 |
+
<selector>.quick-access|.links</selector>
|
72 |
+
<blockname>top.links</blockname>
|
73 |
+
</action>
|
74 |
+
<action method="addResponseBlock">
|
75 |
+
<selector>.col-right|.block-cart</selector>
|
76 |
+
<blockname>cart_sidebar</blockname>
|
77 |
+
</action>
|
78 |
+
</block>
|
79 |
+
</ajaxquickcart_viewcart_refresh>
|
80 |
+
</layout>
|
app/design/frontend/default/default/template/ajaxquickcart/quickcart/product.phtml
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category PSystem
|
4 |
+
* @package PSystem_AjaxQuickCart
|
5 |
+
* @author Pascal System <info@pascalsystem.pl>
|
6 |
+
* @version 1.0.0
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<?php
|
10 |
+
/**
|
11 |
+
* Product quick cart view
|
12 |
+
*
|
13 |
+
* @see Mage_Checkout_Block_Cart
|
14 |
+
*/
|
15 |
+
?>
|
16 |
+
<div class="product-view-layer">
|
17 |
+
<?php $_helper = $this->helper('catalog/output'); ?>
|
18 |
+
<?php $_product = $this->getProduct(); ?>
|
19 |
+
<script type="text/javascript">
|
20 |
+
var optionsPrice = new Product.OptionsPrice(<?php echo $this->getJsonConfig() ?>);
|
21 |
+
</script>
|
22 |
+
<div id="messages_product_view"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
|
23 |
+
<div class="product-view">
|
24 |
+
<div class="product-essential">
|
25 |
+
<form action="<?php echo ($submitUrl = $this->getSubmitUrl($_product))?$submitUrl:$this->getAddToCartUrl($_product) ?>" method="post" id="product_addtocart_form"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
|
26 |
+
<div class="no-display">
|
27 |
+
<input type="hidden" name="product" value="<?php echo $_product->getId() ?>" />
|
28 |
+
<input type="hidden" name="related_product" id="related-products-field" value="" />
|
29 |
+
</div>
|
30 |
+
|
31 |
+
<div class="product-shop">
|
32 |
+
<div class="product-name">
|
33 |
+
<h1><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></h1>
|
34 |
+
</div>
|
35 |
+
|
36 |
+
<?php echo $this->getChildHtml('product_type_data') ?>
|
37 |
+
<?php echo $this->getTierPriceHtml() ?>
|
38 |
+
<?php echo $this->getChildHtml('extrahint') ?>
|
39 |
+
|
40 |
+
<?php if (!$this->hasOptions()):?>
|
41 |
+
<div class="add-to-box">
|
42 |
+
<?php if($_product->isSaleable()): ?>
|
43 |
+
<?php echo $this->getChildHtml('addtocart') ?>
|
44 |
+
<?php if( $this->helper('wishlist')->isAllow() || $_compareUrl=$this->helper('catalog/product_compare')->getAddUrl($_product)): ?>
|
45 |
+
<span class="or"><?php echo $this->__('OR') ?></span>
|
46 |
+
<?php endif; ?>
|
47 |
+
<?php endif; ?>
|
48 |
+
<?php echo $this->getChildHtml('addto') ?>
|
49 |
+
</div>
|
50 |
+
<?php echo $this->getChildHtml('extra_buttons') ?>
|
51 |
+
<?php endif; ?>
|
52 |
+
|
53 |
+
<?php echo $this->getChildHtml('other');?>
|
54 |
+
|
55 |
+
<?php if ($_product->isSaleable() && $this->hasOptions()):?>
|
56 |
+
<?php echo $this->getChildChildHtml('container1', '', true, true) ?>
|
57 |
+
<?php endif;?>
|
58 |
+
|
59 |
+
</div>
|
60 |
+
|
61 |
+
<div class="clearer"></div>
|
62 |
+
<?php if ($_product->isSaleable() && $this->hasOptions()):?>
|
63 |
+
<?php echo $this->getChildChildHtml('container2', '', true, true) ?>
|
64 |
+
<?php endif;?>
|
65 |
+
</form>
|
66 |
+
<script type="text/javascript">
|
67 |
+
//<![CDATA[
|
68 |
+
var productAddToCartForm = new VarienForm('product_addtocart_form');
|
69 |
+
productAddToCartForm.submit = function(button, url) {
|
70 |
+
if (this.validator.validate()) {
|
71 |
+
var form = this.form;
|
72 |
+
var oldUrl = form.action;
|
73 |
+
|
74 |
+
if (url) {
|
75 |
+
form.action = url;
|
76 |
+
}
|
77 |
+
var e = null;
|
78 |
+
try {
|
79 |
+
this.form.submit();
|
80 |
+
} catch (e) {
|
81 |
+
}
|
82 |
+
this.form.action = oldUrl;
|
83 |
+
if (e) {
|
84 |
+
throw e;
|
85 |
+
}
|
86 |
+
|
87 |
+
if (button && button != 'undefined') {
|
88 |
+
button.disabled = true;
|
89 |
+
}
|
90 |
+
}
|
91 |
+
}.bind(productAddToCartForm);
|
92 |
+
|
93 |
+
productAddToCartForm.submitLight = function(button, url){
|
94 |
+
if(this.validator) {
|
95 |
+
var nv = Validation.methods;
|
96 |
+
delete Validation.methods['required-entry'];
|
97 |
+
delete Validation.methods['validate-one-required'];
|
98 |
+
delete Validation.methods['validate-one-required-by-name'];
|
99 |
+
if (this.validator.validate()) {
|
100 |
+
if (url) {
|
101 |
+
this.form.action = url;
|
102 |
+
}
|
103 |
+
this.form.submit();
|
104 |
+
}
|
105 |
+
Object.extend(Validation.methods, nv);
|
106 |
+
}
|
107 |
+
}.bind(productAddToCartForm);
|
108 |
+
//]]>
|
109 |
+
</script>
|
110 |
+
</div>
|
111 |
+
<?php echo $this->getChildHtml('ajaxquickjs'); ?>
|
112 |
+
</div>
|
113 |
+
</div>
|
app/design/frontend/default/default/template/ajaxquickcart/viewcart/cart.phtml
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category PSystem
|
4 |
+
* @package PSystem_AjaxQuickCart
|
5 |
+
* @author Pascal System <info@pascalsystem.pl>
|
6 |
+
* @version 1.0.0
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<?php
|
10 |
+
/**
|
11 |
+
* Shopping layer cart template
|
12 |
+
*
|
13 |
+
* @see Mage_Checkout_Block_Cart
|
14 |
+
*/
|
15 |
+
?>
|
16 |
+
<div class="cart">
|
17 |
+
<div class="page-title title-buttons">
|
18 |
+
<h1><?php echo $this->__('Shopping Cart') ?></h1>
|
19 |
+
</div>
|
20 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
21 |
+
<?php echo $this->getChildHtml('form_before') ?>
|
22 |
+
<form action="<?php echo $this->getUrl('checkout/cart/updatePost') ?>" method="post">
|
23 |
+
<fieldset>
|
24 |
+
<table id="shopping-cart-table" class="data-table cart-table">
|
25 |
+
<col width="1" />
|
26 |
+
<col />
|
27 |
+
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
28 |
+
<col width="1" />
|
29 |
+
<?php endif; ?>
|
30 |
+
<?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
31 |
+
<col width="1" />
|
32 |
+
<?php endif; ?>
|
33 |
+
<col width="1" />
|
34 |
+
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
35 |
+
<col width="1" />
|
36 |
+
<?php endif; ?>
|
37 |
+
<?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
38 |
+
<col width="1" />
|
39 |
+
<?php endif; ?>
|
40 |
+
<col width="1" />
|
41 |
+
|
42 |
+
<?php $mergedCells = ($this->helper('tax')->displayCartBothPrices() ? 2 : 1); ?>
|
43 |
+
<thead>
|
44 |
+
<tr>
|
45 |
+
<th rowspan="<?php echo $mergedCells; ?>"> </th>
|
46 |
+
<th rowspan="<?php echo $mergedCells; ?>"><span class="nobr"><?php echo $this->__('Product Name') ?></span></th>
|
47 |
+
<th class="a-center" colspan="<?php echo $mergedCells; ?>"><span class="nobr"><?php echo $this->__('Unit Price') ?></span></th>
|
48 |
+
<th rowspan="<?php echo $mergedCells; ?>" class="a-center"><?php echo $this->__('Qty') ?></th>
|
49 |
+
<th class="a-center" colspan="<?php echo $mergedCells; ?>"><?php echo $this->__('Subtotal') ?></th>
|
50 |
+
<th rowspan="<?php echo $mergedCells; ?>" class="a-center"> </th>
|
51 |
+
</tr>
|
52 |
+
<?php if ($this->helper('tax')->displayCartBothPrices()): ?>
|
53 |
+
<tr>
|
54 |
+
<th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
|
55 |
+
<th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
|
56 |
+
<th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
|
57 |
+
<th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
|
58 |
+
</tr>
|
59 |
+
<?php endif; ?>
|
60 |
+
</thead>
|
61 |
+
<tfoot>
|
62 |
+
<tr>
|
63 |
+
<td colspan="50" class="a-right">
|
64 |
+
<?php if($this->getContinueShoppingUrl()): ?>
|
65 |
+
<button type="button" title="<?php echo $this->__('Continue Shopping') ?>" class="button btn-continue" onclick="PS.layer.manager.close();"><span><span><?php echo $this->__('Continue Shopping') ?></span></span></button>
|
66 |
+
<?php endif; ?>
|
67 |
+
<button type="button" title="<?php echo $this->__('My Cart') ?>" class="button btn-viewcart" onclick="setLocation('<?php echo $this->getUrl('checkout/cart/index') ?>');"><span><span><?php echo $this->__('My Cart') ?></span></span></button>
|
68 |
+
<button type="submit" title="<?php echo $this->__('Update Shopping Cart') ?>" class="button btn-update"><span><span><?php echo $this->__('Update Shopping Cart') ?></span></span></button>
|
69 |
+
</td>
|
70 |
+
</tr>
|
71 |
+
</tfoot>
|
72 |
+
<tbody>
|
73 |
+
<?php foreach($this->getItems() as $_item): ?>
|
74 |
+
<?php echo $this->getItemHtml($_item) ?>
|
75 |
+
<?php endforeach ?>
|
76 |
+
</tbody>
|
77 |
+
</table>
|
78 |
+
<script type="text/javascript">decorateTable('shopping-cart-table')</script>
|
79 |
+
</fieldset>
|
80 |
+
</form>
|
81 |
+
<div class="cart-collaterals">
|
82 |
+
<div class="totals">
|
83 |
+
<?php echo $this->getChildHtml('totals'); ?>
|
84 |
+
</div>
|
85 |
+
</div>
|
86 |
+
</div>
|
app/design/frontend/default/default/template/ajaxquickcart/viewcart/item/default.phtml
ADDED
@@ -0,0 +1,224 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category PSystem
|
4 |
+
* @package PSystem_AjaxQuickCart
|
5 |
+
* @author Pascal System <info@pascalsystem.pl>
|
6 |
+
* @version 1.0.0
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<?php
|
10 |
+
$_item = $this->getItem();
|
11 |
+
$isVisibleProduct = $_item->getProduct()->isVisibleInSiteVisibility();
|
12 |
+
?>
|
13 |
+
<tr>
|
14 |
+
<td><?php if ($this->hasProductUrl()):?><a href="<?php echo $this->getProductUrl() ?>" title="<?php echo $this->htmlEscape($this->getProductName()) ?>" class="product-image"><?php endif;?><img src="<?php echo $this->getProductThumbnail()->resize(75); ?>" width="75" height="75" alt="<?php echo $this->htmlEscape($this->getProductName()) ?>" /><?php if ($this->hasProductUrl()):?></a><?php endif;?></td>
|
15 |
+
<td>
|
16 |
+
<h2 class="product-name">
|
17 |
+
<?php if ($this->hasProductUrl()):?>
|
18 |
+
<a href="<?php echo $this->getProductUrl() ?>"><?php echo $this->htmlEscape($this->getProductName()) ?></a>
|
19 |
+
<?php else: ?>
|
20 |
+
<?php echo $this->htmlEscape($this->getProductName()) ?>
|
21 |
+
<?php endif; ?>
|
22 |
+
</h2>
|
23 |
+
<?php if ($_options = $this->getOptionList()):?>
|
24 |
+
<dl class="item-options">
|
25 |
+
<?php foreach ($_options as $_option) : ?>
|
26 |
+
<?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
|
27 |
+
<dt><?php echo $this->htmlEscape($_option['label']) ?></dt>
|
28 |
+
<dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>><?php echo $_formatedOptionValue['value'] ?>
|
29 |
+
<?php if (isset($_formatedOptionValue['full_view'])): ?>
|
30 |
+
<div class="truncated_full_value">
|
31 |
+
<dl class="item-options">
|
32 |
+
<dt><?php echo $this->htmlEscape($_option['label']) ?></dt>
|
33 |
+
<dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
|
34 |
+
</dl>
|
35 |
+
</div>
|
36 |
+
<?php endif; ?>
|
37 |
+
</dd>
|
38 |
+
<?php endforeach; ?>
|
39 |
+
</dl>
|
40 |
+
<?php endif;?>
|
41 |
+
<?php if ($messages = $this->getMessages()): ?>
|
42 |
+
<?php foreach ($messages as $message): ?>
|
43 |
+
<p class="item-msg <?php echo $message['type'] ?>">* <?php echo $message['text'] ?></p>
|
44 |
+
<?php endforeach; ?>
|
45 |
+
<?php endif; ?>
|
46 |
+
<?php if ($addtInfoBlock = $this->getProductAdditionalInformationBlock()):?>
|
47 |
+
<?php echo $addtInfoBlock->setItem($_item)->toHtml() ?>
|
48 |
+
<?php endif;?>
|
49 |
+
</td>
|
50 |
+
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
51 |
+
<td class="a-right">
|
52 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
53 |
+
<span class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
54 |
+
<?php else: ?>
|
55 |
+
<span class="cart-price">
|
56 |
+
<?php endif; ?>
|
57 |
+
|
58 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
59 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?>
|
60 |
+
<?php else: ?>
|
61 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()) ?>
|
62 |
+
<?php endif; ?>
|
63 |
+
|
64 |
+
</span>
|
65 |
+
|
66 |
+
|
67 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
68 |
+
|
69 |
+
<div class="cart-tax-info" id="eunit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
70 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
71 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
72 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
|
73 |
+
<?php endforeach; ?>
|
74 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
75 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
76 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
|
77 |
+
<?php endforeach; ?>
|
78 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
79 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
80 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
|
81 |
+
<?php endforeach; ?>
|
82 |
+
<?php endif; ?>
|
83 |
+
</div>
|
84 |
+
|
85 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
86 |
+
<div class="cart-tax-total" onclick="taxToggle('eunit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
87 |
+
<span class="weee"><?php echo Mage::helper('weee')->__('Total'); ?>: <?php echo $this->helper('checkout')->formatPrice($_item->getCalculationPrice()+$_item->getWeeeTaxAppliedAmount()+$_item->getWeeeTaxDisposition()); ?></span>
|
88 |
+
</div>
|
89 |
+
<?php endif; ?>
|
90 |
+
<?php endif; ?>
|
91 |
+
</td>
|
92 |
+
<?php endif; ?>
|
93 |
+
<?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
94 |
+
<td>
|
95 |
+
<?php $_incl = $this->helper('checkout')->getPriceInclTax($_item); ?>
|
96 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
97 |
+
<span class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
98 |
+
<?php else: ?>
|
99 |
+
<span class="cart-price">
|
100 |
+
<?php endif; ?>
|
101 |
+
|
102 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
103 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?>
|
104 |
+
<?php else: ?>
|
105 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxDisposition()) ?>
|
106 |
+
<?php endif; ?>
|
107 |
+
|
108 |
+
</span>
|
109 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
110 |
+
|
111 |
+
<div class="cart-tax-info" id="unit-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
112 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
113 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
114 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount'],true,true); ?></span>
|
115 |
+
<?php endforeach; ?>
|
116 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
117 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
118 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
|
119 |
+
<?php endforeach; ?>
|
120 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
121 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
122 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['amount_incl_tax'],true,true); ?></span>
|
123 |
+
<?php endforeach; ?>
|
124 |
+
<?php endif; ?>
|
125 |
+
</div>
|
126 |
+
|
127 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
128 |
+
<div class="cart-tax-total" onclick="taxToggle('unit-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
129 |
+
<span class="weee"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>: <?php echo $this->helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedAmount()); ?></span>
|
130 |
+
</div>
|
131 |
+
<?php endif; ?>
|
132 |
+
<?php endif; ?>
|
133 |
+
</td>
|
134 |
+
<?php endif; ?>
|
135 |
+
<td class="a-center">
|
136 |
+
<input name="cart[<?php echo $_item->getId() ?>][qty]" value="<?php echo $this->getQty() ?>" size="4" title="<?php echo $this->__('Qty') ?>" class="input-text qty" maxlength="12" />
|
137 |
+
</td>
|
138 |
+
<?php if ($this->helper('tax')->displayCartPriceExclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
139 |
+
<td class="a-right">
|
140 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
141 |
+
<span class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
142 |
+
<?php else: ?>
|
143 |
+
<span class="cart-price">
|
144 |
+
<?php endif; ?>
|
145 |
+
|
146 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
147 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?>
|
148 |
+
<?php else: ?>
|
149 |
+
<?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()) ?>
|
150 |
+
<?php endif; ?>
|
151 |
+
|
152 |
+
</span>
|
153 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
154 |
+
|
155 |
+
<div class="cart-tax-info" id="esubtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
156 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
157 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
158 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span>
|
159 |
+
<?php endforeach; ?>
|
160 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
161 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
162 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
|
163 |
+
<?php endforeach; ?>
|
164 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
165 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
166 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
|
167 |
+
<?php endforeach; ?>
|
168 |
+
<?php endif; ?>
|
169 |
+
</div>
|
170 |
+
|
171 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
172 |
+
<div class="cart-tax-total" onclick="taxToggle('esubtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
173 |
+
<span class="weee"><?php echo Mage::helper('weee')->__('Total'); ?>: <?php echo $this->helper('checkout')->formatPrice($_item->getRowTotal()+$_item->getWeeeTaxAppliedRowAmount()+$_item->getWeeeTaxRowDisposition()); ?></span>
|
174 |
+
</div>
|
175 |
+
<?php endif; ?>
|
176 |
+
<?php endif; ?>
|
177 |
+
</td>
|
178 |
+
<?php endif; ?>
|
179 |
+
<?php if ($this->helper('tax')->displayCartPriceInclTax() || $this->helper('tax')->displayCartBothPrices()): ?>
|
180 |
+
<td>
|
181 |
+
<?php $_incl = $this->helper('checkout')->getSubtotalInclTax($_item); ?>
|
182 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
183 |
+
<span class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
184 |
+
<?php else: ?>
|
185 |
+
<span class="cart-price">
|
186 |
+
<?php endif; ?>
|
187 |
+
|
188 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, array(0, 1, 4), 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
189 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?>
|
190 |
+
<?php else: ?>
|
191 |
+
<?php echo $this->helper('checkout')->formatPrice($_incl-$_item->getWeeeTaxRowDisposition()) ?>
|
192 |
+
<?php endif; ?>
|
193 |
+
|
194 |
+
</span>
|
195 |
+
|
196 |
+
|
197 |
+
<?php if (Mage::helper('weee')->getApplied($_item)): ?>
|
198 |
+
|
199 |
+
<div class="cart-tax-info" id="subtotal-item-tax-details<?php echo $_item->getId(); ?>" style="display:none;">
|
200 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 1, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
201 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
202 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount'],true,true); ?></span>
|
203 |
+
<?php endforeach; ?>
|
204 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
205 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
206 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
|
207 |
+
<?php endforeach; ?>
|
208 |
+
<?php elseif (Mage::helper('weee')->typeOfDisplay($_item, 4, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
209 |
+
<?php foreach (Mage::helper('weee')->getApplied($_item) as $tax): ?>
|
210 |
+
<span class="weee"><?php echo $tax['title']; ?>: <?php echo Mage::helper('checkout')->formatPrice($tax['row_amount_incl_tax'],true,true); ?></span>
|
211 |
+
<?php endforeach; ?>
|
212 |
+
<?php endif; ?>
|
213 |
+
</div>
|
214 |
+
|
215 |
+
<?php if (Mage::helper('weee')->typeOfDisplay($_item, 2, 'sales') && $_item->getWeeeTaxAppliedAmount()): ?>
|
216 |
+
<div class="cart-tax-total" onclick="taxToggle('subtotal-item-tax-details<?php echo $_item->getId(); ?>', this, 'cart-tax-total-expanded');">
|
217 |
+
<span class="weee"><?php echo Mage::helper('weee')->__('Total incl. tax'); ?>: <?php echo $this->helper('checkout')->formatPrice($_incl+$_item->getWeeeTaxAppliedRowAmount()); ?></span>
|
218 |
+
</div>
|
219 |
+
<?php endif; ?>
|
220 |
+
<?php endif; ?>
|
221 |
+
</td>
|
222 |
+
<?php endif; ?>
|
223 |
+
<td class="a-center"><a href="<?php echo $this->getDeleteUrl()?>" title="<?php echo $this->__('Remove item')?>" class="btn-remove btn-remove2"><?php echo $this->__('Remove item')?></a></td>
|
224 |
+
</tr>
|
app/design/frontend/default/default/template/ajaxquickcart/viewcart/noItems.phtml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @category PSystem
|
4 |
+
* @package PSystem_AjaxQuickCart
|
5 |
+
* @author Pascal System <info@pascalsystem.pl>
|
6 |
+
* @version 1.0.0
|
7 |
+
*/
|
8 |
+
?>
|
9 |
+
<div class="ajaxemptycart">
|
10 |
+
<div class="page-title">
|
11 |
+
<h1><?php echo $this->__('Shopping Cart is Empty') ?></h1>
|
12 |
+
</div>
|
13 |
+
<div class="cart-empty">
|
14 |
+
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
|
15 |
+
<p><?php echo $this->__('You have no items in your shopping cart.') ?></p>
|
16 |
+
<p><?php echo $this->__('Click <a href="%s">here</a> to continue shopping.', $this->getContinueShoppingUrl()) ?></p>
|
17 |
+
</div>
|
18 |
+
</div>
|
app/etc/modules/PSystem_AjaxQuickCart.xml
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* @category PSystem
|
5 |
+
* @package PSystem_AjaxQuickCart
|
6 |
+
* @author Pascal System <info@pascalsystem.pl>
|
7 |
+
* @version 1.0.0
|
8 |
+
*/
|
9 |
+
-->
|
10 |
+
<config>
|
11 |
+
<modules>
|
12 |
+
<PSystem_AjaxQuickCart>
|
13 |
+
<active>true</active>
|
14 |
+
<codePool>community</codePool>
|
15 |
+
<depends>
|
16 |
+
<PSystem_Base/>
|
17 |
+
</depends>
|
18 |
+
</PSystem_AjaxQuickCart>
|
19 |
+
</modules>
|
20 |
+
</config>
|
js/pascalsystem/ajaxquickcart.js
ADDED
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
PS.AjaxQuickCart = {
|
2 |
+
initView : function(selector, url){
|
3 |
+
PS.onload(function(){
|
4 |
+
var els = $$(selector);
|
5 |
+
for (var i=0;i<els.length;i++) {
|
6 |
+
els[i]._ajaxUrl = url;
|
7 |
+
els[i].onclick = PS.AjaxQuickCart.clickViewCart;
|
8 |
+
}
|
9 |
+
});
|
10 |
+
},
|
11 |
+
initQuick : function(conf){
|
12 |
+
PS.onload(function(){
|
13 |
+
var els;
|
14 |
+
var i;
|
15 |
+
els = $$(conf.single.selector);
|
16 |
+
for (i=0;i<els.length;i++) {
|
17 |
+
if (typeof els[i]._psquick != 'undefined')
|
18 |
+
continue;
|
19 |
+
els[i]._psquick = new PS.AjaxQuickCart.AddToCart(els[i], 'single', conf);
|
20 |
+
}
|
21 |
+
els = $$(conf.list.selector);
|
22 |
+
for (i=0;i<els.length;i++) {
|
23 |
+
if (typeof els[i]._psquick != 'undefined')
|
24 |
+
continue;
|
25 |
+
els[i]._psquick = new PS.AjaxQuickCart.AddToCart(els[i], 'list', conf);
|
26 |
+
}
|
27 |
+
});
|
28 |
+
},
|
29 |
+
initLayerQuick : function(selector) {
|
30 |
+
var els = $$(selector);
|
31 |
+
var conf = {'single':{'selector':selector}};
|
32 |
+
for (var i=0;i<els.length;i++) {
|
33 |
+
if (typeof els[i]._psquick != 'undefined')
|
34 |
+
continue;
|
35 |
+
els[i]._psquick = new PS.AjaxQuickCart.AddToCart(els[i], 'single', conf);
|
36 |
+
}
|
37 |
+
},
|
38 |
+
refresh : function(url) {
|
39 |
+
if (PS.AjaxQuickCart._fixDoubleRefresh)
|
40 |
+
return;
|
41 |
+
PS.AjaxQuickCart._fixDoubleRefresh = true;
|
42 |
+
PS.ajax.call(url,{});
|
43 |
+
setTimeout(function(){PS.AjaxQuickCart._fixDoubleRefresh=false;},100);
|
44 |
+
},
|
45 |
+
clickViewCart : function() {
|
46 |
+
if (typeof this._ajaxUrl == 'undefined')
|
47 |
+
return true;
|
48 |
+
PS.layer.ajax(this._ajaxUrl, {'content':'content'});
|
49 |
+
return false;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
PS.AjaxQuickCart.AddToCart = function(el, type, conf) {
|
53 |
+
if (typeof el.onclick == 'function') {
|
54 |
+
el._orginalStringOnClick = el.getAttribute('onclick');
|
55 |
+
if (typeof el._orginalStringOnClick == 'function')
|
56 |
+
el._orginalStringOnClick = el._orginalStringOnClick.toString();
|
57 |
+
el._psajaxonclick = el.onclick;
|
58 |
+
}
|
59 |
+
el.onclick = function() {
|
60 |
+
if (this._psquick.actionClick())
|
61 |
+
return false;
|
62 |
+
return el._psajaxonclick();
|
63 |
+
}
|
64 |
+
this._element = el;
|
65 |
+
this._type = type;
|
66 |
+
this._conf = conf;
|
67 |
+
}
|
68 |
+
PS.AjaxQuickCart.AddToCart.prototype.actionClick = function() {
|
69 |
+
if (this._type == 'single') {
|
70 |
+
return this.actionClickSingle();
|
71 |
+
}
|
72 |
+
var url = this.getUrl();
|
73 |
+
if (!url)
|
74 |
+
return false;
|
75 |
+
PS.layer.ajax(url, {'content':'content'});
|
76 |
+
return true;
|
77 |
+
}
|
78 |
+
PS.AjaxQuickCart.AddToCart.submitAddProductToLayer = function() {
|
79 |
+
var form = document.getElementById('product_addtocart_form');
|
80 |
+
if (!form) {
|
81 |
+
return this._psajaxquickcart();
|
82 |
+
}
|
83 |
+
var varienForm = new VarienForm('product_addtocart_form');
|
84 |
+
|
85 |
+
if (!varienForm.validator.validate())
|
86 |
+
return false;
|
87 |
+
|
88 |
+
var methodSend = form.getAttribute('method');
|
89 |
+
var url = form.getAttribute('action');
|
90 |
+
var els = Form.getElements(form);
|
91 |
+
|
92 |
+
var postData = '';
|
93 |
+
for (var i=0;i<els.length;i++) {
|
94 |
+
if (postData)
|
95 |
+
postData+='&';
|
96 |
+
if (els[i].disabled)
|
97 |
+
continue;
|
98 |
+
if (!els[i].name)
|
99 |
+
continue;
|
100 |
+
postData+= els[i].name.toString()+'='+els[i].value.toString();
|
101 |
+
}
|
102 |
+
url+= (url.indexOf('?')<0)?'?':'&';
|
103 |
+
url+= postData;
|
104 |
+
if (typeof PS.layer.manager.content != 'undefined') {
|
105 |
+
PS.layer.manager.close();
|
106 |
+
}
|
107 |
+
PS.layer.ajax(url, {'content':'content'});
|
108 |
+
return false;
|
109 |
+
}
|
110 |
+
PS.AjaxQuickCart.AddToCart.prototype.actionClickSingle = function() {
|
111 |
+
if (typeof productAddToCartForm == 'undefined') {
|
112 |
+
PS.AjaxQuickCart.AddToCart.submitAddProductToLayer();
|
113 |
+
return false;
|
114 |
+
}
|
115 |
+
if (typeof productAddToCartForm._psajaxquickcart != 'undefined') {
|
116 |
+
productAddToCartForm.submit();
|
117 |
+
return true;
|
118 |
+
}
|
119 |
+
productAddToCartForm._psajaxquickcart = productAddToCartForm.submit;
|
120 |
+
productAddToCartForm.submit = PS.AjaxQuickCart.AddToCart.submitAddProductToLayer;
|
121 |
+
productAddToCartForm.submit();
|
122 |
+
return true;
|
123 |
+
}
|
124 |
+
PS.AjaxQuickCart.AddToCart.prototype.getUrl = function() {
|
125 |
+
if (typeof this._url == 'undefined') {
|
126 |
+
var att = this._element._orginalStringOnClick;
|
127 |
+
if (att) {
|
128 |
+
if (this._conf[this._type].match) {
|
129 |
+
this._url = false;
|
130 |
+
var splitData = this._conf[this._type].match.toString().split('###URL###');
|
131 |
+
if (splitData.length == 2) {
|
132 |
+
var parts = att.toString().split(splitData[0]);
|
133 |
+
if (parts.length>1) {
|
134 |
+
var lastParts = parts[1].toString().split(splitData[1]);
|
135 |
+
var lastUrlPart = lastParts[0].toString();
|
136 |
+
if (lastUrlPart) {
|
137 |
+
this._url = lastUrlPart;
|
138 |
+
}
|
139 |
+
}
|
140 |
+
}
|
141 |
+
} else {
|
142 |
+
this._url = att;
|
143 |
+
}
|
144 |
+
} else {
|
145 |
+
this._url = false;
|
146 |
+
}
|
147 |
+
this._url = this._url.toString();
|
148 |
+
if (this._url.indexOf('?') < 0)
|
149 |
+
this._url+= '?';
|
150 |
+
else
|
151 |
+
this._url+= '&';
|
152 |
+
this._url+= 'ajaxquickcartoption=1';
|
153 |
+
}
|
154 |
+
return this._url;
|
155 |
+
}
|
156 |
+
PS.AjaxQuickCart._fixDoubleRefresh = false;
|
package.xml
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>PSystem_AjaxQuickCart</name>
|
4 |
+
<version>1.0.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Floating shopping cart, and quick add products to the basket, use layer and AJAX technology</summary>
|
10 |
+
<description>This module allow to add products in a quick way to the basket. After customer click button "add to cart", product move to the basket, and client see your shopping bag on layer. The module also works with configurable products and the grouped.
|
11 |
+
After try add configurable or grouped product, client see layer with additional options and customer can choose options and add this product.
|
12 |
+
|
13 |
+
You can set in Admin Panel configuration for your specif css and selector for javascript.
|
14 |
+
Additional you can also modify layout xml file if you want see on layer another blocks.</description>
|
15 |
+
<notes>This module was tested in Magento Commerce version 1.4.0.1 and 1.5.0.1, and work in this version smoothly. Also test in Firefox 3.6, Chrome, Opera and IE 7,8,9.</notes>
|
16 |
+
<authors><author><name>Pascal System</name><user>auto-converted</user><email>info@pascalsystem.pl</email></author></authors>
|
17 |
+
<date>2011-06-15</date>
|
18 |
+
<time>19:05:54</time>
|
19 |
+
<contents><target name="mageskin"><dir name="frontend"><dir name="default"><dir name="default"><dir name="css"><dir name="pascalsystem"><file name="ajaxquickcart.css" hash="ec1549d4513f819481f8b1a4310751e2"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="ps_ajaxquickcart.xml" hash="4165471069879c49224639324af19826"/></dir><dir name="template"><dir name="ajaxquickcart"><dir name="quickcart"><file name="product.phtml" hash="2419f6dfc367d434c4e26ece77a6c9cf"/></dir><dir name="viewcart"><file name="cart.phtml" hash="1c0a562e9454ef8bbad80a20ff5d3df6"/><file name="noItems.phtml" hash="85f1cab8052a938af3835896f8a77ad1"/><dir name="item"><file name="default.phtml" hash="67c8157acd6ee3975d2d7fe6025c8a91"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="pascalsystem"><file name="ajaxquickcart.js" hash="549942bb46755eea4bde8f4370fd5324"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="PSystem_AjaxQuickCart.xml" hash="d92cca5a0f9609283ad4be1c7cd75194"/></dir></target><target name="magecommunity"><dir name="PSystem"><dir name="AjaxQuickCart"><dir name="Block"><file name="Headerjs.php" hash="87e46591c8713c5946e54788ad92e00e"/><file name="Layerjs.php" hash="f0123ebac27fc5c0ec4c7dc58d9123ac"/><file name="Refresh.php" hash="1d1f50a7b719770e03b082187df3b24f"/><dir name="Refresh"><file name="Response.php" hash="89d5ac7dadc5c38a996b82f64502ccb5"/></dir></dir><dir name="controllers"><file name="ViewcartController.php" hash="0cce1063e354a66b22b06b4ee1b02e1d"/></dir><dir name="etc"><file name="adminhtml.xml" hash="13a00983a4523dcb797e0361a2421032"/><file name="config.xml" hash="3acf3457d098a1075133002a0222f146"/><file name="system.xml" hash="fd387caac54dd50439a6200f4f62cdf9"/></dir><dir name="Model"><file name="Observer.php" hash="f81e83b84583e2bb27fca8ac128d3d29"/></dir></dir></dir></target></contents>
|
20 |
+
<compatible/>
|
21 |
+
<dependencies><required><package><name>PSystem_Base</name><channel>community</channel><min>1.1.1</min><max></max></package></required></dependencies>
|
22 |
+
</package>
|
skin/frontend/default/default/css/pascalsystem/ajaxquickcart.css
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.pascalsystem-content .ajaxemptycart, .pascalsystem-content .cart {
|
2 |
+
width:550px;
|
3 |
+
padding:5px 10px;
|
4 |
+
background:#ffffff;
|
5 |
+
border:1px solid #000000;
|
6 |
+
}
|
7 |
+
.pascalsystem-content .cart .btn-continue {
|
8 |
+
margin-right:5px;
|
9 |
+
}
|
10 |
+
.pascalsystem-content .cart .btn-viewcart {
|
11 |
+
float:left;
|
12 |
+
}
|
13 |
+
.pascalsystem-content .product-view-layer {
|
14 |
+
width:380px;
|
15 |
+
}
|