Hara Partners Blog

  • Waitex Receives Happy Holiday Wishes from Hara Partners!

    On Friday, December 17th, Hara Partners enjoyed a beautiful, 29th annual holiday celebration hosted by our client, Waitex. The celebration took place at the  Jing Fong restaurant in the heart of NYC's Chinatown. As a respected, friend, business partner and client, Waitex graciously accepted Hara Partners sponsorship of a $250 photo shoot & print package.  Mai Erne, VP of Development, picked the lucky winner...

    Waitex Hara Partners' Mai Erne draws the lucky winner!

    PING IS THE LUCKY WINNER!!! Congratulations!

    Waitex Mai Erne with Ping, the winner of the photo package prize.
  • The Magento Onepage Checkout is quite a tricky component. For simple tasks, it is quite possible to change the PHP code with surgical precision without messing around with the JavaScript part. But unfortunately, in many complicated tasks, like adding a new step with a bunch of new functions, would inevitably involve JavaScript handling.

    Here come a couple of useful tips:

    Our final target is the opcheckout.js, located at: skin/frontend/default/default/js/opcheckout.js

    Before we jump into hundreds of lines of JS codes, our first stop should be the template files for the Onepage Checkout. At the end of those files, you will see something like:

    <script type="text/javascript">
    var billing = new Billing('co-billing-form', ...);

    Yes, this is the critical link between our PHP part and JS part.

    Continue reading

  • One of the major features of Magento is the Entity-Attribute-Value (Magento EAV) data model.

    This is indeed quite a block to play with. However with the right leverage, it can become rather handy.

    To some extent, using EAV is, arguably, an improvement. The major advantage of the Magento EAV is: there won't be endless ad hoc attributes inserted to the table, which is one of the critical flaw for older platforms, say OS-commerce, where table columns rapidly grow to an unmanageable size.

    On the other hand, EAV basically means no raw queries of the database, or at least very challenging if you are really determined to query directly into the database, not to mention that an upgrade will easily break your code. This is, indeed, very clumsy for simple things like selecting a group of products or customers. In addition, there is quite an efficiency trade-off since there would be quite a few table joint to load an EAV object. Also, quite a lot of data a duplicated throughout different tables, a small price we have to pay.

    Despite all these, personally, I find the Magento EAV quite okay. I guess the decision making factor for the Magento team to choose EAV tables against flat table is that EAV is generically more flexible. It's relatively easy to maintain given the fact more than often multiple developers/teams are involved in the same project.

    Continue reading

  • The Magento adminhtml (or admin panel) is quite different from other modules for the frontend. The Adminhtml module has a distinct implementation of the Model-Controller-View scheme. In fact, forms, tables, graphs and etc. are usually stereotypical and highly repetitive comparing to the large varieties in the frondend. As a result, in Adminhtml page, such elements are generalized into block 'widgets' to boost coding efficiency.

    However, when building a new module, we often need to modify the frontend and the backend together. And in many cases, since the we already build the functions in frontend module, it's really a waste of energy if we have to rewrite everything in terms of 'widget' in the backend. Simply, we would like to migrate the controller and view to the backend and reuse the code.

    Here, I'm going to go through the basic steps the Mage_Adminhtml_Block_Template rather than widgets.

    (This is a developer's guide.)

    Let's begin with creating a new menu in the Admin panel. We added to the config.xml to our new module:

        <new_module translate="title" module="new_module">
          <title>New Module Name</title>

    Continue reading

  • More than often, we need to create a new Magento attribute to extend some Magento functions, or even a new attribute group to serve our own module.  Here is how we do it using the sql setup file.

    First, a few words about the sql setup file.

    If this is the first time building the module or fresh installation, create a php file, say "mysql4-install-0.1.0.php", in [company]/[module]/sql/[module]/[module]_setup/ folder, where the version 0.1.0 is defined the the config.xml file.

    In case of module upgrade, try something like "mysql4-upgrade-0.1.0-0.2.0.php", again, verify your upgrade version in the config.xml file.

    Inside this file, first we need to initiate:

    $installer = $this;
    $setup = new Mage_Eav_Model_Entity_Setup('core_setup');

    Continue reading

  • Magento Onepage Checkout, Quick But Not Dirty

    The Magento Onepage Checkout is a very special feature in Magento. Beyond the regular Model-Controller-View structure, the Onepage MCV is quite a hybrid of PHP and JavaScript.

    The first place to look is of course the Mage_Checkout_OnepageController, this is pretty much the bread and butter of many nice little tricks.

    The index action together with the corresponding block and template file are indeed very important here.  Indeed, our first treat today lies in the block file (Checkout/Block/Onepage.php):

    $stepCodes = array('billing', 'shipping', 'shipping_method', 'payment',  'review');

    Continue reading

  • Adding a Custom Block to Magento CMS Page

    Adding a custom block to Magento CMS page is a very good way to improve the flexibility of these static pages. This will help us to keep our CMS page tight, without copy-pasting the same large paragraph of scripts into every single page.

    It's usually an over-shoot to build a whole new module for this, a new block class would be sufficient for this purpose.
    Since it's CMS related, we can simply do the following:

    • Extend the Magento core module: core/Mage/CMS
    • Create local/Mage/Cms/Block/xxx.php
    • Also create the corresponding .phtml template
    • (No update needed for the layout/ folder)

    Continue reading

  • Magento utility: add multiple simple/configurable products to cart from catalog page

    In the endless struggle to make our Magento stores more user-friendly, often we want to enable the customers to add multiple products in the catalog view page directly into shopping cart. This is a very convenient feature for wholesale websites, since the customer does not have to go through every single product detail page.

    (This is a developer's guide.)

    We are shooting for a clean and direct fix, which I classify as a Magento utility.

    The first step is to modify the /catalog/category/view.phtml, for each product in the product list, insert a form:

    <form action="<?php echo $this->getBaseUrl() ?>utility/expressCart/add" method="post" >
        <input type="hidden" name="addToCartProductId" value="<?php echo $product->getId() ?>" />
        <p><?php echo $inputString ?></p>
        <p><input type="submit" value="<?php echo $this->__('Add to Cart') ?>"></p>

    Continue reading

  • magento top links

    Magento Support - Add, Edit and Remove Magento Top Links

    This is a simple trick, and often requested for Magento support. The general rule for each Magento top link is that each is mostly controlled by the Magento layout,  so check layout/module_name.xml first.

    To Add a new top link:
    Sample code:

        <reference name="top.links">
            <action method="addLink" translate="label title" module="module_name">
                <label>My Top Link Name</label>
                <url helper="module_name/get_top_link_target_url"/>
                <title>My Top Link Title</title>

    Continue reading

  • Magento form validation using Varien JavaScript objects

    When building new pages in Magento, form validation is usually a necessary but highly repetitive process.

    Luckily, Magento already comes with very nice form validation functions written in JavaScript.

    Here is a quick demo of how to use it, based on the Magento customer login form.

    At the end of the .phtml template file, attach the following code:

    <script type="text/javascript">
        var loginForm = new VarienForm('login-form', true);
        $('login-email').observe('keypress', bindLoginPost);
        $('login-password').observe('keypress', bindLoginPost);
        function bindLoginPost(evt){
            if (evt.keyCode == Event.KEY_RETURN) {
        function onepageLogin(button){
            if(loginForm.validator &&  loginForm.validator.validate()){
                button.disabled = true;

    The key is to wrap a VarienForm object around our form element with id='login-form', and then loginForm.validator.validate() will handle everything with ease.

    Continue reading

Items 881 to 890 of 892 total

  1. 1
  2. ...
  3. 86
  4. 87
  5. 88
  6. 89
  7. 90
Back to top