You are here:  » append some text on BuyURL

Support Forum



append some text on BuyURL

Submitted by Oisin on Sun, 2006-12-17 10:48 in

Hi david,

can i auto append on BUYURL links

I would like to add an "?example" on every BuyURL and i need the the "example" variable be set in config.php to make the final URL.

original URL: (merchant URL)
http://merchantdomain.com/product.html?example

OR

is it possible to add the full URL as the example variable?
to make the final URL
http://merchantdomain.com/product.html?http://youraffiliatesite.com/product.html

thank you.

Submitted by support on Sun, 2006-12-17 12:15

Hiya,

The "Text After" filter will do it without changing config.php - simply register a Text After filter against the "Buy URL" field, and enter the text "?example". You will need to do this for each merchant - and the changes won't take effect until you next import...

If you want to manipulate the Buy URL automatically, you could make changes in includes/tapestry.php in the tapestry_buyURL() function by changing the following line:

      return $product["buy_url"];

For example, where you want to add the full URL of the current page you could use PHPs super global variables. To take you example and add the full URL of the current page, you could try this:

      return $product["buy_url"]."?http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"];

That would only take effect if you weren't using tracking. If you want to use tracking, you would need to make a similar change in jump.php on the following line:

header("Location: ".$product["buy_url"]);

...for example:

header("Location: ".$product["buy_url"]."?http://".$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"]);

Cheers,
David.

Submitted by Oisin on Sun, 2006-12-17 22:35

thanks david! :)

Submitted by Oisin on Wed, 2007-01-03 18:34

david,

How can i get the result URL for

http://merchantdomain.com/product.html?exampleXXX

exampleXXX must be configured on config.php and is static on the domain.

thank you!

Submitted by support on Wed, 2007-01-03 18:55

Hi Oisin,

Almost the same as a above. Firstly, if you create your new variable in config.php, for example:

  $config_urlPostfix = "?exampleXXX";

Then, to manipulate the Buy URL automatically, you need tomake changes in includes/tapestry.php in the tapestry_buyURL() function by changing the following line:

      return $product["buy_url"];

as follows...

      global $config_urlPostfix;
      return $product["buy_url"].$config_urlPostfix;

As above, that would only take effect if you weren't using tracking. If you want to use tracking, you would need to make a similar change in jump.php on the following line:

header("Location: ".$product["buy_url"]);

...as follows:

header("Location: ".$product["buy_url"].$config_urlPostfix;

Hope this helps!
Cheers,
David.

Submitted by Oisin on Thu, 2007-01-04 05:20

thanks david.

Submitted by Frank Hollander on Wed, 2007-10-10 15:50

Hi David,

At first thanks for your great help last week with the 'strange characters'
The content looks much better now, and best of all the search results are better ;)

I have one question more, maybe it is a litte issue:

Is it possible to add

($product["buy_url"]);

to an array. Like this:

$myArray = array ($product["buy_url"]);

But when i check the output keys with:

print_r (array_keys ($myArray));

the array is empty, the keys are all zero 0 [0]

How can I fill the array with the URLs?

Thanks in advanced,

Frank

Submitted by support on Wed, 2007-10-10 16:16

Hi Frank,

The code you have posted there using the array() function will only create a single entry, flat array, which is why you see no keys. If you wanted to see keys, then the array function must be used like this:

$myArray = array ("buy_url"=>$product["buy_url"]);

That would give you a key of "buy_url" in your new array $myArray...

Hope this helps!
Cheers,
David.

Submitted by Frank Hollander on Wed, 2007-10-10 20:37

Hi David,

Thanks for the quick answer,

But when I use above code

$myarray = array("buy_url"=>$product["buy_url"]);

I got for each url the key:

( [0] => buy_url)
( [0] => buy_url)
( [0] => buy_url)

While you should expect the keys:
( [0] => 0)
( [1] => 1)
( [2] => 2)

It seems that the created array stays flat, while the collection $product["buy_url"]); sure got different URL’s.

Maybe it is something with the url data in the collection?

I hope there is a solution or a workaround ;)

Frank

Submitted by support on Thu, 2007-10-11 05:38

Hi Frank,

Could you let me know what it is you're trying to do with $product["buy_url"] (which is a string, not an array) and I might be able to give some pointers...

Cheers,
David.

Submitted by Frank Hollander on Thu, 2007-10-11 06:48

Hi David,

You are right, my fault. Each cycle the buy_url Function get a string with one URL from the searchresult.php. When you say it is a string and no array, I start thinking further then the tapestry.php page ;). Now I know what to do.

What I want is to modify each URL separate from every feed from different networks to add my own control code for each merchant.
This is possible in the admin zone with filters, but with a lot of feeds from the same network it is easer to build it in the code ;)

But now it does exactly what I want!

Thanks,

Frank