PHP, Magento, Codigniter, Opencart and Wordpress Developer. Contact for school and college projects on PHP, Codiegniter, Wordpress, Mysql etc.
Tuesday, 31 March 2015
Magento - Display Full Breadcrumb Path on product page
if ($breadcrumbsBlock = $this->getLayout()->getBlock('breadcrumbs')) { $breadcrumbsBlock->addCrumb('home', array( 'label'=>Mage::helper('catalog')->__('Home'),
$current_category = Mage::registry('current_category');
if(!$current_category && $current_product){
Monday, 30 March 2015
How to delete all orders from Magento?
Go to Phpmyadmin and run following sql code:
SET FOREIGN_KEY_CHECKS=0;
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_comment`;
TRUNCATE `sales_flat_invoice_grid`;
TRUNCATE `sales_flat_invoice_item`;
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_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_quote_payment`;
TRUNCATE `sales_flat_quote_shipping_rate`;
TRUNCATE `sales_flat_shipment`;
TRUNCATE `sales_flat_shipment_comment`;
TRUNCATE `sales_flat_shipment_grid`;
TRUNCATE `sales_flat_shipment_item`;
TRUNCATE `sales_flat_shipment_track`;
TRUNCATE `sales_invoiced_aggregated`;
TRUNCATE `sales_invoiced_aggregated_order`;
TRUNCATE `sales_order_aggregated_created`;
TRUNCATE `sendfriend_log`;
TRUNCATE `tag`;
TRUNCATE `tag_relation`;
TRUNCATE `tag_summary`;
TRUNCATE `wishlist`;
TRUNCATE `log_quote`;
TRUNCATE `report_event`;
ALTER TABLE `sales_flat_creditmemo` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_creditmemo_comment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_creditmemo_grid` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_creditmemo_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_invoice` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_invoice_comment` 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_order` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_address` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_grid` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_payment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_status_history` 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_quote_payment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_shipping_rate` 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_track` AUTO_INCREMENT=1;
ALTER TABLE `sales_invoiced_aggregated` AUTO_INCREMENT=1;
ALTER TABLE `sales_invoiced_aggregated_order` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_aggregated_created` 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;
SET FOREIGN_KEY_CHECKS=1;
Tuesday, 17 March 2015
Magento Currency Symbol page not found, display 404 error when i go to admin
Change line 68 in: app\code\core\Mage\CurrencySymbol\etc\config.xml
And change to
<currencysymbol>Mage_CurrencySymbol_Adminhtml</currencysymbol>
from
<currencysymbol before="Mage_Adminhtml">Mage_CurrencySymbol_Adminhtml</currencysymbol>
How to add custom filters on the category page in Magento
Directory file path: app/code/core/Mage/Catalog/Model/Category.php
public function getProductCollection()
{
$collection = Mage::getResourceModel('catalog/product_collection')
->setStoreId($this->getStoreId())
->addCategoryFilter($this)
->addAttributeToFilter('featured', array('value'=>'1'));
return $collection;
}
How to filters products by attribute value in Magento
Directory file path : app/design/frontend/base/default/template/catalog/product/list.phtml
$_productCollection=$this->getLoadedProductCollection();
$_productCollection = clone $this->getLoadedProductCollection();
$_productCollection->clear()
->addAttributeToFilter('featured', array('value'=>'1'))
->load();
Wednesday, 11 March 2015
How to add Indian States in Magento?
In this tutorial, we will see how to add states of any country in Magento.
All states value are stored in two main table: directory_country_region and directory_country_region_name.
So Please Follow the following steps:
1. open phpmyadmin
2. select your database
3. open 'directory_country_region' table
4. click on sql and paste following code:
(485, 'IN', 'ANDRA', 'Andra Pradesh'),
(486, 'IN', 'ARUNA', 'Arunachal Pradesh'),
(487, 'IN', 'ASSAM', 'Assam'),
(488, 'IN', 'BIHAR', 'Bihar'),
(489, 'IN', 'CHAND', 'Chandigarh'),
(490, 'IN', 'CHHAT', 'Chhattisgarh'),
(491, 'IN', 'DADAR', 'Dadar and Nagar Haveli'),
(492, 'IN', 'DAMAN', 'Daman and Diu'),
(493, 'IN', 'DELHI', 'Delhi'),
(494, 'IN', 'GOA', 'Goa'),
(495, 'IN', 'GUJAR', 'Gujarat'),
(496, 'IN', 'HARYA', 'Haryana'),
(497, 'IN', 'HP', 'Himachal Pradesh'),
(498, 'IN', 'JK', 'Jammu and Kashmir'),
(499, 'IN', 'JHARK', 'Jharkhand'),
(500, 'IN', 'KARNA', 'Karnataka'),
(501, 'IN', 'KERAL', 'Kerala'),
(502, 'IN', 'LAKSH', 'Lakshadeep'),
(503, 'IN', 'MP', 'Madya Pradesh'),
(504, 'IN', 'MAHAR', 'Maharashtra'),
(505, 'IN', 'MANIP', 'Manipur'),
(506, 'IN', 'MEGHA', 'Meghalaya'),
(507, 'IN', 'MIZOR', 'Mizoram'),
(508, 'IN', 'NAGAL', 'Nagaland'),
(510, 'IN', 'ORISS', 'Orissa'),
(511, 'IN', 'PONDI', 'Pondicherry'),
(512, 'IN', 'PUNJA', 'Punjab'),
(513, 'IN', 'RAJAS', 'Rajasthan'),
(514, 'IN', 'SIKKI', 'Sikkim'),
(515, 'IN', 'TAMIL', 'Tamil Nadu'),
(516, 'IN', 'TELANGANA', 'Telangana'),
(517, 'IN', 'TAMIL', 'Tripura'),
(518, 'IN', 'UP', 'Uttar Pradesh'),
(519, 'IN', 'UTTAR', 'Uttaranchal'),
(520, 'IN', 'WB', 'West Bengal');
And press 'Go' Button in right bottom.
Now check dropdown list, all states of India are displaying.
You can add any states of any Country. Follow the above steps.
Subscribe to:
Posts (Atom)