search
top
Currently Browsing: Magento

Email with attachment in Magento

I had a specific requirement to generate a CSV file and send the same as an attachment in a mail, without saving it at any physical location. I am listing here the way to do it. <?php $csv = ''; $_columns = array( 'N', 'SKU', 'Name' ); $data = array(); // prepare CSV header… foreach ($_columns as $column) { $data[] = '"'.$column.'"'; } $csv .= implode(',', $data)."\n"; $productData...
read more

cURL request in Magento

cURL request in Magento Most of the time there is a need to call 3rd party APIs from Magento. We use cURL functions for the same, now here is an interesting part, Magento has wrapper functions for the same in its own library. This make it easy for calling the 3rd party API url’s. Code snippet is as shown below. $param = array(); //initialise the request variable $param['userid'] =...
read more

RSS Feed Reader Magento Extension

Hello All, I have developed an extension and posted on Magento Connect for free. DW Reader extension will enable the shop owner to display RSS Feed on any static/dynamic page of the shop together with many configuration settings to choose from. Please have a look FeedReader by DW. Kindly rate and review. Instruction for using For showing feed in block {{block type="reader/reader" feed_url...
read more

OrderProfit Magento Extension

Hello All, I have developed an extension and I am posting here for free. An extension that will add a ‘Profit’ column in Orders grid showing profit per order. Configuration setting are provided for disabling the column and editing the column header. Compatibility : Tested with Magento Community Edition 1.5, 1.6, 1.6.1, 1.6.2.0, 1.7 and Magento Enterprise Edition v1.12.0.0 Installation...
read more

Master Password Magento Extension

Hello All, I have developed an extension and posted on Magento Connect for free. An extension to implement a master password functionality, that allows you to login as any valid registered customer with one master password. Please have a look MasterPassword by DW. Kindly rate and review. Thanks
read more

Date Time Input Magento

Hello, There are times when backend developer needs to create a form in admin end and we need to have an input box which accepts data and time. In this post I have explained the code for doing this. Open your form file, will be in app\code\local\[NameSpace]\[Module]\Block\Adminhtml\[BlockName]\Edit\Tab\Form.php There is a function _prepareForm() inside it. Add the below code in it, please note the...
read more

Magento Set Admin Store

There are times when we need to use the admin access to execute tasks. For example you want to call admin URLs etc. There is a simple way to do that, you need to change the current store to admin store. Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
read more

Get all product attributes in Magento

Hello All, I am writing here a simple but important code snippet for getting all the existing product attributes $attributes = Mage::getSingleton('catalog/config')->getProductAttributes(); echo '<pre>'; print_r($attributes); exit;
read more

Get creditcard type in Magento

Hello All, I am writing here a script snippet for getting the credit card type used in the order $order_id = 100; //order id goes here $_order = Mage::getModel('sales/order')->load($order_id); $_cctype = ''; if(!empty($_order)) { $_cctype = $_order->getPayment()->getCcTypeName(); } echo $_cctype;
read more

Get customer order count in Magento

Hello All, I am writing here a script snippet for getting the orders count for given customer < ?php $customer_id = 5; $_orders = Mage::getModel('sales/order')->getCollection()->addFieldToFilter('customer_id',$customer_id); $_orderCnt = $_orders->count(); //orders count echo 'Customer with ID '.$customer_id.' has '.$_orderCnt.' orders'; ?>
read more

« Previous Entries

top