Richard Castera - Explorations in Software Development
Richard Castera - Explorations in Software Development
Browsing Tag
magento
Scripts Web Server

Magento – Add Static Block to CMS Page

July 29, 2010 5 Comments

Static blocks are a great way to add sections of HTML to your CMS or Catalog pages. I’m going to show you how to add a static block to a CMS page.

It’s a 2 step process and a very simple one. First, create your static block by going to CMS->Static Blocks. You will use the identifier of your static block to reference it on the CMS page. Edit the CMS page you would like this block to appear in, and add this code in the location where you would like it to show up:

1
{{block type="cms/block" block_id="home-page-promo"}}
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Scripts Web Server

MySQL – How to Export and Import tables with the Command Line

June 13, 2010 2 Comments

2 commands I use often throughout the day is importing and exporting large databases into MySQL VIA the command line. Here is how I do it where “USERNAME” is your username, “PASSWORD” is your password and “DATABASE” is your database name.

To Export:

MySQL
1
mysqldump -uUSERNAME -pPASSWORD DATABASE | gzip -c > ~/dump_2010-06-14.sql.gz

To Import:

MySQL
1
mysql -uUSERNAME -pPASSWORD DATABASE < database.sql

Also, you may have a large database that may give you errors while importing. You can use this command to force the import without warnings or errors:

MySQL
1
mysql -f -uUSERNAME -pPASSWORD DATABASE < database.sql
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

Magento – Get the Total Price of items currently in the Cart

June 10, 2010 12 Comments

Ever wanted to get the total price of items in your Magento cart? Here you go:

PHP
1
<?php echo $this->helper('checkout')->formatPrice(Mage::getSingleton('checkout/cart')->getQuote()->getGrandTotal()); ?>
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

Magento – Contact Form Not Submitting Bug

June 7, 2010 5 Comments

Since the new release of Magento, people have been encountering a lot of problems. One of them in particular, seem to be the contact form. The error is, “Unable to submit your request. Please, try again later.” If you’re on Magento 1.4 and get this error when submitting the contact form, that’s because your template (theme) is not fully compatible with 1.4. Your Magento theme is overriding the form.phtml file with its own version, which doesn’t have the new line in it. Here’s what you’ll need to do to quickly fix this error:

Open this file in your theme folder:

XHTML
1
app/design/frontend/default/YOUR_THEME/template/contacts/form.phtml

And add the following hidden field somewhere before the submit button:

XHTML
1
<input id="hideit" style="display: none !important;" name="hideit" type="text" />
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Thoughts

Magento extensions and modern e-commerce

May 16, 2010 3 Comments

For an online retailer, choosing an e-commerce software platform is one of the most important decisions. Depending on the size of the business, the key requirements could vary from robustness and scalability critical for large retailers to the need for simplicity and flexibility for small store owners. Perhaps it is the ability to effortlessly meet the diverse needs of disparate audiences that has made Magento one of the fastest growing e-commerce applications globally. Already, the Magento e-commerce suite has carried out over US$25 billion in transactions via the 30,000+ merchants who rely on this platform, including some from the Internet Retailer Top 500 list. No wonder then that the platform continues to receive international acclaim, most recently from well known research organization Forrester Research which highlighted Magento as ‘unique’ among various e-commerce technology providers.

One of the key contributors to Magento’s rising popularity as the platform of choice is its ‘flexibility’ and the control that it puts in the hands of the online merchant. Unlike some of the other ‘closed’ or even open source e-commerce platforms, Magento does not place restrictions on business flows and processes. With over 1700 Magento extensions already available (and counting..), technology complements the business rather than business being shaped by the limits posed by technology.

Continue reading
Reading time: 6 min
Share:
Written by: rcastera
Resources Scripts

Magento – Check if a User is logged in

February 23, 2010 6 Comments

You may want to check if a user is logged in with Magento, possibly to display a link or promotional item. Here’s how to do it:

PHP
1
2
3
4
5
6
7
8
<?php
if ($this->helper('customer')->isLoggedIn()) {
    echo("Anonymous user");
}
else {
    echo("Authenticated user");
}
?>
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

Magento – How to Display the Product SKU

February 23, 2010 4 Comments

Magento is a pretty flexible platform. That flexibility comes with a price though; You have to be knowledgeable of the functions that are available to you to utilize. Finding or knowing them is a challenge though. Here is one of those such functions that you may need to display the product Sku on a category page.

PHP
1
<?php echo($_product->getSku()); ?>
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

Magento – How to run a SQL query against the database

August 23, 2009 7 Comments

In order to run a SQL query against the Magento database, you first need a resource model then a database connection.

PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
$db = Mage::getResourceSingleton('core/resource')->getConnection('core_write');
$result = $db->query('SELECT 'entity_id' FROM 'catalog_product_entity');
if (!$result) {
    return FALSE;
}
$rows = $result->fetch(PDO::FETCH_ASSOC);
if (!$rows) {
    return FALSE;
}
print_r($rows);
?>
Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

Magento – Database Repair Tool

August 20, 2009 No Comments

The Magento Database Repair Tool compares 2 databases (reference and target), and updates the target database so it has the same structure as the reference database by doing the following:

  • Adds missing tables, or repairs them to have the same engine type and char-set.
  • Adds missing fields or repairs them.
  • Removes inconsistent data from tables that have broken foreign key references.
  • Adds missing foreign keys and indexes.

You can download it here. For a full list of features and instructions, you can refer to this wiki post.

Continue reading
Reading time: 1 min
Share:
Written by: rcastera
Resources Scripts

Magento – Add additional fields to the Contact Form

August 16, 2009 38 Comments

If you need to add additional fields to Magento’s default contact form, read on! First open the form.phtml file located in your /magento_root/app/design/frontend/YOUR_INTERFACE/YOUR_THEME/template/contacts/form.phtml. So, we are going to add a subject field to this contact form so that customers tell us the subject of their email. Open the file for editing in your favorite editor.

Find this section in the file below (this should be around line 39):

XHTML
1
2
3
4
<div class="input-box">
    <label for="name"><?php echo Mage::helper('contacts')->__('Name') ?> <span class="required">*</span></label>
    <input name="name" id="name" title="<?php echo Mage::helper('contacts')->__('Name') ?>" value="<?php echo $this->htmlEscape($this->helper('contacts')->getUserName()) ?>" class="required-entry input-text" type="text"/>
</div>
Continue reading
Reading time: 2 min
Share:
Written by: rcastera
Page 1 of 3123»

About me

Hello, my name is Richard Castera. I have more than 12 years of experience architecting, implementing, leading and launching large scale, high performance software products in a fast-paced agile environment.

Popular Posts

Magento – Display new products on the home page

May 20, 2009

How to Fix “Internet Explorer Cannot Open the Internet Site- Operation Aborted” Error

May 9, 2009

PHP – Convert Array to Object with stdClass

July 5, 2009

Categories

  • Home Automation
  • Resources
  • Scripts
  • SEO
  • Thoughts
  • Web Server

Tags

Apache Apple Bash CSS Drupal Free home automation htaccess Java Javascript Magento PHP raspberry pi SEO SQL thoughts Wordpress

© 2019 copyright Richard Castera // All rights reserved