Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Changing a form action


mrickert

Recommended Posts

Posted

When a customer clicks on a catagory, the list of items in that catagory appears. In that list for each item, there is a "buy now" button. I want to change the action of that button. In what file(s) should I be looking? I can't figure out where that output comes from. Thanks.

Posted

Starting places: :)

 

the button text is defined in: catalog\includes\languages\english.php

define('IMAGE_BUTTON_BUY_NOW', 'Buy Now');

 

the main links are at: catalog\includes\modules\product_listing.php

case 'PRODUCT_LIST_BUY_NOW':
		$lc_align = 'center';
		$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>?';
		break;

 

have fun :thumbsup:

one-click installation..

Dave's info

Posted

But what happens when the submit button is clicked is defined in /includes/application_top.php from these lines onwards:

// Shopping cart actions
 if (isset($HTTP_GET_VARS['action'])) {
// redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled
if ($session_started == false) {
  tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));
}

if (DISPLAY_CART == 'true') {
  $goto =  FILENAME_SHOPPING_CART;
  $parameters = array('action', 'cPath', 'products_id', 'pid');
} else {
  $goto = basename($PHP_SELF);
  if ($HTTP_GET_VARS['action'] == 'buy_now') {
	$parameters = array('action', 'pid', 'products_id');
  } else {
	$parameters = array('action', 'pid');
  }
}
switch ($HTTP_GET_VARS['action']) {

 

To write a form basically, you need to the submit button, a page where the form goes to after submit is hit, and then code which actions a script based on the submit button.

 

all the best, Terra

My code for combining PayPal IPN with ** QTPro 4.25 ** osC Affiliate ** CCGV(trad)

and how to solve the invoice already paid error

General info: Allow customer to delete order comment ** FTP Programs & Text Editors ** Amending order email **

Posted

Upon further review, this might be a little over my head, or at least the wrong way to look at things.

 

What I want to do is to have real-time pricing / availability of my products loaded upon every catalog browse. I have a method to do this, I basically query an external database and pull the information from it.

 

Correct me if I'm wrong, but basically the osc engine queries the osc database when a catagory name is clicked, then outputs all the information. So if I can grab that info before it is displayed, query my external data, then tie it all back together, I should be ok. Where does the database query take place? I'm looking at index.php and it may happen there? Is the query stored in $listing_sql?

Posted
Correct me if I'm wrong, but basically the osc engine queries the osc database when a catagory name is clicked, then outputs all the information. So if I can grab that info before it is displayed, query my external data, then tie it all back together, I should be ok. Where does the database query take place? I'm looking at index.php and it may happen there? Is the query stored in $listing_sql?

It's a mix of \index.php and \includes\modules\product_listing.php. In theory you should be able to do what you want with the approach described above .... I've changed the way categories are displayed on my site but found it easier to just rewrite the whole query & replace the existing code with a new query & output ... Sometimes trying to understand how osCom works takes longer than writing from scratch ... :D Terra

My code for combining PayPal IPN with ** QTPro 4.25 ** osC Affiliate ** CCGV(trad)

and how to solve the invoice already paid error

General info: Allow customer to delete order comment ** FTP Programs & Text Editors ** Amending order email **

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...