Magento Themes and Magento Extensions

Magento: How to check if current page is homepage

Share
Posted on April 30th, 2013 | Posted by admin

Magento: How to check if current page is homepage

If you are checking in header.phtml then this will work for you :

if($this->getIsHomePage()) {
echo ‘Homepage!’;
} else {
echo ‘NOT in Homepage!’;
}
here is an alternative way to check for homepage( works in all .phtml files.):->

$routeName = Mage::app()->getRequest()->getRouteName();
$identifier = Mage::getSingleton(‘cms/page’)->getIdentifier();

Magento – MVC Structure and Code Organization

Share
Posted on April 29th, 2013 | Posted by admin

Code Organized in Modules
Magento organizes its code into individual Modules. In a typical PHP Model-View-Controller (MVC) application, all the Controllers will be in one folder, all the Models in another, etc. In Magento, files are grouped together based on functionality, which are called modules in Magento.

Magento’s Code

For example, you’ll find Controllers, Models, Helpers, Blocks, etc. related to Magento’s checkout functionality in

app/code/core/Mage/Checkout
You’ll find Controllers, Models, Helpers, Blocks, etc. related to Magento’s Google Checkout functionality in

app/code/core/Mage/GoogleCheckout

RUN MAGENTO CODE EXTERNALLY

Share
Posted on April 28th, 2013 | Posted by admin

If you’re working with Magento often you’ll find sometimes you need to use Magento functions and classes outside of the Magento platform. This can be easily achieved with the following lines of code.

<?php
require_once('app/Mage.php'); //Path to Magento
umask(0);
Mage::app();
// Now you can run ANY Magento code you want
// Change 12 to the ID of the product you want to load
$_product = Mage::getModel('catalog/product')->load(12);
echo $_product->getName();

This was only a quick post but hopefully it will be useful to someone.

Creating Customer Using Magento API

Share
Posted on April 26th, 2013 | Posted by admin

You can able to create a customer using magento API.Here the following code will create a customer in magento.

$client = new SoapClient(‘http://192.168.1.190/magento/index.php/api/soap/?wsdl’);
$session = $client->login(‘xxxx’,'yyyy’);
$customerInfo = array(
‘firstname’ => ‘Anish’,
‘lastname’ => ‘Kumar’,
‘email’ => ‘anish@example.com’,
‘password_hash’ => md5(‘password’),
‘store_id’ => 0,
‘website_id’ => 0
);
$newCustomerId = $client->call($session, ‘customer.create’,
array($customerInfo));
$client->endSession($session);
?>
Check it out in magento(customers->Manage Customers).You will see a customer that you created.

Hiding (or Showing) Filters In Certain Categories

Share
Posted on April 25th, 2013 | Posted by admin

Layered Navigation Plus and Layered Navigation Positioning extensions, you can easily hide or show individual filters in certain categories. Here is how:

  1. Open category in which you’d like to hide certain filter.
  2. Go to “Custom Design” tab.
  3. In “Custom Layout Update” field, add: 
    <reference name=”mana.catalog.above_products.nav“>
    <action method=”setHideCategory“><value>1</value></action>
    </reference>
Page 1 of 612345»...Last »