Hmmm i think the best i could do is make it so that when you update the products status to active from the categories page you can go back to the update product page and simple click update to tweet the info.
to do this edit the included update_product.php as follows:
delete everything from like 128 to line 149 so that you're deleting // bof Auto Tweet. and // eof Auto-Tweet and everything in between (all of the autotweet code). now skip down about 3 lines or so to where you see:
PHP Code:
} elseif ($action == 'update_product') {
zen_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");
}
and replace just those 3 lines with:
PHP Code:
} elseif ($action == 'update_product') {
zen_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");
// bof Auto Tweet.
if($_POST['products_status'] = "1"){
include 'twitter/twitter.php';
require_once 'twitter/bitly.php';
// CHANGE: path to your store (i.e. http://example.com/store
$myStoreUrl = 'http://www.example.com';
// CHANGE: Your stores Twitter username and password
$twitter = new Twitter("TwitterUsername","TwitterPassword");
// CHANGE: Your bit.ly Username and API Key
// API Key should be a long number starting with "R_"
// available free @ http://bit.ly/account/your_api_key
$bitly = new Bitly('myBITLYusername', 'R_321321321321321');
// ##### No need to change below this line #####
// URL for bitly.php to shorten
$shirturl = $myStoreUrl . '/index.php?main_page=product_info&cPath=' . $current_category_id . '&products_id=' . $products_id ;
// send tweet.
$shirtname = $sql_data_array['products_name'];
$mytweet ='New Product Available: "' . $shirtname . '" Check it out at ' . $bitly->shorten($shirturl);
$twitter->updateStatus($mytweet);
}// eof Auto-Tweet
}
using your stores/twitter/bit.ly info of course. This new code is just checking the products status and if the status is = to 1 it performs the tweet. So this code will only be executed from the product's update page if the product is active.
Bookmarks