Magento Themes and Magento Extensions

In Magento, How to display static block in phtml file

Share
Posted on March 23rd, 2013 | Posted by admin

In Magento, you can easily display the different static blocks in each pages. First you need to create static block, for these just Login into site admin end goto CMS->Static Blocks.

Click Add New Block button and fill the required fields and finally save it. Here you need to note the Identifierthat need to be input in below code to display block in individual pages.

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('your_cms_block_identifier')->toHtml() ?>

Batch Product Entity Updates in Magento

Share
Posted on March 16th, 2013 | Posted by admin

Batch Product Entity Updates in Magento
I’ve been writing scripts that interact directly with the database to modify products, etc., but today, I found a much better way to do things. Although direct DB modification is FAST, it’s also very unsafe, and I’m very wary of putting our clients’ sites at risk in order to do the updates they want. Magento, although very frustrating, offers some flexible functionality to alter its often immense database. Following is a PHP script I wrote to update products based on a CSV. The CSV contains product SKUs, but it can be easily modified to grab IDs from a CSV, and one can export their products and modify the fields they want, and then modify the script slightly to modify entities where needed, and grab the correct columns from the database. It will also resume if it needs to be terminated early (useful because it can take a long time for large updates), and reports percentage of completion. So, without further ado….

Magento – Nested ifconfig for better Layouts

Share
Posted on February 27th, 2013 | Posted by admin

By default, Magento allows you to use ifconfig in the following way:

10 <action method="addItem" ifconfig="path/to/config/status/enabled"><type>skin_js</type><name>js/script_one.js</name></action>

the javascript js/script_one.js will be included if path/to/config/status/enabled is true.
Unfortunately, Magento does not allow you to use the “else” block for ifconfig.

for example:
Let’s say, you want to implement the following logic:
if path/to/config/status/enabled is true
then
include the javacript js/script_one.js
else
include the javacript js/script_two.js

Get product review info (independent) of review page

Share
Posted on February 21st, 2013 | Posted by admin

We are working on a private project, that should see daylight any time soon. One of the requirements we had is to show product review info on pages independent of product review page. Let’s say you wish to show review info on home page for some of the products. After few weeks with working with Magento, one learns how to use the model stuff directly from view files. Although this might not be the “right” way, it’s most definitely the fastest way (and I doubt most of your clients would prefer any other  , especially if it’s some minor modification).

Here is a code to retrieve the product review info:

Just be sure to pass it the right product id number.

Create Magento order invoice programmatically

Share
Posted on February 14th, 2013 | Posted by admin

Create Magento order invoice programmatically
Here is a quick and easy way to create order invoice programmatically.

Suppose, $_order contains your order.

Here goes the code to create invoice:-

Page 6 of 51« First...«45678»102030...Last »