Magento seems to include the “Login” link by default. However, Magento does not seem to show a link to Logout after one logs in.
If you have been searching tirelessly for a solution to your Magento logout woes, have no worries your search is at an end! We’ve already searched and found. We’ve included the code you will need to add a Logout link to Magento. This code actually only displays the pertinent link – so if a user is already logged in they will only see a Logout link and if a user is not Logged in then they will see a Login link.
It always take time to get rid of the Magento cache. However cache is needed to execute the request faster. One way of clearing the cache is delete all the directories inside the /var/cache directory. Doing that manually it will take some time if you are connected to the FTP server.
The easiest way of clearing the cache in Magento is here.
Are you looking for the solution i.e. customer can provide their inputs or comments along with the products they are going to order. To make it easier, one way is to allow them enter the comments for each individual item they order.
On the other hand, admin should be able to view the comment on the order page.
Adding a custom comment box for each item in the cart is actually very easy. First lets add the textarea field for each item.
In your theme, for the file: template/checkout/cart.phtml
Add the new heading along with other heading for cart items.
__('Comments') ?>
In the file: template/checkout/cart/item/default.phtml
Add a new column
For Older version of Magento it would be:
Doing upto this. shoul show the text area added
The next step is to save the comment in DB, when customer update the cart.
So add a new field ‘itemcomment’ in the tabel ‘sales_flat_quote_item’. (For older version of Magento the table would be ‘sales_quote_item’)
Now we are going to add the code which will do the DB operation. For this we will need to modify the file:
app/code/core/Mage/Checkout/Model/Cart.php (Note: If you are planning to upgrade your Magento setup, copy this file to local & modify.)
Here we need to add some code to the function updateItems(), such a way that the function should now look like below:
public function updateItems($data)
{
Mage::dispatchEvent('checkout_cart_update_items_before', array('cart'=>$this, 'info'=>$data));
foreach ($data as $itemId => $itemInfo) {
$item = $this->getQuote()->getItemById($itemId);
if (!$item) {
continue;
}
if (!empty($itemInfo['remove']) || (isset($itemInfo['qty']) && $itemInfo['qty']=='0')) {
$this->removeItem($itemId);
continue;
}
$qty = isset($itemInfo['qty']) ? (float) $itemInfo['qty'] : false;
if ($qty > 0) {
$item->setQty($qty);
}
/* Start: Custom code added for comments */
if(!empty($itemInfo['comments'])) {
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
# make the frame_queue active
$query = "UPDATE `sales_flat_quote_item` SET itemcomment = '".$itemInfo['comments']."' where item_id = $itemId";
$write->query($query);
$item->setItemcomment($itemInfo['comments']);
}
/* End: Custom code added for comments */
}
Mage::dispatchEvent('checkout_cart_update_items_after', array('cart'=>$this, 'info'=>$data));
return $this;
}
Showing the comment in Admin -> View Order
Add a new function getItemcomment() to the file below:
app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Items.php
If you are on verstion 1.5 or later.. add it to the file below.
app/code/core/Mage/Adminhtml/Block/Sales/Order/View/Items.php
public function getItemcomment($item) {
$itemId = $item->getId();
$write = Mage::getSingleton('core/resource')->getConnection('core_write');
$query = "SELECT q.* FROM `sales_flat_order_item` o
LEFT JOIN `sales_flat_quote_item` q on o.quote_item_id = q.item_id
WHERE o.item_id = $itemId";
# For older versions of Magento
/* $query = "SELECT q.* FROM `sales_order_entity_int` o
LEFT JOIN `sales_flat_quote_item` q on o.value = q.entity_id
WHERE o.entity_id = $itemId AND o.attribute_id = 343"; */
$res = $write->query($query);
while ($row = $res->fetch() ) {
if(key_exists('itemcomment',$row)) {
echo nl2br($row['itemcomment']);
}
}
}
To add the comments column to the items edit the .phtml file below:
app/design/adminhtml/default/default/template/sales/order/view/items.phtml
Adding header for items to make it look like below:
.
.
helper('sales')->__('Product') ?>
helper('sales')->__('Comments') ?>
helper('sales')->__('Item Status') ?>
.
.
.
Adding Column with comments. app/design/adminhtml/default/default/template/sales/order/view/items/renderer/default.phtml
Add a column for item comments juts before status columns to make it look a like below.
.
.
getItemcomment($_item) ?>
getStatus() ?>
.
.
Doing upto this will show the comments column in the item table. It should look like image below.
Here is a quick and useful code on getting actual price and special price of any product in Magento. The actual price is the real price assigned to the product and special price is the price after any discount is applied to the product.
A demo store is where there are products but the order done by customer is not processed. If your website is in development mode then it is better to enable demo store notice.
Enabling demo store notice in Magento is very simple. You just need to select an option in configuration settings in admin panel.
Go to System -> Configuration -> Design -> HTML Head -> Display Demo Store Notice
By default, it is set as ‘No’. To enable demo store notice, select ‘Yes’.
Now, you will see a notice bar at top of your page saying ‘This is a demo store. Any orders placed through this store will not be honored or fulfilled.‘
Magento provides a number of web services to ease the life of programmers and users. You will find web services for adding, deleting, listing, editing of products, customers, shipments etc. But Magento lacks a very important web service- Placing Orders. Magento says that it is due to security reasons so that a hacker does not break into your site and place unwanted orders. But no worries, I have found a way out, a simple one. I have developed the web service for placing an order in Magento.
Open the file: app\code\core\Mage\Sales\etc\api.xml
Here search for methods tag inside sales_order parent tag an add the folloeing lines to it
Hi, this is Mohan Natarajan working as a Senior Software Engineer at DCKAP Technologies.I have completed BE Computer Science and Engineering in Ranipet Engineering College. I did my schooling in Govt Boys Hr Sec School Timiri.(Vellore Dist)