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}}