| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Share on Twitter aka Tweet This Mod | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Share on Twitter aka Tweet This Mod
I know there are third party programs out there such as AddThis but I like to do things myself and have better control. This code probably could be cleaned up a bit(I just put things together from what I found on Google) but it works. If anyone feels like cleaning up the code a bit, please feel free.
What this code does is add a link to a product's page that allows the user to quickly and easily Tweet about the product and include a link back to the product page. Because of the 140 character limit, the current page link is sent to a link shortening site (http://www.bit.ly in this case) to shorten it before using it in the Tweet. As such, you'll need to create a free account a bit.ly so you can fill in your own details below. This will also allow you to track the links being shortened and how many clicks they get through the bit.ly interface. Here's the code. I put this beneath my Add to Cart button in product.tpl Code:
You can put pretty much say whatever after the http://twitter.com/home?status= part above. What I have will pre-fill the user's Twitter post box with: I'm liking this PRODUCT_NAME from @MYTWITTERACCOUNT SHORT_URL_BACK_TO_PRODUCT_PAGE You might want to say something similar or depending on your products maybe something like Checking out PRODUCT_NAME at SHORT_URL_BACK_TO_PRODUCT_PAGE - What do you guys think? etc.
__________________
X-Cart Gold 4.3.1 Military Support Shop :: Army Wife Clothing, Military Support T-Shirts |
|||||||
#2
|
|||||||
|
|||||||
Re: Share on Twitter aka Tweet This Mod
Hey there,
Thanks very much for posting your code, it works well! I'm going to make a modified version that will cache the bit.ly URL for a product in the DB when it's generated the first time, and use the local copy instead of calling out to bit.ly every time the product page is displayed. Will post that here when I finally get around to it.
__________________
Mick Szucs Scrapbookgraphics.com XCart Pro v4.2.3 |
|||||||
#3
|
|||||||
|
|||||||
Re: Share on Twitter aka Tweet This Mod
Oh, I should add that the json_decode() function doesn't exist in PHP 5.1. It's native in 5.2.
You can use PEAR to install the class from here: http://pear.php.net/package/Services_JSON And then rig your own json_decode() function like so: Code:
__________________
Mick Szucs Scrapbookgraphics.com XCart Pro v4.2.3 |
|||||||
|
|||
X-Cart forums © 2001-2020
|