Magento – Move Currency Switcher to the Header

If you would like to move the currency switcher from the left column to the header, you can use the following instructions to do so!
Open /app/design/frontend/default/default/layout/page.xml
Locate:

<block type="page/html_header" name="header" as="header">

Change to:

<block type="page/html_header" name="header" as="header">
<block type="directory/currency" name="currency" template="directory/currency.phtml"/>

Open /app/design/frontend/default/default/template/page/html/header.phtml
After:

<?php echo $this->getChildHtml('store_language') ?>

Insert:

<?php echo $this->getChildHtml('currency') ?>

Save, Upload + Clear Cache
Make sure you have imported or manually entered your Currency Rates otherwise the switcher will not appear!
Its as simple as that!!

Source:http://www.pauldonnelly.net/magento-move-currency-switcher-to-the-header/

WordPress : Displaying categories and subcategories “tree like”

Suppose you want to show a category / subcategory “tree like” list on a WordPress page that gets the posts from a certain “main” category.
The following code, probably will be useful.

//# first of all, you need to get the category array,
// and I did it, putting the line bellow inside the loop
$category = get_the_category(get_the_ID());

// once you have the category array, the rest of the code will work wherever you want on the page

//# getting the main category of the page
$catid=$category[0]-&gt;category_parent;
if($catid==0){
$catid=$category[0]-&gt;cat_ID;
}

//# now letz get the children categories of the main category
$categories = get_categories('child_of='.intval($catid));

foreach ($categories as $category) {
//# check if it is a real parent category with subcategories
if ($category-&gt;parent ==$catid):
echo '&lt;span&gt;&lt;a href=""&gt;'.$category-&gt;cat_name.'&lt;/a&gt;&lt;/span&gt;';
//# here we go, getting the subcategories
$subcategories= get_categories('child_of='.intval($category-&gt;cat_ID));
foreach ($subcategories as $subcategory) {
echo '&lt;span style="padding-left:12px"&gt;';
echo '&lt;a href=""&gt;'.$subcategory-&gt;cat_name.'&lt;/a&gt;&lt;/span&gt;';
}
endif;
}

<pre>

Displaying categories and subcategories “tree like” list on WordPress


</pre>

Send newsletter queue in Admin Magento

If newsletter queue is not going to sent by default magento, try to send newsletter manually as following way. Then we can send it by different ways. Here i am going to discuss about 2 methods. Navigate to Configuration>Admin>Security, select “No” in “Add Secret Key to URLs”, save configuration. type http://www.yourdomain.com/admin/newsletter_queue/sending (you will be sent to a blank page.) The news letter will send. (check in the control panel it will be showing sent) After that, you can restore the secret key to url. above is the only work around that worked for me….

Locate file ‘app\code\core\Mage\Adminhtml\Block\Newsletter\Queue\Grid\Renderer\Action.php’
add following code in that page but don’t make any change in core file, override that file
in your local directory as
‘app\code\local\Mage\Adminhtml\Block\Newsletter\Queue\Grid\Renderer \Action.php’
just copy and paste that file in this directory.
Now add the following code in line number 77 before this code $this->getColumn()->setActions($actions);
$actions[] = array(
‘url’=> $this->getUrl(‘*/newsletter_queue/sending’),
‘caption’=>Mage::helper(‘newsletter’)->__(‘Send’),
‘popup’ =>true
);

By default magento send only 20 recipients at time. if you want to change this number and want to send more recipients at a time change in following file.

app/code/core/Mage/Adminhtml/controllers/Newsletter/QueueController.php in this file change following line

$countOfSubscritions = 20;
to
$countOfSubscritions = 100; //change 100 with what ever number you want to change.

Both solution worked for me.

Sources: http://www.magentocommerce.com/boards/viewthread/2424/P105/# (for first solution)
http://hkpatel201.blogspot.in/2013/03/add-newsletter-sending-option-in.html (for second solution)

magento error : Fatal error: spl_autoload() [function.spl-autoload]: Class

Magento error:-
Fatal error: spl_autoload() [<a href=’function.spl-autoload’>function.spl-autoload</a>]: Class Zend_Log could not be loaded in /magento/app/code/core/Mage/Core/functions.php on line 247

Solution: this error comes most of the times due to lack of disk sapce or disk quota. so you need to update the disk quota for the user. Contact hosting provider for to increase the space

WordPress Fatal error: Allowed memory size of 33554432 bytes exhausted

The problem:
Receive “Fatal error: Allowed memory size of 33554432 bytes exhausted” when try to upload an image with medium file size. To solve this error, try to increase the memory allocated to PHP. You can set the limit to 32MB, 64MB, 128MB or 256MB. It depends on your host.

Solution 1: Edit PHP.ini

If you’re still allowed to edit your PHP.inifile, update your memory_limit in PHP.ini by modifying the below line
memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)
If the line is showing 64M in default, try 128M.

Solution 2: Edit .htaccess file

Add the script below to your .htaccess file.
php_value memory_limit 64M

Solution 3: Edit wp-config.php file

Add the script below to your wp-config.php file
Increasing memory allocated to PHP
define('WP_MEMORY_LIMIT', '64M');

Solution 4: Create a PHP.ini file to wp-admin folder
  1. Open Notepad.
  2. Insert the following code into Notepad.
    memory_limit = 64M ;
  3. Save as “PHP.ini”.
  4. Upload this file to “wp-admin” directory.
Source : http://www.hongkiat.com/blog/common-wordpress-errors-with-solutions/

Warning: Cannot modify header information – headers already sent by

Most of the time we donot actually care about leaving the blanks spaces before and after the “php” tag which results on “Warning: Cannot modify header information – headers already sent by (output started at /path/blog/somefile.php:4)“” .

The above problem could be solved by removing the blank spaces before “<?php” tag and after “?>” tag. and make sure the last characters are ?>, placed at the last line with no space in between.

Magento Best Selling Products in homepage

Magento keeps tracks of the sold item , sometimes we need to displayed the most selled product in the homepage . So for that case i find the article while searching and i am using that article in this post.
Simply create directory as app/code/local/Mage/Catalog/Block/Product and create file Bestseller.php , and paste the following code.

 <?php
class Mage_Catalog_Block_Product_Bestseller extends Mage_Catalog_Block_Product_Abstract
{
    public function __construct()
    {
        parent::__construct();

        $storeId    = Mage::app()->getStore()->getId();

        $products = Mage::getResourceModel('reports/product_collection')
            ->addOrderedQty()
            //->addAttributeToSelect('*')
            ->addAttributeToSelect(array('name', 'price', 'small_image', 'short_description', 'description')) //edit to suit tastes
            ->setStoreId($storeId)
            ->addStoreFilter($storeId)
            ->setOrder('ordered_qty', 'desc'); //best sellers on top
        
        Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($products);
        Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($products);

        //$products->setPageSize(6)->setCurPage(1);

        $this->setProductCollection($products);
    }
} 

Now we need a template to use. So for that case create the file bestseller.phtml in your design folder as following order,
app/design/frontend/*/*/template/catalog/product/bestseller.phtml . Then paste the following code

 <?php if (($_products = $this->getProductCollection()) && $_products->getSize()): ?>
<div class="home-page-cntr">
<?php $i=0; foreach ($_products->getItems() as $_product): ?>
    <?php if ($i>5): continue; endif; ?>

<div class="home-page-item">
        <div class="home-page-img">
            <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>">
                 <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(65,65); ?>" alt="<?php echo $this->htmlEscape($_product->getName()) ?>"/>
            </a>
            <?php echo $_product->getDescription(); //also getShortDescription ?>
        </div>
        <div class="home-page-txt">
            <p><a class="product-name" href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->htmlEscape($_product->getName()) ?>)"><?php echo $_product->getName() ?></a></p>
            <?php //echo $this->helper('review/product')->getSummaryHtml($_product, 'short') //product review link ?>
            <?php echo $this->getReviewsSummaryHtml($_product, false, true)?>
            <?php //echo $this->helper('catalog/product')->getPriceHtml($_product) ?>
            <?php echo $this->getPriceHtml($_product) ?>
            <?php echo $_product->getProductId(); ?>
            <?php if($_product->getevent_date()) {echo $_product->getevent_date();} ?>
            
</div>
</div>
<?php $i++; endforeach; ?>
<?php for($i;$i%5!=0;$i++): ?>
    <?php endfor ?>
</div>
<?php endif; ?> 

To use this code, you need to add the block somewhere, either via XML or in a CMS page like your home page:
To use in a CMS page, use this where you enter your content – use it where you want to this item to show up!:

{{block type="catalog/product_bestseller"  template="catalog/product/bestseller.phtml"}}

Above code is tested and implemented in Magento 1.7.0.2

Source : http://www.magentocommerce.com/boards/viewthread/14764/#t51479
http://www.magentocommerce.com/boards/viewthread/14764/#t78979

Changing WordPress’ Autosave Frequency and Post Revisions

WordPress has a very nifty autosave feature which can be a lifesaver to anyone who uses WordPress. The downside to WordPress’ autosave, is that it creates a bunch of draft posts increasing your mySQL database size, especially if you write the post within WordPress’ post editor.

If desired, it is possible to change WordPress’ autosave frequency, or even disable the WordPress autosave feature entirely. Furthermore, if you wish to disable WordPress’ post revisions, or limit the total number of post revisions, both are simple to do in WordPress.

The following code snippets will need to be placed in your WordPress install’s wp-config.php. It’s a simple copy and paste, but be careful. If you mess up your WordPress install’s wp-config.php, the WordPress site will break. If you break your WordPress site while editing the wp-config.php file, undo your changes and re-save your WordPress install’s wp-config.php file and everything should be fixed.

How to Change WordPress’ Autosave Frequency

Simply paste the following snippet in your WordPress install’s wp-config.php to change WordPress’ autosave frequency to save every 5 minutes. The integer is the total number of seconds between each autosave.

define('AUTOSAVE_INTERVAL', 300 );  // integer is in seconds

How to Disable WordPress’ Post Revisions

Simply paste the following snippet in your WordPress install’s wp-config.php to disable WordPress’ post revisions feature.

define('WP_POST_REVISIONS', false ); // disable post revisions

How to Limit WordPress’ Post Revisions

Simply paste the following snippet in your WordPress install’s wp-config.php to adjust the limit of WordPress’ revisions that are kept from WordPress’ autosave feature

define('WP_POST_REVISIONS', 3); // alter number of post revisions kept.

Conclusion

It’s that simple to change WordPress’ autosave frequency or even completely disable WordPress’ post revisions. Doing so will decrease the size of WordPress’ database, but will limit the ability to recover from mistakes. So this WordPress modification could come in handy, or cause problems. Be careful.

Source : http://wplifeguard.com/changing-wordpress-autosave-frequency-and-post-revisions/