Jump to content
Sign in to follow this  
dreamscape

[Contribution] Change "buy now" links to forms.

Recommended Posts

I've just uploaded a contribution that changes the "buy now" links to forms.

 

http://www.oscommerce.com/community/contributions,864

 

Q: Why would I want to do this?

A: This mod is intended as a compliment to Ian's SID killer (http://forums.oscommerce.com/viewtopic.php?t=25595). Ian's mod kills the SID unless a user is logged in or something is in the cart. Since the "buy now" buttons are links, a spider or bot (like our friend googlebot) can add items into your cart, creating a SID. This is bad. Doing this mod will change those links to forms, making it pretty impossible for a spider or bot to fill up your cart.

 

Enjoy :)


The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Share this post


Link to post
Share on other sites

Joshua,

 

Cheers mate, you just decreased my 'infinite' todo list by one. I haven't downloaded the code yet but hope to try it this weekend.

 

A big thumbs up.

 

 

(unfortunately infinity-1 = infinity)


Trust me, I'm an Accountant.

Share this post


Link to post
Share on other sites
(unfortunately infinity-1 = infinity)

 

LOL!

 

Aint that the same for everyone dude!! :(

 

CC.

Share this post


Link to post
Share on other sites

Hi,

 

Would I be correct in assuming that the following code in your instructions at step 3:

 

<?php echo '<form name="buy_now" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now', 'NONSSL') . '"><input type="hidden" name="products_id" value="' . $product_info_values['products_id'] . '">' . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></form>

 

should be changed to

 

<?php echo '<form name="buy_now" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now', 'NONSSL') . '"><input type="hidden" name="products_id" value="' . $reviews_values['products_id'] . '">' . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></form>

 

for the latest snapshot - ie the File: /catalog/product_review_info.php was changed on 6/02/2003 and uses $reviews_values instead of $product_info_values

 

 

Thanks for the contribution - the work is greatly appreciated.

 

Graeme

Share this post


Link to post
Share on other sites

Hey thanks for the contribution. However, I am having troubles getting item to display in shopping cart after changing the HTTP_GET_VARS to HTTP_POST_VARS.

 

Clicking the "Buy Now" button sends me to shopping_cart.php, but there is no information. However, I can go through the entire checkout process like there is an item in cart (It even sends me an email confirmation with no products listed and the "ghost" order shows up in the Admin section).

 

After I have processed order, the cart will empty the "ghosts" and if I click on shopping cart button I will get message that "shopping cart is empty!"

 

It seems like item is not getting added to properly to database (which I assume is the sessions DB)

 

If I change back to HTTP_GET_VARS, everything is fine. I tried on two snapshots and both are post Nov 16. (One is Ian's November loaded)

 

I found one thread http://forums.oscommerce.com/viewtopic.php?t=32946 that was having similar problems but they went away for some mysterious reason before the solution could be found

 

Any ideas? I know just enough about PHP to be dangerous.

Share this post


Link to post
Share on other sites

ask Ian,

 

if you follow the directions correctly, then it will accept the HTTP_POST method... if you didn't follow the directions, then I really cannot help you.


The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Share this post


Link to post
Share on other sites

Ask Joshua:lol:

 

I've just installed Joshua's code on a clean snapshot. I did get the problem you were talking about, but only because I didn't make sure that all $HTTP_GET_VARS were changed to $HTTP_POST_VARS.

 

Now works with no problems


Trust me, I'm an Accountant.

Share this post


Link to post
Share on other sites

Thanks Ian and Josh. I will re-read the instructions again. But first I will make sure I have a good night's rest. As I mentioned before, I know just enough to miss the obvious. Keep up the good work

Share this post


Link to post
Share on other sites

FYI. Problem was instead of having a product_listing.php file, I had a product_listing_col.php file. I changed code for product_listing per instruction, but did not change product_listing_col.php file. All is fine now. Works perfectly.

Share this post


Link to post
Share on other sites

Graeme would be correct (I think [and hope] :shock: )

 

Had me puzzled for a few minutes.

 

Step 3 needs to be changed a little if you're installing Joshua's button keeler. :-)

 

You have to change your search string a little, and the change you make since Version 1.45 changed $product_info_values to $review_values in the specified line.

Share this post


Link to post
Share on other sites
Graeme would be correct (I think [and hope]  :shock: )

 

Had me puzzled for a few minutes.

 

Step 3 needs to be changed a little if you're installing Joshua's button keeler. :-)

 

You have to change your search string a little, and the change you make since Version 1.45 changed $product_info_values to $review_values in the specified line.

 

thats only in newer snapshots... I run a mid november 2002 snapshot and everything I develop I develop for that snapshot. I do not support or develop for newer snapshots...


The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Share this post


Link to post
Share on other sites

I can't find this contrib. The link that is provided isn't anymore.

 

Thanks.


Steve

-------------------------

Share this post


Link to post
Share on other sites

Ok, ok! I missed it. I did find this page, but I didn't bother to read the whole page. :oops: So, I guess from now on I should read before I jump.


Steve

-------------------------

Share this post


Link to post
Share on other sites

I've installed the "buy now to forms" contribution and almost everything is working fine, BUT... I've got the product_listing_col contribution which displays my products in columns. So... I think I need to modify the product_listing_col file. Right now, click the buynow button results in going to the shopping cart with the "cart is empty message".

 

I think this is where I need to modify - but I'm not sure what exactly should be inserted here - even after rereading all the install info for comparison sake in hopes of deducing a conclusion:

 

if (PRODUCT_LIST_BUY_NOW) {

     $lc_text .= '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing_values['products_id'], 'NONSSL') . '">' . tep_image_button('button_buy_now.gif', TEXT_BUY . $listing_values['products_name'] . TEXT_NOW) . '</a> ';      

   }

 

 

Anyone?

Share this post


Link to post
Share on other sites

I had same problem. You are right on track. Just replace with code provided for product_listing.php.

Share this post


Link to post
Share on other sites

Hmmm... well, I think I've got it but on a couple products (original testing products from installation), the buy now button takes you to the product page rather than putting the item in the cart. ???

 

-shaun

Share this post


Link to post
Share on other sites

Thanks for the link but is that mean I have to install Ian's sid killer??

I've already got Burt's sid killer which may confuse the system :?

 

AG

Share this post


Link to post
Share on other sites

no scroll down the list & you will see the file ""buy now" links to forms v1.01"

 

Ian moved it to the same page as his Sid killer cause... well I really can't remember why it moved it there


The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Share this post


Link to post
Share on other sites

Doh! Didn't realise it was right down the bottom of the sid killer contribution. It should have stayed!? where it was as a separate contribution. Bit confusing but never mind.

Someone else will may be able to find it now too.

 

I've been hammering my computer for nearly 14 hours today and my eyes are like one of those goldfish :shock:

 

Thank you.

 

AG

Share this post


Link to post
Share on other sites

I have read through this thread and all the others I can find having to do with this but I am still having a problem that seems like a common one, only I am not missing the http_post_vars like the person before. As you probably could guess when the buy now button is clicked I get a what is in my cart? type of message. I have gone over the directions several times over and tried to make it work but I keep having the same problem. Any help please?

 

Dave

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×