Jump to content

Archived

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

ce7

pass categories and product inforamtion to new page

Recommended Posts

hi

I have phoenix 1075 website, when price is 0, the click button will redirect to a quote page (copy and modified from contact_us page).

when point to the button, it show up the categories and product information, and when open the link,

will the categories and product information be saved when the form been sent out to shop owner?
if not how can i make it been saved and send out with the quote form at the same time?

define('EMAIL_SUBJECT', 'Enquiry from ' . STORE_NAME);
Eventually I like to have quote form with the requirement details plus store information and categories/product information.

any help or suggestion is appreciated, thanks!
image.png.165cd495e8d6adcf9a97a8e44de5dfa1.png

image.png.b6f96ca111bebd902230d329dcf61bb8.png

image.png.d66120193c1f341bcf9397cedc174110.png

 

Share this post


Link to post
Share on other sites

also i created quote form copy from contact_us page, however, it doesn't sent out and redirect to the index page.
i have pages like this:

catalog/quote.php
catalog/template/default/includes/pages/quote.php
catalog/includes/modules/action_recorder/ar_quote.php

did i miss something or some page so that it will not sent out properly?

any suggestion? thanks!

Share this post


Link to post
Share on other sites

Perhaps post the code where you say tep_draw_form ?  E.g. for adding to cart: 


<?php echo tep_draw_form('cart_quantity', tep_href_link('product_info.php', tep_get_all_get_params(['action']). 'action=add_product', 'NONSSL'), 'post', 'role="form"'); ?>

I suspect that you need, but are not using, tep_get_all_get_params. 


Always back up before making changes.

Share this post


Link to post
Share on other sites

@ecartz  hi Matt, thank you for your reply.

here is my code for catalog/quote.php (I basically copy contact_us page, add make it easy just add extra MOBILE details for quote form, the image i posted was from old version osC website.)

Do I miss out some other pages?

	<?php
/*
  $Id$
	  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com
	  Copyright (c) 2020 osCommerce
	  Released under the GNU General Public License
*/
  ini_set('display_errors', '1');
  error_reporting(E_ALL & ~E_NOTICE);
  //error_reporting(E_ALL);
  ini_set("auto_detect_line_endings", true);
 
 
 
  require 'includes/application_top.php';
	  require "includes/languages/$language/quote.php";
	  if (tep_validate_form_action_is('send')) {
    $error = false;
	    $name = tep_db_prepare_input($_POST['name']);
    $email_address = tep_db_prepare_input($_POST['email']);
//////////////////////////////////////////////////////////////////////////////
    $mobile = tep_db_prepare_input($_POST['mobile']);
  //////////////////////////////////////////////////////////////////////////////
    $enquiry = tep_db_prepare_input($_POST['enquiry']);
    
    
    
    
	    if (!tep_validate_email($email_address)) {
      tep_block_form_processing();
	      $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);
    }
    
    $OSCOM_Hooks->call('siteWide', 'injectFormVerify');
	    $actionRecorder = new actionRecorder('ar_quote', ($_SESSION['customer_id'] ?? null), $name);
    if (!$actionRecorder->canPerform()) {
      tep_block_form_processing();
	      $actionRecorder->record(false);
	      $messageStack->add('contact', sprintf(ERROR_ACTION_RECORDER, (defined('MODULE_ACTION_RECORDER_QUOTE_EMAIL_MINUTES') ? (int)MODULE_ACTION_RECORDER_QUOTE_EMAIL_MINUTES : 15)));
    }
	    if (tep_form_processing_is_valid()) {
   // tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, sprintf(EMAIL_SUBJECT, STORE_NAME), $enquiry, $name, $email_address);
      tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, sprintf(EMAIL_SUBJECT, STORE_NAME), $enquiry, $name, $email_address, $mobile);
	      $actionRecorder->record();
	      tep_redirect(tep_href_link('index.php', 'action=success'));
    }
  }
	  require $oscTemplate->map_to_template(__FILE__, 'page');
	  require 'includes/application_bottom.php';
	 
	

and include/modules/action_recorder/ar_quote.php code as below:

	<?php
/*
  $Id$
	  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com
	  Copyright (c) 2013 osCommerce
	  Released under the GNU General Public License
*/
	  class ar_quote {
    var $code = 'ar_quote';
    var $title;
    var $description;
    var $sort_order = 0;
    var $minutes = 15;
    var $identifier;
	    function __construct() {
      $this->title = MODULE_ACTION_RECORDER_QUOTE_TITLE;
      $this->description = MODULE_ACTION_RECORDER_QUOTE_DESCRIPTION;
	      if ($this->check()) {
        $this->minutes = (int)MODULE_ACTION_RECORDER_QUOTE_EMAIL_MINUTES;
      }
    }
	    function setIdentifier() {
      $this->identifier = tep_get_ip_address();
    }
	    function canPerform($user_id, $user_name) {
      $check_query = tep_db_query("select date_added from action_recorder where module = '" . tep_db_input($this->code) . "' and (" . (!empty($user_id) ? "user_id = '" . (int)$user_id . "' or " : "") . " identifier = '" . tep_db_input($this->identifier) . "') and date_added >= date_sub(now(), interval " . (int)$this->minutes  . " minute) and success = 1 order by date_added desc limit 1");
      if (tep_db_num_rows($check_query)) {
        return false;
      } else {
        return true;
      }
    }
	    function expireEntries() {
      tep_db_query("delete from action_recorder where module = '" . $this->code . "' and date_added < date_sub(now(), interval " . (int)$this->minutes  . " minute)");
	      return tep_db_affected_rows();
    }
	    function check() {
      return defined('MODULE_ACTION_RECORDER_QUOTE_EMAIL_MINUTES');
    }
	    function install() {
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Minimum Minutes Per E-Mail', 'MODULE_ACTION_RECORDER_QUOTE_EMAIL_MINUTES', '15', 'Minimum number of minutes to allow 1 e-mail to be sent (eg, 15 for 1 e-mail every 15 minutes)', '6', '0', now())");
    }
	    function remove() {
      tep_db_query("delete from configuration where configuration_key in ('" . implode("', '", $this->keys()) . "')");
    }
	    function keys() {
      return array('MODULE_ACTION_RECORDER_QUOTE_EMAIL_MINUTES');
    }
  }
?>
	

and final code below is for
template/default/includes/pages/quote.php

	<?php
/*
  $Id$
	  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com
	  Copyright (c) 2020 osCommerce
	  Released under the GNU General Public License
*/
 
 
  $breadcrumb->add(NAVBAR_TITLE, tep_href_link('quote.php'));
	  require $oscTemplate->map_to_template('template_top.php', 'component');
?>
	<h1 class="display-4"><?php echo HEADING_TITLE; ?></h1>
	<?php
  if ($messageStack->size('quote') > 0) {
    echo $messageStack->output('quote');
  }
	  if (isset($_GET['action']) && ($_GET['action'] == 'success')) {
?>
	  <div class="alert alert-info" role="alert"><?php echo TEXT_SUCCESS; ?></div>
	  <div class="buttonSet">
    <div class="text-right"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'fas fa-angle-right', tep_href_link('index.php'), null, null, 'btn-light btn-block btn-lg'); ?></div>
  </div>
	<?php
  } else {
    echo tep_draw_form('quote', tep_href_link('quote.php', 'action=send'), 'post', '', true);
    ?>
 
  <div class="row">
    <?php echo $oscTemplate->getContent('quote'); ?>
  </div>
	  <p class="text-danger text-right"><?php echo FORM_REQUIRED_INFORMATION; ?></p>
  <div class="w-100"></div>
 
  <div class="form-group row">
    <label for="inputFromName" class="col-sm-3 col-form-label text-right"><?php echo ENTRY_NAME; ?></label>
    <div class="col-sm-9">
      <?php
      echo tep_draw_input_field('name', NULL, 'required aria-required="true" id="inputFromName" placeholder="' . ENTRY_NAME_TEXT . '"');
      echo FORM_REQUIRED_INPUT;
      ?>
    </div>
  </div>
 
  <div class="form-group row">
    <label for="inputFromEmail" class="col-sm-3 col-form-label text-right"><?php echo ENTRY_EMAIL; ?></label>
    <div class="col-sm-9">
      <?php
      echo tep_draw_input_field('email', NULL, 'required aria-required="true" id="inputFromEmail" placeholder="' . ENTRY_EMAIL_TEXT . '"', 'email');
      echo FORM_REQUIRED_INPUT;
      ?>
    </div>
  </div>
 
<!---BOF Mobile------------------------------------------------------------------------->
  <div class="form-group row">
    <label for="inputFromMobile" class="col-sm-3 col-form-label text-right"><?php echo ENTRY_MOBILE; ?></label>
    <div class="col-sm-9">
      <?php
      echo tep_draw_input_field('mobile', NULL, 'required aria-required="true" id="inputFromMobile" placeholder="' . ENTRY_MOBILE_TEXT . '"', 'mobile');
      echo FORM_REQUIRED_INPUT;
      ?>
    </div>
  </div>  
<!---EOF Mobile------------------------------------------------------------------------->
	
  <div class="form-group row">
    <label for="inputEnquiry" class="col-sm-3 col-form-label text-right"><?php echo ENTRY_ENQUIRY; ?></label>
    <div class="col-sm-9">
      <?php
      echo tep_draw_textarea_field('enquiry', 'soft', 20, 5, NULL, 'required aria-required="true" id="inputEnquiry" placeholder="' . ENTRY_ENQUIRY_TEXT . '"');
      echo FORM_REQUIRED_INPUT;
      ?>
    </div>
  </div>    
	
  </div>  
	  <?php
  echo $OSCOM_Hooks->call('siteWide', 'injectFormDisplay');
  ?>
 
  <div class="buttonSet">
    <div class="text-right"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'fas fa-paper-plane', null, 'primary', null, 'btn-success btn-block btn-lg'); //english.php ?></div>
  </div>
	</form>
	<?php
  }
	  require $oscTemplate->map_to_template('template_bottom.php', 'component');
?>
	 
	

and on index page the quote button:

so when click on index, it will show the product info on url (i am not sure if it will send this information with the form or not??? because i can not make the form submit and sent out

 

 

 

image.png

Share this post


Link to post
Share on other sites

for other people's information if they also try to create a new page, I uninstall and reinstall the action recorder quote, and it finally working now..

but i checked the email i received, it doesn't record the cateories/product information, nor the mobile detail...just the default enquiry column information on email...

Share this post


Link to post
Share on other sites

Change

    echo tep_draw_form('quote', tep_href_link('quote.php', 'action=send'), 'post', '', true);

to

    echo tep_draw_form('quote', tep_href_link('quote.php', tep_get_all_get_params(['action']) . 'action=send'), 'post', '', true);

 


Always back up before making changes.

Share this post


Link to post
Share on other sites

×