Help - Search - Members - Calendar
Full Version: Help Please Experts
CubeCart Forums > General > General Discussion
tomdarton
Hi Experts,

I think I may be asking the impossible here, but here goes.

Is it possible to have mosr products going through the shopping cart system, but for some products when the customer clicks on the "more info" button they can directed through my affiliate link to another site for those particular products?

Any help would be greatly appreciated.

Tom.
grcdude2
One solution would be to use a keyword in the title or description. The description would be my personal choice. The keyword would need to be something that otherwise will never appear in the description (or title). Then it is only a matter of looking for it.

In an unedited index.php at or around line 363:

if($gd_version!==0){
echo"<td bgcolor=\"$bgcolour\" align=\"center\"><a href=\"view_product.php?product=$product\"><img src=\"images/thumb_$image\" border=\"0\"></a></td>";}
else{
echo"<td bgcolor=\"$bgcolour\" align=\"center\"><a href=\"view_product.php?product=$product\"><img src=\"images/$image\" width=\"75\" height=\"75\" border=\"0\"></a></td>";}

echo"<td align=\"center\"><a href=\"view_product.php?product=$product\">$title</a></td>
<td>$description";

Change to:

if(strpos($description,"Affiliate") === false)
{
if($gd_version!==0){
echo"<td bgcolor=\"$bgcolour\" align=\"center\"><a href=\"view_product.php?product=$product\"><img src=\"images/thumb_$image\" border=\"0\"></a></td>";}
else{
echo"<td bgcolor=\"$bgcolour\" align=\"center\"><a href=\"view_product.php?product=$product\"><img src=\"images/$image\" width=\"75\" height=\"56\" border=\"0\"></a></td>";}
echo"<td align=\"center\"><a href=\"view_product.php?product=$product\">$title</a></td>";
} else {
if($gd_version!==0){
echo"<td bgcolor=\"$bgcolour\" align=\"center\"><a href=\"http://www.google.com\"><img src=\"images/thumb_$image\" border=\"0\"></a></td>";}
else{
echo"<td bgcolor=\"$bgcolour\" align=\"center\"><a href=\"http://www.google.com\"><img src=\"images/$image\" width=\"75\" height=\"56\" border=\"0\"></a></td>";}
echo"<td align=\"center\"><a href=\"http://www.google.com\">$title</a></td>";}
echo"<td>$description";
<---the bold parts were missing from the original post ^^

Then at or around line 400 of an unedited index.php:

<tr>
<td height=\"24\" width=\"94\" background=\"images/white_button.gif\" align=\"center\" valign=\"middle\" style=\"cursor: hand;\" onClick=\"location.href='view_product.php?product=$product'\"><a href=\"view_product.php?product=$product\"><font class=\"wht_btn\">$la_more_info</font></a></td>
</tr>

Change to:

<tr>";
if(strpos($description,"Affiliate") === false)
{
echo"<td height=\"24\" width=\"94\" background=\"images/white_button.gif\" align=\"center\" valign=\"middle\" style=\"cursor: hand;\" onClick=\"location.href='view_product.php?product=$product'\"><a href=\"view_product.php?product=$product\"><font class=\"wht_btn\">$la_more_info</font></a></td>";
} else {
echo"<td height=\"24\" width=\"94\" background=\"images/white_button.gif\" align=\"center\" valign=\"middle\" style=\"cursor: hand;\"><a href=\"http://www.google.com\"><font class=\"wht_btn\">$la_more_info</font></a></td>";
}
echo"</tr>

In the above code, "Affiliate" is my keyword. It can be whatever works best for you. All references to "http://www.google.com" are where you would enter the affiliate site information. And actually you will probably want to leave the "product=$product". Instead of,"http://www.google.com\", it would be
"http://www.google.com/view_product.php?product=$product\". I tried this on my store(s) and it works fine bouncing from one store to another. Unless the stores are identical, you may want to notify the consumer they are leaving and open the link in a new window. To do that, in all the <a href>, change to <a target=\"blank\" href>.

If you need some assistance, let me know. Or if I totally missed the question also let me know. I'm no expert, but I hope it helps.
tomdarton
Hi

Thanks for your response. I have modified index.php as per your instructions, and having over come several parse errors I have got to a situation where each time I try to access my cube cart site I get the following error:
Parse error: parse error, unexpected $ in /home/babyfr/public_html/cart/index.php on line 980
But on line 980 all I can see is ?>.

Can you help please?

Many thanks

Tom.
iceman2g
If the error is all that's being displayed on page then, make sure all curlys brackets are closed. And that ; is where they needs to be. Those are common mistakes I found that cause these errors.
tomdarton
Hi

Thank you for your swift response.

Unfortunately my experience of php is very limited and I presume that I only need to look at the modified portion of the file for these errors.

As far as I can see each entry of "{" is closed by a "}". is this what you mean. Where the ";" should go I am not certain.

Tom.
iceman2g
Is this code on your index.php?
tomdarton
Yes it is in the index.php.
grcdude2
Dang sorry, I must have hit some cut and paste limit. I edited it, if you have already copied it, just add the parts in bold. Be sure to add the }.
tomdarton
I have made the changes you suggested and noe get this error:

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/babyfr/public_html/cart/index.php on line 745
twisted
grcdude...i'm no php expert either, but in the code changes you posted for tom, the last line of the last change reads:

echo"</tr>

Shouldn;t this be:

echo"</tr>"; ?

Could that be causing his error?
tomdarton
Hi Folks

All sorted!!

Thanks very much for all your help!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.