Monthly Archives: November 2013

  1. All Magento URL list

    Magento Mage Core, Admin Static Blocks, or Phtml edits are usually includes getting url path such as images, javascript, base url, media and store url. There are different ways to retrieve mentioned URL paths depending on which section you’re editing.

    To Retrieve URL path in STATIC BLOCK
    To get SKIN URL

    {{skin url='images/sampleimage.jpg '}}
    To get Media URL

    https://www.samdoit.com/pub/media//sampleimage.jpg
    To get Store URL

    https://www.samdoit.com/mypage.html/
    To get Base URL

    {{base url='yourstore/mypage.html'}}
    TO Retrieve URL path in PHTML
    Note: In editing PHTML don’t forget to enclode the following code with PHP tag

    Not secure Skin URL:

    getSkinUrl('images/sampleimage.jpg') ?>
    Secure Skin URL

    getSkinUrl('images/ sampleimage.gif', array('_secure'=>true)) ?>
    Get Current URL

    $current_url = Mage::helper('core/url')->getCurrentUrl();
    Get Home URL

    $home_url = Mage::helper('core/url')->getHomeUrl();
    Get Magento Media Url

    Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
    Get Magento Media Url

    Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
    Get Magento Skin Url

    Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
    Get Magento Store Url

    Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
    Get Magento Js Url

    Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);

    Read more »
  2. Display magento cart in Menu

    If you want to change your shopping cart display like number of item and price ,

    i give sample image show ,

    Cart in menu bar

    <div class="mybag">

    <a href="<?php echo $this->getUrl('checkout/cart')?>">

    <span class="mybag-text">Shopping Cart:</span>

    <?php $cartcnt= Mage::helper('checkout/cart')->getItemsCount();?>

    <?php if($cartcnt==0):?>

    <span class="empty-bag"><?php echo '0 items,';?>

    <?php echo $this->helper('checkout')->formatPrice(Mage::getSingleton('checkout/cart')->getQuote()->getGrandTotal()); ?>

    </span>

    <?php else:?>

    <span class="bag-item">

    <?php echo $cartcnt.' '.'items,';?><?php echo $this->helper('checkout')->formatPrice(Mage::getSingleton('checkout/cart')->getQuote()->getGrandTotal()); ?></span>

    <?php endif; ?>

    </a>

    </span>

    </div>

    Read more »
  3. Display Related products on magento

    As a magento developer display related product on product view page.It’s easy to show related product by following few easy steps. First we will have to add products to a particular product as related product. Screen shows product added as related product

    Related Product

    After selecting products it will show on your product view page if you can`t view related product on it .Do following steps it`s very easy to follow all the best friends.


    1)Open catalog.xml

    catalog.xml file available in .

    {magento root}/app/design/frontend/default/{your theme}/layout/catalog.xml .

    If you not have the file just copy file from

    {magento toot}/app/design/frontend/base/default/layout/catalog.xml

    to your theme i already mention the path.

    2) Remove & Add some xml in catalog.xml

    Search catalog_product_view in

    {magento root}/app/design/frontend/default/{your theme}/layout/catalog.xml

    . Command or remove the following line from there .Search in catalog.xml "catalog.product.related" in appropriately line 258 under <reference name="right"> .

    <block type=“catalog/product_list_related” name=“catalog.product.related”before=“-” template=“catalog/product/list/related.phtml”/>

    add following line in catalog.xml . Search in catalog.xml "<reference name="content">" in appropriately line 189 . Below "<block type="catalog/product_view"..........>" this linl add following line.

    <block type=“catalog/product_list_related” name=“catalog.product.related”before=“-” as="catalog_product_relate" template=“catalog/product/list/related.phtml”/>


    3) Adding related product in product view page.

    Adding some code in view.phtml available in

    {magento root}/app/design/frontend/default/{your theme}/template/catalog/product/view.phtml

    If you not have the file just copy file from

    {magento toot}/app/design/frontend/base/default/template/catalog/product/view.phtml .

    Add following line in where you want to view.

    <?php echo $this->getChildHtml('catalog_product_relate');?>

    4) Related Product view

     

    Related Product View

    Read more »
  4. How to add Login/Logout code on magento

    Login/Logout Code in Header

    <?php if (! Mage::getSingleton('customer/session')->isLoggedIn()): ?>

    <a href="<?php echo Mage::helper('customer')->getLoginUrl(); ?>"><?php echo $this->__('Login') ?></a>

    <?php else: ?>

    <a href="<?php echo Mage::helper('customer')->getLogoutUrl(); ?>"><?php echo $this->__('Logout') ?></a>

    <?php endif; ?>

    Read more »
  5. Add wysiwyg editor in magento custom module.

    Add wysiwyg editor in magento custom module. is very easy to make it in your magento custom modue use this following method to add wysiwyg editor .

    go to the file

    {your magento root folder}/Block/Adminhtml/{module name}/Edit/Tab/Form.php

    add following code in top of the file

    $fieldset->addField('followupemail_text', 'editor', array( 

    'name'=>'followupemail_text',

    'label' => Mage::helper('followupemail')->__('Content'),

    'title' => Mage::helper('followupemail')->__('Content'),

    'required' => true,

    'style' => 'height:24em;',

    'config' => $wysiwygConfig, ));

     

    go to the file

    {your magento root folder}/Block/Adminhtml/{module name}/Edit.php

    add the following line in this file

     

    protected function _prepareLayout()

    {

    // Load Wysiwyg on demand and Prepare layout

    if (Mage::getSingleton('cms/wysiwyg_config')->isEnabled() && ($block = $this->getLayout()->getBlock('head')))

    {

    $block->setCanLoadTinyMce(true);

    }

    parent::_prepareLayout();

    }

    Read more »
  6. Magento

    From time to time everyone finds them selves in a position where they are faced with a development they have never confronted before. Today I was achieve to get all orders for a customer based on the customer email address.. While there are almost certainly several ways to do this, I found a nice query that is quick, and capable.

    $orderCollection = Mage::getModel(‘sales/order’)->getCollection(); $orderCollection->addFieldToFilter(‘customer_email’,'email@domain.com’);

    Happy coding, hope this helps next time you’re working on Magento

    Read more »
  7. Vtiger outgoing mail server setting

    Vtiger outgoing mail server setting for gmail user

    Mail Server Settings (SMTP)
     
    * Server Name
    User Name youremail@gmail.com
    Password your email password
    From Email youremail@gmail.com
    Requires Authentication?  

      if not working let`s try with this setting

    Mail Server Settings (SMTP)
     
    * Server Name
    User Name
    Password
    From Email youremail@yourcompany.com
    Requires Authentication?

    no need to use user name also password , and finaly don`t enable authentication

    Read more »
Copyright © 2016 Samdoit Infotech. All rights reserved.