rss
twitter
    Find out what I'm doing, Follow Me :)

Saturday, February 27, 2010

Magento 1.4.0.0-Alpha2 available with WYSIWYG Editor!

The 25th of September, Magento released the 1.4.0.0-alpha2 version, offering us the so expected official WYSIWYG editor.
After several minutes on it, I only could say that it was worth waiting! It’s powerfull, easy to control and user friendly.
All the basics functionnality usually offered by a WYSIWYG editor are embedded.


Magento wysiwyg editor


By pressing “Show / Hide Editor” button, you can insert one of the following Widgets (specific Magento tags):
  • Link to a Product
  • Link to a Category
  • Link to a CMS Page
  • CMS Block Widget
  • Catalog Product List Widgets: New, Recently Compared, Recently Viewed
Menu without Editor

Let’s have an example: display the new products on Home Page, using the catalog product list Widget “New“:
First of all, do not forget to configure at least one product as “New” from the option “Set Product as New from Date“.
Then, go to CMS –> Manage Pages –> Home Page.
  • Click on the new tab “Content
  • Click “Insert Widget” button
Magento Widget button
  • Select “Catalog New Product List
  • And then choose the number of products to display and the cache lifetime
Widget Options
Then click “Insert Widget”
That’s all!

Backend result

Now just check the result in your Home Page (In my case, I first had to reindex data from System –> Index Management):

Frontend result

Wednesday, February 24, 2010

How to create a custom page in magento and link it to a new menu

STEPS FOR CREATING A CUSTOM PAGE IN MAGENTO AND LINK IT TO A NEW MENU

1. Login as admin, Then select ‘Manage Pages’ from CMS menu.
2. Click ‘Add New Page’ Button to create a page.
3. In the New Page:

a) In General Information tab enter following details:
Page Title: Test Page
SEF URL Indentifier: test1
Store View: All Store Views
Status: Enabled
Content: Enter some text here..

b) Custome Design: Select your own layout from this tab
Select Layout: Three Column (you can select any layout)

c) Meta Data: If you want to add Keywords and Descriptions

Then click on ‘Save Page’ button. Now your test page is ready.

4. Now we have to create a new menu to link this page. Open app/design/frontend/default/default/template/catalog/navigation/top.phtml

Enter following line just above the foreach statement.

<li><a href="<?php echo $this->getUrl('test1')?>"><?php echo $this->__('Staff') ?></a></li>

Here test1 is the SEF URL Identifier and Staff is the new menu name.

Now your menu is ready.  Go to magento frontend and click on ‘Staff’ menu to see your new page.

Friday, February 19, 2010

Restrict access to Magento during upgrades etc

We get many requests about how to restrict access to Magento during upgrades or other issues that requires that Magento is not available for customers and search spiders, but is still accessible for you to debug.

Here is an example of restricting your Magento instance to your IP address exclusively. Other visitors, including search spiders, will get the HTTP503 Service Unavailable error.

First, create a file 503.php in your Magento installation root:

      <?php
      header(‘HTTP/1.1 503 Service Unavailable’);
  
      header(‘Content-Type: text/plain; charset=UTF-8');
  
      echo "503 Service Unavailable";
      ?>

In .htaccess or in Apache server configuration, add the following rewrite rule:

Where 127.0.0.1 (note the backslashes before dots) should be replaced with your IP-address

Once you save this .htaccess file or reload Apache configuration, your site will be down until you restore the initial state.

Source : http://www.silverthemes.com/blog/

Wednesday, February 17, 2010

Magento 1.4 Fatal Error Stack Frame + Solution

If your shiny new Magento 1.4 is displaying this error message at the bottom of the page then you might want to apply this fix.

Fatal error: Exception thrown without a stack frame in Unknown on line 0

The solution is to comment out a small section of code in

app/code/core/Mage/Core/Model/Cache.php

line 180

        try {
                      if (class_exists($type, true)) {
                          $implements = class_implements($type, true);
                          if (in_array('Zend_Cache_Backend_Interface', $implements)) {
                              $backendType = $type;
                          }
                      }
                  } catch (Exception $e) {
                }

Source : http://www.edmondscommerce.co.uk/blog/magento/magento-1-4-fatal-error-stack-frame-solution/

Monday, February 15, 2010

2 SQL Tricks to Auto-Organize your Images In Magento

If you imported a lot of data into your Magento installation, and your images got disorganized in the process, here are a couple SQL scripts that may help you!

Trick 1 - Auto-set default base, thumb, small image to first image.

If you have multiple images per product from your import, Magento might have set the LAST one as the default base, small, and thumb image for all of your products!  This can be an issue if you want the FIRST image to be the default!
This script updates your images and makes the FIRST image (image order 1) your default BASE, SMALL, and THUMB image for ALL products in your database.  Can save you lots of hours if you were planning on doing this task manually!

Careful if you run this!  Getting your image order set back to how it was won’t be so easy!

UPDATE catalog_product_entity_media_gallery AS mg,
    catalog_product_entity_media_gallery_value AS mgv,
    catalog_product_entity_varchar AS ev
SET ev.value = mg.value
WHERE  mg.value_id = mgv.value_id
    AND mg.entity_id = ev.entity_id
    AND ev.attribute_id IN (70, 71, 72)
    AND mgv.position = 1;

Trick 2 - Auto-enable thumbs for multi-image and auto-disable for single-image products

Ok, so you imported 5,000 new products into your Magento store, and some have 1 product image, and the rest have 2+ images.  If you’re like me, you want the multi-image products to have thumbnails enabled on the product page, and if you only have 1 image, you want no thumbnails (kind of silly to switch between an image and itself LOL). 

So this script runs 2 updates.  The first enables all images for thumbnails, then the second disables any thumbnails for images associated to products having only a total count of 1image.

UPDATE catalog_product_entity_media_gallery_value SET disabled = 0;
UPDATE catalog_product_entity_media_gallery_value AS mgv,
    (SELECT entity_id, COUNT(*) as image_count, MAX(value_id) AS value_id
    FROM catalog_product_entity_media_gallery AS mg
    GROUP BY entity_id
    HAVING image_count = 1) AS mg
SET mgv.disabled = 1
WHERE mgv.value_id = mg.value_id

Source : http://www.magentocommerce.com/boards/viewthread/59440/

Saturday, February 13, 2010

Fix for Magento Backup Error

 If you see this error:

    Warning: Invalid argument supplied for foreach() in /home/USERNAME/domains/DOMAINNAME/public_html/MAGENTOLOCATION/lib/Varien/Data/Collection/Filesystem.php on line 234

    - go to line 234 on file : lib/Varien/Data/Collection/Filesystem.php
    - change this line :

    foreach (glob($folder . DIRECTORY_SEPARATOR . ‘*’) as $node) {

    with this :

    foreach ((array)glob($folder . DIRECTORY_SEPARATOR . ‘*’) as $node) {

    Note : this problem has been detected on version 1.3.2.2


Source : http://www.simplehelix.com/blog/2009/07/magento-backup-error/

Thursday, February 11, 2010

Importing a Product List CSV file into Magento

With a Magento eCommerce site, you’ll often want to work with your products offline. Luckily Magento makes it easy to export your product list via ftp and other methods. But once you’ve downloaded that CSV file and made your changes you’re going to have to import them back into Magento.

The good news is that Magento allows you to easily import your product list CSV file back into your website. You just have to follow a few simple steps, and you’re store will be updated and ready for more business!

1. Login to your Magento Account Dashboard.
2. Go to System -> Import/Export -> Profiles
3. Click on Import All Products
4. On the First section, Profile Wizard, make sure Data transfer is set to Interactive. Also, make sure that Data Format Type is CSV/Tab separated. To apply these changes, click Save and Continue.
5. Now move on to the next section, Upload File. Here’s where you click the Choose File button to select the CSV file you want to upload from your computer.
5. Once that is done, click Save and Continue.
6. After it has saved, click Run Profile. You will then need to select the file you just uploaded.
7. If you found the file successfully, you should then click Run Profile in Popup.

Magento will begin uploading your product data. This may take a while, depending on the file size, connection speed, etc. But that’s it - you’re done!

Source : http://joeyreed.com/uncategorized/importing-a-product-list-csv-file-into-magento/#more-46

Tuesday, February 9, 2010

How to view Magento Error Logs

Mostly while working with Magento, you end up with serious errors or broken stuffs. So, Magento Error Logs come to the rescue here. Whenever you have a serious error on your site, you can just view your error logs and debug the error and get rid of that situation. As simple as it is.
Many of you may be wondering, how to switch on Magento Error Logs or view it. So,here are the simple steps :

1) Turn on your logging: Admin
> Configuration > Developer > Log Settings > Enabled = Yes

2) Watch your var/log/system.log and var/log/exception.log for raw information from this.
You may run into file permission errors, so you might need to set your folder permissions appropriately.

Source : http://www.learnmagento.org/magento-tips-tricks/magento-error-logs/

Wednesday, February 3, 2010

Magento: Paypal Standard IPN Double Totals Bug 1.3.2.3 + fix

Untitled 1 Magento: Paypal Standard IPN Double Totals Bug 1.3.2.3 + fix

Does the above look familiar for Paypal Standard Orders, Note the Grand Total and Total Paid…
Running into this issue myself I thought I would post it up to let everyone else know the issue with the Standard Paypal IPN and Magento version 1.3.2.3.  It appears double Order totals are showing up under “Total Paid” and can cause a lot of customer confusion.

Here is the quick temporary fix:

NOTE: This modifies the base code of Magento and recommended you save a backup of the original file, as it may cause issues upgrading later on.
app/code/core/Mage/Paypal/Model/Standard.php as follows:

- $invoice->register()->capture();
+ $invoice->register()->pay(); 

The above modification fixed IPN problems but now the Total Paid amount is wrong.

Also the above modification introduced another bug: paid orders are shown as COMPLETE instead of PROCESSING. This can be fixed by changing app/code/core/Mage/Paypal/Model/Standard.php as follows:

- Mage_Sales_Model_Order::STATE_COMPLETE, true,
+ Mage_Sales_Model_Order::STATE_PROCESSING, $newOrderStatus, 

This change will fix the status problem so that paid orers now appear as PROCESSING.

Source : http://www.molotovbliss.com/blog/magento-commerce/magento-paypal-standard-ipn-double-totals-bug-1-3-2-3-fix/

Monday, February 1, 2010

Magento: How to get all active payment modules

This code bellow will get you all active Magento payment modules. This example below return an array which you can use to create drop down menu or something else in Magento’s front-end or admin sections.

class Inchoo_Vendor_Model_Activpayment
{
   public function getActivPaymentMethods()
    {
       $payments = Mage::getSingleton('payment/config')->getActiveMethods();
 
       $methods = array(array('value'=>'', 'label'=>Mage::helper('adminhtml')->__('--Please Select--')));
 
       foreach ($payments as $paymentCode=>$paymentModel) {
            $paymentTitle = Mage::getStoreConfig('payment/'.$paymentCode.'/title');
            $methods[$paymentCode] = array(
                'label'   => $paymentTitle,
                'value' => $paymentCode,
            );
        }
        return $methods;
    }
 }

Source : http://inchoo.net/ecommerce/magento/magento-how-to-get-all-active-payment-modules/