dConstructing

Custom product attributes and flat database tables in Magento

Magento Improvements

I recently started using flat product tables in Magento. It drastically sped up the site load time and I could never go back (to learn how to enable flat product and category tables, visit the following link and read Tip 4 - http://blog.nexcess.net/2010/10/22/6-tips-for-making-magento-production-ready/)

When I did that, I noticed some product attributes that should be displayed on various pages suddenly stopped showing up...

Read in full

Magento products' is_salable attribute from the admin

The Situation

I’m developing a module for Magento (v. 1.5.0.1) that creates a product Archive for old products (so the information can still be found by people doing research on past product, but it won’t clutter the interface for people looking to buy currently available product). The module will also place products into the Archive automatically. That automatic processing will likely be done via a cron job, but for the time being I am triggering it manually from the configuration section of the Magento admin...

Read in full

SocialEngine’s "Make Profile Photo" not working

When you’re looking through pictures on a SocialEngine website and you click through to look at one by itself, there’s a list of options underneath the photo. These options vary depending on whose picture it is, but often you’ll see the option to “Make Profile Photo”. That supposed to enable you do quickly swap in a new profile photo.

The Problem

Users have started complaining that this link is not working properly. Instead of allowing them to change their profile photo, a modal window appears with a “Page Not Found” error:

Page Not Found

The page you have attempted to access could not be found

I dug into the code to see what was going on...

Read in full

Error accessing SocialEngine Groups

Users have recently reported receiving error messages when accessing Groups on a website built on the SocialEngine platform. The site was recently upgraded to SocialEngine 4.1.7 from 4.1.3

The Error

The error messages the users received weren’t very detailed (as usual). This is the relevant message found in the log file:

2011-09-16T03:15:03+00:00 ERR (3): [4096] Object of class Zend_View_Helper_Translate could not be converted to string (/socialengine-root/application/libraries/Engine/View/Helper/HtmlLink...
Read in full

SocialEngine error messages

Getting Errors

Sometimes when working with the SocialEngine platform I’ve come across an error message that sits in the middle of a blank, white page. It’s quite a bit less scary than a typical error message, but there’s not much information to help the developer know what’s wrong. This is how it reads (though not as pretty):

We're sorry! We are currently experiencing some technical issues. Please try again later. Error code: a0dceb

There’s always an error code underneath the apologetic text, and that’s the important part...

Read in full

Cleaning WordPress of malicious code

I run a few WordPress sites, and every now and then one of them gets hacked. Most recently I found that Google Chrome was warning visitors to my web site that there was malicious code on my site. Here’s the process I went through to clean out my site running WordPress 3.2.1 (though I’m sure it applies to others as well).

Accepting the Problem

Since Google was warning that I was linking to a URL that contained malware, I assumed the link came from an outside source. I’ve heard that Google AdSense can sometimes be the culprit (they blacklist URLs, but sometimes there are AdWords ads pointing to the URLs and those ads don’t get pulled from AdSense, so they end up on your site), so I decided to take the lazy route wait until Google realized it wasn’t my fault and cleared my good name...

Read in full

Integrity constraint violation when enabling/disabling Magento modules

Background

I’ve been working on a new custom Magento payment module and having a lot of headaches along the way. I decided to start from scratch using the template provided here: http://inchoo.net/ecommerce/magento/how-to-create-magento-payment-module/.

I’m doing this using Magento Community Edition (the free one) version 1.5.0.1.

Setting Up

I got all the code copied into place with a few modifications:

  • In the modules block of config...
Read in full

Allowed memory size exhausted when running PHP from the command line

I’m trying to test a Magento cron job by running the target file from the command line. When I do, I get this error:

Fatal error: Allowed memory size of 262144 bytes exhausted (tried to allocate 523800 bytes) in Unknown on line 0

Line 0? Nothing happens before Line 27 (on this script). This isn’t a problem with my code. It’s a problem with PHP.

The Fix

It’s actually a problem with the PHP Command Line Interface (CLI). The server was recently upgraded to Ubuntu 10...

Read in full

Sort grouped products in Magento by "in stock" status

Many of the products in our Magento catalog are grouped products. We’ve noticed that unless they’re looking for a specific variation of a specific product, they tend to just order the first of the grouped products listed on the product details page. We want to avoid customers moving on to other products (or *gasp* other web sites) to order, so we want any out of stock products moved to the bottom of the grouped products table...

Read in full

Sort Magento catalog by date added

I haven’t worked with Magento in over a year, and even then it wasn’t very much. Now I’ve got a project that will teach me the inner works of the system.

First task

When users view a list of products on a Magento site, Magento displays them in the order they were added to the system (after other sorting filters have been applied). We want to reverse that order so the newest products are displayed at the top of the list...

Read in full