Web Dev

Image Handler2

Fred's picture

Image Handler 2 is a great addition to any Zen Cart install. Gone are the rather naïve, really old school "resized by the browser from much bigger images" images. instead, sensible, correctly proportioned and re-sized images are put in place.

Allowed Values pulled from Table

Fred's picture

A simple method for pulling Allowed Values for a CCK Select List field:

$sql = 'SELECT p.`partno` FROM {nrg_custom_monitor_part_numbers} p ORDER BY p.`partno`';
$result = db_query($sql);
while($row = db_fetch_array($result)){
  $rows[$row['partno']] = $row['partno'];
}
return $rows;

Note that you need both a key and value!

Filling an array

Fred's picture

To fill an array from results of a database query you normally do something like this:

function get_monitor_models() {
  $sql = "SELECT title FROM {node} n WHERE n.type='dell_monitor_model' ORDER BY n.title";
  $result = db_query($sql);
  $monitor_models = array();
  while ($monitor_model = db_fetch_array($result)) {
    $monitor_models[] = $monitor_model;
  }
  return $monitor_models;
}

However, if you want the key to be one returned field, and the value to be the second, do this instead:

Amazing what you find when looking for something else

Fred's picture

I was looking for a solution to a Drupal Ubercart issue I was having, when I came across this gem:

Hiding "No Image Available" image

Fred's picture

This is a simple one - go to admin -> Comfiguration -> Images. Set the following:

Product Image - No Image Status: 0

Changing the Heading Title

Fred's picture

Like most settings, the default header text "Congratulations! You have successfully installed your Zen Cart™ E-Commerce Solution." is in more than one location, although this time it is in the same file. Copy /includes/languages/english/index.php to /includes/languages/english/<your template>/index.php and edit lines 53 & 57.

Removing the IP Address

Fred's picture

To disable the IP address of the visitor from the bottom of the page, go to admin -> Configuration -> Layout Settings and set the following:

Footer - Show IP Address status: 0

Changing Admin & User paths

Fred's picture

Having signed up for a Reseller account over at Terra Networks, I found out that the Ensim Control Panel (or Parallels control Panel as it is now known as) automatically uses http://<sitename>/admin and http://<sitename>/user for it's administration URLs. This is a bit of a pain as they are the same as the Drupal URLs!

Products priced by attributes

Fred's picture

Sometimes you may need to add products which have no base price, but are priced by their attributes (e.g. takeaway dishes priced by the main ingredient). To do so, go to admin -> Catelog -> Categories/Products -> new product. Set the following:

Removing Add to Cart links from Product Listing

Fred's picture

Depending on the site and client, you may wish to remove the Add to Cart links from the product lists when browsing categories. You need to make two changes in admin -> Configuration -> Product Listing:

Display Product Add to Cart Button: 0
Display Multiple Products Qty Box Status and Set Button Location: 0
Syndicate content