Showing posts with label magento. Show all posts
Showing posts with label magento. Show all posts

Friday 3 April 2015

How to add static block call in phtml,xml and cms page in magento

How to add static block call in phtml,xml and cms page in magento


Hello Here sample code add static block in phtml,xml  and cms page.

In your Phtml File in magento


<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('set your block id')->toHtml() ?>

herer set i am setting my block

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('block-header-top1')->toHtml() ?>

In your xml file

  <reference name="content">
    <block type="cms/block" name="home-page-block">
      <action method="setBlockId">add your block id
    </block>
  </reference>

In Your cms page

{{block type="cms/block" block_id="add your block id "}}

I hope this blog help you to add static block in your magento  any suggetion for me please comment it.


Monday 23 February 2015

Magento Add to cart quantity increment/decrement quantity with jQuery

Magento Add to cart quantity increment/decrement with jQuery


Hello

I am just creating simple examples of  jquery Increamen And Decrement.

but it will help you in magento increment and decrement quantity 

Just adding query first after adding below script.


Monday 19 January 2015

Change products per page for individual categories in magento

Hello 
Change products per page for individual categories in magento


 all your default values are set in "Products per Page on Grid Allowed Values" in Admin > system config > Catalog > Catalog > Frontend

Layout handle for product grid and list view in magento

 Layout handles for product grid and list view in MagentoHello

Using the handles: catalog_category_default, catalog_category_layered and catalogsearch_result_index you should be able to change the template of the products listed.


Friday 9 January 2015

Magento secure url Secure/Unsecure Link - Link Securely for Secure Pages only

hello

Your first (with the {{media}} tag) is correct and should work.

In the admin go to System > Configuration > Web > Secure and make sure the following are set:

    Base Link URL - {{secure_base_url}}
    Base Skin URL - {{secure_base_url}}skin/
    Base Media URL - {{secure_base_url}}media/

    Base Javascript URL - {{secure_base_url}}js/

magento Get Base Url , Skin Url , Media Url , Js Url , Store Url and Current Url ,home url , module url , drirectory url userfull reference for magento

Hello here some useful code for Magento developer

Get Url in cms pages or static blocks


Thursday 8 January 2015

Change product list page template in magento


If you need to set page template for all categories, you need to take into consideration of default categories as well as layered categories. Use local.xml file for this.

first we want to create local.xml file in your theme. in path like this

app\design\frontend\<your_package>\<your_theme>\layout\local.xml

How to display discount percentage for Special Price in Magento


If price. phtml file not in your theme, please copy from here

copy

App/design/frontend/base/default/template/catalog/product/price.phtml

paste
App/design/frontend/default/YOURTEMPLATE/template/catalog/product/price.phtml

Thursday 18 September 2014

add and Remove Js In magento

hello All,

remove js in magento change in  your loca.xml file

if not exit then create local,xml file in your theme layout folder.

Thursday 11 September 2014

Magento Product Addtocart go to Checkout Page by skipping Cart Page

hello Magento developer,

this example of Magento Product Addtocart go to Checkout Page by skipping Cart Page .

if you want skip cart process in magento. follow this simple code.

just goto your app/code/local/Mage/checkout/controllers/CartController.php;

write this below code. check this your site.

below code use skip cart process. just click on add to cart i will goto checkout process.

require_once 'Mage/Checkout/controllers/CartController.php';
class My_Module_Checkout_CartControllerextendsMage_Checkout_CartController
{
 public function addAction(){
$returnUrl =Mage::getUrl('checkout/onepage'); $this->getRequest()->setParam('return_url', $returnUrl); parent::addAction();
}
}
 this code help to direct redirect to checkout page

Create new custom category attribute in Magento

if you want to create custom textbox attribute use this code

create new custom category attributes in magneto.

in magneto admin you want to create custom attributes using code. just follow below instruction.

here example of brand. i am create text box  for brand. i am create brand attributes  in product.

it can use for how to create text box attributes using code. this code use for create text box.

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(
    'group'         => 'General',
    'input'         => 'text',
    'type'          => 'varchar',
    'label'         => 'Brand value',
    'backend'       => '',
    'visible'       => true,
    'required'      => false,
    'visible_on_front' => true,
    'global'        => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
);
$installer->addAttribute('catalog_category', 'brand_value', $attribute);
$installer->endSetup();

paste this code in header.phml file and check category menu.



if you want to create custom selectbox for Yes/no attribute use this code

it can use for how to create selectattributes using code. this code use for create select.

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(
    'group'                     => 'General',
        'input'                     => 'select',
        'type'                      => 'int',
        'label'                     => 'Is Mega Menu',
        'source'                    => 'eav/entity_attribute_source_boolean',
        'global'                    => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
        'visible'                   => 1,
        'required'                  => 0,
        'visible_on_front'          => 0,
        'is_html_allowed_on_front'  => 0,
        'is_configurable'           => 0,
        'searchable'                => 0,
        'filterable'                => 0,
        'comparable'                => 0,
        'unique'                    => false,
        'user_defined'              => false,
        'default'           => '0',
        'is_user_defined'           => false,
        'used_in_product_listing'   => true
);
$installer->addAttribute('catalog_category', 'mega_menu', $attribute);
$installer->endSetup();

paste this code in header.phml file and check category menu.

just check this.