//AutoFacebook
$app_id = "Your Application ID"; //given when you created app
$app_secret = "Your Application Secret"; //given when you created app
$page_id = "Your page ID"; //obtained from running facebook_authorization.php from your browser
$page_token = "Your page token"; //long number obtained from facebook_authorization.php
$store_name = "yourstore.com"; // store name i.e. "Mary's Car Shop", or "MikesCupcakes.com."
$store_url = 'http://www.yourstore.com'; //path to your store without the trailing "/"
$cur = '$'; //change to your currency symbol. Assumes symbol comes in front of numbers
$new_message = "New Product!"; // change to whatever or leave the same. i.e "New Cupcake!"
// No Need to edit below here.
$prod_image = $store_url . "/images/" . $_POST['products_image'];
$price = $products_price;
$prod_url = $store_url . '/index.php?main_page=product_info&cPath=' . $current_category_id . '&products_id=' . $products_id;
$prod_name = $_POST['products_name'][$_SESSION['languages_id']];
$prod_description = $_POST['products_description'][$_SESSION['languages_id']];
//$prod_description = implode(" ", $_POST['products_description']);
include_once 'facebook/facebook.php';
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true, ));
$attachment = array(
'access_token' => $page_token,
'message' => $new_message,
'name' => $prod_name,
'link' => $prod_url,
'caption' => 'Price: '.$cur . $price,
'description' => $prod_description,
'picture' => $prod_image
);
try {
$status = $facebook->api($page_id.'/feed', 'post', $attachment);
$messageStack->add_session('Facebook was successfully updated!', 'success');
}
catch (FacebookApiException $fbe){
$fberror = $fbe->result['error']['message'];
$messageStack->add_session('Facebook Error: '.$fberror, 'error');
}
//end of autoFacebook
Bookmarks