Twitter Tweets

Locked

Views: 12,077

Results 41 to 60 of 60
This thread is locked. New replies are disabled.
12 Aug 2009, 7:17 AM
#41
lissae avatar

lissae

Totally Zenned

Join Date:
Oct 2007
Location:
Australia
Posts:
814
Plugin Contributions:
0

Twitter Tweets

Hi Wilt....I have been trying to get this to work cos I think it's great and will be a definite time saver lol I am however having an issue...when I add a new product I get these warnings on the next page:

Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /home/christon/public_html/digiscraps/changedadmindirectory/includes/modules/update_product.php on line 203

Warning: file_get_contents(http://tinyurl.com/api-create.php?url=http://www.havendesignz.com/digiscraps/index.php?main_page=product_info&products_id=1079) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in /home/christon/public_html/digiscraps/changedadmindirectory/includes/modules/update_product.php on line 203

Warning: Cannot modify header information - headers already sent by (output started at /home/christon/public_html/digiscraps/changedadmindirectory/includes/modules/update_product.php:203) in /home/christon/public_html/digiscraps/changedadmindirectory/includes/functions/general.php on line 21
```The product does get added to both the catalog and twitter...just the link does not lol

My admin section is password protected from CPanel, would this make a difference?

HunnyBee Design
"A man's manners are a mirror in which he shows his portrait." ~ Johann Wolfgang von Goethe

12 Aug 2009, 5:07 PM
#42
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Twitter Tweets

LissaE:

URL file-access is disabled in the server configuration

no suitable wrapper could be found
It has nothing to do with your cPanel.

Your hosting company has prohibited the use of the PHP file_get_contents() function from accessing files outside your server.

You'd have to have the hosting company relax their security (not likely an option), or rewrite the code to use another method to talk to external services.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

12 Aug 2009, 6:18 PM
#43
lissae avatar

lissae

Totally Zenned

Join Date:
Oct 2007
Location:
Australia
Posts:
814
Plugin Contributions:
0

Re: Twitter Tweets

Thanx DrByte, I did some Google searches yesterday and came to the same conclusion lol

Unfortunately I know just enough about programming to make me dangerous and not enough to rewrite the code, so unless anyone feels like jumping in this will have to take a backburner for me lol :)

HunnyBee Design
"A man's manners are a mirror in which he shows his portrait." ~ Johann Wolfgang von Goethe

13 Aug 2009, 5:50 PM
#44
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,928
Plugin Contributions:
3

Re: Twitter Tweets

countrycharm:

I have inserted the code and it is where it is suppose to be. My problem is this, when i insert a new product I get the error message bar at the top but their is no writing or nothing besides the error bar. When I look at the source code it don't show up. What am I doing wrong. Thank you.

Are you sure that the PHP Curl extensions are available in the version of PHP your server is using.

13 Aug 2009, 5:52 PM
#45
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,928
Plugin Contributions:
3

Re: Twitter Tweets

LissaE:

Thanx DrByte, I did some Google searches yesterday and came to the same conclusion lol

Unfortunately I know just enough about programming to make me dangerous and not enough to rewrite the code, so unless anyone feels like jumping in this will have to take a backburner for me lol :)

Note the call to the tinyURl service is not strictly necessary and you could try the code without it, i.e just passing the plain url as part of the message.

Twitter itself will try and shorten Urls in a message.

13 Aug 2009, 8:14 PM
#46
lissae avatar

lissae

Totally Zenned

Join Date:
Oct 2007
Location:
Australia
Posts:
814
Plugin Contributions:
0

Re: Twitter Tweets

Thanx Wilt :)

How would I try and pass the plain url?

edited to add....would I just remove the tinyurl bits, like so:

// BOF twitter feed
    
    if ($action == 'insert_product')
    {
      $purl = zen_catalog_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_id);
      function updateStatus($user, $password, $message)
      {
        $url = "https://twitter.com/statuses/update.xml";
        $curl = curl_init($url);
        $data = array('status'=>$message);
        curl_setopt($curl, CURLOPT_USERPWD, $user.':'.$password);
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
        curl_setopt($curl, CURLOPT_HTTPHEADER, array('Expect:'));
        $result = @curl_exec($curl);
        curl_close($curl);
        return $result;
      }
      $message = STORE_NAME . ' has a new product. ' . $purl;
      $user = 'limelites';
      $password = '********';
      updateStatus($user, $password, $message);
    }
    // EOF twitter feed  
```</span></span>

HunnyBee Design
"A man's manners are a mirror in which he shows his portrait." ~ Johann Wolfgang von Goethe

13 Aug 2009, 8:24 PM
#47
lissae avatar

lissae

Totally Zenned

Join Date:
Oct 2007
Location:
Australia
Posts:
814
Plugin Contributions:
0

Re: Twitter Tweets

Ok, I tried the above, and it worked! The url was converted to bit.ly ... thanx Wilt :)

Dunno how those span tags got in my post LOL

HunnyBee Design
"A man's manners are a mirror in which he shows his portrait." ~ Johann Wolfgang von Goethe

10 Sep 2009, 3:38 AM
#48
countrycharm avatar

countrycharm

Totally Zenned

Join Date:
Jul 2007
Posts:
2,179
Plugin Contributions:
2

Re: Twitter Tweets

limelites:

OK, answered my own question again:
**
$display_special_price = zen_get_products_special_price($products_id, true)**

But how do you get the price to display to two places after the decimal point? At present, it's displaying £49.9900 instead of £49.99

How did you get this to work? What code did you use, and what file does it go in. I have everything else working like I want it. Thanks

Is your site Upgraded to the current version 1.5.4 Yet?
zencart-upgrades-website-installation

23 Sep 2009, 5:29 PM
#49
mipavluk avatar

mipavluk

Zen Follower

Join Date:
Jun 2007
Location:
Posadas, Misiones, Argentina
Posts:
221
Plugin Contributions:
0

Re: Twitter Tweets

Wilt, could you please, put all this improves:

$_POST['products_name'][$_SESSION['languages_id']]

$display_special_price = zen_get_products_special_price($products_id, true)

round(zen_get_products_special_price($products_id, false), 2)

like must be in the message row please?

I try in this way:

$message = STORE_NAME . ' has a new product. ' . $_POST['products_name'][$_SESSION['languages_id']] . round(zen_get_products_special_price($products_id, false), 2) . $tinyPurl;

without success...

URL: http://www.littledreamswarehouse.com/shop
Zen Version: 1.3.89h
Zen Template: orange modified

23 Sep 2009, 9:46 PM
#50
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

Re: Twitter Tweets

countrycharm:

How did you get this to work? What code did you use, and what file does it go in. I have everything else working like I want it. Thanks

/includes/modules/update_product.php

**round(zen_get_products_special_price($products_id, false), 2) **

24 Sep 2009, 4:52 AM
#51
countrycharm avatar

countrycharm

Totally Zenned

Join Date:
Jul 2007
Posts:
2,179
Plugin Contributions:
2

Re: Twitter Tweets

limelites:

/includes/modules/update_product.php

**round(zen_get_products_special_price($products_id, false), 2) **
Thanks for the update

Is your site Upgraded to the current version 1.5.4 Yet?
zencart-upgrades-website-installation

25 Sep 2009, 1:51 PM
#52
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,928
Plugin Contributions:
3

Re: Twitter Tweets

mipavluk:

Wilt, could you please, put all this improves:

$_POST['products_name'][$_SESSION['languages_id']]

$display_special_price = zen_get_products_special_price($products_id, true)

round(zen_get_products_special_price($products_id, false), 2)

like must be in the message row please?

I try in this way:

$message = STORE_NAME . ' has a new product. ' . $_POST['products_name'][$_SESSION['languages_id']] . round(zen_get_products_special_price($products_id, false), 2) . $tinyPurl;

> 
> without success...


Hi,

need some more information. When you say without success, do you mean no message is sent to twitter.

Are you including this in the product update code, as shown in previous posts. 

Can you get any message to send to twitter. 
ie if you just set 

$message = 'This is a test";
25 Sep 2009, 1:54 PM
#53
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,928
Plugin Contributions:
3

Re: Twitter Tweets

also I have been informed that some people have problems calling twitter using an https domain and that setting

$url = "http://twitter.com/statuses/update.xml";

in the updateStatus function, works better.

25 Sep 2009, 2:45 PM
#54
mipavluk avatar

mipavluk

Zen Follower

Join Date:
Jun 2007
Location:
Posadas, Misiones, Argentina
Posts:
221
Plugin Contributions:
0

Re: Twitter Tweets

I finally solved... was my syntaxis I think... the code works exactly like you provide...

thanks...

URL: http://www.littledreamswarehouse.com/shop
Zen Version: 1.3.89h
Zen Template: orange modified

17 Oct 2009, 4:02 AM
#55
palmve avatar

palmve

New Zenner

Join Date:
Oct 2009
Posts:
7
Plugin Contributions:
0

Re: Twitter Tweets

:no: I have not been able, what is the final text :?

17 Oct 2009, 2:18 PM
#56
mipavluk avatar

mipavluk

Zen Follower

Join Date:
Jun 2007
Location:
Posadas, Misiones, Argentina
Posts:
221
Plugin Contributions:
0

Re: Twitter Tweets

// BOF twitter feed
    
    if ($action == 'insert_product')
    {
      $purl = zen_catalog_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_id);
      $tinyPurl = file_get_contents('http://tinyurl.com/api-create.php?url='.$purl);
      function updateStatus($user, $password, $message)
      {
        $url = "[URL]https://twitter.com/statuses/update.xml[/URL]";
        $curl = curl_init($url);
        $data = array('status'=>$message);
        curl_setopt($curl, CURLOPT_USERPWD, $user.':'.$password);
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
        curl_setopt($curl, CURLOPT_HTTPHEADER, array('Expect:'));
        $result = @curl_exec($curl);
        curl_close($curl);
        return $result;
      }
      $message = STORE_NAME . ' has a new product. ' . $tinyPurl;
      $user = 'YYYYYYYYY';
      $password = 'XXXXXXXXX';
      $result = updateStatus($user, $password, $message);
      $messageStack->add_session($result, 'error');
    }
    // EOF twitter feed

YYYYYYY: your username
XXXXXX: your password

I try with price and product name, but like in my store, product name is so large, I decide go with wilt text :smile:

URL: http://www.littledreamswarehouse.com/shop
Zen Version: 1.3.89h
Zen Template: orange modified

31 Oct 2009, 4:51 AM
#57
pinkleopard avatar

pinkleopard

Zen Follower

Join Date:
Jun 2009
Posts:
383
Plugin Contributions:
0

Re: Twitter Tweets

Hi, I have been able to successfully use this great Tweet but I have to make 2 separate mods if I put my item on sale.

For example, if I have an item listed for $12 but put it on sale for $7 then it tweets $12 so then I have to go in and hard code to $display_special_price SO my question is.....

Is it possible that it picks the current price whether it is a sale or not?

Thanks Wilt & everyone for all the help.

18 Dec 2009, 10:59 PM
#58
mipavluk avatar

mipavluk

Zen Follower

Join Date:
Jun 2007
Location:
Posadas, Misiones, Argentina
Posts:
221
Plugin Contributions:
0

Re: Twitter Tweets

Wilt

I install the mod for another zen... and does not work...
the same like countrycharm here:
http://www.zen-cart.com/forum/showpost.php?p=766963&postcount=36

I get the error area, without text and no post in twitter

I check with the hosting about the PHP Curl extensions and they said are available in my hosting account

I will pm you my code...

thanks in advance...

URL: http://www.littledreamswarehouse.com/shop
Zen Version: 1.3.89h
Zen Template: orange modified

19 Dec 2009, 2:38 AM
#59
countrycharm avatar

countrycharm

Totally Zenned

Join Date:
Jul 2007
Posts:
2,179
Plugin Contributions:
2

Re: Twitter Tweets

mipavluk:

Wilt

I install the mod for another zen... and does not work...
the same like countrycharm here:
http://www.zen-cart.com/forum/showpost.php?p=766963&postcount=36

I get the error area, without text and no post in twitter

I check with the hosting about the PHP Curl extensions and they said are available in my hosting account

I will pm you my code...

thanks in advance...

Hi does the code look like this with the highlighted area in red?

// BOF twitter feed

if ($action == 'insert_product')
{
  $purl = zen_catalog_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_id);
  $tinyPurl = file_get_contents('http://tinyurl.com/api-create.php?url='.$purl);
  function updateStatus($user, $password, $message)
  {
    $url = "<https://twitter.com/statuses/update.xml>";
    $curl = curl_init($url);
    $data = array('status'=>$message);
    curl_setopt($curl, CURLOPT_USERPWD, $user.':'.$password);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array('Expect:'));
    $result = @curl_exec($curl);
    curl_close($curl);
    return $result;
  }
  $message = STORE_NAME . ' has a new product. ' . $tinyPurl;
  $user = 'YYYYYYYYY';
  $password = 'XXXXXXXXX';
  $result = updateStatus($user, $password, $message);
  $messageStack->add_session($result, 'error');
}
// EOF twitter feedIf it does try changing the https:// to just http:// and see if that want take care of your problem.

Is your site Upgraded to the current version 1.5.4 Yet?
zencart-upgrades-website-installation

19 Dec 2009, 2:18 PM
#60
mipavluk avatar

mipavluk

Zen Follower

Join Date:
Jun 2007
Location:
Posadas, Misiones, Argentina
Posts:
221
Plugin Contributions:
0

Re: Twitter Tweets

yessssssssssssssss!
thank you very much!!!!!!!!
:clap:

URL: http://www.littledreamswarehouse.com/shop
Zen Version: 1.3.89h
Zen Template: orange modified