While developing sites in Magento, I have found myself using the below snippets of code regularly and may also be useful to you.
Product Reviews and Form in a Tab
Add the following:
Then add:
to app/design/frontend/[your_theme]/template/review/product/list.phtml
Note: For the above to work, your theme should already be using product tabs (Many tutorials are available online if you don’t have tabs)
Show Sub-Categories (as images with text) on Category or product Pages (and sort by name)
If a category contains both products and further sub-categories, then this code can be used so such a category shows both products and sub-categories.
Add the following:
to app/design/frontend/[your_theme]/template/catalog/category/list.phtml
OR app/design/frontend/[your_theme]/template/catalog/product/list.phtml
Display RSS Feed items
Step 1
Create a file called latest_news.phtml in app/design/frontend/default/[your_theme]/template/callouts/latest_news.phtml with the following:
Step 2: Add the following
to app/design/frontend/[your_theme]/layout/page.xml
Note: The above will add the code to the right sidebar – you can reference it elsewhere on the site.
Display a product’s “quantity in stock” on your Product Pages
Flush/force DNS (Windows only)
Many a time, when you change the DNS records and nameservers of a domain to point to the new site, it can take up to 72 hours to propagate over the internet. Unfortunately sometimes, the client/customer/general users may see the new site before the developer and if there are any issues then the developer won’t be able to fix them until they can see the new site. Previously i used to wait like anybody else however recently a colleague showed me a method by which I can force my browser to view the new site!
Step 1:
Open command promt (search/run CMD in windows)
In Command promt, type the following:
“ipconfig /flushdns”
Step 2
Go to the folder:
%SystemRoot%system32driversetc
For windows 7, %SystemRoot% is C:Windows
For windows XP, it may be a little different.
Inside the folder “etc” is a file named – “hosts”. Open this with Notepad and add the line
xx.xxx.xxx.xx www.YOUR-DOMAIN.co.uk
At the bottom of the file (where xx.xxx.xxx.xx is the ip address of the new host)
Then you will have to clear your browser cache.
Ecommerce tracking in Magento Using Google Analytics
This one is simple.
Go to System > Configuration > Google API and insert you analytics ID.
Then
- login to Google analytics
- Select the account for your site
- Click edit
- on “Main Website Profile Information”, click edit
- tick the radio button “Yes, an E-Commerce site”
Site search tracking in Magento Using Google Analytics
login to Google analytics
- Select the account for your site
- Click edit
- on “Main Website Profile Information”, click edit
- tick the radio button “Do Track Site Search”
- insert the letter “q” in the input box
Display PHTML files in Dreamweaver
http://www.dreamweaverclub.com/dreamweaver-phtml-inc.php
Conclusion
Is there anything else you would like to do with Magento? leave a note below.