Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help Updating Module


Portman

Recommended Posts

Posted

Hi everyone,

I have installed the Modular Checkout pages addon so that I can add a modal info box to the products section of checkout_confirmation....

I have go it to work.... sort of ish...

I include below my Modified includes/modules/content/checkout_confirmation/cm_cc_products.php file ...

<?php
/*
  $Id$

  Modular Checkout by @raiwa
  [email protected]
  www.oscaddons.com
  
  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2018 osCommerce

  Released under the GNU General Public License
*/

  class cm_cc_products {
    var $code;
    var $group;
    var $title;
    var $description;
    var $sort_order;
    var $enabled = false;

    function __construct() {
      $this->code = get_class($this);
      $this->group = basename(dirname(__FILE__));

      $this->title = MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_TITLE;
      $this->description = MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_DESCRIPTION;
      $this->description .= '<div class="secWarning">' . MODULE_CONTENT_BOOTSTRAP_ROW_DESCRIPTION . '</div>';

      if ( defined('MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_STATUS') ) {
        $this->sort_order = MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_SORT_ORDER;
        $this->enabled = (MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_STATUS == 'True');
      }
    }

    function execute() {
      global $oscTemplate, $order, $currencies, $order_total_modules;

      $content_width = (int)MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_CONTENT_WIDTH;
      
      ob_start();
      include('includes/modules/content/' . $this->group . '/templates/tpl_' . basename(__FILE__));
      $template = ob_get_clean();

      $oscTemplate->addContent($template, $this->group);
    }

    function isEnabled() {
      return $this->enabled;
    }

    function check() {
      return defined('MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_STATUS');
    }

    function install() {
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Products information', 'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_STATUS', 'True', 'Should this module be shown on the checkout confirmation page?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Width', 'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_CONTENT_WIDTH', '12', 'What width container should the content be shown in?', '6', '1', 'tep_cfg_select_option(array(\'12\', \'11\', \'10\', \'9\', \'8\', \'7\', \'6\', \'5\', \'4\', \'3\', \'2\', \'1\'), ', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_SORT_ORDER', '200', 'Sort order of display. Lowest is displayed first.', '6', '1', now())");
*      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Modal Name', 'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_MODAL_BUTTONNAME', 'Latest Updates', 'Name for your custom box', '6', '8', now())");
*      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Modal class', 'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_MODAL_BUTTONCLASS', 'btn btn-primary', 'class', '6', '8', now())");
*      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Modal Box title', 'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_MODAL_TITLE', 'Information', 'title', '6', '8', now())");
*      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Modal Box content', 'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_MODAL_BODY', 'put your info here', 'modal content', '6', '8', now())"); 
 }

    function remove() {
      tep_db_query("delete from configuration where configuration_key in ('" . implode("', '", $this->keys()) . "')");
    }

    function keys() {
      return array('MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_STATUS', 
				   'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_CONTENT_WIDTH',
				   'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_SORT_ORDER'
*				   'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_MODAL_BUTTONNAME',
*				   'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_MODAL_BUTTONCLASS',
*				   'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_MODAL_TITLE',
*				   'MODULE_CONTENT_CHECKOUT_CONFIRMATION_PRODUCTS_MODAL_BODY');
    }
  }

I have added an '*' to the start of each line I have added ... as I said the modal part works my problem is that when I navigate to the Modules>Content>Products section of admin the extra fields I have created do not show up, essentially it looks identical to how it did before I added the extra lines of test.

 Likewise, when I save the changes to the module the default text that I have assigned to the fields does not show up... I only get the placeholders/variables showing up

I have uninstalled and reinstalled the module a number of times, there is obviously something I am missing in modifying this file, any help would be appreciated.

Archived

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

×
×
  • Create New...