donot access files directily wordress


we can use that code

.htacess files on top

Options +Indexes

Advertisements

home page condtion issue in magento


To disable the block caching for “footer” block write below xml code in your page.xml

<block type="page/html_footer" name="footer" as="footer" template="page/html/footer.phtml">
<
action method="unsetData"><key>cache_lifetime</key></action>
<
action method="unsetData"><key>cache_tags</key></action>

paypal recuring method in php


index.php<?php
include "class.paypal.recurring.php";
$obj=new paypal_recurring;
$obj->environment = 'sandbox';   // or 'beta-sandbox' or 'live'
$obj->paymentType = urlencode('Authorization');          // or 'Sale' or 'Order'
// Set request-specific fields.
$obj->startDate = urlencode("2011-9-6T0:0:0");
$obj->billingPeriod = urlencode("Month");          // or "Day", "Week", "SemiMonth", "Year"
$obj->billingFreq = urlencode("4");                // combination of this and billingPeriod must be at most a year
$obj->paymentAmount = urlencode('10');
$obj->currencyID = urlencode('USD');                     // or other currency code ('GBP', 'EUR', 'JPY', 'CAD', 'AUD')
/* PAYPAL API  DETAILS */
$obj->API_UserName = urlencode('API KEY');
$obj->API_Password = urlencode('PASSWORD');
$obj->API_Signature = urlencode('SIGNATURE');
$obj->API_Endpoint = "https://api-3t.paypal.com/nvp";
/*SET SUCCESS AND FAIL URL*/
$obj->returnURL = urlencode("http://www.mysite.com/index.php?task=getExpressCheckout");
$obj->cancelURL = urlencode('http://www.mysite.comindex.php?task=error');
$task="setExpressCheckout"; //set initial task as Express Checkout
switch($task)
{
   case "setExpressCheckout":
   $obj->setExpressCheckout();
   exit;
   case "getExpressCheckout":
   $obj->getExpressCheckout();
   exit;
   case "error":
   echo "setExpress checkout failed";
   exit;
}
?>class.paypal.recurring.php

<?php
class paypal_recurring{
	

function setExpressCheckout()
{

$environment=$this->environment;
$API_UserName=$this->API_UserName;
$API_Password=$this->API_Password;
$API_Signature=$this->API_Signature;
$API_Endpoint=$this->API_Endpoint;
$paymentAmount=$this->paymentAmount;
$currencyID=$this->currencyID;
$paymentType=$this->paymentType;
$returnURL=$this->returnURL;
$cancelURL=$this->cancelURL;
$startDate=$this->startDate;

// Add request-specific fields to the request string.
$nvpStr = "&Amt=$paymentAmount&ReturnUrl=$returnURL&CANCELURL=$cancelURL&PAYMENTACTION=$paymentType&CURRENCYCODE=$currencyID";

// Execute the API operation; see the PPHttpPost function above.
$httpParsedResponseAr = $this->fn_setExpressCheckout('SetExpressCheckout', $nvpStr);

if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) {
	// Redirect to paypal.com.
	$token = urldecode($httpParsedResponseAr["TOKEN"]);
	$payPalURL = "https://www.paypal.com/webscr&cmd=_express-checkout&token=$token";
	if("sandbox" === $environment || "beta-sandbox" === $environment) {
		$payPalURL = "https://www.$environment.paypal.com/webscr&cmd=_express-checkout&token=$token";
	}
	header("Location: $payPalURL");
	exit;
} else  {
	exit('SetExpressCheckout failed: ' . print_r($httpParsedResponseAr, true));
}



}


function getExpressCheckout()
{
$environment=$this->environment;
$API_UserName=$this->API_UserName;
$API_Password=$this->API_Password;
$API_Signature=$this->API_Signature;
$API_Endpoint=$this->API_Endpoint;
$paymentAmount=$this->paymentAmount;
$currencyID=$this->currencyID;
$paymentType=$this->paymentType;
$returnURL=$this->returnURL;
$cancelURL=$this->cancelURL;
$startDate=$this->startDate;
// Obtain the token from PayPal.
if(!array_key_exists('token', $_REQUEST)) {
	exit('Token is not received.');
}

// Set request-specific fields.
$token = urlencode(htmlspecialchars($_REQUEST['token']));

// Add request-specific fields to the request string.
$nvpStr = "&TOKEN=$token";

// Execute the API operation; see the PPHttpPost function above.
$httpParsedResponseAr = $this->fn_getExpressCheckout('GetExpressCheckoutDetails', $nvpStr);

if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) {
	// Extract the response details.
	$payerID = $httpParsedResponseAr['PAYERID'];
	$street1 = $httpParsedResponseAr["SHIPTOSTREET"];
	if(array_key_exists("SHIPTOSTREET2", $httpParsedResponseAr)) {
		$street2 = $httpParsedResponseAr["SHIPTOSTREET2"];
	}
	$city_name = $httpParsedResponseAr["SHIPTOCITY"];
	$state_province = $httpParsedResponseAr["SHIPTOSTATE"];
	$postal_code = $httpParsedResponseAr["SHIPTOZIP"];
	$country_code = $httpParsedResponseAr["SHIPTOCOUNTRYCODE"];


$this->doExpressCheckout($payerID,$token);

//	exit('Get Express Checkout Details Completed Successfully: '.print_r($httpParsedResponseAr, true));
} else  {
	exit('GetExpressCheckoutDetails failed: ' . print_r($httpParsedResponseAr, true));
}


}





function doExpressCheckout($payerID,$token)
{
$environment=$this->environment;
$API_UserName=$this->API_UserName;
$API_Password=$this->API_Password;
$API_Signature=$this->$API_Signature;
$API_Endpoint=$this->API_Endpoint;
$paymentAmount=$this->paymentAmount;
$currencyID=$this->currencyID;
$paymentType=$this->paymentType;
$returnURL=$this->returnURL;
$cancelURL=$this->cancelURL;

// Add request-specific fields to the request string.
$nvpStr = "&TOKEN=$token&PAYERID=$payerID&PAYMENTACTION=$paymentType&AMT=$paymentAmount&CURRENCYCODE=$currencyID";

// Execute the API operation; see the PPHttpPost function above.
$httpParsedResponseAr = $this->fn_doExpressCheckout('DoExpressCheckoutPayment', $nvpStr);

if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) {

createRecurringPaymentsProfile($token);


	exit('Express Checkout Payment Completed Successfully: '.print_r($httpParsedResponseAr, true));
} else  {
	exit('DoExpressCheckoutPayment failed: ' . print_r($httpParsedResponseAr, true));
}
}

function createRecurringPaymentsProfile($token)
{
$environment=$this->environment;
$API_UserName=$this->API_UserName;
$API_Password=$this->API_Password;
$API_Signature=$this->API_Signature;
$API_Endpoint=$this->API_Endpoint;
$paymentAmount=$this->paymentAmount;
$currencyID=$this->currencyID;
$paymentType=$this->paymentType;
$returnURL=$this->returnURL;
$cancelURL=$this->cancelURL;
$startDate=$this->startDate;
$billingPeriod=$this->billingPeriod;
$billingFreq=$this->billingFreq;


$token = $_REQUEST['token'];


$nvpStr="&TOKEN=$token&AMT=$paymentAmount&CURRENCYCODE=$currencyID&PROFILESTARTDATE=$startDate";
$nvpStr .= "&BILLINGPERIOD=$billingPeriod&BILLINGFREQUENCY=$billingFreq";

$httpParsedResponseAr = $this->fn_createRecurringPaymentsProfile('CreateRecurringPaymentsProfile', $nvpStr);

if("SUCCESS" == strtoupper($httpParsedResponseAr["ACK"]) || "SUCCESSWITHWARNING" == strtoupper($httpParsedResponseAr["ACK"])) {
	exit('CreateRecurringPaymentsProfile Completed Successfully: '.print_r($httpParsedResponseAr, true));
} else  {
	exit('CreateRecurringPaymentsProfile failed: ' . print_r($httpParsedResponseAr, true));
}

}






function fn_createRecurringPaymentsProfile($methodName_, $nvpStr_)
{
$environment=$this->environment;
$API_UserName=$this->API_UserName;
$API_Password=$this->API_Password;
$API_Signature=$this->API_Signature;
$API_Endpoint=$this->API_Endpoint;
$paymentAmount=$this->paymentAmount;
$currencyID=$this->currencyID;
$paymentType=$this->paymentType;
$returnURL=$this->returnURL;
$cancelURL=$this->cancelURL;
$startDate=$this->startDate;
	$version = urlencode('51.0');

	// setting the curl parameters.
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
	curl_setopt($ch, CURLOPT_VERBOSE, 1);

	// turning off the server and peer verification(TrustManager Concept).
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);

	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_POST, 1);

	// NVPRequest for submitting to server
	$nvpreq = "METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr_";

	// setting the nvpreq as POST FIELD to curl
	curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);

	// getting response from server
	$httpResponse = curl_exec($ch);

	if(!$httpResponse) {
		exit("$methodName_ failed: ".curl_error($ch).'('.curl_errno($ch).')');
	}

	// Extract the RefundTransaction response details
	$httpResponseAr = explode("&", $httpResponse);

	$httpParsedResponseAr = array();
	foreach ($httpResponseAr as $i => $value) {
		$tmpAr = explode("=", $value);
		if(sizeof($tmpAr) > 1) {
			$httpParsedResponseAr[$tmpAr[0]] = $tmpAr[1];
		}
	}

	if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) {
		exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
	}

	return $httpParsedResponseAr;
}




function fn_setExpressCheckout($methodName_, $nvpStr_) {

$environment=$this->environment;
$API_UserName=$this->API_UserName;
$API_Password=$this->API_Password;
$API_Signature=$this->API_Signature;
$API_Endpoint=$this->API_Endpoint;
$paymentAmount=$this->paymentAmount;
$currencyID=$this->currencyID;
$paymentType=$this->paymentType;
$returnURL=$this->returnURL;
$cancelURL=$this->cancelURL;
$startDate=$this->startDate;

	if("sandbox" === $environment || "beta-sandbox" === $environment) {
		$API_Endpoint = "https://api-3t.$environment.paypal.com/nvp";
	}
	$version = urlencode('51.0');

	// Set the curl parameters.
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
	curl_setopt($ch, CURLOPT_VERBOSE, 1);

	// Turn off the server and peer verification (TrustManager Concept).
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);

	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_POST, 1);

	// Set the API operation, version, and API signature in the request.
	$nvpreq = "METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr_";

	// Set the request as a POST FIELD for curl.
	curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);

	// Get response from the server.
	$httpResponse = curl_exec($ch);

	if(!$httpResponse) {
		exit("$methodName_ failed: ".curl_error($ch).'('.curl_errno($ch).')');
	}

	// Extract the response details.
	$httpResponseAr = explode("&", $httpResponse);

	$httpParsedResponseAr = array();
	foreach ($httpResponseAr as $i => $value) {
		$tmpAr = explode("=", $value);
		if(sizeof($tmpAr) > 1) {
			$httpParsedResponseAr[$tmpAr[0]] = $tmpAr[1];
		}
	}

	if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) {
		exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
	}

	return $httpParsedResponseAr;
}





function fn_getExpressCheckout($methodName_, $nvpStr_)
{
$environment=$this->environment;
$API_UserName=$this->API_UserName;
$API_Password=$this->API_Password;
$API_Signature=$this->API_Signature;
$API_Endpoint=$this->API_Endpoint;
$paymentAmount=$this->paymentAmount;
$currencyID=$this->currencyID;
$paymentType=$this->paymentType;
$returnURL=$this->returnURL;
$cancelURL=$this->cancelURL;
$startDate=$this->startDate;
	if("sandbox" === $environment || "beta-sandbox" === $environment) {
		$API_Endpoint = "https://api-3t.$environment.paypal.com/nvp";
	}
	$version = urlencode('51.0');

	// Set the curl parameters.
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
	curl_setopt($ch, CURLOPT_VERBOSE, 1);

	// Turn off the server and peer verification (TrustManager Concept).
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);

	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_POST, 1);

	// Set the API operation, version, and API signature in the request.
	$nvpreq = "METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr_";

	// Set the request as a POST FIELD for curl.
	curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);

	// Get response from the server.
	$httpResponse = curl_exec($ch);

	if(!$httpResponse) {
		exit('$methodName_ failed: '.curl_error($ch).'('.curl_errno($ch).')');
	}

	// Extract the response details.
	$httpResponseAr = explode("&", $httpResponse);

	$httpParsedResponseAr = array();
	foreach ($httpResponseAr as $i => $value) {
		$tmpAr = explode("=", $value);
		if(sizeof($tmpAr) > 1) {
			$httpParsedResponseAr[$tmpAr[0]] = $tmpAr[1];
		}
	}

	if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) {
		exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
	}

	return $httpParsedResponseAr;

}


function fn_doExpressCheckout($methodName_, $nvpStr_)
{
$environment=$this->environment;
$API_UserName=$this->API_UserName;
$API_Password=$this->API_Password;
$API_Signature=$this->API_Signature;
$API_Endpoint=$this->API_Endpoint;
$paymentAmount=$this->paymentAmount;
$currencyID=$this->currencyID;
$paymentType=$this->paymentType;
$returnURL=$this->returnURL;
$cancelURL=$this->cancelURL;
$startDate=$this->startDate;

	if("sandbox" === $environment || "beta-sandbox" === $environment) {
		$API_Endpoint = "https://api-3t.$environment.paypal.com/nvp";
	}
	$version = urlencode('51.0');

	// setting the curl parameters.
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $API_Endpoint);
	curl_setopt($ch, CURLOPT_VERBOSE, 1);

	// Set the curl parameters.
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);

	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_POST, 1);

	// Set the API operation, version, and API signature in the request.
	$nvpreq = "METHOD=$methodName_&VERSION=$version&PWD=$API_Password&USER=$API_UserName&SIGNATURE=$API_Signature$nvpStr_";

	// Set the request as a POST FIELD for curl.
	curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);

	// Get response from the server.
	$httpResponse = curl_exec($ch);

	if(!$httpResponse) {
		exit('$methodName_ failed: '.curl_error($ch).'('.curl_errno($ch).')');
	}

	// Extract the response details.
	$httpResponseAr = explode("&", $httpResponse);

	$httpParsedResponseAr = array();
	foreach ($httpResponseAr as $i => $value) {
		$tmpAr = explode("=", $value);
		if(sizeof($tmpAr) > 1) {
			$httpParsedResponseAr[$tmpAr[0]] = $tmpAr[1];
		}
	}

	if((0 == sizeof($httpParsedResponseAr)) || !array_key_exists('ACK', $httpParsedResponseAr)) {
		exit("Invalid HTTP Response for POST request($nvpreq) to $API_Endpoint.");
	}

	return $httpParsedResponseAr;
}

}

?>

sorting by name and sku number in woo commerce


However, I wanted to add some sorting options that use the WooCommerce’s custom attributes. According to this thread, the product attributes are saved in a serialized format in the database and therefore it’s not feasible to do it directly.

To use the provided WooCommerce filters the attributes should be saved as meta data.

When a post that has some custom attributes set is updated, the submitted data ($_REQUEST) contains the following:

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
'attribute_names' =>
 array (
 0 => 'pa_pub-year',
 1 => 'pa_pub-author',
...
 ),
 'attribute_position' =>
 array (
 0 => '1',
 1 => '1',
......
'attribute_is_taxonomy' =>
 array (
 0 => '1',
......
 ),
 'attribute_values' =>
 array (
 0 => '1990',
 1 => '',
 2 => '',
......
 ),

The approach I followed is to get the submitted attributes and save them as post meta data. Afterwards, the code provided by WooCommerce to sort using attributes, with a tiny modification, worked successfully.

The code is as follows

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/************* Add sorting by attributes **************/
/**
 *  Defines the criteria for sorting with options defined in the method below
 */
add_filter('woocommerce_get_catalog_ordering_args', 'custom_woocommerce_get_catalog_ordering_args');
function custom_woocommerce_get_catalog_ordering_args( $args ) {
    global $wp_query;
        // Changed the $_SESSION to $_GET
    if (isset($_GET['orderby'])) {
        switch ($_GET['orderby']) :
            case 'pa_pub-year' :
                $args['order'] = 'ASC';
                $args['meta_key'] = 'pa_pub-year';
                $args['orderby'] = 'meta_value_num';
            break;
        endswitch;
    }
    return $args;
}
/**
 *  Adds the sorting options to dropdown list .. The logic/criteria is in the method above
 */
add_filter('woocommerce_catalog_orderby', 'custom_woocommerce_catalog_orderby');
function custom_woocommerce_catalog_orderby( $sortby ) {
    $sortby['pa_pub-year'] = 'Sort by Year: Older to Newer';
    return $sortby;
}
/**
 *  Save custom attributes as post's meta data as well so that we can use in sorting and searching
 */
add_action( 'save_post', 'save_woocommerce_attr_to_meta' );
function save_woocommerce_attr_to_meta( $post_id ) {
        // Get the attribute_names .. For each element get the index and the name of the attribute
        // Then use the index to get the corresponding submitted value from the attribute_values array.
    foreach( $_REQUEST['attribute_names'] as $index => $value ) {
        update_post_meta( $post_id, $value, $_REQUEST['attribute_values'][$index] );
    }
}
/************ End of Sorting ***************************/

This should be placed in the functions.php file of your theme.

magneto site not working window 7


app\code\core\Mage\Core\Model\Session\Abstract\Varien.php change:

if (isset($cookieParams['domain'])) {
    $cookieParams['domain'] = $cookie->getDomain();
}

replace to
if (isset($cookieParams['domain']) && !in_array("127.0.0.1", self::getValidatorData())) {
    $cookieParams['domain'] = $cookie->getDomain();
}

Permission denied: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs Action ‘start’ failed.


myslice~: /etc/init.d/apache2 reload * Reloading web server config apache2 4924 httpd not running, trying to start (13)Permission denied: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs ...fail!

 

we can use that command then slove that error  that:sudo /etc/init.d/apache2 reload 

or

sudo apache2ctl restart

 

Enjoy