Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

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


dreamscape

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://www.oscommerce.com/forums/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

Link to comment
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.

Link to comment
Share on other sites

  • 4 weeks later...

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

Link to comment
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://www.oscommerce.com/forums/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.

Link to comment
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

Link to comment
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.

Link to comment
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.

Link to comment
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.

Link to comment
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

Link to comment
Share on other sites

  • 2 months later...

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?

Link to comment
Share on other sites

  • 1 month later...

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

Link to comment
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

Link to comment
Share on other sites

  • 2 months later...

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...