Tuesday, 24 July 2012

Review From In Tabbed Magento

First, download the zip of my “review” folder, located in app/design/frontend/base/default/template.
Second, open: catalog.xml, in your “layout” directory. Find this section:

<reference name=”content”>
<block type=”catalog/product_view” name=”product.info” template=”catalog/product/view.phtml”>
Add the following:

<block type=”review/form” name=”product.review.form” as=”review_form”/>
<block type=”review/product_view_list” name=”product.info.product_additional_data” as=”product_additional_data_review” template=”review/product/view/reviews-in-tab.phtml”>
<block type=”review/form” name=”product.review.form” as=”review_form”/>
</block>
Finally, open you template file where you would like to display the reviews and form. You will need to create a new tab, then use this:

<?php echo $this->getChildHtml(‘product_additional_data_review’) ?>
<?php echo $this->getChildHtml(‘review_form’) ?>

Monday, 23 July 2012

How to remove index.php from magento URL

There are the following steps

step 1: Goto to your site root folder and you can find the htaccess file there.Open it on text editor and find the line #Rewrite Base/ magento. Just replace it with Rewrite Base/

step 2: Then goto your admin panel and enable the Rewrites. You can find it at System->Configuration->Web->Search Engine Optimization

step 3: Then goto Cache management page (system cache management )

Saturday, 21 July 2012

Delete Orders From Magento and Reset The Order Id

1. Take the backup of your current database
2. Run the below queries
3. I have not fully tested that what will be the effect of these queries on the database, but as much i tested it does not have any negative effect on the Magento Database
4. If you find any wrong effect then your comment are welcome
These are the queries to delete the orders on the magento and reset the Id
—————————————————————-
SET FOREIGN_KEY_CHECKS=0;

TRUNCATE `sales_flat_order`;
TRUNCATE `sales_flat_order_address`;
TRUNCATE `sales_flat_order_grid`;
TRUNCATE `sales_flat_order_item`;
TRUNCATE `sales_flat_order_payment`;
TRUNCATE `sales_flat_order_status_history`;

TRUNCATE `sales_flat_creditmemo`;
TRUNCATE `sales_flat_creditmemo_comment`;
TRUNCATE `sales_flat_creditmemo_grid`;
TRUNCATE `sales_flat_creditmemo_item`;

TRUNCATE `sales_flat_invoice`;
TRUNCATE `sales_flat_invoice`;
TRUNCATE `sales_flat_invoice_grid`;
TRUNCATE `sales_flat_invoice_item`;

TRUNCATE `sales_flat_quote`;
TRUNCATE `sales_flat_quote_address`;
TRUNCATE `sales_flat_quote_address_item`;
TRUNCATE `sales_flat_quote_item`;
TRUNCATE `sales_flat_quote_item_option`;
TRUNCATE `sales_flat_order_item`;

TRUNCATE `sales_flat_shipment`;
TRUNCATE `sales_flat_shipment_comment`;
TRUNCATE `sales_flat_shipment_grid`;
TRUNCATE `sales_flat_shipment_item`;
TRUNCATE `sales_flat_shipment_item`;
TRUNCATE `sales_flat_shipment_track`;

TRUNCATE `sendfriend_log`;
TRUNCATE `tag`;
TRUNCATE `tag_relation`;
TRUNCATE `tag_summary`;
TRUNCATE `wishlist`;
TRUNCATE `log_quote`;
TRUNCATE `report_event`;

ALTER TABLE `sales_flat_invoice` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_invoice` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_invoice_grid` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_invoice_item` AUTO_INCREMENT=1;

ALTER TABLE `sales_flat_quote` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_address` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_address_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_item_option` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_item` AUTO_INCREMENT=1;

ALTER TABLE `sales_flat_shipment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment_comment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment_grid` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment_track` AUTO_INCREMENT=1;

ALTER TABLE `sendfriend_log` AUTO_INCREMENT=1;
ALTER TABLE `tag` AUTO_INCREMENT=1;
ALTER TABLE `tag_relation` AUTO_INCREMENT=1;
ALTER TABLE `tag_summary` AUTO_INCREMENT=1;
ALTER TABLE `wishlist` AUTO_INCREMENT=1;
ALTER TABLE `log_quote` AUTO_INCREMENT=1;
ALTER TABLE `report_event` AUTO_INCREMENT=1;

TRUNCATE `eav_entity_store`;
ALTER TABLE  `eav_entity_store` AUTO_INCREMENT=0;

SET FOREIGN_KEY_CHECKS=1;

Thursday, 19 July 2012

Delete all Products and ResetProduct id’s in Magento

TRUNCATE TABLE `catalog_product_bundle_option`; 
TRUNCATE TABLE `catalog_product_bundle_option_value`; 
TRUNCATE TABLE `catalog_product_bundle_selection`; 
TRUNCATE TABLE `catalog_product_entity_datetime`;
TRUNCATE TABLE `catalog_product_entity_decimal`;
TRUNCATE TABLE `catalog_product_entity_gallery`; 
TRUNCATE TABLE `catalog_product_entity_int`;
TRUNCATE TABLE `catalog_product_entity_media_gallery`;
TRUNCATE TABLE `catalog_product_entity_media_gallery_value`;
TRUNCATE TABLE `catalog_product_entity_text`;
TRUNCATE TABLE `catalog_product_entity_tier_price`; 
TRUNCATE TABLE `catalog_product_entity_varchar`;
TRUNCATE TABLE `catalog_product_link`; 
TRUNCATE TABLE `catalog_product_link_attribute`;
TRUNCATE TABLE `catalog_product_link_attribute_decimal`; 
TRUNCATE TABLE `catalog_product_link_attribute_int`; 
TRUNCATE TABLE `catalog_product_link_attribute_varchar`; 
TRUNCATE TABLE `catalog_product_link_type`; 
TRUNCATE TABLE `catalog_product_option`; 
TRUNCATE TABLE `catalog_product_option_price`; 
TRUNCATE TABLE `catalog_product_option_title`; 
TRUNCATE TABLE `catalog_product_option_type_price`;
TRUNCATE TABLE `catalog_product_option_type_title`; 
TRUNCATE TABLE `catalog_product_option_type_value`;
TRUNCATE TABLE `catalog_product_super_attribute`;
TRUNCATE TABLE `catalog_product_super_attribute_label`;
TRUNCATE TABLE `catalog_product_super_attribute_pricing`;
TRUNCATE TABLE `catalog_product_super_link`; 
TRUNCATE TABLE `catalog_product_enabled_index`; 
TRUNCATE TABLE `catalog_product_website`;
TRUNCATE TABLE `catalog_product_entity`;
 TRUNCATE TABLE `cataloginventory_stock`;
TRUNCATE TABLE `cataloginventory_stock_item`;
TRUNCATE TABLE `cataloginventory_stock_status`;

insert  into `catalog_product_link_type`(`link_type_id`,`code`) values (1,'relation'),(2,'bundle'),(3,'super'),(4,'up_sell'),(5,'cross_sell'); 

insert  into `catalog_product_link_attribute`(`product_link_attribute_id`,`link_type_id`,`product_link_attribute_code`,`data_type`) values (1,2,'qty','decimal'),(2,1,'position','int'),(3,4,'position','int'),(4,5,'position','int'),(6,1,'qty','decimal'),(7,3,'position','int'),(8,3,'qty','decimal'); 

insert  into `cataloginventory_stock`(`stock_id`,`stock_name`) values (1,'Default');
Probably should also clear/refresh/disable cache from System > Cache Management. I also like to delete everything under my ./var directory as well just to be doubly sure its all clear.  

Tuesday, 17 July 2012

How to get Test (Developer) Access to Fedex Web Services

For use of the Fedex API you must follow a number of steps to obtain a credentials. Below I have listed 13 page by page steps for you to acquire your own account.
Step 1: Go to http://fedex.com/us/developer/index.html
Step 2: Log in, if you do not have a developer account, click on “Sign up” and fill out the form
Step 3: After you have logged in (with existing or new credentials) mouse over “Fedex Web Services” in the sub-nav bar
Step 4: Click on FedEx Web Services for Shipping in the fly-out menu
Step 5: Click on “Develop & Test Your Application”
Step 6: Click on Obtain Test Key (at bottom of page)
Step 7 : Fill in the form with the contact information for the developer or company, I just used my own info.
Step 8:  Accept License Agreement
Step 9:  On the confirmation page they will have a printout of your developer Key, Password, Account #, Meter # etc. Copy these for your records!
Step 10 : Go to the Fedex (edit) area of  your  wordpress admin panel under the Shopping cart admin area and enter all the information provided by Step 9.

Monday, 16 July 2012

jquery conflict in magento

Working with JavaScript

  • Design > Themes Editor > Java Script Editor > Theme Java Script
If you’re comfortable working with and editing JavaScript, you can further customize the look and feel of your web store. Magento Go allows you to add your own custom Javascript files to add elements that enhance your pages.
NOTE: This section will not teach you how to use JavaScript, please see one of the many excellent online tutorials or books on learning and using JavaScript if you are not familiar with it.

Uploading JavaScript Files

  1. In the Admin Panel, go to the Design menu and select the Themes Editor.
  2. Select the theme you want to customize for the list of Available Themes by clicking the [Customize] button.
  3. Select the JavaScript Editor tab from the tabs at the left.
  4. In the Theme JavaScript panel, click Browse to select the JavaScript file from your local machine. Repeat this step for every JavaScript file you want to upload.
  5. Click Upload Files to upload them to your store.
NOTE: For many JavaScript libraries, scripts and libraries must load in the correct order in order to function properly. Manage the loading order of the scripts by simply dragging and dropping the files around in the list of uploaded JavaScript files. Uploading them in sequence will ensure that they are in correct order automatically.

jQuery Solution

To take advantage of the jQuery library or any of the custom plugins available, follow the steps below. This so
Disclaimer: This method may not always work. When you’re working with different versions of JavaScript you always run the risk of having different scripts conflicting with each other. We believe the noConflict() solution is the best alternative currently available.

To learn more about the noConflict() solution, visit the jQuery API page.

To add custom jQuery code using the Built-In Library (v.1.3.1):


  1. Create a new CMS static block.
  2. Type in a Block Title and Identifier.
  3. In the Content textarea, paste this wrapper:
    <script type="text/javascript"> (function($) { // ---------------------- // your code here // ---------------------- })(jQuery); </script>
  4. Replace the comments with your custom jQuery code.

To add custom jQuery code using any version of jQuery:

In our example, we’re going to use a hosted jQuery library version 1.5.2 from Google APIs.
  1. From the Admin Panel, select Configuration > Design > HTML Head > Miscellaneous Scripts
  2. Paste this: <script src=’https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js’ type="text/javascript"></script> and click Save.
  3. Next, paste this into Miscellaneous Scripts just after the hosted jQuery library you included:
    <script type="text/javascript"> var j152 = jQuery.noConflict(true); </script>
  4. Next, create a new CMS static block.
  5. Type in a Block Title and Identifier.
  6. In the Content textarea, paste this wrapper:
    <script type="text/javascript"> (function($) { // ---------------------- // your code here // ---------------------- })(j152); </script>
  7. Replace the commented lines with your custom jQuery code.

To add custom jQuery code using an uploded version of jQuery:


  1. Open the jQuery library file in a text editor.
  2. Paste the following at the end of the file:
    var j152 = jQuery.noConflict(true);
    Note: In our example, we named this variable j152 because we are using jQuery 1.5.2. Name your variable based on the version of jQuery you use.
  3. From the Admin Panel, go to Design > Theme Editor and click to customize your current theme.
  4. In the JavaScript editor, upload this modified jQuery you wish to use.
  5. Create a new CMS static block.
  6. In the Content textarea, paste this wrapper:
    <script type="text/javascript"> (function($) { // ---------------------- // your code here // ---------------------- })(j152); </script>
    Note: Make sure that (j152) corresponds to the variable name you created in step 2.
  7. Replace the comments with your custom jQuery code.

Thursday, 12 July 2012

How to add a extra field “Contact Us” form in magento

Step One: Modify the (interface)/(theme)/template/contacts/form.phtml file.
Say we would like to add a field called ‘Test’ in between e-mail and telephone on the default field.

  1. <div class="input-box">
  2.                     <label for="email"><?php echo $this->__('Email') ?> <span class="required">*</span></label><br />
  3.                     <input name="email" id="email" title="<?php echo $this->__('Email') ?>" value="<?php echo $this->htmlEscape($this->helper('contacts')->getUserEmail()) ?>" class="required-entry input-text validate-email" type="text"/>
  4.                 </div>
  5.                 <div class="clear"></div>
  6.                 <div class="input-box">
  7.                     <label for="telephone"><?php echo $this->__('Telephone') ?></label><br />
  8.                     <input name="telephone" id="telephone" title="<?php echo $this->__('Telephone') ?>" value="" class="input-text" type="text"/>
  9.                 </div>
    Here is the new field

  1. <div class="input-box">
  2.                     <label for="email"><?php echo $this->__('Email') ?> <span class="required">*</span></label><br />
  3.                     <input name="email" id="email" title="<?php echo $this->__('Email') ?>" value="<?php echo $this->htmlEscape($this->helper('contacts')->getUserEmail()) ?>" class="required-entry input-text validate-email" type="text"/>
  4.                 </div>
  5.                 <div class="clear"></div>
  6.                 <div class="input-box">
  7.                     <label for="test"><?php echo $this->__('Test') ?></label><br />
  8.                     <input name="test" id="test" title="<?php echo $this->__('Test') ?>" value="" class="input-text" type="text"/>
  9.                 </div>
  10.                 <div class="input-box">
  11.                     <label for="telephone"><?php echo $this->__('Telephone') ?></label><br />
  12.                     <input name="telephone" id="telephone" title="<?php echo $this->__('Telephone') ?>" value="" class="input-text" type="text"/>
  13.                 </div>
    Step Two: Create the new Transactional E-Mail form.
    1) Go to System→Transactional E-mails in the Magento Admin section. 2) Click ‘Add New Template’ 3) From the ‘Template’ dropdown box select ‘Contact Form’ 4) Click ‘Load Template’ 5) Under template content you will see:

    1. Name: {{var data.name}}
    2. E-mail: {{var data.email}}
    3. Telephone: {{var data.telephone}}
    4. Comment: {{var data.comment}}
      Add your new field in between E-mail and Telephone: 


    1. Name: {{var data.name}}
    2. E-mail: {{var data.email}}
    3. Test: {{var data.test}}
    4. Telephone: {{var data.telephone}}
    5. Comment: {{var data.comment}}

Wednesday, 11 July 2012

Tip to hide the price of the product if Magento user is not logged in

 To show tiered pricing to logged in visitors only, go to: app/design/frontend/default/default/template/catalog/product/view/tierprices.phtml
 
On this file, add this PHP function

  <?php if(Mage::getSingleton('customer/session')->isLoggedIn()): ?>
 
The above function should be added before the following piece of code 

<?php if (count($_tierPrices) > 0): ?>
 
Then add this code at the end.
 
  <?php endif; ?> 

Add a contact form to a Magento CMS page

Of all Magento tips, this one solve a very frequent problem. Your clients will want to get a contact form to which they can add bits of text, they’ll also want to have the breadcrumb menu shown for that contact page. Out of the box, the Magento contact form doesn’t allo this, to do it you just have to follow this procedure.
Go to your CMS> Manage Pages interface
Once there, input your HTML as you normally would on any other page
Once you are happy with HTML part, add this lines

<!– CONTACT FORM –>
{{block type="core/template" name="contactForm"
 form_action="/contacts/index/post" template="contacts/form.phtml"}}
<!– END OF CONTACT FORM –>

how to show new products on homepage magento

New products:-

Go to “CMS - Manage Pages” and select “Home Page” from the list of pages.
Use this code snippet to show products labeled as “new” on your front page:

{{block type="catalog/product_new" name="home.catalog.product.new" alias="product_homepage" template="catalog/product/new.phtml"}} 

 

All Products:-

Go to “CMS - Manage Pages” and select “Home Page” from the list of pages.
Use this code snippet to show all products in your catalog on your front page


{{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" template="catalog/product/list.phtml"}}

All Products from one Category:-

Go to “CMS - Manage Pages” and select “Home Page” from the list of pages.
Use this code snippet to show one category on your front page

{{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" category_id="4" template="catalog/product/list.phtml"}}

 


 

how to add css and js in magento

first put your css and js in your project and and path is:-
skin\frontend\default\default  in css folder paste your css and make js folder this path and paste your js

and after call in head.phtml

 open this path  app\design\frontend\base\default\template\page\html\head.phtml
 and and of the page in  head.phtml

css link:-
<link href="<?php echo $this->getSkinUrl('css')?>/yourcssname.css" type="text/css" rel="stylesheet" />
js link:-
<script src="<?php echo $this->getSkinUrl("js")?>/yourjsname.js" type="text/javascript"></script>

Saturday, 7 July 2012

How to add Currency selector to Magento’s header

Magento ’s  Admin “System->Configuration” menu, you have “Currency Setup” tab. There You should select default site currency, and besides that, And Selected Multiple Currencies from in Allowed Currencies Drop Down.





After that you should go to menu item under “System->Manage Currency Rates”. And set rates between values you’ve chosen before. And here’s how it looks like:

And Currency Convertor define in left column .if you want show in header then make a static block .Go to your CMS> Static Block> Add New Block. Put below xml in content part
{{block type="directory/currency" name="currency" before="catalog.leftnav" template="directory/currency.phtml"}}
And Call this Staic  Block your header. And call method Is->
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('your identifier code')->toHtml() ?>

Friday, 6 July 2012

particular category show product in magnto

Open your ftp editor and go to app => design => frontend => base => default => template => catalog => product and create new php file calledyourfilename.phtml”. (considering that you are using default theme {change theme name and path according to your current selected theme})
Put the following code in yourfilename.phtml

<?php
$_productCollection=$this->getLoadedProductCollection();
$_helper = $this->helper('catalog/output');
if ($_productCollection->count()):
$_iterator = 0;
 
foreach ($_productCollection as $_product): ?>
 
<div> <a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(145); ?>" width="120" height="120" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
<p><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></p>
<p><span><?php echo $this->getPriceHtml($_product, true) ?></span></p>
<p><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><img src="images/more-info.gif" width="110" height="30" alt="More Info" /></a></p>
</div>
 
<?php endforeach; // end products loop ?>
<script type="text/javascript">decorateList('products-list', 'none-recursive')</script>
<?php endif; // if product collection ?>

Finally we will call this piece of code on our store’s home page. Go to Admin => CMS => Pages and edit your store’s selected home page.


 
{{block type="catalog/product_list" category_id="179" 
template="catalog/product/yourfilename.phtml"}}
 

Magento: Get store information

 Get store data
    Mage::app()->getStore();

    Store Id
    Mage::app()->getStore()->getStoreId();

    Store code
    Mage::app()->getStore()->getCode();

    Website Id
    Mage::app()->getStore()->getWebsiteId();

    Store Name
    Mage::app()->getStore()->getName();

    Is Active
    Mage::app()->getStore()->getIsActive();

    Store Home Url
    Mage::app()->getStore()->getHomeUrl();

Removing dropdowns from Product List Pager in magnto

Magento styles the “Sort By” and “Show x per page” with a drop down, however for one of our sites we needed to put these into a link list. The change was easier to enact than I thought (or at least by Magento’s standards). So if you want to do it yourself:

1. Open up template/catalog/product/list/toolbar.phtml, and look for the “Sort By” div. Completely replace the select and dropdown options with:
<?php foreach($this->getAvailableOrders() as $_key=>$_order): ?>
<a href=”<?php echo $this->getOrderUrl($_key, ‘asc’) ?>” ><?php echo $this->__($_order) ?></a>
<?php endforeach; ?>

2. In the same file, look for the “Limiter” div and replace with:
<div class=”limiter”>
<label><?php echo $this->__(‘Show’) ?></label>
<?php foreach ($this->getAvailableLimit() as $_key=>$_limit): ?>
<a href=”<?php echo $this->getLimitUrl($_key) ?>”><?php echo $_limit ?></a>
<?php endforeach; ?>
<?php echo $this->__(‘per page’) ?>
</div>
The result:

Remove Category option from Layered Navigation options list in magnto

 
This is what I did to remove the “Category” section from my layered navigation so I wouldnt have any repeat information with the attributes I wanted in the layered navigation.
go to app/design/frontend/default/default/template/catalog/layer and open up view.phtml for edit.
 
<dl id="narrow-by-list"><?php $_filters $this->getFilters() ?>
<?php 
foreach ($_filters as $_filter): ?>
 <?php 
if($_filter->getItemsCount()): ?>
<?php 
if($_filter->getName() != "Category"){ ?><dt><?php echo $this->__($_filter->getName()) ?></dt>
<
dd><?php echo $_filter->getHtml() ?></dd><?php } endif; ?>
<?php 
endforeach; ?></dl>

Show Category With Image in Magento

For adding of  categories with its  images on homepage od magento  we have to add    block from admininstration cms management either by just putiing the code given below  or making the static block .

{{block type="catalog/navigation" name="catalog.category" 
template="catalog/category/list_category.phtml"}}
 
 And also you need to create a list.phtml file under “/app/design/frontend/default/default/template/catalog/category/list_category.phtml”

<?php foreach ($this->getStoreCategories() as $_category): ?>
 <?php $open = $this->isCategoryActive($_category); ?>
 <?php
$cur_category=Mage::getModel('catalog/category')->load($_category->getId());
$layer = Mage::getSingleton('catalog/layer');
$layer->setCurrentCategory($cur_category);
if ($immagine = $this->getCurrentCategory()->getImageUrl()):
 ?>
<div style="float:left; padding-right:30px; text-align:center;">
 <div class="linkimage">
 <p>
 <a href="<?php echo $this->getCategoryUrl($_category)?>">
 <img src="<?php echo $immagine ?>"
  alt="<?php echo $this->htmlEscape($this->getCurrentCategory()->getName()) ?>" width="135" height="135" />
 <?php echo $_category->getName()?>
    </a>
    </p>
    </div>
    </div> <?php endif; ?>
    <?php endforeach; ?>

Thursday, 5 July 2012

Onepage Checkout - Remove login in magnto

1.) /app/design/frontend/default/detault/layout/checkout.xml 

<!-- <block type="checkout/onepage_login" name="checkout.onepage.login" as="login" template="checkout/onepage/login.phtml"/> -->

2: Create local.xml 

  1. <?xml version="1.0"?>
  2. <layout version="0.1.0">
  3. <checkout_onepage_index>
  4.       <reference name="content">
  5.              <! -- Complete process of removing steps is defined here: http://www.magentocommerce.com/wiki/5_-_modules_and_development/checkout/customizing_onepage_checkout_-_remove_shipping_method -->
  6.             <remove name="checkout.onepage.login"/>
  7.       </reference>
  8. </checkout_onepage_index>
  9. </layout>

3.) /app/design/frontend/default/default/template/checkout/onepage.phtml  

  1. <!-- ADD THIS NEXT LINE!!! -->
  2. <input type="hidden" name="checkout_method" id="login:guest" checked="checked" value="guest"/>
  3.  
  4. <script type="text/javascript">
  5. //<![CDATA[
  6.     var accordion = new Accordion('checkoutSteps', '.head', true);
  7.     <?php if($this->getActiveStep()): ?>
  8.     accordion.openSection('opc-billing');
  9.     <?php endif ?>
  10.  
  11.     var checkout = new Checkout(accordion,{
  12.         progress: '<?php echo $this->getUrl('checkout/onepage/progress') ?>',
  13.         review: '<?php echo $this->getUrl('checkout/onepage/review') ?>',
  14.         saveMethod: '<?php echo $this->getUrl('checkout/onepage/saveMethod') ?>',
  15.         failure: '<?php echo $this->getUrl('checkout/cart') ?>'}
  16.     );
  17.  
  18.     // Go to the next method on start (it will look for the input we added above)
  19.     //IE fix
  20.     var cb = $("login:guest");
  21.     cb.checked = true;
  22.  
  23.     checkout.setMethod();  // MAKE SURE TO ADD THIS LINE!!!
  24. //]]>
  25. </script>
 

skip shipping method from onepage checkout :=>In Magento

skip shipping method from onepage checkout :=>In Magento

step 1: app/code/core/Mage/Checkout/Block/Onepage/Onepage.php

change the line
$stepCodes = array('billing', 'shipping', 'shipping_method', 'payment', 'review');
with
$stepCodes = array('billing', 'payment', 'review');

step2 : app/code/core/mage/checkout/controller/Onepagecontrollers.php

protected $_sectionUpdateFunctions = array(
'payment-method' => '_getPaymentMethodsHtml',
'shpping-method' => '_getShippingMeghtoHtml',
'review' => '_getReviewHtml',
);

to

protected $_sectionUpdateFunctions = array(
'payment-method' => '_getPaymentMethodsHtml',
'review' => '_getReviewHtml',
);


Step 3. In same page

------------------------Change this code--------------------------
public function saveBillingAction()
{
if ($this->_expireAjax()) {
return;
}
if ($this->getRequest()->isPost()) {
$postData = $this->getRequest()->getPost('billing', array());
$data = $this->_filterPostData($postData);
$customerAddressId = $this->getRequest()->getPost('billing_address_id', false);

if (isset($data['email'])) {
$data['email'] = trim($data['email']);
}
$result = $this->getOnepage()->saveBilling($data, $customerAddressId);

if (!isset($result['error'])) {
/* check quote for virtual */
if ($this->getOnepage()->getQuote()->isVirtual()) {
$result['goto_section'] = 'payment';
$result['update_section'] = array(
'name' => 'payment-method',
'html' => $this->_getPaymentMethodsHtml()
);
} elseif (isset($data['use_for_shipping']) && $data['use_for_shipping'] == 1) {
$result['goto_section'] = 'shipping_method';
$result['update_section'] = array(
'name' => 'shipping-method',
'html' => $this->_getShippingMethodsHtml()
);

$result['allow_sections'] = array('shipping');
$result['duplicateBillingInfo'] = 'true';
} else {
$result['goto_section'] = 'shipping';
}
}

$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}
-----------------------With-----------------------
public function saveBillingAction()
{
if ($this->_expireAjax()) {
return;
}
if ($this->getRequest()->isPost()) {
$postData = $this->getRequest()->getPost('billing', array());
$data = $this->_filterPostData($postData);
$customerAddressId = $this->getRequest()->getPost('billing_address_id', false);

if (isset($data['email'])) {
$data['email'] = trim($data['email']);
}
$result = $this->getOnepage()->saveBilling($data, $customerAddressId);

if (!isset($result['error'])) {
/* check quote for virtual */
if ($this->getOnepage()->getQuote()->isVirtual()) {
$result['goto_section'] = 'payment';
$result['update_section'] = array(
'name' => 'payment-method',
'html' => $this->_getPaymentMethodsHtml()
);
} else {
$result['goto_section'] = 'payment';
}
}

$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
}
}



Step 4. app/code/core/Mage/Sales/Model/Service/Quote.php

-------------------------Change this code ----------------
protected function _validate()
{
$helper = Mage::helper('sales');
if (!$this->getQuote()->isVirtual()) {
$address = $this->getQuote()->getShippingAddress();
$addressValidation = $address->validate();
if ($addressValidation !== true) {
Mage::throwException(
$helper->__('Please check shipping address information. %s', implode(' ', $addressValidation))
);
}
$method= $address->getShippingMethod();
$rate = $address->getShippingRateByCode($method);*/
if (!$this->getQuote()->isVirtual() && (!$method || !$rate)) {
Mage::throwException($helper->__('Please specify a shipping method.'));
}
}


---------------------------With------------------------
protected function _validate()
{
$helper = Mage::helper('sales');
if (!$this->getQuote()->isVirtual()) {
$address = $this->getQuote()->getShippingAddress();
$addressValidation = $address->validate();
}



Step: 5. app/design/frontend/base/default/template/checkout/onepage/billing.phtml

remove the code of radio button : line no 173

Step: 6. app/design/frontend/base/default/template/checkout/onepage/progress.phtml
remove the code for hide shipping method block: Your Checkout Progress

Step: 7.


Change Order tamplate which you have created
OR
Change from here:
app/locale/en_US/template/email/sales/order_new.html


Shipping Information:
Shipping Method:

{{var order.getShippingAddress().format('html')}}


{{var order.getShippingDescription()}}


Refer Following url:

http://www.magentocommerce.com/boards/viewthread/76049/

http://www.magentocommerce.com/boards/viewthread/19125/

Wednesday, 4 July 2012

How To Show Size Chart in Magento Detail Page

Create Magento Size Charts Using Static Blocks and Javascript

In my Old post I showed you how to create a size chart using a
link that pop-ups an external php page.
In this tutorial, I will show you how to use static blocks and JavaScript to create size charts . Demo Here
Suppose you want to create a size chart for the product type Jackets.
Here are steps you have to follow:
  • STEP 1: Create a new static block called "Jackets Size Chart" identified by "jackets-size-chart"
  • STEP 2: Create a new attribut called size_chart_template

STEP 1


STEP 2

Go to Admin->Attributes->Manage Attributes
Add new attribute with the following properties:
  • Attribute Code : size_chart_template
  • Scope: Global
  • Catalog Input type  for Store Owner : Dropdown
  • Unique Value : No
  • Required value : No
  • Input Validation for store owner: No
  • Apply to * : All Product Types
  • Use to create Configurable Product   : No
For Frontend Properties: No everywhere and Position to 0
In Manage Label/Options:
Admin : Size Chart Template
add your options for example:
jackets-size-chart (remember this is the identifier of your static block)
...
Save your attribute.
Now go to Catalog->Attributes->Manage Attribute Sets
Select your set and add the attribute you have just created. (drag and drop)
Now we are going to assign to the product  Icon Retro Motorcycle Jacket, the size chart identified by "jackets-size-chart".
Go to Icon Retro Motorcycle Jacket Item and select "jackets-size-chart" from your dropdown list (You should add this attribut before use it).
Open app/design/frontend/default/yourtemplate/template/catalog/product/view.phtml and paste the following code. (where you like to see your size chart info)
1  <!-- BOF SIZE CHART --><!-- BOF SIZE CHART -->
2<?php
3  $sizeChartIcon= Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA)."size-charts/size-chart.gif"; ?>
4            <a onclick="$('size-chart').show();"><?php echo '<img src="%27.$sizeChartIcon.%27" alt="size chart">' ; ?>  </a>
5            <div id="size-chart" style="display:none;"> <?php echo  Mage::app() ->getLayout() ->createBlock('cms/block') ->setBlockId($_product->getAttributeText('size_chart_template')) ->toHtml(); ?></div>
6<!-- EOF SIZE CHART --><!-- EOF SIZE CHART -->

Display special priced products on your Magento homepage

Step one
Open your homepage CMS page and click on the design tab. Paste the following:


<reference name="content">
<remove name="product_list"/>
<remove name="category.products"/>
<block before="-" type="catalog/product" name="home.new" alias="product" template="catalog/product/specials.phtml"> <action method="setProductsCount"><count>9</count></action>
</block>
</reference>
 
Step two:
 
First of all this is the code were that we're going to be using to do this.
 
<?php
Mage::getSingleton('core/session', array('name' => 'frontend'));
$_productCollection = Mage::getResourceModel('catalogsearch/advanced_collection')
->addAttributeToSelect(Mage::getSingleton('catalog/config')->getProductAttributes())
->addMinimalPrice()
->addStoreFilter();

Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($_productCollection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($_productCollection);

$todayDate = date('m/d/y');
$tomorrow = mktime(0, 0, 0, date('m'), date('d'), date('y'));
$tomorrowDate = date('m/d/y', $tomorrow);

$_productCollection->addAttributeToFilter('special_from_date', array('date' => true, 'to' => $todayDate))
->addAttributeToFilter('special_to_date', array('or'=> array(
0 => array('date' => true, 'from' => $tomorrowDate),
1 => array('is' => new Zend_Db_Expr('null')))
), 'left');


echo '<div class="listing-type-grid catalog-listing">';
$_collectionSize = $_productCollection->count();
$i=0; foreach($_productCollection as $_product):
if($i++%3==0)
echo '<ol class="grid-row">';

echo '<li class="item">';
echo '<p class="product-image">';
echo '<a href="'.$_product->getProductUrl().'" title="'.$this->htmlEscape($this->getImageLabel($_product, 'small_image')).'">';
echo '<img src="'.$this->helper('catalog/image')->init($_product, 'small_image')->resize(135, 135).'" width="135" height="135" alt="'.$this->htmlEscape($this->getImageLabel($_product, 'small_image')).'" title="'.$this->htmlEscape($this->getImageLabel($_product, 'small_image')).'" />
</a>
</p>';
echo '<h5><a href="'.$this->getProductUrl().'" title="'.$this->htmlEscape($_product->getName()).'">'.$this->htmlEscape($_product->getName()).'</h5>';

echo $this->getPriceHtml($_product, true) ?>
</li>

<?php if($i%3==0 || $i==$_collectionSize): ?>
</ol>
<?php endif; ?>
<?php endforeach ?>
</div> 

You can then paste this into a file and name it specials.phtml and save it into your frontend template folder catalog/product.