Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Simple Email Enquiry option instead of payment


Ian.G

Recommended Posts

Hi there,

 

just implemented my first os-commerce based site which I am very pleased with. Its a great way of getting a LOT of functionality very quickly.

 

I do however, have a small issue. The customer I have built the site for does not want to allow payment to be taken at the moment (I think they plan to use at least paypal eventually). What they would like is a means to have an enquiry email sent to both themselves and the customer listing all the products that were in the cart.

 

They want to do this as most of the products they sell are 'special order' or one-off custom parts for cars.

 

So basically when they check out it simply asks for all their regular details but does not capture payment details - it simply needs to send a mail to the customer and the shop with details of the cart.

 

Is there any way to achieve this ? I've turned off all payment and shipping options - but this just makes things confusing for the user. Even being able to turn of the cart functionality would help

 

I've had a good look around the forums but I cant seem to find what I'm looking for. Anyone have any ideas ?

 

Regards

 

Ian.

Link to comment
Share on other sites

I would suggest you redo the shipping, payment confirmation and process files in the checkout. In reality, you would need to edit the checkout confirmation and checkout_process files only.

 

I would rename the two files to something else (so it will be easy to re-introduce them back in later). Then remove the checking for shipping and payment. If they want to keep the shipping this is fine as well, then you would need to remove the payment checking only.

 

What this will do for you is allow orders to be processed, saved within the cart system as an order and send the emails with minimal changes to the system.

 

cheers,

Peter M

Peter McGrath

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

See my Profile (click here) for more information and to contact me for professional osCommerce support that includes SEO development, custom development and security implementation

Link to comment
Share on other sites

Ok,

 

so I did some hunting about and I think I came up with a reasonable way of doing this by modifying an existing payments module:

 

I started with the cash only module as this one does not take any additional fields from the user/make any integration to a payments site - this means there was less stuff to remove from the code before it started to work.

 

So...

 

here is what I did

 

create a new file includes/modules/payment/enquiry.php with the following content

 

<?php

/*

 $Id: enquiry.php



Enquiry Payments Module

This module sends the contents of the users shopping basket as an equiry only instead of an order

*/



class enquiry

  {

	var $code, $title, $description, $enabled;



	// class constructor



	function enquiry()

	{

		  global $order;



		  $this->code = 'enquiry';

		  $this->title = MODULE_PAYMENT_ENQUIRY_TEXT_TITLE;

		  $this->description = MODULE_PAYMENT_ENQUIRY_TEXT_DESCRIPTION;

		  $this->sort_order = MODULE_PAYMENT_ENQUIRY_SORT_ORDER;

		  $this->enabled = ((MODULE_PAYMENT_ENQUIRY_STATUS == 'True') ? true : false);



		  if ((int)MODULE_PAYMENT_ENQUIRY_ORDER_STATUS_ID > 0)

		  {

			$this->order_status = MODULE_PAYMENT_ENQUIRY_ORDER_STATUS_ID;

		  }



		  if (is_object($order)) $this->update_status();



		  $this->email_footer = MODULE_PAYMENT_ENQUIRY_TEXT_EMAIL_FOOTER;

	}



	// class methods



	function update_status()

	{

		  global $order;



		  if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_ENQUIRY_ZONE > 0) )

		  {

			$check_flag = false;

			$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_ENQUIRY_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");

			while ($check = tep_db_fetch_array($check_query))

			{

				  if ($check['zone_id'] < 1)

				  {

					$check_flag = true;

					break;

				  }

				  elseif ($check['zone_id'] == $order->billing['zone_id'])

				  {

					$check_flag = true;

					break;

				  }

			}



			if ($check_flag == false)

			{

				  $this->enabled = false;

			}

		  }

	}



	function javascript_validation()

	{

		// No validation is required - we are not capturing any details from the user

		  return false;

	}



	function selection()

	{

		  return array('id' => $this->code, 'module' => $this->title);

	}



	function pre_confirmation_check()

	{

		// Nothing to check here - enquiry only

		  return false;

	}



	function confirmation()

	{

		  return array('title' => MODULE_PAYMENT_ENQUIRY_TEXT_DESCRIPTION);

	}



	function process_button()

	{

		  return false;

	}



	function before_process()

	{

		  return false;

	}



	function after_process()

	{

		  return false;

	}



	function get_error()

	{

		  return false;

	}



	function check()

	{

		  if (!isset($this->_check))

		  {

			$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_ENQUIRY_STATUS'");

			$this->_check = tep_db_num_rows($check_query);

		  }



		  return $this->_check;

	}



	function install()

	{

		  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Enquiry Module', 'MODULE_PAYMENT_ENQUIRY_STATUS', 'True', 'Do you want to accept Enquiries ?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now());");

		  // tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Make Payable to:', 'MODULE_PAYMENT_ENQUIRY_PAYTO', '', 'Who should payments be made payable to?', '6', '1', now());");

		  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_ENQUIRY_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");

		  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_ENQUIRY_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");

		  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_ENQUIRY_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");

	}



	function remove()

	{

		  tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");

	}



	function keys()

	{

		  // return array('MODULE_PAYMENT_ENQUIRY_STATUS', 'MODULE_PAYMENT_ENQUIRY_ZONE', 'MODULE_PAYMENT_ENQUIRY_ORDER_STATUS_ID', 'MODULE_PAYMENT_ENQUIRY_SORT_ORDER', 'MODULE_PAYMENT_ENQUIRY_PAYTO');

		  return array('MODULE_PAYMENT_ENQUIRY_STATUS', 'MODULE_PAYMENT_ENQUIRY_ZONE', 'MODULE_PAYMENT_ENQUIRY_ORDER_STATUS_ID', 'MODULE_PAYMENT_ENQUIRY_SORT_ORDER');

	}

  }

?>

 

next create the language specific part of this module (in my case english) in includes/languages/english/modules/payment/enquiry.php

 

<?php

/*

 $Id: enquiry.php



 This is a simple payment module for OSCommerce that routes the contents of the customers shopping basket as an enquiry

*/



 define('MODULE_PAYMENT_ENQUIRY_TEXT_TITLE', 'Enquiry Only');

 define('MODULE_PAYMENT_ENQUIRY_TEXT_DESCRIPTION', '<b>Note:</b> The contents of your shopping basket as an enquiry and <b>NOT</b> an order');

 define('MODULE_PAYMENT_ENQUIRY_TEXT_EMAIL_FOOTER', '<b>Note:</b>This is an enquiry based upon the contents of your shopping cart.  No money has been taken.  Our sales team will be in touch shortly to advise on product availability.');

?>

 

next I turned off all shipping modules (people suggested you needed to at least use the flat rate shipping module so you dont break the checkout process - this appears not to be the case)

 

I then turned off all payment modules and installed the enquiry module that the above to files define.

 

Next under Localization I created a new order status called 'Enquiry Only'.

I Modified the 'Set order status' property of my new enquiry payment module to be 'Enquiry Only'. This way it makes it easy to differentiate orders from enquiries in the orders section of the admin site.

 

I then put a simple order through the system - and sure enough the user making the order got an email as normal stating at the bottom it was an enquiry only and the order appeared in the admin side of oscommerce with enquiry only status.

 

I think this meets most of my requirements - however it would be nice to be able to send an email notification to the [email protected] email address - I think I can probably achieve this by adding emails to the 'Send Extra Order Emails To' field in the oscommerce admin pages.

 

So I guess thats it really.

 

I hope somebody else finds this useful or if you have any suggestions for improvements please let me know

 

Regards

 

Ian.

Link to comment
Share on other sites

Hey Peter

 

thanks for getting back in touch on this one.

 

Do you think my solution above is a reasonable way of getting what I want.

I guess the good part is that they can choose to turn on payment modules eventually whilst still making use of the enquiry only module that I implemented.

 

I hope I have done the right thing.

Link to comment
Share on other sites

You solution will work as well, no reason it would not. The only thing your solution does do theough is add in another step which is not needed in the checkout portion of the system.

 

Some like to minimize the amount of clicks, while others do not care about this. Your solution will work just fine though ;)

 

cheers,

Peter M

Peter McGrath

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

See my Profile (click here) for more information and to contact me for professional osCommerce support that includes SEO development, custom development and security implementation

Link to comment
Share on other sites

You solution will work as well, no reason it would not. The only thing your solution does do theough is add in another step which is not needed in the checkout portion of the system.

 

Some like to minimize the amount of clicks, while others do not care about this. Your solution will work just fine though ;)

 

cheers,

Peter M

 

Ha - yeah - I can totally see where you are coming from here. I just wanted to minimise the number of changes required to the core oscommerce code so that I didnt end up breaking things in the long term. I am more of a J2EE developer than php - but I can see me doing more of this in the future.

 

Will find out if the customer is happy later today. - and the 'Send extra order emails To' property seems to do the trick of cc'ing the order back to the shop when its made - this stops them from needing to get into the admin side of the site just to see if any orders have arrived.

 

I guess I could add another order status of 'Enquiry Answered' so the customer gets another update email when the shop have dropped them a mail.

 

Very pleased with what oscommerce has done so far - all I had to do was convert all their old product data and do a bit of CSS work and hey presto - a commerce site up and running :D

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...