Posts tagged "Magento"

Magento OneStepCheckout A/B Test

March 6th, 2012 Posted by Public 3 comments on “Magento OneStepCheckout A/B Test”

Hi everyone,

One of my major Magento Enterprise customers just launched the onestepcheckout extsion – http://www.onestepcheckout.com as an A/B test with the existing multi-step checkout process. We are using Google Website Optimizer to test the variations and I will have some data starting today.

I will update this post with results of the test. I know others have experienced a lift with this extension and I am excited to see how it works for us.

Reset “Use Secure in Front End or Admin” in Database – Magento

October 8th, 2011 Posted by Public 10 comments on “Reset “Use Secure in Front End or Admin” in Database – Magento”

I ran into an issue this week where I switched on SSL on a development site and then realized the SSL cert was not installed correctly. This is a big issue in Magento because there is no way to get back to the admin to switch it back off.

If this ever happens do the following to switch back:

1. Open up your admin panel (cPanel or other)
2. Go to phpMyAdmin (if MySql)
3. Find your Magento Database
4. Find table “core_config_data”
5. Look for the columns “web/secure/use_in_frontend” and “web/secure/use_in_adminhtml”
6. Edit both values, make them equal to “0”

After this is done you will be back in action.

CMS Block in Transactional Email Template – Magento

June 3rd, 2011 Posted by Public 0 comments on “CMS Block in Transactional Email Template – Magento”

Promotional content in order confirmation, shipping notice, etc emails are common in eCommerce – here is a tiny code snippet to make this possible in Magento (Community or Enterprise). I recently added this to the Enterprise implementation for my current customer and everything appears to be working without issue.

1. Add reference to CMS block in transactional email template

 {{block type="cms/block" block_id="ford-order-confirmation-promotions" }}

2. Create CMS block, make sure identifier of block matches.
3. Test your email

Simple right? This could be taken a step further with a little code to select a CMS block based on certain conditions (customer type, purchase history, etc). Anyone want to share that code?

Show SKU in Magento Shopping Cart

April 16th, 2011 Posted by Public 2 comments on “Show SKU in Magento Shopping Cart”

Quick code addition to display the product SKU in the shopping cart in Magento.

Copy the file “default.phtml” from here: “app/design/frontend/default/default/template/checkout/cart/item/” to your local template directory.

Something like “app/design/frontend/default/”your_template”/template/checkout/cart/item/”

Add the following under the product title:

        SKU: <?php echo $_item->getSku() ?>  

Finished:

<h4 class="title"><a href="<?php echo $this->getProductUrl() ?>"><?php echo $this->getProductName() ?> </a></h4>
        SKU: <?php echo $_item->getSku() ?>  

Auto Populate Cross Sell with Products from Current Category Magento

April 16th, 2011 Posted by Public 26 comments on “Auto Populate Cross Sell with Products from Current Category Magento”

eCommerce Data is clear – you need to have cross sell items for every product in your catalog to help conversion.  The usual process consists of manually associating items in the Magento Admin interface.  This process works fine if you have hundreds or even a few thousand items – OR – you have this data in back end systems.

What happens if you don’t have the data and you have 15,000+ items in your catalog?

  • Hire someone to associate all products?
  • Randomly apply products in your data feed?
  • Develop custom code?

All of the above items are true for my Medical Supplies business – Medical Delivered so I needed a solution.  I decided to auto assign cross sell products on the front end on product page render.

In action: http://www.medicaldelivered.com/medline-k1-excel-wheelchair.html

Rules:

  1. The item must be “visible”
  2. The item must reside in the same category as the current item
  3. Don’t display the item from the current product detail page

Results:

  1. All products automatically have cross sells displayed
  2. No need to assign products on the back end
  3. BAD:  Less control over items displayed

This solution won’t work for everyone, if you are an advanced retailer you won’t want to lose this control but if you just want cross sells and don’t have the time/resources to define manually you can try the code below.

Path:  app/design/frontend/default/<template>/catalog/product/list/upsell.phtml

(you may need to create this path – make sure to replace <template> with your template name)


<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@magentocommerce.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade Magento to newer
* versions in the future. If you wish to customize Magento for your
* needs please refer to http://www.magentocommerce.com for more information.
*
* @category   design_default
* @package    Mage
* @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
* @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
* @author        Nick Cron
* @authorweb  www.njcmedia.com
*/
?>
<?php
$_related = $this->getProduct();
// get the parent id to skip
$_parentid = $_related->getId();

if ($_related) {
// get collection of categories this product is associated with
$categories =$_related->getCategoryCollection()
->setPage(1, 1)
->load();

// if the product is associated with any category
if ($categories->count())
foreach ($categories as $_category)
{
$cur_category = Mage::getModel('catalog/category')->load($_category->getId());

?>

<div>
<div><h4><?php echo $this->__('You may also be interested in the following product(s)') ?></h4></div>
<table cellspacing="0" id="upsell-product-table">

<tr>

<?php

$visibility = array(
Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH,
Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG
);

$products = Mage::getResourceModel('catalog/product_collection')
->addCategoryFilter($_category)
->addAttributeToFilter('visibility', $visibility)
->addAttributeToSelect('small_image');

$products->getSelect()->limit(5);

// count the number of displayed products
$_i=0;

foreach ( $products as $productModel )       {
$_related = Mage::getModel('catalog/product')->load($productModel->getId());
$_realtedid = $_related->getId();

// prevents displaying the same product your are already on
if ($_realtedid != $_parentid && $_i<4):

?>

<td>
<p><a href="<?php echo $_related->getProductUrl() ?>"><img src="<?php echo $this->helper('catalog/image')->init($_related, 'small_image')->resize(125) ?>" width="125" height="125" alt="<?php echo $this->htmlEscape($_related->getName()) ?>" /></a></p>
<h5><a href="<?php echo $_related->getProductUrl() ?>"><?php echo $this->htmlEscape($_related->getName()) ?></a></h5>

<?php echo $this->getPriceHtml($_related, true) ?>
<?php echo $this->getReviewsSummaryHtml($_related) ?>
</td>

<?php
// increment displayed products
$_i++;
endif;
}
?>

</tr>

<?php }
}
?>
</table>
<script type="text/javascript">decorateTable('upsell-product-table')</script>
</div>

Room for improvement:

  1. Display items from the back end if exist
  2. Display only items with images
  3. ..?

I hope this helps someone.  If you have any suggestions for improvement or code upgrades/fixes please let me know in the comments.

Magento: Remove auto breaks (“br/”) from product description

April 16th, 2011 Posted by Public 2 comments on “Magento: Remove auto breaks (“br/”) from product description”

By Default Magento automatically adds

 <br/> 

html tags to product descriptions for display on the customer interface.  If you have created a nice description with the WYSIWYG Editor or imported HTML descriptions you most likely want to remove this behavior.   Luckily this is not hard to do.

1.  Find the file “description.phtml” here:  /app/design/frontend/base/default/template/catalog/product/view/description.phtml

2. Make a local copy by copying the file to your local template.  You may need to create the same path in your Magento template (you never want to change core code for upgrade reasons).

New Path: app/design/frontend/default/<template name>/template/catalog/product/view/description.phtml

3.  Remove the “nl2br” tag

Before:


<div>
<?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(), nl2br($this->getProduct()->getDescription()), 'description') ?>
</div>

After:


<div>
<?php echo $this->helper('catalog/output')->productAttribute($this->getProduct(),     $this->getProduct()->getDescription()), 'description' ?>
</div>

4.  Upload the file to your server.

Magento 1.5 Product Import/Export – First Take

February 28th, 2011 Posted by Public 14 comments on “Magento 1.5 Product Import/Export – First Take”

Recently I upgraded from Magento Community 1.4 to 1.5 to take advantage of the next import and export features released in 1.5.  These updates are intended to finally fix the major pain point for many Magento users – it is not easy to import or export products and customers, especially on shared servers or machines with lower resource levels.

I had a specific need to export all of my products, clean the catalog data and import back to Magento.  Here are some things I have found so far.

#1 Menu Location

The new import and export features are in “System > Import/Export > Import” and “System > Import/Export > Export” – the old/legacy profiles have been renamed “Dataflow – profiles” and “Dataflow – Advanced Profiles”

#2 Options

The first screen has two main options “Products” and “Customers” and an option for file type (.csv is the only option)

#3 Products – Detailed Options

Once you select “Products” you have the option to restrict the products included in the .csv file.  This is a much larger list of options than the previous version and nice to see.

(screenshot too large to include)

#4 Run Job

To run the job with the parameters you have specified click the “Continue” button in the lower right to create the file.

Note:  In my case I was trying to export 16,000+ products on a shared server with limited resources (my staging site) and ran into memory errors.  To fix the issue I had to restrict the products exported by setting price ranges in the export and change the ranges until I had a small enough memory usage.

#5 File Created

#5 Resulting File – Columns found in .csv

The following columns were exported:
sku
_store
_attribute_set
_type
_category
_product_websites
color
cost
created_at
custom_design
custom_design_from
custom_design_to
custom_layout_update
description
enable_googlecheckout
gallery
gift_message_available
has_options
image
image_label
is_imported
manufacturer
media_gallery
meta_description
meta_keyword
meta_title
minimal_price
name
news_from_date
news_to_date
options_container
page_layout
price
prices
required_options
short_description
small_image
small_image_label
special_from_date
special_price
special_to_date
status
tax_class_id
thumbnail
thumbnail_label
updated_at
url_key
url_path
visibility
weight
qty
min_qty
use_config_min_qty
is_qty_decimal
backorders
use_config_backorders
min_sale_qty
use_config_min_sale_qty
max_sale_qty
use_config_max_sale_qty
is_in_stock
notify_stock_qty
use_config_notify_stock_qty
manage_stock
use_config_manage_stock
use_config_qty_increments
qty_increments
use_config_enable_qty_increments
enable_qty_increments
_links_related_sku
_links_related_position
_links_crosssell_sku
_links_crosssell_position
_links_upsell_sku
_links_upsell_position
_associated_sku
_associated_default_qty
_associated_position
_tier_price_website
_tier_price_customer_group
_tier_price_qty
_tier_price_price

Note: With my memory restriction I had to create a bunch of these files and manually add them all to a single excel file.

Using this method I was able to export over 16,000 SKUs from a shared server environment in a little over 1 hour.  The export job itself is very much improved from the previous versions and I am happy with the results so far.

Now on to the update and import process, I want to be able to do the following:

  • Change product titles in the export file and import them back to Magento in Bulk
  • Modify the catalog taxonomy and add/change categories by changing in the data file
  • Configure complex products (grouped, configurable, etc) directly in the data file.
  • Reload the updated data feed without experiencing memory issues and failures
  • Reindex the site to pick up the new catalog

I don’t know how many of my wish list items will work… off to begin testing.

Upgrade Magento Community from 1.4 to 1.5 via SSH

February 28th, 2011 Posted by Public 3 comments on “Upgrade Magento Community from 1.4 to 1.5 via SSH”

It’s that time of year again. The new Magento 1.5.0.1 stable release is out and it’s time to upgrade to the new version. I am upgrading on my staging site first and have of course made copies of everything in case it blows up.

I am upgrading to move to the “enhanced” import/export features in 1.5.0.1 – supposedly I will actually be able to export my products (16,000+).

Step 1: Generate a SSH key on Mac

Navigate to “Utilities > Terminal”

In Terminal enter the following:

ssh-keygen -t dsa

Expected Response: “Generating public/private dsa key pair.”

Provide file to save the key:

Enter file in which to save the key (/Users/macuser/.ssh/id_dsa): id_dsa

Enter a passphrase (your local password – can be anything)

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

If successful:

Your identification has been saved in id_dsa.
Your public key has been saved in id_dsa.pub.
The key fingerprint is:

Step 2: Locate the id_dsa.pub key in your file directory and open it with a text editor (I used bluefish).

Copy all text and add the text to the “Public Key” configuration at your web host. This step creates the secure connection between your server and local machine.

Step 3: Load SSH key in terminal

ssh-add /Users/macuser/id_dsa

– enter passphrase

Step 4: Connect to your server

ssh <user>@<domain>.com -p<ssh port>

Step 5: If connected correctly your prompt will change the user provided in step 4. Type “ls” to list folder contents on your server.

Step 6: Download Magento
wget http://www.magentocommerce.com/downloads/assets/1.5.0.1/magento-1.5.0.1.tar.gz

Step 7: Extract tar file

tar -zxvf magento-1.5.0.1.tar.gz

Step 8: list files again and look for folder “Magento”
ls

Step 9: Copy extracted files over existing Magento installation (MAKE SURE YOU HAVE A BACKUP)
cd magento
cp -rf * ../public_html

Step 10: Try to load the site at your URL. If you have permissions issues or 500 errors try these fixes:
http://www.magentocommerce.com/boards/viewthread/220253/
– I also had to look at the error logs in my cpanel to figure out the folder that had too high of permissions. For me it was ‘erorrs’ t0 fix I did a chmod 755 on that folder.

Step 11: Load the front end URL for your store to check to see if your template files work in version 1.5+
I had the following error:
Fatal error: Call to a member function toHtml() on a non-object in /home/../public_html/app/code/core/Mage/Core/Model/Layout.php on line 529
– Googled Fix: http://screencastworld.com/2010/07/magento/how-to-fix/php-fatal-error-call-to-a-member-function-tohtml-on-a-non-object-in-layout-php-on-line-529
– This worked for me

Step 12: Login to your administrative interface (usually http://<domain>/admin)
– Once you login you should see version 1.5.0.1 in the footer (upgrade is done)

Step 13: Clean up the temp files

cd ../
rm -rf magento
rm magento-1.5.0.1.tar.gz

Much thanks to “veracious” in the Magento Forums for this helpful post: http://www.magentocommerce.com/boards/viewthread/219570/P30/