leeherron Posted March 27, 2003 Share Posted March 27, 2003 Is there any hidden problem with using text links instead of forms when adding items to the shopping cart? I want to use "Buy-Now" and "Add to Cart" text links instead of form images; any reason the following wouldn't work? Add to Cart: product_info.php?products_id=6&action=add_product buy now: default.php?action=buy_now&products_id=12 Cpath, and variables like it, will only be needed to maintain navigation state I assume seeing how I didn't see it embedded within the add-to form, and I also realize that the values will need to reflect the product values. Link to comment Share on other sites More sharing options...
toolcrazy Posted March 27, 2003 Share Posted March 27, 2003 The only problem I see is the problem with sessions. You create a link outside a form, search engines will follow the links and create a shopping cart with multiple items, which may cause them to end up in a loop. And they will steal valuable bandwidth, and create a very large number of sessions. Steve ------------------------- Link to comment Share on other sites More sharing options...
dele Posted March 28, 2003 Share Posted March 28, 2003 I have the same problem, and this reply to another post http://www.oscommerce.com/forums/viewtopic.php?t=37370 appears to suggest that there's also another problem with using straight links: Your tip is nice but you have made an error in your include file.... Try adding something to your cart without accepting 'cookies' and then clicking on one of the links in the header... You loose your cart contents. This happens because you have used plain html links. osCommerce links need to be made like this: <?php echo '<a href="' . tep_href_link('filename.php', '', 'NONSSL') . '">Your description</a>'; ?> The NONSSL should be SSL if you are connecting to a secure page. And the '' (empty) is to specify an optional parameter, like 'opt=param' in which case you would have the variable $opt on the linked page which would have 'param' as a value. HTH Mattice Link to comment Share on other sites More sharing options...
leeherron Posted March 29, 2003 Author Share Posted March 29, 2003 So something like this should work? <?php echo '<a href="http://www.mydomain.com/catalog/' . tep_href_link('product_info.php', 'products_id=6&action=add_product ', 'NONSSL') . '">Add to Cart</a>'; ?> Link to comment Share on other sites More sharing options...
leeherron Posted March 29, 2003 Author Share Posted March 29, 2003 Some useful notes on documentation found regarding this function: ## catalogFAQ: 05 ## q. Why is the session-ID screwing up my urls in href links? a. This project uses a custom function for all href links, called tep_href_link(). This function is used for normal href links, forms, and header redirects. The best way to avoid this problem is to use the function as: <?php echo '<a href="' . tep_href_link('index.php', 'a=b', 'NONSSL') . '">my link</a>'; ?> ## catalog#CHANGELOG.1.1.1.1 ## * tep_href_link now removes extra & and ? characters in the URL ## thread ## http://www.oscommerce.com/forums/viewtopic.php...ght=tephreflink Other than this, I haven't found any formal documentation on it. (so far) Link to comment Share on other sites More sharing options...
leeherron Posted March 29, 2003 Author Share Posted March 29, 2003 Okay, assuming that the tep_href_link function allows us to use text links without causing problems with/without cookies and maintains SIDs, then why does OSC use forms for each buy-now link instead of a text link; is there a reason? Link to comment Share on other sites More sharing options...
dele Posted March 29, 2003 Share Posted March 29, 2003 The guy who recommended the tep-link solution (Mattice) responded to my post by saying the Buy Button text link is 'not really possible'. See http://www.oscommerce.com/forums/viewtopic.php?p=137847 I will soon experiment with all the possibilities. I'm certain that something can be done, somehow - probably with compromises. Link to comment Share on other sites More sharing options...
delaen Posted March 29, 2003 Share Posted March 29, 2003 You could always take a screenshot of the text and then use it as the image. Link to comment Share on other sites More sharing options...
leeherron Posted March 30, 2003 Author Share Posted March 30, 2003 The guy who recommended the tep-link solution (Mattice) responded to my post by saying the Buy Button text link is 'not really possible'. Reading his post, it appears that he was writing mostly about the "outside page" being used. His post reads as though the tep_href_link function will work as long as it's used within the catalog pages; outside of these pages seems to be the problem -- according to his post. Would love to see a response from someone on the OSC team here. You could always take a screenshot of the text and then use it as the image. Only as a last resort; one of the problems using the method that OSC uses is when the number of items (forms) exceeds 10, IE starts to act unpredictably. Link to comment Share on other sites More sharing options...
delaen Posted April 10, 2003 Share Posted April 10, 2003 If you just want a text link instead of an image to submit your form, you can use code something like this to submit it: <a href="javascript:void(document.cart_quantity.submit())">Add to Cart</a> That doesn't get rid of using a form though. Link to comment Share on other sites More sharing options...
leeherron Posted April 10, 2003 Author Share Posted April 10, 2003 Considering that OSC uses text-links for category links, which are created with the tep_href_link() function, it should work for Buy-now text links as well .. would love to hear from someone on the team to confirm that is how it *should* work .. we've managed to get it to work with a slight work around, but don't know if it was required or some kind of bug. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.