RSS

Remove Sidebar Callouts in Magento Layout

Tue, Jul 20, 2010

0 Comments

Here are a coupe of quick references for removing sidebar callouts in either a template/layout .xml file or custom page Layout per page. I used the following to remove some unwanted blocks from the homepage sidebar by updating the XML Layout for the homepage under the Design tab, such as the cart which is unnecessary on a website homepage.

<reference name=”right”>
<action method=”unsetChild”><name>cart_sidebar</name></action>
<action method=”unsetChild”><name>catalog.compare.sidebar</name></action>
<action method=”unsetChild”><name>right.reports.product.viewed</name></action>
<action method=”unsetChild”><name>right.permanent.callout</name></action>
</reference>

Continue reading...

Magento 1.4.1.0 Upgrade Error

Wed, Jul 14, 2010

0 Comments

Fatal error:  Call to a member function toHtml() on a non-object in /public_html/app/code/core/Mage/Core/Model/Layout.php on line 529

The line in page.xml that seems to cause the problem is

<block type=”core/profiler” output=”toHtml”/>

Magento now uses an updated call:

<block type=”core/profiler” output=”toHtml” name=”core_profiler”/>

This should be one of the initial changes that can get your site live and updated when upgrading to Magento 1.4.1.0

Continue reading...

Custom SEF Sidebar Navigation For Magento

Tue, Jul 13, 2010

0 Comments

I wanted to share a quick snippet of code that I created for adding a custom navigation section to your Magento left column area. I currently created this navigation area for a client to replace the layered navigation. The layered navigation has a lot of great features and organization but probably better severs as a multi -select drop down. Also in the previous versions of Magento the layered navigation was not search engine friendly.

This is not currently the case but I still find that there is not enough control over the category / subcategory display within the layered navigation. This custom navigation block could be used above some of the other build in features such as price, manufacturer etc. that is simple to accomplish with the layered navigation.

Also of note, I have found including other SEO centralized developers, that the layered navigation simply refreshs that page, so should you have content on the main category page, the layered navigation link creates confusion becuase the page content continues to display. (more…)

Continue reading...

Make ‘Ship to This Address’ Default Option During Magento Checkout

Fri, Jun 4, 2010

0 Comments

As you may uncover there are a number of obvious changes that need to be made to the Magento core code. The default shipping option being one of them, this may in fact be yet another change that you would want to record and check during any upgrades as the code change is made to the core code of Magento.

Navigate to – app/code/core/Mage/Checkout/Block/Onepage/Billing.php

To update the default shipping option to ‘Ship to this Adress’ simply edit the core magento file located on your server:

Replace:

public function isUseBillingAddressForShipping()
{
if (($this->getQuote()->getIsVirtual()) || !$this->getQuote()->getShippingAddress()->getSameAsBilling())
{
return false;
}
return true;
}

With:

public function isUseBillingAddressForShipping()
{
if (($this->getQuote()->getIsVirtual()) || (!$this->getQuote()->getShippingAddress()->getSameAsBilling()))
{
return true;
} else {
return false;
}
}

Continue reading...

Removing Extra Line Breaks Added To Magento Product Descriptions

Thu, May 27, 2010

0 Comments

In order to remove the extra line breaks that are added to Magento product descriptions. Simply update the following file:

/app/design/frontend/base/default/template/catalog/product/view/description.phtml

Edit the line nl2br($_description) to $_description, removing nl2br.

The added line breaks were causing issues in Firefox when creating unordered lists and such as the list code would have an added line break, <br>, or what appeared to be line spacing added to each item within the list.

Continue reading...

Google Analytics Bug Fix for Magento 1.4.0.1

Fri, Apr 30, 2010

0 Comments

In installing Google Analytics you may notice that your account remains in a waiting to receive data state. Although Google Analytics has been recognized and installed correctly a small correction must be made to the source code of the Mage code.

You will want to edit the following file:
app/code/core/Mage/GoogleAnalytics/Block/Ga.php

…And add this simple line of code to line 179 in order to resolve the issue.

var _gaq = _gaq || [];

This issue has been reported and resolved already by the Magento Team through Issue #21456

Continue reading...

How to Change an Existing Products Attribute Set in Magento

Fri, Apr 30, 2010

3 Comments

Unfortunately Magento does not have the function built into its setup to allow you the option to change a products attribute set once you have created a simple product. However, with the following coding updates, you can add the functionality to change a simple products attribute set directly on the Catalog > Manage Products page:

In app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php around line 253 ad:

$sets = Mage::getResourceModel(‘eav/entity_attribute_set_collection’)
->setEntityTypeFilter(Mage::getModel(‘catalog/product’)
->getResource()->getTypeId())->load()->toOptionHash();

array_unshift($statuses, array(‘label’=>”, ‘value’=>”));
$this->getMassactionBlock()->addItem(‘attribute_set’, array(
‘label’=> Mage::helper(‘catalog’)->__(‘Change attribute set’),
‘url’ => $this->getUrl(‘*/*/massAttributeSet’, array(‘_current’=>true)),
‘additional’ => array(
‘visibility’ => array(
‘name’ => ‘attribute_set’,
‘type’ => ’select’,
‘class’ => ‘required-entry’,
‘label’ => Mage::helper(‘catalog’)->__(‘Attribute Set’),
‘values’ => $sets
)
)
));

And then in app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php (anywhere in the class) add a new function:

public function massAttributeSetAction(){

$productIds = $this->getRequest()->getParam(‘product’);
$storeId = (int)$this->getRequest()->getParam(’store’, 0);
if(!is_array($productIds)) {
$this->_getSession()->addError($this->__(‘Please select product(s)’));
} else {
try {
foreach ($productIds as $productId) {
$product = Mage::getSingleton(‘catalog/product’)
->unsetData()
->setStoreId($storeId)
->load($productId)
->setAttributeSetId($this->getRequest()->getParam(‘attribute_set’))
->setIsMassupdate(true)
->save();
}
Mage::dispatchEvent(‘catalog_product_massupdate_after’, array(‘products’=>$productIds));
$this->_getSession()->addSuccess(
$this->__(‘Total of %d record(s) were successfully updated’, count($productIds)));
} catch (Exception $e) {
$this->_getSession()->addError($e->getMessage());
}
}

$this->_redirect(‘*/*/’, array(’store’=>(int)$this->getRequest()->getParam(’store’, 0)));
}

Once you have added the two snippets of code you will now be able to select products from teh Manage Products list and update any products Attribute Set from the actions dropdown menu.

Simply Select ‘Change Attribute Set’ and select the appropriate attribute set from the new dropdown menu that appears to the right of Actions.

Continue reading...

Pagination Update for Magento 1.4

Tue, Apr 13, 2010

0 Comments

With the update to Magento 1.4 comes a quick fix to the template file in order to allow your product listings to properly display the subpages or pagination for products.

In order to properly implement pagination into your product listings again, you must simply update your catalog.xml template file located in the layout directory of your template folder:

app/design/frontend/your-template/layout/catalog.xml

Add the follow code to properly call the pagination setup in the pager.phtml file:

<block type=”page/html_pager” name=”product_list_toolbar_pager”/>

Simply look for the toolbar.phtml block and paste in the pager block.

<block type=”catalog/product_list_toolbar” name=”product_list_toolbar” template=”catalog/product/list/toolbar.phtml”>
<block type=”page/html_pager” name=”product_list_toolbar_pager”/>
</block>

Continue reading...

Adding Related Products to Magento

Thu, Mar 11, 2010

0 Comments

The step that I found most useful here was that you had to setup the drop down menu to ‘Any’ when searching for the product(s) you want to relate to a given product. Otherwise nothing shows when trying to search your product catalog.

Continue reading...

Add Custom Content to Magento Category Pages

Thu, Mar 11, 2010

1 Comment

When adding custom content to the category pages on your site, I find the category description to be very limiting and not necessarily give me the type of control I want to have over how much content I can add to a page without pushing the products below the fold. This tutorial outlines how you can use Custom CMS Blocks to design the exact layout you desire for your category pages.

First you will want to create a static block that will end up replacing the category page setup.

CMS > Static Block

Once created you may need to grab some of the template code in order to setup the static block so the text areas match the design of the template. Personally I create an introductory paragraph followed by the product listings, then adding another section of content below the products that is more expansive and creates more unique content for my main category pages.  Simply update the cat_ID with the corresponding category products you want to display on this page, set the status to ‘Enabled’ and save the CMS Custom Block.

Content

{{block type=”catalog/product_list” column_count=”3″ category_id=”cat_ID” template=”catalog/product/list.phtml”}}

Content

Now you can setup the category page to display the custom blog you have created, rather then just using the category description as it limits your control over where you can implement content.

Catalog > Manage Categories

Select the category and click on the Display Settings tab. Under Display Mode select Static Block only as we have used custom code to display the products between our content blocks. Now you simply have to select the CMS Block you created and save the changes.

Continue reading...
Older Entries