Version Notes
First Version
Download this release
Release Info
Developer | Anuj |
Extension | AK_Multiaddtocart |
Version | 0.1.0 |
Comparing to | |
See all releases |
Version 0.1.0
- app/code/community/AK/Multiaddtocart/Helper/Data.php +5 -0
- app/code/community/AK/Multiaddtocart/controllers/CartController.php +70 -0
- app/code/community/AK/Multiaddtocart/etc/config.xml +64 -0
- app/code/community/AK/Multiaddtocart/etc/system.xml +42 -0
- app/design/frontend/base/default/layout/multiaddtocart.xml +27 -0
- app/design/frontend/base/default/template/multiaddtocart/catalog/product/multilist.phtml +205 -0
- app/etc/modules/AK_Multiaddtocart.xml +10 -0
- package.xml +18 -0
- skin/frontend/base/default/multiaddtocart/multiaddtocart.js +45 -0
app/code/community/AK/Multiaddtocart/Helper/Data.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class AK_Multiaddtocart_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
}
|
5 |
+
|
app/code/community/AK/Multiaddtocart/controllers/CartController.php
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once 'Mage/Checkout/controllers/CartController.php';
|
4 |
+
|
5 |
+
class AK_Multiaddtocart_CartController extends Mage_Checkout_CartController
|
6 |
+
{
|
7 |
+
|
8 |
+
public function multiaddtocartAction(){
|
9 |
+
|
10 |
+
$cart = $this->_getCart();
|
11 |
+
try{
|
12 |
+
|
13 |
+
$productIds = $this->getRequest()->getParam('check',array());
|
14 |
+
|
15 |
+
if (!is_array($productIds)) {
|
16 |
+
$this->_goBack();
|
17 |
+
return;
|
18 |
+
}
|
19 |
+
|
20 |
+
|
21 |
+
foreach ($productIds as $productId) {
|
22 |
+
$product = Mage::getModel('catalog/product')
|
23 |
+
->setStoreId(Mage::app()->getStore()->getId())
|
24 |
+
->load($productId);
|
25 |
+
|
26 |
+
if (!$product) {
|
27 |
+
$this->_goBack();
|
28 |
+
return;
|
29 |
+
}
|
30 |
+
$qtyname = 'qty_'.$productId;
|
31 |
+
$params['qty'] = (int) $this->getRequest()->getParam($qtyname);
|
32 |
+
$cart->addProduct($product, $params);
|
33 |
+
$productNames[]=$product->getName();
|
34 |
+
}
|
35 |
+
|
36 |
+
$cart->save();
|
37 |
+
$this->_getSession()->setCartWasUpdated(true);
|
38 |
+
if (!$this->_getSession()->getNoCartRedirect(true)) {
|
39 |
+
if (!$cart->getQuote()->getHasError()) {
|
40 |
+
$message = $this->__('%s was added to your shopping cart.', Mage::helper('core')->escapeHtml(implode(",",$productNames)));
|
41 |
+
$this->_getSession()->addSuccess($message);
|
42 |
+
}
|
43 |
+
$this->_goBack();
|
44 |
+
}
|
45 |
+
|
46 |
+
} catch (Mage_Core_Exception $e) {
|
47 |
+
if ($this->_getSession()->getUseNotice(true)) {
|
48 |
+
$this->_getSession()->addNotice(Mage::helper('core')->escapeHtml($e->getMessage()));
|
49 |
+
} else {
|
50 |
+
$messages = array_unique(explode("\n", $e->getMessage()));
|
51 |
+
foreach ($messages as $message) {
|
52 |
+
$this->_getSession()->addError(Mage::helper('core')->escapeHtml($message));
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
$url = $this->_getSession()->getRedirectUrl(true);
|
57 |
+
if ($url) {
|
58 |
+
$this->getResponse()->setRedirect($url);
|
59 |
+
} else {
|
60 |
+
$this->_redirectReferer(Mage::helper('checkout/cart')->getCartUrl());
|
61 |
+
}
|
62 |
+
} catch (Exception $e) {
|
63 |
+
$this->_getSession()->addException($e, $this->__('Cannot add the item to shopping cart.'));
|
64 |
+
Mage::logException($e);
|
65 |
+
$this->_goBack();
|
66 |
+
}
|
67 |
+
|
68 |
+
}
|
69 |
+
|
70 |
+
}
|
app/code/community/AK/Multiaddtocart/etc/config.xml
ADDED
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<AK_Multiaddtocart>
|
5 |
+
<version>0.1.0</version>
|
6 |
+
</AK_Multiaddtocart>
|
7 |
+
</modules>
|
8 |
+
<global>
|
9 |
+
<helpers>
|
10 |
+
<multiaddtocart>
|
11 |
+
<class>AK_Multiaddtocart_Helper</class>
|
12 |
+
</multiaddtocart>
|
13 |
+
</helpers>
|
14 |
+
</global>
|
15 |
+
|
16 |
+
<frontend>
|
17 |
+
<routers>
|
18 |
+
<checkout>
|
19 |
+
<args>
|
20 |
+
<modules>
|
21 |
+
<AK_Multiaddtocart before="Mage_Checkout">AK_Multiaddtocart</AK_Multiaddtocart>
|
22 |
+
</modules>
|
23 |
+
</args>
|
24 |
+
</checkout>
|
25 |
+
</routers>
|
26 |
+
|
27 |
+
<layout>
|
28 |
+
<updates>
|
29 |
+
<multiaddtocart>
|
30 |
+
<file>multiaddtocart.xml</file>
|
31 |
+
</multiaddtocart>
|
32 |
+
</updates>
|
33 |
+
</layout>
|
34 |
+
|
35 |
+
</frontend>
|
36 |
+
|
37 |
+
<adminhtml>
|
38 |
+
|
39 |
+
<acl>
|
40 |
+
<resources>
|
41 |
+
<all>
|
42 |
+
<title>Allow Everything</title>
|
43 |
+
</all>
|
44 |
+
<admin>
|
45 |
+
<children>
|
46 |
+
<system>
|
47 |
+
<children>
|
48 |
+
<config>
|
49 |
+
<children>
|
50 |
+
<multiaddtocart>
|
51 |
+
<title>Multi Add to Cart - All</title>
|
52 |
+
</multiaddtocart>
|
53 |
+
</children>
|
54 |
+
</config>
|
55 |
+
</children>
|
56 |
+
</system>
|
57 |
+
</children>
|
58 |
+
</admin>
|
59 |
+
</resources>
|
60 |
+
</acl>
|
61 |
+
|
62 |
+
</adminhtml>
|
63 |
+
|
64 |
+
</config>
|
app/code/community/AK/Multiaddtocart/etc/system.xml
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<tabs>
|
4 |
+
<multiaddtocart translate="label" module="multiaddtocart">
|
5 |
+
<label>AK Extensions</label>
|
6 |
+
<sort_order>400</sort_order>
|
7 |
+
</multiaddtocart>
|
8 |
+
</tabs>
|
9 |
+
<sections>
|
10 |
+
<multiaddtocart translate="label" module="multiaddtocart">
|
11 |
+
<class>separator-top</class>
|
12 |
+
<label>Multiple Add to Cart</label>
|
13 |
+
<tab>multiaddtocart</tab>
|
14 |
+
<sort_order>130</sort_order>
|
15 |
+
<show_in_default>1</show_in_default>
|
16 |
+
<show_in_website>1</show_in_website>
|
17 |
+
<show_in_store>1</show_in_store>
|
18 |
+
<groups>
|
19 |
+
<multiaddtocart_general translate="label">
|
20 |
+
<label>General</label>
|
21 |
+
<frontend_type>text</frontend_type>
|
22 |
+
<sort_order>10</sort_order>
|
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 |
+
<fields>
|
27 |
+
<enabled translate="label">
|
28 |
+
<label>Enabled</label>
|
29 |
+
<frontend_type>select</frontend_type>
|
30 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
31 |
+
<sort_order>1</sort_order>
|
32 |
+
<show_in_default>1</show_in_default>
|
33 |
+
<show_in_website>1</show_in_website>
|
34 |
+
<show_in_store>1</show_in_store>
|
35 |
+
<comment>Select Yes to enable this feature.</comment>
|
36 |
+
</enabled>
|
37 |
+
</fields>
|
38 |
+
</multiaddtocart_general>
|
39 |
+
</groups>
|
40 |
+
</multiaddtocart>
|
41 |
+
</sections>
|
42 |
+
</config>
|
app/design/frontend/base/default/layout/multiaddtocart.xml
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
|
3 |
+
<layout version="0.1.0">
|
4 |
+
|
5 |
+
<catalog_category_default>
|
6 |
+
<reference name="head">
|
7 |
+
<action method="addItem" ifconfig="multiaddtocart/multiaddtocart_general/enabled"><type>skin_js</type><name>multiaddtocart/multiaddtocart.js</name></action>
|
8 |
+
</reference>
|
9 |
+
<reference name="product_list">
|
10 |
+
<action method="setTemplate" ifconfig="multiaddtocart/multiaddtocart_general/enabled">
|
11 |
+
<template>multiaddtocart/catalog/product/multilist.phtml</template>
|
12 |
+
</action>
|
13 |
+
</reference>
|
14 |
+
</catalog_category_default>
|
15 |
+
|
16 |
+
<catalog_category_layered>
|
17 |
+
<reference name="head">
|
18 |
+
<action method="addItem" ifconfig="multiaddtocart/multiaddtocart_general/enabled"><type>skin_js</type><name>multiaddtocart/multiaddtocart.js</name></action>
|
19 |
+
</reference>
|
20 |
+
<reference name="product_list">
|
21 |
+
<action method="setTemplate" ifconfig="multiaddtocart/multiaddtocart_general/enabled">
|
22 |
+
<template>multiaddtocart/catalog/product/multilist.phtml</template>
|
23 |
+
</action>
|
24 |
+
</reference>
|
25 |
+
</catalog_category_layered>
|
26 |
+
|
27 |
+
</layout>
|
app/design/frontend/base/default/template/multiaddtocart/catalog/product/multilist.phtml
ADDED
@@ -0,0 +1,205 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* NOTICE OF LICENSE
|
6 |
+
*
|
7 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
8 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
9 |
+
* It is also available through the world-wide-web at this URL:
|
10 |
+
* http://opensource.org/licenses/afl-3.0.php
|
11 |
+
* If you did not receive a copy of the license and are unable to
|
12 |
+
* obtain it through the world-wide-web, please send an email
|
13 |
+
* to license@magento.com so we can send you a copy immediately.
|
14 |
+
*
|
15 |
+
* DISCLAIMER
|
16 |
+
*
|
17 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
18 |
+
* versions in the future. If you wish to customize Magento for your
|
19 |
+
* needs please refer to http://www.magento.com for more information.
|
20 |
+
*
|
21 |
+
* @category design
|
22 |
+
* @package rwd_default
|
23 |
+
* @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
|
24 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
25 |
+
*/
|
26 |
+
?>
|
27 |
+
<?php
|
28 |
+
/**
|
29 |
+
* Product list template
|
30 |
+
*
|
31 |
+
* @see Mage_Catalog_Block_Product_List
|
32 |
+
*/
|
33 |
+
/* @var $this Mage_Catalog_Block_Product_List */
|
34 |
+
?>
|
35 |
+
<?php
|
36 |
+
$_productCollection=$this->getLoadedProductCollection();
|
37 |
+
$_helper = $this->helper('catalog/output');
|
38 |
+
?>
|
39 |
+
<?php if(!$_productCollection->count()): ?>
|
40 |
+
<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
|
41 |
+
<?php else: ?>
|
42 |
+
<div class="category-products">
|
43 |
+
<?php echo $this->getToolbarHtml() ?>
|
44 |
+
<form id="checkall-form" action="<?php echo $this->getUrl('checkout/cart/multiaddtocart') ?>" method="post">
|
45 |
+
<input type="checkbox" value="1" class="checkall" name="checkall">
|
46 |
+
<label for="checkall">Check All</label>
|
47 |
+
<button class="button btn-cartall" title="Add to Cart" type="button">
|
48 |
+
<span><span>Add All to Cart</span></span>
|
49 |
+
</button>
|
50 |
+
<?php // List mode ?>
|
51 |
+
<?php if($this->getMode()!='grid'): ?>
|
52 |
+
<?php $_iterator = 0; ?>
|
53 |
+
<ol class="products-list" id="products-list">
|
54 |
+
<?php foreach ($_productCollection as $_product): ?>
|
55 |
+
<li class="item<?php if( ++$_iterator == sizeof($_productCollection) ): ?> last<?php endif; ?>">
|
56 |
+
<?php // Product Image ?>
|
57 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
|
58 |
+
<?php /* Based on the native RWD styling, product images are displayed at a max of ~400px wide when viewed on a
|
59 |
+
one column page layout with four product columns from a 1280px viewport. For bandwidth reasons,
|
60 |
+
we are going to serve a 300px image, as it will look fine at 400px and most of the times, the image
|
61 |
+
will be displayed at a smaller size (eg, if two column are being used or viewport is smaller than 1280px).
|
62 |
+
This $_imgSize value could even be decreased further, based on the page layout
|
63 |
+
(one column, two column, three column) and number of product columns. */ ?>
|
64 |
+
<?php $_imgSize = 300; ?>
|
65 |
+
<img id="product-collection-image-<?php echo $_product->getId(); ?>"
|
66 |
+
src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->keepFrame(false)->resize($_imgSize); ?>"
|
67 |
+
alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
|
68 |
+
</a>
|
69 |
+
<?php // Product description ?>
|
70 |
+
<div class="product-shop">
|
71 |
+
<div class="f-fix">
|
72 |
+
<div class="product-primary">
|
73 |
+
<?php $_productNameStripped = $this->stripTags($_product->getName(), null, true); ?>
|
74 |
+
<h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped; ?>"><?php echo $_helper->productAttribute($_product, $_product->getName() , 'name'); ?></a></h2>
|
75 |
+
<?php if($_product->getRatingSummary()): ?>
|
76 |
+
<?php echo $this->getReviewsSummaryHtml($_product) ?>
|
77 |
+
<?php endif; ?>
|
78 |
+
<?php
|
79 |
+
// Provides extra blocks on which to hang some features for products in the list
|
80 |
+
// Features providing UI elements targeting this block will display directly below the product name
|
81 |
+
if ($this->getChild('name.after')) {
|
82 |
+
$_nameAfterChildren = $this->getChild('name.after')->getSortedChildren();
|
83 |
+
foreach ($_nameAfterChildren as $_nameAfterChildName) {
|
84 |
+
$_nameAfterChild = $this->getChild('name.after')->getChild($_nameAfterChildName);
|
85 |
+
$_nameAfterChild->setProduct($_product);
|
86 |
+
echo $_nameAfterChild->toHtml();
|
87 |
+
}
|
88 |
+
}
|
89 |
+
?>
|
90 |
+
</div>
|
91 |
+
<div class="product-secondary">
|
92 |
+
<?php echo $this->getPriceHtml($_product, true) ?>
|
93 |
+
</div>
|
94 |
+
<div class="product-secondary">
|
95 |
+
<?php if(!$_product->canConfigure() && $_product->isSaleable()): ?>
|
96 |
+
<p class="action">
|
97 |
+
<input type="checkbox" value="<?php echo $_product->getId() ?>" id="check-<?php echo $_product->getId() ?>" class="check" name="check[]">
|
98 |
+
<input type="text" style="width: 30px;" value="1" id="qty-<?php echo $_product->getId() ?>" name="qty_<?php echo $_product->getId() ?>" class="quantity">
|
99 |
+
<button type="button" title="<?php echo $this->quoteEscape($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>
|
100 |
+
<?php elseif($_product->getStockItem() && $_product->getStockItem()->getIsInStock()): ?>
|
101 |
+
<p class="action"><a title="<?php echo $this->quoteEscape($this->__('View Details')) ?>" class="button" href="<?php echo $_product->getProductUrl() ?>"><?php echo $this->__('View Details') ?></a></p>
|
102 |
+
<?php else: ?>
|
103 |
+
<p class="action availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
|
104 |
+
<?php endif; ?>
|
105 |
+
<ul class="add-to-links">
|
106 |
+
<?php if ($this->helper('wishlist')->isAllow()) : ?>
|
107 |
+
<li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" 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="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
|
111 |
+
<?php endif; ?>
|
112 |
+
</ul>
|
113 |
+
</div>
|
114 |
+
<div class="desc std">
|
115 |
+
<?php echo $_helper->productAttribute($_product, $_product->getShortDescription(), 'short_description') ?>
|
116 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $_productNameStripped ?>" class="link-learn"><?php echo $this->__('Learn More') ?></a>
|
117 |
+
</div>
|
118 |
+
</div>
|
119 |
+
</div>
|
120 |
+
</li>
|
121 |
+
<?php endforeach; ?>
|
122 |
+
</ol>
|
123 |
+
<script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
|
124 |
+
|
125 |
+
<?php else: ?>
|
126 |
+
|
127 |
+
<?php // Grid Mode ?>
|
128 |
+
|
129 |
+
<?php $_collectionSize = $_productCollection->count() ?>
|
130 |
+
<?php $_columnCount = $this->getColumnCount(); ?>
|
131 |
+
<ul class="products-grid products-grid--max-<?php echo $_columnCount; ?>-col">
|
132 |
+
<?php $i=0; foreach ($_productCollection as $_product): ?>
|
133 |
+
<?php /*if ($i++%$_columnCount==0): ?>
|
134 |
+
<?php endif*/ ?>
|
135 |
+
<li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
|
136 |
+
<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image">
|
137 |
+
<?php $_imgSize = 210; ?>
|
138 |
+
<img id="product-collection-image-<?php echo $_product->getId(); ?>"
|
139 |
+
src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($_imgSize); ?>"
|
140 |
+
alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" />
|
141 |
+
</a>
|
142 |
+
<div class="product-info">
|
143 |
+
<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>
|
144 |
+
<?php
|
145 |
+
// Provides extra blocks on which to hang some features for products in the list
|
146 |
+
// Features providing UI elements targeting this block will display directly below the product name
|
147 |
+
if ($this->getChild('name.after')) {
|
148 |
+
$_nameAfterChildren = $this->getChild('name.after')->getSortedChildren();
|
149 |
+
foreach ($_nameAfterChildren as $_nameAfterChildName) {
|
150 |
+
$_nameAfterChild = $this->getChild('name.after')->getChild($_nameAfterChildName);
|
151 |
+
$_nameAfterChild->setProduct($_product);
|
152 |
+
echo $_nameAfterChild->toHtml();
|
153 |
+
}
|
154 |
+
}
|
155 |
+
?>
|
156 |
+
<?php echo $this->getPriceHtml($_product, true) ?>
|
157 |
+
<?php if($_product->getRatingSummary()): ?>
|
158 |
+
<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
|
159 |
+
<?php endif; ?>
|
160 |
+
<div class="actions">
|
161 |
+
<?php if(!$_product->canConfigure() && $_product->isSaleable()): ?>
|
162 |
+
<input type="checkbox" value="<?php echo $_product->getId() ?>" id="check-<?php echo $_product->getId() ?>" class="check" name="check[]">
|
163 |
+
<input type="text" style="width: 30px;" value="1" id="qty-<?php echo $_product->getId() ?>" name="qty_<?php echo $_product->getId() ?>" class="quantity">
|
164 |
+
<button type="button" title="<?php echo $this->quoteEscape($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>
|
165 |
+
<?php elseif($_product->getStockItem() && $_product->getStockItem()->getIsInStock()): ?>
|
166 |
+
<a title="<?php echo $this->quoteEscape($this->__('View Details')) ?>" class="button" href="<?php echo $_product->getProductUrl() ?>"><?php echo $this->__('View Details') ?></a>
|
167 |
+
<?php else: ?>
|
168 |
+
<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
|
169 |
+
<?php endif; ?>
|
170 |
+
<ul class="add-to-links">
|
171 |
+
<?php if ($this->helper('wishlist')->isAllow()) : ?>
|
172 |
+
<li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
|
173 |
+
<?php endif; ?>
|
174 |
+
<?php if($_compareUrl=$this->getAddToCompareUrl($_product)): ?>
|
175 |
+
<li><span class="separator">|</span> <a href="<?php echo $_compareUrl ?>" class="link-compare"><?php echo $this->__('Add to Compare') ?></a></li>
|
176 |
+
<?php endif; ?>
|
177 |
+
</ul>
|
178 |
+
</div>
|
179 |
+
</div>
|
180 |
+
</li>
|
181 |
+
<?php /*if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
|
182 |
+
<?php endif*/ ?>
|
183 |
+
<?php endforeach ?>
|
184 |
+
</ul>
|
185 |
+
<script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
|
186 |
+
<?php endif; ?>
|
187 |
+
|
188 |
+
</form>
|
189 |
+
<div class="toolbar-bottom">
|
190 |
+
<?php echo $this->getToolbarHtml() ?>
|
191 |
+
</div>
|
192 |
+
</div>
|
193 |
+
<?php endif; ?>
|
194 |
+
<?php
|
195 |
+
// Provides a block where additional page components may be attached, primarily good for in-page JavaScript
|
196 |
+
if ($this->getChild('after')) {
|
197 |
+
$_afterChildren = $this->getChild('after')->getSortedChildren();
|
198 |
+
foreach ($_afterChildren as $_afterChildName) {
|
199 |
+
$_afterChild = $this->getChild('after')->getChild($_afterChildName);
|
200 |
+
//set product collection on after blocks
|
201 |
+
$_afterChild->setProductCollection($_productCollection);
|
202 |
+
echo $_afterChild->toHtml();
|
203 |
+
}
|
204 |
+
}
|
205 |
+
?>
|
app/etc/modules/AK_Multiaddtocart.xml
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<config>
|
3 |
+
<modules>
|
4 |
+
<AK_Multiaddtocart>
|
5 |
+
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
+
<version>0.1.0</version>
|
8 |
+
</AK_Multiaddtocart>
|
9 |
+
</modules>
|
10 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>AK_Multiaddtocart</name>
|
4 |
+
<version>0.1.0</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>OSL v3.0</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Add Multiple Products to cart</summary>
|
10 |
+
<description>Add Multiple Products to cart</description>
|
11 |
+
<notes>First Version</notes>
|
12 |
+
<authors><author><name>Anuj Kumar</name><user>Anuj</user><email>farshwal.anujkumar11@gmail.com</email></author></authors>
|
13 |
+
<date>2016-05-19</date>
|
14 |
+
<time>18:47:58</time>
|
15 |
+
<contents><target name="mageetc"><dir name="modules"><file name="AK_Multiaddtocart.xml" hash="fd82e89986f482f2b7ea32db7a41c7df"/></dir></target><target name="magecommunity"><dir name="AK"><dir name="Multiaddtocart"><dir name="Helper"><file name="Data.php" hash="154f93be9fc2332b3805b57583402fe2"/></dir><dir name="controllers"><file name="CartController.php" hash="07c49622ccc72d3bfdadedff22bcdc94"/></dir><dir name="etc"><file name="config.xml" hash="6d4696aa1cb42aa164e1d5a57be460d2"/><file name="system.xml" hash="6414303ceacbb4f364a969d41f99b34d"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="multiaddtocart.xml" hash="700b1935cc1e80361f68709014f3411b"/></dir><dir name="template"><dir name="multiaddtocart"><dir name="catalog"><dir name="product"><file name="multilist.phtml" hash="b3688f0ba13f158bf0dc43f5eff8642f"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="multiaddtocart"><file name="multiaddtocart.js" hash="c58e24933089bb509eefc6da453c6dcb"/></dir></dir></dir></dir></target></contents>
|
16 |
+
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><package><name/><channel>connect.magentocommerce.com/core</channel><min/><max/></package></required></dependencies>
|
18 |
+
</package>
|
skin/frontend/base/default/multiaddtocart/multiaddtocart.js
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
jQuery(document).ready(function() {
|
3 |
+
jQuery('.checkall').click(function() {
|
4 |
+
|
5 |
+
if(jQuery(this).is(":checked")) {
|
6 |
+
var len = document.getElementsByClassName('check').length;
|
7 |
+
var i;
|
8 |
+
for(i=0;i<(len);i++) {
|
9 |
+
document.getElementsByClassName('check')[i].checked = true;
|
10 |
+
}
|
11 |
+
} else {
|
12 |
+
var len = document.getElementsByClassName('check').length;
|
13 |
+
var i;
|
14 |
+
for(i=0;i<(len);i++) {
|
15 |
+
document.getElementsByClassName('check')[i].checked = false;
|
16 |
+
}
|
17 |
+
}
|
18 |
+
});
|
19 |
+
|
20 |
+
jQuery('.btn-cartall').click(function() {
|
21 |
+
var error = false;
|
22 |
+
var error1 = true;
|
23 |
+
|
24 |
+
jQuery('.check').each(function() {
|
25 |
+
if(jQuery(this).is(':checked')) {
|
26 |
+
error1 = false;
|
27 |
+
}
|
28 |
+
});
|
29 |
+
if(error1 == true) {
|
30 |
+
alert("No checkbox selected !");
|
31 |
+
} else {
|
32 |
+
jQuery('.quantity').each(function() {
|
33 |
+
if(jQuery(this).val() < 0 || isNaN(jQuery(this).val()) == true) {
|
34 |
+
alert("Invalid Value !");
|
35 |
+
jQuery(this).focus();
|
36 |
+
error = true;
|
37 |
+
}
|
38 |
+
});
|
39 |
+
}
|
40 |
+
|
41 |
+
if(error == false && error1 == false) {
|
42 |
+
jQuery('#checkall-form').submit();
|
43 |
+
}
|
44 |
+
});
|
45 |
+
});
|