Hello,
I am working with osc v2.3.1, and have encountered a bit of an issue while trying to implement some changes to product_info.php. I am using OSC as an info site, i.e. there are no customer accounts and no shopping cart. Instead, the idea is to use it as a consignment shop: we host the items on our website and allow customers to contact the seller directly.
I have not had any issues with removing the Add to Cart/Account functions and links, however, I am in the process of creating a ReCAPTCHA button, Contact Seller, on the product_info.php page and discovered that nearly the entire page is already a <form> for the original Add to Cart buttons, which leads to the shopping cart page. I need to change the action on this form so that it no longer leads to the Shopping Cart page, but instead, upon correct input of the ReCAPTCHA code, displays the (otherwise) hidden Seller's contact information.
I certainly do not expect someone to code this all in it's entirety for me, however is it possible to change/remove the original add_to_cart form without causing any major problems? If so, how can this be done?
Thank you in advance for the help.
Latest News: (loading..)
Changing add_to_cart form action
Started by Mr. Ables, Mar 20 2012 09:02 PM
add_to_cart form action product_info.php
9 replies to this topic
#-19
Posted 20 March 2012 - 09:02 PM
#-18
Posted 20 March 2012 - 09:20 PM
I have looked through the forums quite a bit and found a few bits of guidance (such as Any form submitted from the Product info page just go straight to Cart Content page?), but nothing detailing this process. If there is another forum topic that covers this area already that, as well, would be appreciated.
Edited by Mr. Ables, 20 March 2012 - 09:20 PM.
#-17
Posted 21 March 2012 - 05:37 PM
Perhaps I can simplify my question:
How are forms handled in OSC 2.3.1? In product_info.php, the form is drawn with the following line:
I need to change the form action or remove of this form entirely to add another, as I cannot nest another form inside. If I needed to create a form, below the product description, that did something entirely different, what can I change? Would this cause any problems? Since I have removed of all of the buttons, does that mean I can terminate the form sooner? Where does it define what "cart_quantity" or "add_product" are?
I am obviously not, by any means, a PHP expert so help with any of these questions or just a direction to go would be extremely helpful.
How are forms handled in OSC 2.3.1? In product_info.php, the form is drawn with the following line:
<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?>
I need to change the form action or remove of this form entirely to add another, as I cannot nest another form inside. If I needed to create a form, below the product description, that did something entirely different, what can I change? Would this cause any problems? Since I have removed of all of the buttons, does that mean I can terminate the form sooner? Where does it define what "cart_quantity" or "add_product" are?
I am obviously not, by any means, a PHP expert so help with any of these questions or just a direction to go would be extremely helpful.
#-16
Posted 21 March 2012 - 05:53 PM
Why not just change the action of the existing form? Then it's a simple matter of adding another action in application_top.php to process your captcha and return the data.
Regards
Jim
Regards
Jim
My Addons
Banners Box 2.3.x Support
Categories Accordion Box 2.3.x Support
Categories Images Box 2.2x 2.3.x Support
Closest Shipper 2.2x Support
Document Manager 2.2x Support
Generic Box 2.3.x Support
Get 1 Free 2.2x Support
jQuery Banner Rotator 2.2x 2.3.x Support
Modular Front Page 2.3.x Support
Modular SEO Header Tags 2.3.x Support
MVS 2.2x Support
PDF Datasheet 2.3.x Support
Price Updater 2.2x
Products Specifications 2.2x 2.3.x Development Version Support Bugs/Suggestions
Request a Review 2.2x - 2.3.x Support
Similar Products Box 2.2x
Specials Image Overlay 2.3x Support
Theme Switcher 2.3.x Support
Banners Box 2.3.x Support
Categories Accordion Box 2.3.x Support
Categories Images Box 2.2x 2.3.x Support
Closest Shipper 2.2x Support
Document Manager 2.2x Support
Generic Box 2.3.x Support
Get 1 Free 2.2x Support
jQuery Banner Rotator 2.2x 2.3.x Support
Modular Front Page 2.3.x Support
Modular SEO Header Tags 2.3.x Support
MVS 2.2x Support
PDF Datasheet 2.3.x Support
Price Updater 2.2x
Products Specifications 2.2x 2.3.x Development Version Support Bugs/Suggestions
Request a Review 2.2x - 2.3.x Support
Similar Products Box 2.2x
Specials Image Overlay 2.3x Support
Theme Switcher 2.3.x Support
#-15
Posted 21 March 2012 - 06:17 PM
Jim,
Thank you very much for the help. I wasn't aware that the form was processed with application_top.php (as I said, I only have working knowledge of PHP, but this is a wonderful way to learn), so that should lead me in the correct direction. In application_top, would I then be able to display information (i.e. a specific Seller's contact info) based on the $products_id?
Would something simple like this work?:
Thank you again for the help. I appreciate any recommendations.
Thank you very much for the help. I wasn't aware that the form was processed with application_top.php (as I said, I only have working knowledge of PHP, but this is a wonderful way to learn), so that should lead me in the correct direction. In application_top, would I then be able to display information (i.e. a specific Seller's contact info) based on the $products_id?
Would something simple like this work?:
switch ($product_info['products_id']) {
case 29:
case 30:
case 31:
echo ("Seller info");
break;
default:
}
OR
if ($product_info['products_id'] == 29) echo ("Seller info");
Thank you again for the help. I appreciate any recommendations.
Edited by Mr. Ables, 21 March 2012 - 06:18 PM.
#-14
Posted 21 March 2012 - 06:24 PM
How is the seller tied to the product ID? Your database architecture is critical to figuring this part out. Do you have a table with seller info, and another table that relates the seller table to the Product ID? That's how I would design it, but I don't know what you've done. If you did it my way, the the code in application_top.php would use the newt tables to look up the seller info and pass it back to be displayed. Or possibly pass it to a new PHP file, such as a popup.
If you're good with Javascript, you could us a Javascript popup to display the data over the product page. So many possibilities here....
Regards
Jim
If you're good with Javascript, you could us a Javascript popup to display the data over the product page. So many possibilities here....
Regards
Jim
My Addons
Banners Box 2.3.x Support
Categories Accordion Box 2.3.x Support
Categories Images Box 2.2x 2.3.x Support
Closest Shipper 2.2x Support
Document Manager 2.2x Support
Generic Box 2.3.x Support
Get 1 Free 2.2x Support
jQuery Banner Rotator 2.2x 2.3.x Support
Modular Front Page 2.3.x Support
Modular SEO Header Tags 2.3.x Support
MVS 2.2x Support
PDF Datasheet 2.3.x Support
Price Updater 2.2x
Products Specifications 2.2x 2.3.x Development Version Support Bugs/Suggestions
Request a Review 2.2x - 2.3.x Support
Similar Products Box 2.2x
Specials Image Overlay 2.3x Support
Theme Switcher 2.3.x Support
Banners Box 2.3.x Support
Categories Accordion Box 2.3.x Support
Categories Images Box 2.2x 2.3.x Support
Closest Shipper 2.2x Support
Document Manager 2.2x Support
Generic Box 2.3.x Support
Get 1 Free 2.2x Support
jQuery Banner Rotator 2.2x 2.3.x Support
Modular Front Page 2.3.x Support
Modular SEO Header Tags 2.3.x Support
MVS 2.2x Support
PDF Datasheet 2.3.x Support
Price Updater 2.2x
Products Specifications 2.2x 2.3.x Development Version Support Bugs/Suggestions
Request a Review 2.2x - 2.3.x Support
Similar Products Box 2.2x
Specials Image Overlay 2.3x Support
Theme Switcher 2.3.x Support
#-13
Posted 21 March 2012 - 06:48 PM
Jim,
A Javascript popup would be a nice way to do this, and I am much more experienced with Javascript. The seller is not currently tied to the product ID in any way, as I did not know the best way to go about this. A database would likely be the most elegant and effective way to make this work, as I would otherwise have to manually enter the sellers info into the script manually every time a new product was added.
So the best way to go about this would be: ReCAPTCHA would be processed with application_top. If ReCAPTCHA was correct, application_top would look up the seller info via these tables, one that contains the sellers info and one that ties products_id to sellers_id. Then application_top would pass info that to a new page, which would display, in a popup the sellers info based on the original products_id. Correct? My only, probably stupid, question is (despite what I'm sure will be the daunting task of figuring out the syntax), how would I tie in the Javascript Popup to this button? I know I can redirect via the action, but can I use a popup there instead?
Now it's just figuring out the syntax, I suppose
Thanks again for the ideas, Jim
A Javascript popup would be a nice way to do this, and I am much more experienced with Javascript. The seller is not currently tied to the product ID in any way, as I did not know the best way to go about this. A database would likely be the most elegant and effective way to make this work, as I would otherwise have to manually enter the sellers info into the script manually every time a new product was added.
So the best way to go about this would be: ReCAPTCHA would be processed with application_top. If ReCAPTCHA was correct, application_top would look up the seller info via these tables, one that contains the sellers info and one that ties products_id to sellers_id. Then application_top would pass info that to a new page, which would display, in a popup the sellers info based on the original products_id. Correct? My only, probably stupid, question is (despite what I'm sure will be the daunting task of figuring out the syntax), how would I tie in the Javascript Popup to this button? I know I can redirect via the action, but can I use a popup there instead?
Now it's just figuring out the syntax, I suppose
Edited by Mr. Ables, 21 March 2012 - 06:55 PM.
#-12
Posted 21 March 2012 - 06:59 PM
I was just throwing ideas out there. Now, how to make it work ... Could you retrieve the seller information with the original page load but not make it visible until the captcha is processed? Use Javascript to do all of the processing so you don't need to reload. Or would the data show up in the page source? Maybe this would require an AJAX-style call to get the data?
It would be easier to just pass the form back to the server, retrieve the data, and display a popup that way. Not as pretty, but simple to code.
Regards
Jim
It would be easier to just pass the form back to the server, retrieve the data, and display a popup that way. Not as pretty, but simple to code.
Regards
Jim
My Addons
Banners Box 2.3.x Support
Categories Accordion Box 2.3.x Support
Categories Images Box 2.2x 2.3.x Support
Closest Shipper 2.2x Support
Document Manager 2.2x Support
Generic Box 2.3.x Support
Get 1 Free 2.2x Support
jQuery Banner Rotator 2.2x 2.3.x Support
Modular Front Page 2.3.x Support
Modular SEO Header Tags 2.3.x Support
MVS 2.2x Support
PDF Datasheet 2.3.x Support
Price Updater 2.2x
Products Specifications 2.2x 2.3.x Development Version Support Bugs/Suggestions
Request a Review 2.2x - 2.3.x Support
Similar Products Box 2.2x
Specials Image Overlay 2.3x Support
Theme Switcher 2.3.x Support
Banners Box 2.3.x Support
Categories Accordion Box 2.3.x Support
Categories Images Box 2.2x 2.3.x Support
Closest Shipper 2.2x Support
Document Manager 2.2x Support
Generic Box 2.3.x Support
Get 1 Free 2.2x Support
jQuery Banner Rotator 2.2x 2.3.x Support
Modular Front Page 2.3.x Support
Modular SEO Header Tags 2.3.x Support
MVS 2.2x Support
PDF Datasheet 2.3.x Support
Price Updater 2.2x
Products Specifications 2.2x 2.3.x Development Version Support Bugs/Suggestions
Request a Review 2.2x - 2.3.x Support
Similar Products Box 2.2x
Specials Image Overlay 2.3x Support
Theme Switcher 2.3.x Support
#-11
Posted 21 March 2012 - 07:37 PM
If I use Javascript alone to pull the data it would definitely require AJAX. If I pulled the seller info at the top of product_info I believe it would be visible via the source, but because of the complexity of this code and the fact that my boss is hounding me daily to finish this project (because HE already sold many slots on this site) I'm thinking that as long as no one can tell that their information is accessible and it looks as though CAPTCHA blocks bots then who cares if it really works
.
The only way I can think to do it would require a reload or a popup, otherwise the code would be visible in the source. If I made the pop_up process the form and pull the info from the database, would I need to use application_top at all?
The only way I can think to do it would require a reload or a popup, otherwise the code would be visible in the source. If I made the pop_up process the form and pull the info from the database, would I need to use application_top at all?
#-10
Posted 21 March 2012 - 08:18 PM
You don't have to use application_top, but that's where all of the action logic currently resides. Ripping that out is extra work for no real gain. Making major changes to osCommerce requires an understanding of the entire system. There's code in there to manage a lot of different processes from different sources. Removing it might impact something else that you still want to use. I would leave it alone and just add to it.
If you're doing everything in the popup, doesn't that add an extra step? Click once to get the popup, then again to submit the form. I would stay with a single form. Every click that you add to the process will cost you sales.
Regards
Jim
If you're doing everything in the popup, doesn't that add an extra step? Click once to get the popup, then again to submit the form. I would stay with a single form. Every click that you add to the process will cost you sales.
Regards
Jim
My Addons
Banners Box 2.3.x Support
Categories Accordion Box 2.3.x Support
Categories Images Box 2.2x 2.3.x Support
Closest Shipper 2.2x Support
Document Manager 2.2x Support
Generic Box 2.3.x Support
Get 1 Free 2.2x Support
jQuery Banner Rotator 2.2x 2.3.x Support
Modular Front Page 2.3.x Support
Modular SEO Header Tags 2.3.x Support
MVS 2.2x Support
PDF Datasheet 2.3.x Support
Price Updater 2.2x
Products Specifications 2.2x 2.3.x Development Version Support Bugs/Suggestions
Request a Review 2.2x - 2.3.x Support
Similar Products Box 2.2x
Specials Image Overlay 2.3x Support
Theme Switcher 2.3.x Support
Banners Box 2.3.x Support
Categories Accordion Box 2.3.x Support
Categories Images Box 2.2x 2.3.x Support
Closest Shipper 2.2x Support
Document Manager 2.2x Support
Generic Box 2.3.x Support
Get 1 Free 2.2x Support
jQuery Banner Rotator 2.2x 2.3.x Support
Modular Front Page 2.3.x Support
Modular SEO Header Tags 2.3.x Support
MVS 2.2x Support
PDF Datasheet 2.3.x Support
Price Updater 2.2x
Products Specifications 2.2x 2.3.x Development Version Support Bugs/Suggestions
Request a Review 2.2x - 2.3.x Support
Similar Products Box 2.2x
Specials Image Overlay 2.3x Support
Theme Switcher 2.3.x Support









