Google Analytics Bug Fix for Magento 1.4.0.1

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

How to Change an Existing Products Attribute Set in Magento

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.

Pagination Update for Magento 1.4

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>