Version Notes
Stable version.
Download this release
Release Info
Developer | Ray Zhang |
Extension | RayfoxCartItem |
Version | 0.1.1 |
Comparing to | |
See all releases |
Version 0.1.1
- app/code/community/Rayfox/BetterCart/.DS_Store +0 -0
- app/code/community/Rayfox/BetterCart/Helper/Data.php +16 -0
- app/code/community/Rayfox/BetterCart/Model/Quote.php +54 -0
- app/code/community/Rayfox/BetterCart/Model/System/Config/Source/Topbottom.php +12 -0
- app/code/community/Rayfox/BetterCart/etc/.DS_Store +0 -0
- app/code/community/Rayfox/BetterCart/etc/config.xml +51 -0
- app/code/community/Rayfox/BetterCart/etc/system.xml +58 -0
- app/etc/modules/Rayfox_BetterCart.xml +35 -0
- package.xml +30 -0
app/code/community/Rayfox/BetterCart/.DS_Store
ADDED
Binary file
|
app/code/community/Rayfox/BetterCart/Helper/Data.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Rayfox_BetterCart_Helper_Data extends Mage_Core_Helper_Abstract
|
3 |
+
{
|
4 |
+
const XML_PATH_SORT_OUT_OF_STOCK = 'checkout/cart/enable_better_cart';
|
5 |
+
const XML_PATH_UNSALEABLE_PRODUCT_POSITION = 'checkout/cart/unsaleable_items_sort_position';
|
6 |
+
|
7 |
+
public function isEnabled()
|
8 |
+
{
|
9 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_SORT_OUT_OF_STOCK);
|
10 |
+
}
|
11 |
+
|
12 |
+
public function getUnsaleableItemsPosition()
|
13 |
+
{
|
14 |
+
return Mage::getStoreConfigFlag(self::XML_PATH_UNSALEABLE_PRODUCT_POSITION);
|
15 |
+
}
|
16 |
+
}
|
app/code/community/Rayfox/BetterCart/Model/Quote.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Rayfox_BetterCart_Model_Quote extends Mage_Sales_Model_Quote
|
3 |
+
{
|
4 |
+
public function getAllVisibleItems()
|
5 |
+
{
|
6 |
+
if(!Mage::helper('bettercart')->isEnabled()){
|
7 |
+
return parent::getAllVisibleItems();
|
8 |
+
}
|
9 |
+
|
10 |
+
$saleableItems = array();
|
11 |
+
$unSaleableItems = array();
|
12 |
+
$newItems = array();
|
13 |
+
$items = parent::getAllVisibleItems();
|
14 |
+
foreach($items as $item){
|
15 |
+
if(!$this->isItemSaleable($item)){
|
16 |
+
$unSaleableItems[] = $item;
|
17 |
+
}
|
18 |
+
else{
|
19 |
+
$saleableItems[] = $item;
|
20 |
+
}
|
21 |
+
}
|
22 |
+
|
23 |
+
if(Mage::helper('bettercart')->getUnsaleableItemsPosition()){
|
24 |
+
$newItems = array_merge($saleableItems, $unSaleableItems);
|
25 |
+
}
|
26 |
+
else{
|
27 |
+
$newItems = array_merge($unSaleableItems,$saleableItems);
|
28 |
+
}
|
29 |
+
|
30 |
+
return $newItems;
|
31 |
+
}
|
32 |
+
|
33 |
+
public function isItemSaleable($item)
|
34 |
+
{
|
35 |
+
//Mage::log('parent item product id: ' . $item->getProduct()->getId());
|
36 |
+
if ($item->getHasChildren()){
|
37 |
+
foreach ($item->getChildren() as $child){
|
38 |
+
//Mage::log('child item product id: ' . $child->getProduct()->getId());
|
39 |
+
if($child->getProduct()){
|
40 |
+
if(!$child->getProduct()->isSaleable()){
|
41 |
+
return false;
|
42 |
+
break;
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
if($item->getProduct()){
|
49 |
+
return $item->getProduct()->isSaleable();
|
50 |
+
}
|
51 |
+
|
52 |
+
return true;
|
53 |
+
}
|
54 |
+
}
|
app/code/community/Rayfox/BetterCart/Model/System/Config/Source/Topbottom.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class Rayfox_BetterCart_Model_System_Config_Source_Topbottom
|
3 |
+
{
|
4 |
+
public function toOptionArray()
|
5 |
+
{
|
6 |
+
return array(
|
7 |
+
array('value' => 1, 'label'=>Mage::helper('adminhtml')->__('Bottom')),
|
8 |
+
array('value' => 0, 'label'=>Mage::helper('adminhtml')->__('Top')),
|
9 |
+
);
|
10 |
+
}
|
11 |
+
|
12 |
+
}
|
app/code/community/Rayfox/BetterCart/etc/.DS_Store
ADDED
Binary file
|
app/code/community/Rayfox/BetterCart/etc/config.xml
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Rayfox
|
23 |
+
* @package Rayfox_BetterCart
|
24 |
+
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<config>
|
29 |
+
<modules>
|
30 |
+
<Rayfox_BetterCart>
|
31 |
+
<version>0.1.0</version>
|
32 |
+
</Rayfox_BetterCart>
|
33 |
+
</modules>
|
34 |
+
<global>
|
35 |
+
<models>
|
36 |
+
<bettercart>
|
37 |
+
<class>Rayfox_BetterCart_Model</class>
|
38 |
+
</bettercart>
|
39 |
+
<sales>
|
40 |
+
<rewrite>
|
41 |
+
<quote>Rayfox_BetterCart_Model_Quote</quote>
|
42 |
+
</rewrite>
|
43 |
+
</sales>
|
44 |
+
</models>
|
45 |
+
<helpers>
|
46 |
+
<bettercart>
|
47 |
+
<class>Rayfox_BetterCart_Helper</class>
|
48 |
+
</bettercart>
|
49 |
+
</helpers>
|
50 |
+
</global>
|
51 |
+
</config>
|
app/code/community/Rayfox/BetterCart/etc/system.xml
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Rayfox
|
23 |
+
* @package Rayfox_BetterCart
|
24 |
+
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<config>
|
29 |
+
<sections>
|
30 |
+
<checkout>
|
31 |
+
<groups>
|
32 |
+
<cart translate="label">
|
33 |
+
<fields>
|
34 |
+
<enable_better_cart>
|
35 |
+
<label>Enable Better Cart</label>
|
36 |
+
<frontend_type>select</frontend_type>
|
37 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
38 |
+
<sort_order>999</sort_order>
|
39 |
+
<show_in_default>1</show_in_default>
|
40 |
+
<show_in_website>1</show_in_website>
|
41 |
+
<show_in_store>1</show_in_store>
|
42 |
+
</enable_better_cart>
|
43 |
+
<unsaleable_items_sort_position>
|
44 |
+
<label>Unsaleable Items Position</label>
|
45 |
+
<frontend_type>select</frontend_type>
|
46 |
+
<source_model>bettercart/system_config_source_topbottom</source_model>
|
47 |
+
<sort_order>1000</sort_order>
|
48 |
+
<show_in_default>1</show_in_default>
|
49 |
+
<show_in_website>1</show_in_website>
|
50 |
+
<show_in_store>1</show_in_store>
|
51 |
+
</unsaleable_items_sort_position>
|
52 |
+
</fields>
|
53 |
+
</cart>
|
54 |
+
</groups>
|
55 |
+
</checkout>
|
56 |
+
</sections>
|
57 |
+
</config>
|
58 |
+
|
app/etc/modules/Rayfox_BetterCart.xml
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<!--
|
3 |
+
/**
|
4 |
+
* Magento
|
5 |
+
*
|
6 |
+
* NOTICE OF LICENSE
|
7 |
+
*
|
8 |
+
* This source file is subject to the Academic Free License (AFL 3.0)
|
9 |
+
* that is bundled with this package in the file LICENSE_AFL.txt.
|
10 |
+
* It is also available through the world-wide-web at this URL:
|
11 |
+
* http://opensource.org/licenses/afl-3.0.php
|
12 |
+
* If you did not receive a copy of the license and are unable to
|
13 |
+
* obtain it through the world-wide-web, please send an email
|
14 |
+
* to license@magentocommerce.com so we can send you a copy immediately.
|
15 |
+
*
|
16 |
+
* DISCLAIMER
|
17 |
+
*
|
18 |
+
* Do not edit or add to this file if you wish to upgrade Magento to newer
|
19 |
+
* versions in the future. If you wish to customize Magento for your
|
20 |
+
* needs please refer to http://www.magentocommerce.com for more information.
|
21 |
+
*
|
22 |
+
* @category Rayfox
|
23 |
+
* @package Rayfox_BetterCart
|
24 |
+
* @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com)
|
25 |
+
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
26 |
+
*/
|
27 |
+
-->
|
28 |
+
<config>
|
29 |
+
<modules>
|
30 |
+
<Rayfox_BetterCart>
|
31 |
+
<active>true</active>
|
32 |
+
<codePool>community</codePool>
|
33 |
+
</Rayfox_BetterCart>
|
34 |
+
</modules>
|
35 |
+
</config>
|
package.xml
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<package>
|
3 |
+
<name>RayfoxCartItem</name>
|
4 |
+
<version>0.1.1</version>
|
5 |
+
<stability>stable</stability>
|
6 |
+
<license>AFL</license>
|
7 |
+
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>The extension will put all unsaleable items together and move them to
|
10 |
+
the top/bottom of shopping cart items table, so customers can delete
|
11 |
+
them more conveniently.</summary>
|
12 |
+
<description>The extension will put all unsaleable items together and move them to
|
13 |
+
the top/bottom of shopping cart items table, so customers can delete
|
14 |
+
them more conveniently.
|
15 |
+

|
16 |
+
You can control the functionality and position of unsaleable items in
|
17 |
+
shopping cart from Magento Admin.
|
18 |
+

|
19 |
+
这个扩展会将购物车中处于缺货状态或者由于其它原因不可卖的产品集中在一起并
|
20 |
+
放在购物车的顶部或者底部,方便顾客删除购物车中的产品。
|
21 |
+
可通过后台的选项控制是否启用该功能和调整不可卖产品在购物车中的位置。
|
22 |
+
</description>
|
23 |
+
<notes>Stable version.</notes>
|
24 |
+
<authors><author><name>Ray Zhang</name><user>Ray</user><email>cgzhang@gmail.com</email></author></authors>
|
25 |
+
<date>2012-03-22</date>
|
26 |
+
<time>02:13:54</time>
|
27 |
+
<contents><target name="magecommunity"><dir name="Rayfox"><dir name="BetterCart"><dir name="Helper"><file name="Data.php" hash="2a9eb8880cbaac7fe91c67ada5d37aa7"/></dir><dir name="Model"><file name="Quote.php" hash="f3d0e11c8dff4ea54e4d8d0083b28e19"/><dir name="System"><dir name="Config"><dir name="Source"><file name="Topbottom.php" hash="84dfa43bf7ee6aa166817b243237eb2b"/></dir></dir></dir></dir><dir name="etc"><file name="config.xml" hash="2a49045693a2e33becb70806fa90d86c"/><file name="system.xml" hash="5279b282c6093ab3c3aa910099bd93c5"/><file name=".DS_Store" hash="b1ea3be3ec6afda43ee062206ee5f3ab"/></dir><file name=".DS_Store" hash="70c0a44c548cc3f041f707f0bb4a3f26"/></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Rayfox_BetterCart.xml" hash="ba62037372a50952e3aa60429cffbc99"/></dir></target></contents>
|
28 |
+
<compatible/>
|
29 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
30 |
+
</package>
|