Show top level categories in magento.

Posted by – March 21, 2010

Show top level categories of magento any where in the site.

<?php
$obj = new Mage_Catalog_Block_Navigation();
$store_cats	= $obj->getStoreCategories();
$current_cat 	= $obj->getCurrentCategory();
$current_cat	= (is_object($current_cat) ? $current_cat->getName() : '');

foreach ($store_cats as $cat) {
	if ($cat->getName() == $current_cat) {
		echo '<li><a href="'.$this->getCategoryUrl($cat).'">'.$cat->getName()."</a>\n<ul>\n";
		foreach ($obj->getCurrentChildCategories() as $subcat) {
			echo '<li><a href="'.$this->getCategoryUrl($subcat).'">'.$subcat->getName()."</a></li>\n";
		}
		echo "</ul>\n</li>\n";
	} else {
		echo '<li><a href="'.$this->getCategoryUrl($cat).'">'.$cat->getName()."</a></li>\n";
	}
}
?>

Layout CMS cache error Invalid id or tag ‘’ : must use only [a-zA-Z0-9_]

Posted by – March 19, 2010

To get resolved this error  go to the app/etc and remove the use_cache.ser

Invalid id or tag ‘’ : must use only [a-zA-Z0-9_]
Trace:
#0 \lib\Zend\Cache\Core.php(545): Zend_Cache::throwException(’Invalid id or t…’)
#1 \lib\Zend\Cache\Core.php(564): Zend_Cache_Core::_validateIdOrTag(’’)
#2 \lib\Zend\Cache\Core.php(322): Zend_Cache_Core::_validateTagsArray(Array)
#3 \app\code\core\Mage\Core\Model\App.php(1045): Zend_Cache_Core->save(’saveCache()
#6 \app\code\core\Mage\Core\Controller\Varien\Action.php(265): Mage_Core_Model_Layout_Update->load()
#7 \app\code\core\Mage\Cms\Helper\Page.php(83): Mage_Core_Controller_Varien_Action->loadLayoutUpdates()
#8 \app\code\core\Mage\Cms\controllers\IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), ‘home-german’)
#9 \app\code\core\Mage\Core\Controller\Varien\Action.php(376): Mage_Cms_IndexController->indexAction()
#10 \app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(248): Mage_Core_Controller_Varien_Action->dispatch(’index’)
#11 \app\code\core\Mage\Core\Controller\Varien\Front.php(158): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#12 \app\Mage.php(459): Mage_Core_Controller_Varien_Front->dispatch()
#13 \index.php(65): Mage::run()
#14 {main}

Your problem will get resolved.

Enjoy!!!

Add Contat Us Static Block in Magento

Posted by – March 17, 2010

Create a static block in  CMS > Static Block with the same name as email_contact_us in the admin panel

Place the below mentioned code in app\design\frontend\default\default\template\contacts\form.phtml

—————————————————————————————————————————————————

<div><?php echo $this->getLayout()->createBlock(’cms/block’)->setBlockId(’email_contact_us’)->toHtml() ?> </div>

————————————————————————————————————————————————–

Add new order status in admin of magento

Posted by – March 17, 2010

Further modifying the code to add custum STATUS CODES:

Go one tag level up to the ‘<order>’ tag, there are two sub-tags to it – (1) ‘<statuses>’ and (2) ‘<states>’.

You will add data into both these tags, for example, I have added new status codes – ‘Processing (Paid)’ and ‘Processing (Waiting to Ship)’ as follows (also DO NOT FORGET to add the ‘status’ for all ‘states’, as described in atlasit’s post previously).

Please note that this mechanism only allows finer control in managing status of the orders, and not the

==================================================================================

<order>

<statuses>
<pending translate=”label”><label>Pending</label></pending>
<processing translate=”label”><label>Processing</label></processing>

<!————— NEW STATUS CODES DEF [BEGIN] —————>
<processing-paid translate=”label”><label>Processing (Paid)</label></processing-paid>
<processing-toship translate=”label”><label>Processing (To Ship)</label></processing-toship>
<!————— NEW STATUS CODES DEF [END] —————>

<holded translate=”label”><label>On Hold</label></holded>
<complete translate=”label”><label>Complete</label></complete>
<closed translate=”label”><label>Closed</label></closed>
<canceled translate=”label”><label>Canceled</label></canceled>
</statuses>

<states>
<new translate=”label”>
<label>New</label>
<statuses>
<pending/>
<processing/>
<processing-paid/>
<processing-toship/>
<holded/>
<complete/>
<closed/>
<canceled/>
</statuses>
</new>
<pending translate=”label”>
<label>Pending</label>
<statuses>
<pending/>
<processing/>
<processing-paid/>
<processing-toship/>
<holded/>
<complete/>
<closed/>
<canceled/>
</statuses>
</pending>
<processing translate=”label”>
<label>Processing</label>
<statuses>
<pending/>
<processing/>
<processing-paid/>
<processing-toship/>
<holded/>
<complete/>
<closed/>
<canceled/>
</statuses>
</processing>

<!————— NEW STATUS CODES DESC [BEGIN] —————>
<processing-paid translate=”label”>
<label>Processing (Paid)</label>
<statuses>
<pending/>
<processing/>
<processing-paid/>
<processing-toship/>
<holded/>
<complete/>
<closed/>
<canceled/>
</statuses>
</processing-paid>
<processing-toship translate=”label”>
<label>Processing (To Ship)</label>
<statuses>
<pending/>
<processing/>
<processing-paid/>
<processing-toship/>
<holded/>
<complete/>
<closed/>
<canceled/>
</statuses>
</processing-toship>
<!————— NEW STATUS CODES DESC [END] —————>

<complete translate=”label”>
<label>Complete</label>
<statuses>
<complete/>
<pending/>
<processing/>
<processing-paid/>
<processing-toship/>
<holded/>
<closed/>
<canceled/>
</statuses>
</complete>
<closed translate=”label”>
<label>Closed</label>
<statuses>
<pending/>
<processing/>
<processing-paid/>
<processing-toship/>
<holded/>
<complete/>
<closed/>
<canceled/>
</statuses>
</closed>
<canceled translate=”label”>
<label>Canceled</label>
<statuses>
<pending/>
<processing/>
<processing-paid/>
<processing-toship/>
<holded/>
<complete/>
<closed/>
<canceled/>
</statuses>
</canceled>
<holded translate=”label”>
<label>On Hold</label>
<statuses>
<pending/>
<processing/>
<processing-paid/>
<processing-toship/>
<holded/>
<complete/>
<closed/>
<canceled/>
</statuses>
</holded>
</states>
</order>

=============================================================================

1.4.0.1 contact us email sent problem in magento.

Posted by – March 17, 2010

Error : Unable to submit your request. Please, try again later

When you goes to look at your site it suppose the   hideit is missing!

Just need to place the  a hidden field naming

You’ll need to take a closer look at /app/design/frontend/base/default/template/contacts/form.phtml.  The code from my working 1.4.0.1 environment looks like this:

————————————————————————————————–
<div class="buttons-set">
<
p class="required"><?php echo Mage::helper('contacts')->__('* Required Fields') ?></p>
<
input type="text" name="hideit" id="hideit" value="" style="display:none !important;" />
<
button type="submit" title="<?php echo Mage::helper('contacts')->__('Submit') ?>" class="button"><span><span><?php echo Mage::helper('contacts')->__('Submit') ?></span></span></button>
</
div>
——————————————————————————————————–
Keep the backup before  editing any thing!

How to get store specific products in magento

Posted by – December 28, 2009

Different stores can be set in Magento. A product can be made visible in selected stores.

// get store id
$storeId = Mage::app()->getStore()->getId();

// call the Magento catalog/product model and set the current store ID
 $product = Mage::getModel('catalog/product')
                     ->setStoreId(Mage::app()->getStore()->getId())
                     ->load(YOUR_PRODUCT_ID);

Magento : How to get category and product count in magento

Posted by – December 28, 2009

CODE to get categories/subcategories and products count in magento:
------- ----------------- ----------------------
/**
* get current category
*/
$currCat = Mage::registry('current_category');

/**
* get sub categories of current category
*/
$collection = Mage::getModel('catalog/category')->getCategories($currCat->getEntityId());

/**
* looping through sub categories
* only showing active sub categories ($cat->getIsActive())
*/
foreach($collection as $cat) {
if($cat->getIsActive()) {
$category = Mage::getModel('catalog/category')->load($cat->getEntityId());

/**
* getting product collection for a particular category
* applying status and visibility filter to the product collection
* i.e. only fetching visible and enabled products
*/
$prodCollection = Mage::getResourceModel('catalog/product_collection')->addCategoryFilter($category);
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($prodCollection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($prodCollection);

?>

<a href="<?php echo $category->getUrl() ?>"><?php echo $category->getName() ?></a> (<?php echo $prodCollection->count() ?>)<br/>

<?php
}
}

-------------- ------------------- -----------------

WebLaunchStudio

Posted by – December 16, 2009

Welcome to Web Launch Studio

Weblaunchstudio.com, premier Web Development Company located in New Delhi, India, is specialized in offering high quality web development solution at cost effective price to all medium to large organization. Being a process driven and quality conscious company, we have expertise in providing web design services, web development, software development, search engine marketing and content management system etc.

Our vision, well planned strategy and organized approach towards the projects, quick feedback, flexible working hours, experienced and dedicated team and committed customer support makes us stand out from the crowd. We always ensure that our customers not only get value from their money with our services but our developed applications serve the purpose of their objective.

By employing excellent techniques and methodology, welaunchstudio.com, ensures high quality programming along with significant savings for each one our clients. Here, we always understand the true value of customers in scaling heights and attaining operational excellence.

Hello world!

Posted by – November 12, 2009

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!