Magento Quick Order Placement Form

Magento Tips and Fundamental Solutions

Credit Link: Magento and E-Commerce Blog

Magento Quick Order Form
<code>
class Mconnect_QuickOrder_Model_Quickorder extends Mage_Core_Model_Abstract
{
protected $_products = null;
protected function setProducts($products){
$this->_products = $products;
return $this;
}

public function getProducts(){
if ($this->_products === null) {
$products = Mage::getModel(‘catalog/product’)->getCollection();
$products->addAttributeToFilter(‘status’, 1);//enabled
$products->addAttributeToFilter(‘visibility’, array(1,2,3,4));//all categories
$products->addAttributeToFilter(‘type_id’, ‘simple’); //<————-Changed Here
$products->addAttributeToSelect(array(‘id’,’sku’,’name’, ‘type_id’,’image’,’price’,’small_image’,’cart_increment’));
$products->setOrder(‘name’,’ASC’);

$this->setProducts($products);
}
return $this->_products;
}
protected function _construct()
{
$this->_init(‘mconnect_quickorder/quickorder’);
}
}
</code>
<br />
Then please create the indexcontroller file
<code>
class Mconnect_QuickOrder_IndexController extends Mage_Core_Controller_Front_Action
{
//protected methods come from core/Mage/Checkout/controllers/CartController.php

protected $_cookieCheckActions = array(‘add’);

/**
* Retrieve shopping cart model object
*
* @return Mage_Checkout_Model_Cart
*/
protected function _getCart()
{
return Mage::getSingleton(‘checkout/cart’);
}

/**
* Get checkout session model instance
*
* @return Mage_Checkout_Model_Session
*/
protected function _getSession()
{
return Mage::getSingleton(‘checkout/session’);
}

/**
* Get current active quote instance
*
* @return Mage_Sales_Model_Quote
*/
protected function _getQuote()
{
return $this->_getCart()->getQuote();
}

/**
* Set back redirect…

View original post 663 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s