Monday 14 April 2014

Solve “This account is locked.” problem in Magento


If your user has been locked out from the backend, you can reset the lock with one simple query:
UPDATE `admin_user` SET `failures_num` = 0, `first_failure` = NULL, `lock_expires` = NULL WHERE `user_id` = 1;

You can find your user_id with this query:

SELECT `user_id` FROM `admin_user` WHERE `username` = 'admin'

Tuesday 8 April 2014

Using PHP CURL XML Request and get XML Response

<?php
$xml = '<ProductProvisionRequest>
    <requisitionID>4183</requisitionID>
    <orderExternalReferenceID>200000353</orderExternalReferenceID>
    <submissionDate>1395393241</submissionDate>
    <shopperPassword></shopperPassword>
    <shopperInfo>
        <userKey>
            <userID>test@nonesbservice-pro-21-3-2015-2.com</userID>
            <externalReferenceID></externalReferenceID>
            <companyID>Rosetta Stone</companyID>
            <loginID>test@snonesbservice-pro-21-3-2015-2.com</loginID>
            <siteID>rstUS</siteID>
        </userKey>
    </shopperInfo>
    <orderExtendedAttributes>
        <item>
            <name></name>
            <value></value>
            <datatype></datatype>
        </item>
    </orderExtendedAttributes>
    <lineItemLevelRequest>
       
    </lineItemLevelRequest>
</ProductProvisionRequest>';
$ch = curl_init();
$url = 'www.abc.com';
curl_setopt($ch, CURLOPT_URL, $url); //set to url to post to
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // tell curl to return data in a variable
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml","header-tocken"));
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); // post the xml
//curl_setopt($ch, CURLOPT_TIMEOUT, (int)3000000); // set timeout in seconds
$xmlResponse = curl_exec($ch);
echo "<pre>";
print_r($xmlResponse);
curl_close($ch); 
?>