What is the name of this Auto Tweet add on ? Had one before but it did not have the option to turn it off.
Printable View
What is the name of this Auto Tweet add on ? Had one before but it did not have the option to turn it off.
has anybody here gotten auto tweeter and auto facebook to work simultaneously?? i notice they both have to update update_product.php ??
Ok I found out how to get this to work in conjunction with AutoFB. I had always put the Tweet code AFTER the AutoFB code in update_product.php. You have to put it BEFORE and it works. Don't know why. Don't care. It works.
Will this mod will automatically update twitter if you have any promotions and specials that have on the site?
Hi all,
This sounds like a great mod, however I am having difficulty with it.
I have followed the install Readme, setup a Twitter account as well as a bitly account. Set them up and when I add a product now I am getting the message at the top left of my screen stating that "Twitter Updated!" per the image attached. But when I go to my twitter account there is absolutely nothing showing other then "@keystoneairsoft hasn't tweeted yet."
Not sure where I am going wrong. Would be great if someone can point me in some kind of right direction to get this fixed.
Thanks much in advance.
Ron S.
Update!!
Ok I got it to finally upload to the bitly site, however it is still not posting on my Twitter Page. I have Share enabled on the bitly site with all my credentials but will not automatically send to Twitter.
Now, however I am able to go to the bitly site and click on the product and when the display box shows up on the right and I click "Share" it will post to my Twitter account. I have checked all settings on bitly and twitter and seems everything is right but apparently it isn't.
Any help would be greatly appreciated.
Ron S.
today auto tweet work stop in my 2 sites, i am not change any thing in script or website and also not show any type error.
any one help me, how to solve this problem ?
Hello developer!...
Is there a way to get the autotweet to display a special format Price like this (Without the quotes"): "New Product online: xyzname only € 12,00 (excl. VAT) ... "
how does the code look like for this format, caus I cannot get it to look like this... it always looks like
" EURO 12.0000 " and not
" € 12,00 " ....
how to program this?
Thanks for help!
thanks for this great module.
can you add http://adf.ly API in this module at this time you use bitly.com API
if any one help me.
code:
-------------------------------------------------------------------------------------
<?php
/**
* @package admin
* @copyright Copyright 2003-2010 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: update_product.php 15636 2010-03-07 07:00:40Z drbyte $
*/
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
if (isset($_GET['pID'])) $products_id = zen_db_prepare_input($_GET['pID']);
if (isset($_POST['edit_x']) || isset($_POST['edit_y'])) {
$action = 'new_product';
} elseif ($_POST['products_model'] . $_POST['products_url'] . $_POST['products_name'] . $_POST['products_description'] != '') {
$products_date_available = zen_db_prepare_input($_POST['products_date_available']);
$products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null';
// Data-cleaning to prevent MySQL5 data-type mismatch errors:
$tmp_value = zen_db_prepare_input($_POST['products_quantity']);
$products_quantity = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['products_price']);
$products_price = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['products_weight']);
$products_weight = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['manufacturers_id']);
$manufacturers_id = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
$sql_data_array = array('products_quantity' => $products_quantity,
'products_type' => zen_db_prepare_input($_GET['product_type']),
'products_model' => zen_db_prepare_input($_POST['products_model']),
'products_price' => $products_price,
'products_date_available' => $products_date_available,
'products_weight' => $products_weight,
'products_status' => zen_db_prepare_input((int)$_POST['products_status']),
'products_virtual' => zen_db_prepare_input((int)$_POST['products_virtual']),
'products_tax_class_id' => zen_db_prepare_input((int)$_POST['products_tax_class_id']),
'manufacturers_id' => $manufacturers_id,
'products_quantity_order_min' => zen_db_prepare_input($_POST['products_quantity_order_min']),
'products_quantity_order_units' => zen_db_prepare_input($_POST['products_quantity_order_units']),
'products_priced_by_attribute' => zen_db_prepare_input($_POST['products_priced_by_attribute']),
'product_is_free' => zen_db_prepare_input((int)$_POST['product_is_free']),
'product_is_call' => zen_db_prepare_input((int)$_POST['product_is_call']),
'products_quantity_mixed' => zen_db_prepare_input($_POST['products_quantity_mixed']),
'product_is_always_free_shipping' => zen_db_prepare_input((int)$_POST['product_is_always_free_shipping']),
'products_qty_box_status' => zen_db_prepare_input($_POST['products_qty_box_status']),
'products_quantity_order_max' => zen_db_prepare_input($_POST['products_quantity_order_max']),
'products_sort_order' => (int)zen_db_prepare_input($_POST['products_sort_order']),
'products_discount_type' => zen_db_prepare_input($_POST['products_discount_type']),
'products_discount_type_from' => zen_db_prepare_input($_POST['products_discount_type_from']),
'products_price_sorter' => zen_db_prepare_input($_POST['products_price_sorter'])
);
// when set to none remove from database
// is out dated for browsers use radio only
$sql_data_array['products_image'] = zen_db_prepare_input($_POST['products_image']);
$new_image= 'true';
if ($_POST['image_delete'] == 1) {
$sql_data_array['products_image'] = '';
$new_image= 'false';
}
if ($_POST['image_delete'] == 1) {
$sql_data_array['products_image'] = '';
$new_image= 'false';
}
if ($action == 'insert_product') {
$insert_sql_data = array( 'products_date_added' => 'now()',
'master_categories_id' => (int)$current_category_id);
$sql_data_array = array_merge($sql_data_array, $insert_sql_data);
zen_db_perform(TABLE_PRODUCTS, $sql_data_array);
$products_id = zen_db_insert_id();
// reset products_price_sorter for searches etc.
zen_update_products_price_sorter($products_id);
$db->Execute("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . "
(products_id, categories_id)
values ('" . (int)$products_id . "', '" . (int)$current_category_id . "')");
///////////////////////////////////////////////////////
//// INSERT PRODUCT-TYPE-SPECIFIC *INSERTS* HERE //////
// start autoTweet 3.0
//User Settings.
$consumerKey = "Your twitter app consumer key"; //twitter app consumer key.
$consumerSecret = "Your twitter app consumer secret"; //twitter app consumer secret.
$oauthToken = "Your my access oauth token"; //twitter app "my access" token
$oauthTokenSecret = "Your my access oauth token secret"; //twitter app "my access" token secret.
$bitlyUsername = "your bitly username"; //bit.ly username
$bitApiKey = "Your bitly API key"; //bit.ly api key.
$storeUrl = "www.your-store.com"; //url to the homepage of your store.
$showprice = 0; // Show the product price? 0 = off, 1 = on. no quotes.
$timeout = 10; //seconds to wait for twitter & bit.ly. This can be left alone.
//do not edit below this line.
$prodUrl = urlencode(zen_catalog_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_id));
//short url function.
function shortenUrl($user, $key, $shortenUrl){
$url = 'http://api.bit.ly/v3/shorten?login=' . $user .'&apiKey='. $key . '&longUrl=' . $shortenUrl . '&format=xml';
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
//use oAuth library
require_once 'twitteroauth/twitteroauth.php';
//function to shorten url
$shorten = shortenUrl($bitlyUsername, $bitApiKey, $prodUrl);
//start message w/ or w/out price
$message = "New product available: " . $_POST['products_name'][$_SESSION['languages_id']] . '!';
if ($showprice){ $message .= ' Only $' . $products_price . '.'; }
//if shorten fails use $storeUrl
$bitStatus = simplexml_load_string($shorten);
$http_code = $bitStatus->status_code;
$status_txt = $bitStatus->status_txt;
if ($http_code != 200){$shorten = $storeUrl;
$biterror = "URL was not shortened for Twitter: ";
$biterror .= $storeUrl . " was used instead.";
$biterror .= " Reason: " . $status_txt;
$messageStack->add_session($biterror, 'caution');
} else { $shorten = $bitStatus->data->url;}
//finish message.
$message .= ' Check it out now at ' . $shorten;
//the connection to twitter API
$connection = new TwitterOAuth($consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$connection->timeout = $timeout;
$connection->connecttimeout = $timeout;
//send message
$tweet = $connection->post('statuses/update', array('status' => $message));
//error check
if ($connection->http_code != NULL){
if ($connection->http_code != 200){
$error = "Twitter could not be updated: " . $connection->http_header["status"] . ": ";
$error .= $tweet->error;
$error .= "<br />To paste the code into twitter yourself use: <br />" . $message;
$messageStack->add_session($error, 'error');
} else {
$messageStack->add_session('Twitter Updated!', 'success');
}
} else {
$error = "Twitter could not be updated: Could not connect or there was nothing to do once connected.<br />
Twitter may be down or over capacity. To paste the code into twitter yourself use: <br />";
$messageStack->add_session($error, 'error');
$messageStack->add_session($message, 'caution');
}
// end autoTweet 3.0
//// *END OF PRODUCT-TYPE-SPECIFIC INSERTS* ////////
///////////////////////////////////////////////////////
} elseif ($action == 'update_product') {
$update_sql_data = array( 'products_last_modified' => 'now()',
'master_categories_id' => ($_POST['master_category'] > 0 ? zen_db_prepare_input($_POST['master_category']) : zen_db_prepare_input($_POST['master_categories_id'])));
$sql_data_array = array_merge($sql_data_array, $update_sql_data);
zen_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");
// reset products_price_sorter for searches etc.
zen_update_products_price_sorter((int)$products_id);
///////////////////////////////////////////////////////
//// INSERT PRODUCT-TYPE-SPECIFIC *UPDATES* HERE //////
//// *END OF PRODUCT-TYPE-SPECIFIC UPDATES* ////////
///////////////////////////////////////////////////////
}
$languages = zen_get_languages();
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
$language_id = $languages[$i]['id'];
$sql_data_array = array('products_name' => zen_db_prepare_input($_POST['products_name'][$language_id]),
'products_description' => zen_db_prepare_input($_POST['products_description'][$language_id]),
'products_url' => zen_db_prepare_input($_POST['products_url'][$language_id]));
if ($action == 'insert_product') {
$insert_sql_data = array('products_id' => $products_id,
'language_id' => $language_id);
$sql_data_array = array_merge($sql_data_array, $insert_sql_data);
zen_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);
} 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 . "'");
}
}
// add meta tags
$languages = zen_get_languages();
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
$language_id = $languages[$i]['id'];
$sql_data_array = array('metatags_title' => zen_db_prepare_input($_POST['metatags_title'][$language_id]),
'metatags_keywords' => zen_db_prepare_input($_POST['metatags_keywords'][$language_id]),
'metatags_description' => zen_db_prepare_input($_POST['metatags_description'][$language_id]));
if ($action == 'insert_product_meta_tags') {
$insert_sql_data = array('products_id' => $products_id,
'language_id' => $language_id);
$sql_data_array = array_merge($sql_data_array, $insert_sql_data);
zen_db_perform(TABLE_META_TAGS_PRODUCTS_DESCRIPTION, $sql_data_array);
} elseif ($action == 'update_product_meta_tags') {
zen_db_perform(TABLE_META_TAGS_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");
}
}
// future image handler code
define('IMAGE_MANAGER_HANDLER', 0);
define('DIR_IMAGEMAGICK', '');
if ($new_image == 'true' and IMAGE_MANAGER_HANDLER >= 1) {
$src= DIR_FS_CATALOG . DIR_WS_IMAGES . zen_get_products_image((int)$products_id);
$filename_small= $src;
preg_match("/.*\/(.*)\.(\w*)$/", $src, $fname);
list($oiwidth, $oiheight, $oitype) = getimagesize($src);
$small_width= SMALL_IMAGE_WIDTH;
$small_height= SMALL_IMAGE_HEIGHT;
$medium_width= MEDIUM_IMAGE_WIDTH;
$medium_height= MEDIUM_IMAGE_HEIGHT;
$large_width= LARGE_IMAGE_WIDTH;
$large_height= LARGE_IMAGE_HEIGHT;
$k = max($oiheight / $small_height, $oiwidth / $small_width); //use smallest size
$small_width = round($oiwidth / $k);
$small_height = round($oiheight / $k);
$k = max($oiheight / $medium_height, $oiwidth / $medium_width); //use smallest size
$medium_width = round($oiwidth / $k);
$medium_height = round($oiheight / $k);
$large_width= $oiwidth;
$large_height= $oiheight;
$products_image = zen_get_products_image((int)$products_id);
$products_image_extension = substr($products_image, strrpos($products_image, '.'));
$products_image_base = preg_replace('/'.$products_image_extension.'/', '', $products_image);
$filename_medium = DIR_FS_CATALOG . DIR_WS_IMAGES . 'medium/' . $products_image_base . IMAGE_SUFFIX_MEDIUM . '.' . $fname[2];
$filename_large = DIR_FS_CATALOG . DIR_WS_IMAGES . 'large/' . $products_image_base . IMAGE_SUFFIX_LARGE . '.' . $fname[2];
// ImageMagick
if (IMAGE_MANAGER_HANDLER == '1') {
copy($src, $filename_large);
copy($src, $filename_medium);
exec(DIR_IMAGEMAGICK . "mogrify -geometry " . $large_width . " " . $filename_large);
exec(DIR_IMAGEMAGICK . "mogrify -geometry " . $medium_width . " " . $filename_medium);
exec(DIR_IMAGEMAGICK . "mogrify -geometry " . $small_width . " " . $filename_small);
}
}
zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . (isset($_POST['search']) ? '&search=' . $_POST['search'] : '') ));
} else {
$messageStack->add_session(ERROR_NO_DATA_TO_SAVE, 'error');
zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . (isset($_POST['search']) ? '&search=' . $_POST['search'] : '') ));
}
-------------------------------------------------------------------------------------