I am using the latest magento version which is 1.9.0.1.
I have followed the following instructions to increase the limit of cross-sell products but something seems to be wrong here. Any help would be highly appreciated. You can find the original post over here as well How to Increase the Number of Crosssell Items in Cart?
But my code is written below here:
Crosssell.php
in the directory app/code/local/TestingMod/Checkout/Block/Cart
:
class TestingMod_Checkout_Block_Cart_Crosssell extends Mage_Catalog_Block_Product_Abstract
{
// /**
// * Items quantity will be capped to this value
// *
// * @var int
// */
// protected $_maxItemCount = 100;
// /**
// * Get crosssell items
// *
// * @return array
// */
public function getItemCount()
{
return count($this->getItems());
}
public function getItems()
{
$items = $this->getData(\'items\');
if (is_null($items)) {
$items = array();
$ninProductIds = $this->_getCartProductIds();
if ($ninProductIds) {
$lastAdded = (int) $this->_getLastAddedProductId();
if ($lastAdded) {
$collection = $this->_getCollection()
->addProductFilter($lastAdded);
if (!empty($ninProductIds)) {
$collection->addExcludeProductFilter($ninProductIds);
}
$collection->setPositionOrder()->load();
foreach ($collection as $item) {
$ninProductIds[] = $item->getId();
$items[] = $item;
}
}
if (count($items) < 100) {
$filterProductIds = array_merge($this->_getCartProductIds(), $this->_getCartProductIdsRel());
$collection = $this->_getCollection()
->addProductFilter($filterProductIds)
->addExcludeProductFilter($ninProductIds)
->setPageSize(100-count($items))
->setGroupBy()
->setPositionOrder()
->load();
foreach ($collection as $item) {
$items[] = $item;
}
}
}
$this->setData(\'items\', $items);
}
return $items;
}
}
app/code/local/TestingMod/Checkout/etc
in config.xml
:
<?xml version="1.0"?>
<config>
<modules>
<TestingMod_Checkout>
<version>1.0</version>
</TestingMod_Checkout>
</modules>
<global>
<blocks>
<checkout>
<rewrite>
<cart_crosssell>
TestingMod_Checkout_Block_Cart_Crosssell
</cart_crosssell>
</rewrite>
</checkout>
<testingmod_checkout>
<class>TestingMod_Checkout_Block</class>
</testingmod_checkout>
</blocks>
</global>
app/etc/modules
in TestingMod_Checkout.xml
:
<?xml version="1.0"?>
<config>
<modules>
<TestingMod_Checkout>
<active>true</active>
<codePool>local</codePool>
</TestingMod_Checkout>
</modules>
app/design/frontend/default/mytheme/layout/
in checkout.xml
:
<?xml version="1.0"?>
<reference name="content">
<block type="testingmod_checkout/cart_crosssell" name="checkout.cart.crosssell" as="crosssell" template="checkout/cart/crosssell.phtml"/>
</reference>