Skip to main content

Posts

Showing posts with the label Magento

Memcache with Magento : Magento speed like Rocket

Hi Fellas, I am sharing this article showing how we can use the power of memcache alnog with magento. One of major magento drawback would be its speed, although we can several ways to speed up. Memcache is good option as its new and fast. Before starting lets know a bit about what is memcache. Memcache is used to fast access database, api and etc. For this it uses some space on server. For more information please visit: http://www.memcached.org/ You can use below method to apply memcache for Magento v1.9 and older. Below are the steps for starting memcache on your magento store: 1) Go to app/etc/ and find local.xml file. 2) Find the </global> tag and paste below code before the tag. <cache> <cache>     <backend>memcached</backend>     <slow_backend>database</slow_backend>     <fast_backend>Memcached</fast_backend>     <fast_backend_options>  ...

Add/Update product attribute using CSV in Magento

Hi All !!! As per my last post we have updated customer group prices in these I am sharing code to add/update product attributes whether its a custom or default attribute. Have a look at the code: <?php //Upload File if (isset($_POST['submit'])) {     if (is_uploaded_file($_FILES['filename']['tmp_name'])) {         echo "<h1>" . "File ". $_FILES['filename']['name'] ." uploaded successfully." . "</h1>";     }     //Import uploaded file to Database     $handle = fopen($_FILES['filename']['tmp_name'], "r");     $i=0;     while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {         if($i>0) {             $si = Mage::getModel('catalog/product')->loadByAttribute('sku',$data[0]);            ...

Add/Update Customer group product price using CSV in Magento

Hi Guys!!! After a long time I am back on posting. While working on a project I came with a problem of updating customer group pricing in magento using CSV. Well not  a big problem, let first discuss the logic. There are two tables in magento updates when you add customer group price: 1) catalog_product_index_group_price 2) catalog_product_entity_group_price So here is the code <?php //Upload File if (isset($_POST['submit'])) {     if (is_uploaded_file($_FILES['filename']['tmp_name'])) {         echo "<h1>" . "File ". $_FILES['filename']['name'] ." uploaded successfully." . "</h1>";         //readfile($_FILES['filename']['tmp_name']);     }     //Import uploaded file to Database     $handle = fopen($_FILES['filename']['tmp_name'], "r");     $i=0;     while (($data = fgetcsv($handle, 1000, ",...

Add Products to cart Programmatically in Magento

Sometimes we need to add products into cart programmatically in controller. Below is the code which you can use to add product to cart.   1) For Simple Products If you are working in magento controller and wants to add a simple product programmatically then here is the code: Suppose our product id value stored in $productId.         // Below code will create instance of cart         $cart = Mage::getModel('checkout/cart');         // This will initialize cart         $cart->init();         // Get the product collection by passing product id         $productCollection = Mage::getModel('catalog/product')->load($productId); This product collection will be required as we have to pass it at the time of adding product to cart. For adding the product we...

Mobilize your Magento Store

In this post I will illustrate 'How you can mobilize your Magento Store' Browser's Settings : 1) First of all your browser must have iPhone user agent.        In Safari it has its own user agent, just go to Developer > User Agent  and set it to iPhone.        If you are using Firefox then go to Tools > Default User Agent and select iPhone. If you don't have iPhone in option then Tools > Add-ons and install 'User Agent Switcher 0.7.3 in firefox browser. This will switch your Site view from Desktop to Mobile.  Check you special user agent :  whatsmyuseragent.com At last you have your phone to test the Mobile Site. Magento Admin Settings: 1) Log-in to your Magento admin and go to System > Configuration > General > Design. 2) In Design open 'Themes' tab to Mobilize your Store.   3) In Templates click on Add Exception button and In Matched Expression set your ...