Showing posts from 2013

Magento: How to effectively get the website ID

To get the website ID in Magento:

Adobe Business Catalyst: How to specify image dimension on the web app

Recently, I have an ABC project that uses Web App. I was puzzled how to specify image dimension. I played with the values and finally came up with the correct format. In your web app field that has an 'image' type, simply append the width and height to the image path.

Like this:  /path/to/my/image.jpg,370,170

Magento - How to check in the frontend if admin is logged in

In Magento, I've tried different approaches just to check in the frontend if the admin is logged in. There are lots of codes I found in the net but they didn't work.

Well, the easiest approach is just this :

I used that in the custom router I created.

Now buy me some beer!

Ubuntu Terminal: mysql -u username -p database_name < database.sql does not import completely

If ever you have encountered the issue mentioned in the title of this post, I have an alternative for that. I experienced that when I imported a very large sql file which is about 2GB.

What I did was I used the mysql command line client. I think you have an idea now how i did it.
But here we go. In your terminal, type mysql -u <your_username> -p. Then type of course type the password when prompted.

Then run use <database_name>; press enter.
And then, source sqlfile.sql;

That should do the trick. Just wait for it to finish importing.

Magento: Cannot add new attribute option values or delete after adding too many values

I've been trying different fixes for the issue mentioned but the fix below is the best. To fix this issue, do the following in php.ini:

memory_limit = 256M
max_execution_time = 3600
max_input_time = 600
post_max_size = 512M
max_input_vars = 100000 = 100000
suhosin.request.max_vars = 100000

You may add some lines if they don't exist yet.

In CentOS, php.ini can be found in /usr/local/lib/php.ini.
In Ubuntu, it's residing in the following :

After modifying php.ini, please don't forget to restart Apache.

That's all!

Ubuntu: Extract tar.bz2

To untar bz2 file, do this
tar jxvf firefox-3.5.tar.bz2

If it does not work, you probably need to install bzip2,
sudo apt-get install bzip2

Magento : Product CSV import Notice: unserialize(): Error at offset 925 of 1057 bytes in /var/www/magento/app/code/core/Mage/Dataflow/Model/Batch/Abstract.php on line 66

If ever you're getting an error like this when importing products CSV on Magento, 

Notice: unserialize(): Error at offset 925 of 1057 bytes in /var/www/magento/app/code/core/Mage/Dataflow/Model/Batch/Abstract.php on line 66

Make sure to fix special characters on the description or short_description column and other columns. For some reason, Magento does not accept those special characters like ™, ®, &, £, and a lot more.

Hope that helps...

Ubuntu: MySQL Export/Import all databases in CLI

To Export all your MySQL databases, do this :
mysqldump -u yourusername -p -h localhost --all-databases | gzip > filename.sql.gz
To Import all your MySQL databases, do this :
mysql -u yourusername -p -h localhost < filename.sql
Also you might wonder how I unzipped the gz file. You can do this
gunzip filename.sql.gz