Saturday, February 15, 2014

Problem:

I placed an order in Magento using Paypal payment method. Everything went fine. I was able to pay through Paypal. However, when I login to the shop as a customer, I see that ‘My Orders‘ section is empty. I could not find information of the order I recently placed.

Cause:

Your order status might be either ‘Pending‘ or ‘Pending Payment‘. By default, Magento doesn’t allow these two types of orders to be displayed in customer’s end.

Solution:

dd the following code inside global element of app/etc/local.xml
<sales>
    <order>
        <states>                   
            <pending translate="label">
                <label>Pending</label>
                <statuses>
                    <pending default="1"/>
                 </statuses>
                 <visible_on_front>1</visible_on_front>
            </pending>
            <pending_payment translate="label">
                <label>Pending Payment</label>
                <statuses>
                    <pending_payment default="1"/>
                </statuses>
                <visible_on_front>1</visible_on_front>
            </pending_payment>
        </states>
    </order>
</sales>
Note: Core file containing this data is app/code/core/Mage/Sales/etc/config.xmlNow, your customers should be able to view their orders which have ‘pending’ or ‘pending payment’ status.
Magento default have a cron.php file located in the root directory. To set a cron in magento you have to create your own module first, and in the config.xml you have to declare the method which will fired and the time. Below is a dump of a etc/config.xml file of a custom cron module

<?xml version="1.0"?>
<config>
<modules>
<Wl_Cronset>
<version>0.1.0</version>
</Wl_Cronset>
</modules>
<crontab>
<jobs>
<Wl_Cronset>
<schedule>

<cron_expr>01 00 * * *</cron_expr>
</schedule>
<run>
<model>cronset/expired::productExpired</model>
</run>
</Wl_Cronset>
</jobs>
</crontab> 
<global>
<models>
<cronset>
<class>Wl_Cronset_Model</class> 
</cronset> 
</models> 
</global>
</config>



As per mentioned in this xml your cron will be fired every day @ night 00:01 min
Now you have to write your own functionality in your module Model file, Here my model file name is Expired and the function which will trigger is productExpired().
<?php
class Wl_Cronset_Model_Expired extends Mage_Core_Model_Abstract
{
public function productExpired()
{
// Your code goes here
}
}
?>
Now login to your server to call the magento root cron.php and set to be fired in every minute.

Monday, February 10, 2014



we can Refresh a page Using Meta tag and javascript
By Meta tag

<meta http-equiv="refresh" content="600">

By Javascript

<a href="javascript:location.reload(true)">Refresh this page</a>


Click here to Refresh this page
By default there already some css and Javascript file included in the page.xml. If you want to add some more new css file then write 
<action method="addCss"><stylesheet> css/Yourcss.css </stylesheet> </action>
into the page.xml which is inside Yourapp/design/Frontend/base/default/layout/Page.xml (in Magento 1.4.0.0 or Higher version of Magento). If you want to add a javascript then you can directly write that code into your header.Phtml file which is in theapp/design/frontend/base/default/template/page/html/header.phtml .Open the file and write
<script type="text/javascript" src="<?php echo $this->getSkinUrl('js/yourjs.js')?>"></script>
and upload/paste your js into Skin/frontend/default/default/js Folder.
To use Css Class in an HTML Tag we can use a Jquery function addClass(). This function add a css class into your HTML tag.The most intresting things is that you can use this class on a eventhandler also, To get effects when a client/user response on it.
This is an example to add a css class into a Html Tag
<script type="text/javascript">
$(document).ready(function(){
$('.click').click(function(){
$('p').addClass('green');
});
});
</script>
<style type="text/css">
.green{ color:green;}
</style>
Write this code into your body tag
<button class="click">Click Me</button>