Monday, 26 May 2014

Magento | Magento MySQL my.cnf perfect setup

Magento MySQL my.cnf perfect setup

Here is the perfect my.cnf configuration which worked for me.
You can use this for the running magento properly.


[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
 
#innodb settings
innodb_log_file_size=100M
innodb_additional_mem_pool_size=20M
innodb_flush_log_at_trx_commit=2
innodb_lock_wait_timeout=1800
innodb_buffer_pool_size=20G
 
#other vars
net_read_timeout=120
skip-locking
skip-name-resolve
table_cache=2048
thread_cache_size=16
back_log=100
max_connect_errors=10000
open-files-limit=20000
interactive_timeout=3600
wait_timeout=1800
max_connections=200
key_buffer_size=1G
connect_timeout=120
 
#skip-name-resolve
max_allowed_packet=16M
tmp_table_size=64M
max_heap_table_size=64M
query_cache_size=256M
sort_buffer_size=1M
read_buffer_size=1M
read_rnd_buffer_size=8M
join_buffer_size=3M
 
old_passwords=1

Thursday, 22 May 2014

Magento | Magento Error: Base table or view already exists: 1050 Table ’sales_order_status’ already exists

Magento Error: Base table or view already exists: 1050 Table ’sales_order_status’ already exists


Many times when you are upgrading the magento or trying to migrate the magento from one server to the any other server. Many times the upgrade  process halted. Then  quite frequent this error is coming in the magento. This is nothing that the magento does not allowed you to complete the process of upgradation and tables are slightly created over there. You have two method here to overcome with this.

There are many times the it is possible that the inner extension core extension does not upgraded properly. This makes that the table is already created over there and you again creating the table. You can apply following.

1) First make the backup of your current database. Since it is related with the sales extension then it is quite possible that the sales table does not created properly. Go inside the php my admin database select and drop all tables starting with the 'sales_*'  drop all hose tables.
           drop table sales_order_status_label;
            drop table sales_order_status_state;
            drop table sales_order_status;
            drop table paypal_cert;




2) Other method is that just see there on which particular version the system has halted just go to to the core_resouce table in the database and find the path column 'sales' extension name and upgrade the version of the extension if it was halted in the 1.6.0.0 then upgrade it there to 1.6.0.1 it will surely solve your issue.

clear your cache folders by the var/cache location and re-run the magento setup. It will create all the tables again.

Wednesday, 21 May 2014

Magento | Show specific category on home page

Magento | Show specific category on home page

Many times we come with the difficulty that to set the category on the home page.
I will demonstrate you here how to set up the particular category display on the home page.
First you have to decide what category you want to show on the home page, Go to the magento admin panel and then go to Catalog -> Manage Category and then select the particular category when you select the particular category then you will find that the category id stated there.

Go to the cms -> pages by the menu bar and find for the identifier url "home"
Edit this and go to the content tab area.


{{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" category_id="4" template="catalog/product/list.phtml"}}

paste the above code to the area where you wish to show the categories product listing.
It will list all the catalog, search visibility scope product on the front end home page.

Magento | Resize product image

Magento | Resize product image.

Resizing of the images is the issue we are getting many times while we are optimizing and customizing the magento site. You can resize the media images by the following code.


 $src = Mage::helper('catalog/image')->init($_product, 'small_image')->resize(170, 120);


Just follow the above code to optimize and resize your images.
Where $_product: is the object of product
'small_image' :  show the size of image your required as output.
and inside the Resize() function you can insert the parameters where the first parameter is width and next one is the height of the image.
If image is not found in the product then it will show you the default placeholder image at that place.

Tuesday, 20 May 2014

Maento | Fatal error on /app/code/core/Mage/Core/Model/Resource/Resource.php on line 133 in Magento

Fatal error on /app/code/core/Mage/Core/Model/Resource/Resource.php on line 133 in Magento 

This error is coming in magento normally when you are creating any new extension or creating  updating / installing new extension then you must sure to see the config file of the magento where you can find that the version or some other sintax you were not properly written over there so I would suggest you to see there properly.

1) Point to consider
<modules>
    <company_customextension>
        <version>0.1.0</version>
    </company_customextension>
</modules>
look out the version is written properly or not.

2) Point to Consider
Be sure that the file permission of all the files on your server is properly configured. means they all are readable. If they have permission issue then this problem arises many times.

3) Points to Consider
You can go through the naming convention of the magento extension if there some of the modules have the naming convention of the upper case and lower case issue then this issue arises.

4) Points to consider
Set write permission to app/etc folder.


Monday, 19 May 2014

Resize Image By PHP Script

Resize Image By PHP Script

Hi Wait is over now the PHP script library now providing the feature to resize any type of the image into the smaller size.
As we use most of the web programming to resize the images many time. And try to do not reduce the quality of the image. So you can do this by the following code and resize the image as it is.

<?php

$thumb 
= new Imagick();$thumb->readImage('myimage.gif');  

$thumb->resizeImage(320,240,Imagick::FILTER_LANCZOS,1);
$thumb->writeImage('mythumb.gif');
$thumb->clear();
$thumb->destroy();
?>


you can use the above code to resize any type of the image.

Resize Image