Pages

Showing posts with label magento. Show all posts
Showing posts with label magento. Show all posts

Friday, May 3, 2013

Magento-Get information of Items in Cart

Magento-Get Information of Items in Cart

$items=Mage::getSingleton('Checkout/Session')->getQuote()->getAllItems();

foreach($items as $item)
{
    echo $item->getName();
                      ->getQty();
                      ->getPrice();
                      ->getSku();
                      ->getProductid()
}


Magento-get Cart Count

Mage::('checkout/cart')->getItemsCount();

Wednesday, April 3, 2013

Magento install error - Exception printing is disabled

Here is the walk through to recover from this error

  1. Navigate to the "errors" folder.
  2. Change local.xml.sample to local.xml
Worked for me till here while I was in installation phase

However fellow experts have added few more steps

3. You will see a bunch of errors now
4. Open magento/lib/Zend/Cache/Backend/File.php and look for:

protected $_options = array(
'cache_dir' => 'null', 


5. Change the same to

protected $_options = array(
'cache_dir' => 'tmp/', 


and save the file

6. Now the final step is to go create a tmp folder in the root Magento folder.


That's It

Tuesday, April 2, 2013

Magento-Home Page-Store or Store View is not showing up-404 error: Page not found

Checklist :

1. Make sure the default store view of your defaut store of your default website is not disabled.
2. Flush your cache's
3. Reindex Data
4. Set Main website as default and and then set back your website as default.

The last option worked me with once I changed the Default store for my default website and did every thing till 7th point untill I hit and tried 8th one and it worked for me.

If this is not helping you need to debug the issue since it may either be your .htaccess issue or issue from index.php
Open the index.php in root directory of the Magento installation and comment the line
Mage::run($mageRunCode, $mageRunType);
 (you will find this line near the end)
 Run your website if you still find a 404 page not found error its an .htaccess issue try renaming the same

Else try this hardcode in index.php

Just above the code mentioned above type in the following code

/* Store or website code */
$mageRunCode = 'code of store view to load';

/* you will find the code field when you edit your store view type the same code exactly here */

/* Run store or run website */
$mageRunType ='store';


(make sure you type this just before the code line "Mage::run($mageRunCode, $mageRunType);" ) inorder to override default value of these variables

If you are able to open your store view here you need to go back and check store Management.

Post here if you further have any issues

Magento-Home Page-Language drop down not showing up

Checklist:

1. To show a language bar in the header of your website you should have multiple stores(or store views).

If I peek into languages.phtml we get the following code

"getStores())>1): ?>"

which clearly states that the number of stores should be greater than 1

2. Make sure in case you are using 2 websites the "Main Website" default one and the other one(your's) then your's should be default one.

3. Make sure System>>Configuration>>General>>Locale is set to local languages for your respective store views.

4. Make sure language files are installed perfectly and correctly.If not download them from

http://www.magentocommerce.com/translations

and added them in accordance to the folder sequence as in zip file

5. Make sure it is called correctly in page.xml in respective block

6. Flush your cache's

7. Reindex Data

Sunday, July 8, 2012

Magento Session storage?Which and when to choose??

Magento stores sessions by 4 means file-storage,database, memcached and tmpfs-backed file-storage

The benefits of file-based sessions for Magento are simplicity, stability and durability. It’s simple because you don’t have to do anything to set it up. It’s stable because most modern filesystems use journaling to make sure that in the event of a system crash your session data is consistent. I also durable, because a system restart will not cause you to lose your session data.

Add below line in local.xml to start file based storage
<session_save>session_save>

Database session storage is the other storage type.With database session storage the session data is stored in the Magento MySQL database. The connection used is the same as the core connection.

One of the key benefits of using database sessions is the clustered environment support. In a filesystem based session storage scheme, if you have more than one Magento frontend node in a cluster, they will need to share session data (unless you use a loadbalancer with sticky sessions) and the database gives you that capability quite easily.

To use the database for session storage simply have this in your local.xml


<session_save>session_save>

Memcached session storage takes a bit more setup than either of the previous two options.For starters you need a Memcached server running.
Once you have it up and running, the memcached session storage offers a number of benefits. Firstly it is very cluster friendly. The session data can be shared by any number of webnodes, and to make things even better you can easily add more memcached server nodes so that even your session storage can be scaled to handle many 1000′s of concurrent sessions*. Secondly, it is (or can be) separate of the database and web node entirely, which offloads the work of storing sessions from busy nodes in a high-traffic environment.
The memcached server is not tolerant to failures, if your system crashes or dies the data in memory will be lost. Being a separate server does allow the session storage to be kept running during a web or database node restart though – something you cannot do with the tmpfs storage option below.

To use the database for Memcached storage simply have this in your local.xml
 
<session_save>session_save>
<session_save_path>session_save_path>
 
tmpfs-backed Filesystem Session storage
 
This is not really a good idea for storing sessions, it’s highly volatile and unstable two things you probably don’t want for ecommerce store sessions. It’s also not scalable either as it relies on the machine’s physical memory, and you can only stick so much of that in – you might need it for the web server too. It will also not help at all in a clustered environment as it is machine specific.
Despite all it’s limitations I really wanted to test tmpfs sessions more out of curiosity than anything, I have a hunch that it will make quite a performance boost. Let’s see how it does in the benchmark section below.
If you’re keen to try this, I’ll assume you know what you’re doing on the system side of things. Mount var (or var/sessions) as a tmpfs and set Magento to use file based session storage like in the first option above.


 

Tuesday, July 3, 2012

Jquery conflicts with Prototype

Use $$=jQuery.noConflict();

that's all

and then for all JQuery $ use $$

example

for $("#sdf")  use $$("#sdf")