• Google Chrome - Goodbye Firefox

    I've become fed up with Firefox's memory leak problem.  Most of us have seen the browser occupying upwards of 1GB, but even today's offense of just 461MB (5 tabs open) was the final nail in the coffin.  Taking recommendations from co-workers and friends, I installed Google Chrome.  It's lightning fast.  The transition process was smooth and painless -- bookmarks, browsing history, and saved passwords were all migrated.  I'm excited to see how the browser integrates with Google's online services (e.g. bookmark sync)

    [singlepic id=30 w=247 h=260 float=center]

    Don't get me wrong, I love Firefox and once touted it as the best thing to happen to the Internet since broadband came out.  Too bad the rest of my system slows to the point where I'm experiencing issues with basic keyboard and mouse input.  I know I'll have to come back to Firefox every now and then because of the developer toolbar, but it's no longer my default browser.  Did I mention that Chrome is fast?

  • Magento - Set Product Dropdown and Multiselect Values Programmatically

    Here's how to programmatically, meaning through code, set a product's attribute value when the attribute is of type Dropdown or Multiselect.  For dropdown, we'll be interested in setting only a single value.  And obviously for multiselect, we'll be interested in setting multiple values.

    With Text attributes such as Name and Description, you can do something like:

    $product->setName( 'My Sweet Shirt' );
    $product->setDescription( 'This shirt will make you look good, thus impressing girls.' );

    Unfortunately, this won't work for attributes whose values are predefined.  Instead of cursing Magento, think of it as a data-integrity/validation measure.

    Anyway, assuming you already have a $product object, our overall process will be to:

    1. Load an attribute object for the attribute you want to work on
    2. Load the collection of that attribute's values
    3. Make your choices (different for Dropdown and Multiselect)
    4. Save the product

    1. Load an attribute object for the attribute you want to work on

    $attribute = Mage::getModel('eav/entity_attribute');
    $attribute->loadByCode( 4, 'color' );

    2. Load the collection of that attribute's values

    $values = array();
    $valuesCollection = Mage::getResourceModel('eav/entity_attribute_option_collection')
    	->setAttributeFilter( $attribute->getId() )
    	->setStoreFilter( Mage_Core_Model_App::ADMIN_STORE_ID, false)
    foreach ($valuesCollection as $item) {
    	$values[$item->getValue()] = $item->getId();

    3. Make your choice - DROPDOWN

    $product->setColor( $values['Blue'] ); // just do whatever you need to code 'Blue' instead of hard-coding it

    3. Make your choices - MULTISELECT

    $product->addData( array(
    	'color' => $values['Blue'] .','. $values['Red'] .','. $values['Black']  // just putting together a comma-separated list of values
    ) );

    4. Save the product


    This builds off the solution posted by member "icvu" here: http://www.magentocommerce.com/boards/main.php/viewthread/69925/ -- specifically the addData() part.

    Thanks, and have fun setting attribute values.

  • ConstantContact Send Welcome Email When Creating a New Contact via API

    Using the ConstantContact mailing list, I was having trouble getting the welcome email to send after creating a new contact through the API. I had tried checking the "Autoresponder" box in the admin panel, but still no welcome email. The solution is to have:

    var $actionBy = 'ACTION_BY_CONTACT';

    in cc_class.php (provided via the "PHP Sample Forms" zip file). By default, this value is:

    var $actionBy = 'ACTION_BY_CUSTOMER'

    instead, which does not trigger the welcome email.

  • Refresh Magento Cache Programmatically

    When writing processes to automate some of Magento's normally laborious tasks, perhaps for a product-import script, a mass attribute update script, category import, or inventory adjustment, keep in mind that you may have to refresh some kind of cache -- especially when working with attributes. If you are encountering quirks or inconsistencies with your data, try these:

    • Rebuild Catalog Index
    • Rebuild Flat Catalog Product
    • Inventory Stock

    For more cache refreshes, such as:

    • Catalog Rewrites
    • Layered Navigation Indices
    • Product Image
    • Search Index

    ... please refer to the source of this knowledge http://www.magentocommerce.com/boards/viewthread/43238/#t156277

  • Center Align a UL Menu

    The task of center-aligning an unordered list (which can't have its width explicitly set) via CSS comes up every now and then. Logging it here for later.

    "For a start you could text-align: center the ul inside the #ul_container_div and display: inline the li instead of floating them left."

    #ul_container_div{ width:100%; text-align:center; }
    #ul_container_div li { display: inline;  }

    Source of knowledge: http://archivist.incutio.com/viewlist/css-discuss/59041

  • IE6 Phantom Text / Duplicate Text Bug

    Just for purposes of documenting this useful knowledge:

    When viewing in Internet Explorer 6 and experiencing the "strange-repeated-text" problem, try applying this CSS to the element containing the text that gets repeated:

    float: none;
    clear: both;

    Knowledge from: http://uxdev.blogspot.com/2008/10/phantom-text-in-ie6.html

  • Web Design Failure Process

    Got this in my email today.  I'm sure we can all relate to this phenomenon.

    [singlepic id=29 w=300 h=213 float=center]

    Thanks "The Oatmeal"

  • Force IE8 to Render Like IE7

    Found this little snippet yesterday. I'm not saying that this is best practice in any way, but if you're looking for a quick fix, here it is:

    I think this has the effect of enabling "Compatibility Mode" that the user would normally have to turn on.

    As a side note, the specific reason I used this was to make a Google Friend Connect widget render properly -- there are plenty of posts on the web about those widgets not working in IE8.

  • Tips for Being Sick

    I just spent the past 36+ hours in bed, with a few minor exceptions (going to the bathroom 3x and eating 2x).  I don't know what I am sick with, probably just a rogue case of fatigue, but here are some tips to help make being sick easier:

    • Turn up the heat.  Your ability to be warm-blooded is probably weakened.  Does it seem like blankets and comforters don't make you any warmer?
    • Wear socks.  I heard somewhere that one's body temperature generally follows the temperature of one's feet.  I normally don't wear socks when I sleep (I feel they're not as comfortable as not wearing them).  But socks will keep you warm.
    • Move your bed away from the windows.  You never know if drafts (that you'd normaly be insensitive to) are agitating you.  If your bed is right up against the wall/windows, move it away about 6 inches.
    • Take a lozenge.  For this particular illness, it hurt to swallow.  Taking a lozenge provides temporary relief.  It is also a mild anesthetic  so our mouth will be numb.
    • Drink lots of Fluid and take some Soup.
    • Avoid touching cold things and wear slippers or socks when roaming the house.
    • Flip the pillow over a bunch of times.  It's nasty to reposition your head only to discover that you've just landed your cheek in a huge puddle of drool.  Flipping the pillow over allows time for the puddle to dissipate.
    • Listening to music is agitating.  Either don't listen to any, or listen to soft music like opera or classical.
    • Have a glass of water, a box of tissues, and some spittage receptacle nearby.  That way you're not thirsty, blowing your nose on blankets/sheets, and spitting on the floor.

    That's all I can think of for now.  Stay well, everyone!

Items 19 to 27 of 59 total

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. ...
  7. 7


Quick Support