ALTER TABLE `coupon_aggregated` CHANGE COLUMN `period` `period` DATE NOT NULL DEFAULT ‘0000-00-00’
Thursday, 5 April 2012
Magento 1.6.2.0 Syntax error or access violation: 1067 Invalid default value for ‘period‘
Wednesday, 29 February 2012
magento "No shipping information available" in orders
I have problem of shipping description not display in order and order email. After search for that and nothing found and finally i have do that. Its because i have code changed in file app\code\core\Mage\Sales\Model\Quote\Address\Total\Shipping.php in line no 168. i have put something like that.
$shippingDescription = ""; // $rate->getCarrierTitle() . ' - ' . $rate->getMethodTitle();
Than I have remove this do as it default see below.
$shippingDescription = $rate->getCarrierTitle() . ' - ' . $rate->getMethodTitle();
I have do this stuff because i want remove shipping info display in cart page total box where i want only display "Shipping & Handling".
And goto above file around line no 189 and i comment out below code and its hide info of shipping in cart page total box.
//if ($address->getShippingDescription()) { // $title .= ' (' . $address->getShippingDescription() . ')'; //}
Friday, 24 February 2012
How To Change Order Status in Magento1.6
I searched all around to find this solution. In Magento Commerce, there is no provision for manually changing order status from the admin panel. I have also try to change in Magento\app\code\core\Mage\Sales\etc\config.xml file but i cant change in magento1.6. so finally i got below solution i hope this work for you.
Open file app\design\adminhtml\default\default\template\sales\order\view\history.phtml in this file.
Also replace the code.
<?php foreach ($this->getStatuses() as $_code=>$_label): ?> <?php endforeach; ?>
with
<?php $selected = ""; foreach (Mage::getSingleton('sales/order_config')->getStatuses() as $_code=>$_label): if($_code==$this->getOrder()->getStatus()) $selected = 'selected="selected"'; echo ""; endforeach;?>
Its works perfectly for me i hope its work for you.
Monday, 20 February 2012
Magento Fatal error: Call to a member function is Shipping Labels Available() on a non-object
When I click the Ship button, I get this error in the lower right corner, where there should be a button:
Fatal error: Call to a member function isShippingLabelsAvailable() on a non-object in /var/www/limp/app/code/core/Mage/Adminhtml/Block/Sales/Order/Shipment/Create/Items.php on line 132
Here i got solution for it just replace text shown in below.
change line 1214 of app/code/core/Mage/Sales/Model/Order.php from
$shippingMethod = parent::getShippingMethod();
to
$shippingMethod = $this->getData('shipping_method');
I hope this work for you.
Thursday, 16 February 2012
Sort a category and subcategory list array alphabetically in Magento
<?php $cats = Mage::getModel('catalog/category')->load(2)->getChildren(); $catIds = explode(',', $cats); $categories = array(); $subCategories = array(); foreach ($catIds as $catId) { $category = Mage::getModel('catalog/category')->load($catId); $categories[$category->getName()] = $category->getUrl(); $subcats = Mage::getModel('catalog/category')->load($catId)->getChildren(); $subcatIds = explode(',', $subcats); if ($subcats) { foreach ($subcatIds as $subcatId) { $subCategory = Mage::getModel('catalog/category')->load($subcatId); $subCategories[$category->getName()][$subCategory->getName()] = $subCategory->getUrl(); } ksort($subCategories[$category->getName()], SORT_STRING); } } ksort($categories, SORT_STRING); ?>
-
<?php foreach ($categories as $name => $url): ?>
-
<?php echo $name; ?>
<?php
foreach ($subCategories as $key => $values) {
if($name == $key)
{
echo '
- ';
foreach($values as $subName => $subUrl)
{?>
- <?php echo $subName ?> <?php } echo "
<?php endforeach; ?>
Tuesday, 24 January 2012
Magento An error occurred while saving the URL rewrite
The line I commented out to actually get the indexer to work and finish was line 285 in app/code/core/Mage/Catalog/Model/Resource/URL.php
BeforeMage::logException($e); Mage::throwException(Mage::helper('catalog')->__('An error occurred while saving the URL rewrite'));After
//Mage::logException($e); //Mage::throwException(Mage::helper('catalog')->__('An error occurred while saving the URL rewrite'));I hope its work for you.