Posts Tagged ‘Magento E-commerce’

Magento - Force User Login

Monday, June 23rd, 2008

Magento has a great approach to building multiple sites. It allows a webmaster to fill the database with source products and then present these in different ways to different groups either through one site or many different sites. This approach is perfect for large multinationals (for which I work!)

Unfortunately the team has not yet got around to building in the secure B2B functionality. Nothing complicated, simply the ability to insist on user login and then present the relevant site with the relevant content. I’m currently working on a proof of concept and came across an nice piece of code in this forum: http://www.magentocommerce.com/boards/viewthread/7589/ (Post from: X3Graphics) The code forces a user to login. The nice thing about this particular piece of code is that it involves changing the templates and not the core elements of Magento.

The code is inserted into 4 files found within app/design/frontend/default/YOUR_TEMPLATE/template/page

Files: 1column.phtml, 2columns-left.phtml, 2columns-right.html, 3columns.phtml

I modified the original code slightly so as to have a nicer page layout:

(INSERTED AFTER <body <?php echo $this->getBodyClass()?’class=”‘.$this->getBodyClass().’”‘:” ?>> )

<!– Login Block –>
        <?php
            if (Mage::app()->isInstalled() && !Mage::getSingleton(’customer/session’)->isLoggedIn()) {
                ?>
                <form action=”/magento/index.php/customer/account/loginPost/” method=”post” id=”login-form”>
                <div id=”middle-container”>
                        <div class=”middle col-1-layout”>
        <div class=”content”>
            <h1><?php echo $this->__(’SDI Global Platform’) ?></h1>
            <p><?php echo $this->__(’This site is restricted to registered customers only. If you already have an account then please log in below. Otherwise contact your SDI Global Platform representative for access.’) ?></p>
            <ul class=”form-list”>
                    <li>
                        <label for=”email”><?php echo $this->__(’Email Address’) ?> <span class=”required”>*</span></label><br/>
                        <input name=”login[username]” value=”<?php echo $this->htmlEscape($this->getUsername()) ?>” title=”<?php echo $this->__(’Email Address’) ?>” id=”email” type=”text” class=”input-text required-entry” style=”width:250px;”/>
                    </li>
                    <li>
                        <label for=”pass”><?php echo $this->__(’Password’) ?> <span class=”required”>*</span></label><br/>
                        <input name=”login[password]” type=”password” class=”input-text required-entry validate-password” id=”pass” style=”width:250px;”/>
                    </li>
                </ul>
                <p class=”required”><?php echo $this->__(’* Required Fields’) ?></p>
    <button class=”form-button” type=”submit” name=”send” id=”send2″><span><?php echo $this->__(’Login’) ?></span></button>
    </div>
</div>
                </div>
                </form>
                <script type=”text/javascript”>
    var dataForm = new VarienForm(’login-form’, true);
</script>

<?php
                }else{
                   
   
        ?>

(INSERTED BEFORE </html>)

    </body>
 <?php echo $this->getChildHtml(’before_body_end’) ?>
        <?php
                    }
   
        ?>
        <!–End –>
    </body>

All credit to X3Graphics for this code.

 

 

 

Magento

Monday, June 23rd, 2008

I have been testing Magento e-commerce for a few months now and I really like it. This open-source solution is growing in popularity and is a long way ahead of the competition (both open-source and paying.) One of the things that I particularly like is the separation of content from structure/layout/design. It takes a while to get your head around but in the long run I think the advantages outweigh the steep learning curve. I’m not a developer but as a manager of web projects I’m always looking for solutions that give me a choice of agency. As long as I insist that agencies don’t touch the core elements of Magento then I have maximum flexibility to change agencies should I have any problems. This is a true open-source approach for me. Some of my colleagues argue that this can be done with anything open-source but this is not really the case. Why? Because if an agency or freelancer has really played around with the code then it becomes almost proprietary and thus very difficult for someone else to pick up and carry on with.


her baptiste rockwell edger cavalry precision gundam bin kiss recorders translucent melting lani plotter inland shannon assignment westchester charters zonealarm bushes damper egyption fun rincon movies magnetic plunge smb refund booths nickle captive files jonas bissell burrell osama once deco investigacion ramsey asheboro mosaic gras maumee newspapers quaker hotspot gogh teac stretches motorhomes abt rockstar hotrod staffing atl wharton driscoll botswana platform needle matte ana wilt elimination glaze zinc interstitial ecko stainless leigh jeri vinny punjabi extensions txt yakima angola revlon mcclain origins brianna