Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; advanced_code_editor has a deprecated constructor in /home/ursaftwz/public_html/ on line 40

how to get skin url, get media url, get base url, get store url in magento

Magento Mage Core, Admin Static Blocks, or Phtml edits are usually includes getting url path such images, javascript, base url, media and store url. There are different ways to retrieve mentioned URL paths depending on where section you’re editing.

To Retrieve URL path in STATIC BLOCK


{{skin url=’images/sampleimage.jpg’}}

To get Media URL

{{media url=’/sampleimage.jpg’}}

To get Store URL

{{store url=’mypage.html’}}

To get Base URL

{{base url=’yourstore/mypage.html’}}

TO Retrieve URL path in PHTML

Note: In editing PHTML don’t forget to enclode the following code with PHP tag
Not secure Skin URL:


Secure Skin URL


Get Current URL

$current_url = Mage::helper(‘core/url’)->getCurrentUrl();

Get Home URL

$home_url = Mage::helper(‘core/url’)->getHomeUrl();

Get Magento Media Url


Get Magento Media Url


Get Magento Skin Url


Get Magento Store Url


Get Magento Js Url


Retrieve current product, category and CMS page in Magento

Here are the quick snippet scripts for pulling out the current product, category and cms page from inside script or template files in Magento.

Get Current category

$_category = Mage::registry(‘current_category’);

Get Current Product

$_product = Mage::registry(‘current_product’);

Get Gurrent CMS Page

$_cmspage = Mage::registry(‘cms_page’)

How to get url of a category or product in magento .phtml file

For category url by category ID:

 <?php echo Mage::getModel("catalog/category")->load(5)->getUrl() ?>

To load products of a specific category:

$cat_id = 8; // set desired category id$category = Mage::getModel('catalog/category')->load($cat_id);$products = $category->getProductCollection()->addCategoryFilter($category)->addAttributeToSelect('*');?>
<?php foreach ( $products as $_product ): ?>
    <a href="<?php echo $_product->getProductUrl() ?>"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135, 135); ?>" width="135" height="135" title="<?php echo $_product->getName() ?>" alt="<?php echo $_product->getName() ?>" /></a>
<?php endforeach; ?>

How to change magento admin password through phpmyadmin ?

It seems like the password must be typed and not copy/paste at least on the install part. good to know ;o)

The default login is : admin The default password is : 123123
If you are having troubles and want to reset it to a different password, just run at your sql database:

SELECT * FROM admin_user;

Then, find the username you want to modify in the listing provided – ‘admin’ in this example. Then, to update the password, type:

 UPDATE admin_user SET password=CONCAT(MD5('qXpassword'), ':qX') WHERE username='admin';

‘qX’ would be changed to whatever you want it to be and same goes for ‘password’
You can also do this in phpMyAdmin, find the admin_user field and choose MD5 when updating password.
If you want to add a new admin user, you must not only create a new entry in the table ‘admin_user’, but you also have to insert an entry in the table ‘admin_role’ which has to be associated with the user by the field ‘user_id’.

How To Display products on home page In magento

There are numerous ways to put products on your home page, and we’ll compile a list of code snippets you can use on your own store here. Some examples are outdated, they don’t work in magento 1.4.1 but solutions are provided at the bottom.

New products

Go to “CMS – Manage Pages” and select “Home Page” from the list of pages.

Use this code snippet to show products labeled as “new” on your front page:

{{block type="catalog/product_new" name="" alias="product_homepage" template="catalog/product/new.phtml"}}

(Note that you must have some new products in your catalogue for anything to show when you do this. In this context new doesn’t mean that you’ve recently added them; only products explicitly marked as new using ‘Set Product as New from Date’ and ‘Set Product as New to Date’ options in the ‘General’ product information page in the admin tool will be shown.)

All Products

Go to “CMS – Manage Pages” and select “Home Page” from the list of pages.

Use this code snippet to show all products in your catalog on your front page:

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

All Products from one Category

Go to “CMS – Manage Pages” and select “Home Page” from the list of pages.

Use this code snippet to show one category on your front page:

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

The category ID can be found when you go to “manage category” and then select the category you want. The ID is written in the header.


Layout Update XML for magento 1.4

Because in 1.4 version Layout update is different than in 1.3 version, you can use this example:


[category id here]
It’s possible to add the ‘Root category’ ID here to show all products (Is Anchor Yes required!)

New products – Layout Update XML for magento 1.4

To display new product / latest product, you can use this following XML code in layout xml file or layout display in backend. You can use also the widgets to display the products. The code below has been inspired by the widget.

<reference name="content">
    <block type="catalog/product_new" template="catalog/product/new.phtml">
        <action method="setProductsCount"><count>5</count></action>
        <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
        <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
        <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
        <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
        <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>

New products with pagination – Layout Update XML for Magento 1.4.1

By default the Magento New.php and New.phtml block and template do not provide a way for you to display new products with pagination. The pagination and toolbar elements of Magento belong to the Mage_Catalog_Block_Product_List class. It is possible for one to overwrite the New.php file that Magento provides so that it extends the