Magento - getChildrenWrapClass

I just wasted 3 hours of my life trying to set this value in xml.

Normally you think that in a Block when you see $this->getChildrenWrapClass() that the value for that would come from xml or in an observer where that value is being set by $block->setChildrenWrapClass(), however for this you would be totally mistaken.

<reference name="catalog.topnav.renderer">
<action method="setData"><name>setChildrenWrapClass</name><value>abc123</value></action>
<action method="setData"><name>children_wrap_class</name><value>321cba</value></action>
<action method="setChildrenWrapClass"><value>ecreameryTest</value></action>

That was all the different types of xml I was trying to use to get that value set!

Well, it turns out this is actually a parameter that is passed into getHtml()


Read more

Centos 6.5 - eth0 is not present

How to fix this issue when you move a virtual machine from one computer to another.

The mac is set in the config and needs to be updated on the VMWare.

First ssh into the server and get the information from /etc/sysconfig/network-scripts/ifcfg-eth0

$ cat /etc/sysconfig/network-scripts/ifcfg-eth0


Read more

Centos 6.5 Samba user

One thing that seems to be lacking in some documentation is to create the samba user.

This is here because there is lots of instructions on how to setup the samba configuration /etc/samba/smb.conf and I dont need to duplicate that here.  This is helpful when your configuration is setup and you can connect but your username/password is being rejected...and your sure that the username and password your using is correct.

Even though you have the configuration set to communicate with the Samba server, if your user cannot log in, it is because you never gave samba the user information.

The following is for creating a new user, you can skip if you already have a linux user on the system.

$ useradd ralbin 
$ passwd ralbiin

Read more

Magento - How to add customer default shipping address to adminhtml grid

I just was asked to update/change the Admin Customer Grid to show the default Shipping information.

So the new grid has  Email, Company Name ( custom attribute ),  Customer Name, Address, City, State, Postcode, Country, Phone, Group, Customer Since and Website.

First thing we need to create the module to handle this.  This is new module is called Dpc.


<?xml version="1.0"?>
<Mage_Core />

Then the app/code/local/Dpc/etc/config.xml

Read more

Magento - EAV get option values

When ever you have an catalog product attribute and are looking for the options, here is the code sample you need to get the values.

$attribute= Mage::getSingleton('eav/config')->getAttribute('catalog_product', 'created_by');
if ($attribute->usesSource()) {
$options = $attribute->getSource()->getAllOptions(false);

Magento - Adding an index to a table during an upgrade script

I think the title of this says it all. This is how you can add an index and a new column to a table during an upgrade script

$installer= $this;

$tableName = $installer->getTable('dpc_subscription/event');
$indexName = $installer->getIdxName($tableName, array('is_shipped'));
$installer->getConnection()->addColumn($tableName, 'is_shipped', array(
'type' => Varien_Db_Ddl_Table::TYPE_INTEGER,
'unsigned' => true,
'nullable' => false,
'default' => '0',
'comment' => 'Is shipped'
$installer->getConnection()->addIndex($tableName, $indexName, array('is_shipped'));

Magento - Blocks Why some rewrites do not work for example Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Checkbox

Most of the time doing a rewrite of a Block is pretty simple.  However you will run into issues when you want to do something as simple as remove the + from a Bundle product price.  

Most of the time, you can just do a rewrite of the block in XML and its done. However when you try to do this with some blocks, they just dont work!  The reason....some blocks are not called using the factory method.  These blocks are the ones that are extended from, so they are just part of the php code.  The way to get at those is by rewriting the blocks we can do a rewrite ( for example Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Checkbox ).  Then we can extend our version of Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option.

Here is how I achieve this for Bundle Products and the checkbox options for the children products.


Read more

Magento - Find all products in your store with missing images

$products = Mage::getModel("catalog/product")->getCollection()->addAttributeToSelect('image');
$a = array();
foreach($products as $id => $_product){
$a[(int)$id] = (int)$id;
$has_images = Mage::getModel("catalog/product")->getCollection()->addAttributeToSelect('image')->addAttributeTofilter('image', array('notnull' => ''));

foreach($has_images as $id => $_product)
$b[(int)$id] = (int)$id;

$product_ids_missing_images = array_diff($a, $b);
foreach($product_ids_missing_images as $_id){
echo '<div>'.$_id.'</div>';