Magento 2, Magento Development, Customization, Extension Development and Integration, Optimization, SEO and Responsive Design

Magento 2, Magento Development, Customization, Extension Development and Integration, Optimization, SEO and Responsive Design

Add Company column in customer Grid Magento Backend

Add Company column in customer Grid Magento Backend
Add Company column in customer Grid Magento

Go to /app/code/core/Mage/Adminhtml/Block/Customer/Grid.php

in _prepareCollection() add following file
->joinAttribute('billing_company', 'customer_address/company', 'default_billing', null, 'left')

and in _prepareColumns() add following code,

$this->addColumn('company', array(
            'header'    => Mage::helper('customer')->__('Company'),
            'index'     => 'billing_company'
        ));


Note: its the best practise that dont make any changes in your core file. overwrite your php file in local and then make any changes.

Set page limit in magento


You need to add the following line

$_productCollection->clear()
                   ->setPageSize(100)
                   ->load();


your code looks like this

<?php
    $_productCollection=$this->getLoadedProductCollection();
    $_productCollection->clear()
                   ->setPageSize(100)
                   ->load();
    $_helper = $this->helper('catalog/output');
?>

Create new custom category attribute in Magento


There is no option in magento to add new custom category attribute. So if you want to add new category attribute in your magento you need to make some kind of code. Adding new custom attribute in magento using short code as following is short but not much more secure and proper way.

If you want to create new category attribute in proper way via module you can check my post
Adding Custom Category Attributes to Magento via Module


Magento create new custom category attribute

Copy and paste the following code in your header.phtml

require_once('app/Mage.php');
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
$installer = new Mage_Sales_Model_Mysql4_Setup;
$attribute  = array(
    'type' => 'int',
    'label'=> 'Your attribute label',
    'input' => 'text',
    'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
    'visible' => true,
    'required' => false,
    'user_defined' => true,
    'default' => "",
    'group' => "General Information"
);
$installer->addAttribute('catalog_category', 'your_attribute_code', $attribute);
$installer->endSetup();

Run your site once. After that remove this code from header.phtml
Your attribute is created.

its appear in your catalog->manage categories->General information tab

Image slider for Magento

Using this post you can add jQuery Image slider in any page

Magento Image slider

Download the following js.

jquery.js
jquery.caroufredsel-5.6.4-packed.js

Click here for Live demo

Put that files in your skin/frontend/default/[Your Theme]/js directory.
Call these js file in your page in which you want to add the slider as following .


<script src="<?=$this->getSkinUrl()?>js/jquery.js" type="text/javascript"></script>

<script>
    $j = jQuery.noConflict(); //this way the jquery is not Conflict with other js
</script>

<script src="<?=$this->getSkinUrl()?>js/jquery.carouFredSel-5.6.4-packed.js" type="text/javascript"></script>

Add the following script in same page.

<script>
      $j(function() {
           $j('#callaction').carouFredSel({
                 prev: '.jcarousel-prev-horizontal',
                 next: '.jcarousel-next-horizontal',
                 pagination: "#pager2", auto: false
           });
     });
</script>

Now set the html as following.
<div class=" jcarousel-skin-callaction">
    <div class="jcarousel-container jcarousel-container-horizontal" style="position: relative; display: block;">
        <div class="jcarousel-clip jcarousel-clip-horizontal" style="position: relative;">
            <ul class="jcarousel-list jcarousel-list-horizontal" id="callaction" style="overflow: hidden; position: relative; top: 0px; margin: 0px; padding: 0px; left: 0px; width: 1606px;">
                <li><a href="#"><img src="<?php echo $this->getSkinUrl()?>images/image1.jpg" /></a></li>
                <li><a href="#"><img src="<?php echo $this->getSkinUrl()?>images/image2.jpg" /></a></li>
                <li><a href="#"><img src="<?php echo $this->getSkinUrl()?>images/image3.jpg" /></a></li>
                <li><a href="#"><img src="<?php echo $this->getSkinUrl()?>images/image4.jpg" /></a></li>
                <li><a href="#"><img src="<?php echo $this->getSkinUrl()?>images/image5.jpg" /></a></li>
            </ul>
        </div>
        <div class="jcarousel-prev jcarousel-prev-horizontal" style="display: block;"></div>
        <div class="jcarousel-next jcarousel-next-horizontal" style="display: block;"></div>
    </div>
</div>

Now add following class in your styles.css

Load Product Images by scrolldown in list page Magento


Download the following js file and add in your js folder.

jquery.js
scrolling.js

Now add this js in your page.xml

     <action method="addJs"><script>jquery.js</script></action>
     <action method="addJs"><script>scrolling.js</script></action>

go to app/design/frontend/default/[YOUR THEME]/template/catalog/product/list.phtml
add this script on top of your list page

<script type="text/javascript">
     $(document).ready(function(){
       $('img.lazy').jail({
       effect : "fadeIn"
     });
});
</script>

replace your image with following code in line near by 58.

<img class="lazy" data-src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135); ?>" src="<?php echo $this->getSkinUrl();?>images/spacer.gif" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>

"spacer.gif" is default image of magento in your theme.


 

Copyright @ 2017 HKBlog.