Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Slim Checkout for BS


raiwa

Recommended Posts

10 hours ago, Stephan Gebbers said:

@raiwa the addon works but kills <title></title> 

when i activate the slim checkout addon all pages have an empty title.
is it my shop only or can someone else reproduce this?

Hello Stephan @Stephan Gebbers,

Thank you for the report. Yes, you are right.

Here is the fix:

in the ht module find:

  if (class_exists('oscTemplate')) {
    class oscTemplateExt extends oscTemplate {
      public $_blocks = array();
      public $_hide_column = false;

      function __construct() {
        global $PHP_SELF, $oscTemplate;
        $this->_blocks = $oscTemplate->_blocks;
      }

change to:

  if (class_exists('oscTemplate')) {
    class oscTemplateExt extends oscTemplate {
      public $_title;
      public $_blocks = array();
      public $_hide_column = false;

      function __construct() {
        global $PHP_SELF, $oscTemplate;
        $this->_title = $oscTemplate->_title;
        $this->_blocks = $oscTemplate->_blocks;
      }

I'll upload the update with the fix now

Edited by raiwa
Link to comment
Share on other sites

@raiwa thanks! Titles are back.

i did a compare of product info page with and without your module. (the module should have no impact on this page)
here is another line that disappears with your module enabled.

<noscript><div class="no-script"><div class="no-script-inner"><p><strong>JavaScript scheint in ihrem Browser deaktiviert zu sein.</strong></p><p>Sie müssen JavaScript in Ihrem Browser aktivieren um den den vollen Funktionsumfang der Webseite nutzen zu können. <a href="http://www.enable-javascript.com/de/" target="_blank" rel="nofollow">Hier klicken für Hilfe zur Aktivierung von JavaScript in ihrem Browser</a>.</div></div></noscript>

Why has the module so much influence on every shop page, when it should be active on the selected pages only?

checkout_shipping.php
checkout_payment.php
checkout_confirmation.php

Regards,
Stephan

 

 

Link to comment
Share on other sites

Hello Stephan @Stephan Gebbers,

The template class extension overwrites the core template class and therefore has influence on all pages.

I can't reproduce the concrete error you report. On my develop store the javascript alert shows with the actual version. However, can you please double check and add this modification to the header tag:

  if (class_exists('oscTemplate')) {
    class oscTemplateExt extends oscTemplate {
      public $_title;
      public $_blocks = array();
      public $_content = array();
      public $_hide_column = false;
      public $_data = array();

      function __construct() {
        global $PHP_SELF, $oscTemplate;
        $this->_title = $oscTemplate->_title;
        $this->_blocks = $oscTemplate->_blocks;
        $this->_blocks = $oscTemplate->_content;
        $this->_blocks = $oscTemplate->_data;
      }

Can you please check first if it really doesn't show with the actual version.

Then please add only the 2 lines with "$_content" and then only the 2 lines with "$_data".

Let me know and I'll update.

EDIT: could it reproduce now, I'l let you know.

Thanks and kind regards

Rainer

Edited by raiwa
Link to comment
Share on other sites

Hello Stephan @Stephan Gebbers,

 

I checked now and with the modifications above suggested it disappears because the correspondant methods would need to be used in the template extension too.

Again, for me it works just fine with the actual version 1.1:

  if (class_exists('oscTemplate')) {
    class oscTemplateExt extends oscTemplate {
      public $_title;
      public $_blocks = array();
      public $_hide_column = false;

      function __construct() {
        global $PHP_SELF, $oscTemplate;
        $this->_title = $oscTemplate->_title;
        $this->_blocks = $oscTemplate->_blocks;
      }

 

Link to comment
Share on other sites

Congrats Rainer, and many thanks again for your work.

I've not tested it. I'm just writing to share a hack that I used for a similar purpose. Installing Dynamic Template System you can leave any page without boxes. It is not exactly the same as your proposal, since you still have header and footer in your pages, but you get it clean enough (at least for me). Also, you can install Multi Sidebox Banners 8 x (NEW), and by making an empty sidebox (with a transparent pixel, i.e.), you can play with the way that pages are shown. Certain pages can have a column of boxes at the right (which in fact can be empty, simply an space, like an indent), some other at the left, other pages can have both or none. Specially interesting for me is the possibilities offered by that "empty box", which gives more options for designing your shop.

Hope this can be helpful for someone. 

Shopowner, not coder, experienced copypaster  :D

Link to comment
Share on other sites

17 hours ago, raiwa said:

Hello Stephan @Stephan Gebbers,

The template class extension overwrites the core template class and therefore has influence on all pages.

I can't reproduce the concrete error you report. On my develop store the javascript alert shows with the actual version. However, can you please double check and add this modification to the header tag:


  if (class_exists('oscTemplate')) {
    class oscTemplateExt extends oscTemplate {
      public $_title;
      public $_blocks = array();
      public $_content = array();
      public $_hide_column = false;
      public $_data = array();

      function __construct() {
        global $PHP_SELF, $oscTemplate;
        $this->_title = $oscTemplate->_title;
        $this->_blocks = $oscTemplate->_blocks;
        $this->_blocks = $oscTemplate->_content;
        $this->_blocks = $oscTemplate->_data;
      }

Can you please check first if it really doesn't show with the actual version.

Then please add only the 2 lines with "$_content" and then only the 2 lines with "$_data".

Let me know and I'll update.

EDIT: could it reproduce now, I'l let you know.

Thanks and kind regards

Rainer

@raiwa yep, those changes made it worse. i just moved the module up in sort order to be the first ht module. it looks better now.

Regards,
Stephan

 

 

Link to comment
Share on other sites

1 hour ago, Stephan Gebbers said:

@raiwa yep, those changes made it worse. i just moved the module up in sort order to be the first ht module. it looks better now.

Regards,
Stephan

I tested with different sort orders and it is stable for me in any order.

Link to comment
Share on other sites

3 minutes ago, raiwa said:

I tested with different sort orders and it is stable for me in any order.

yes, your module was working always. i just saw that it seems to have influenced the noscript message ht module output. the index or product page  sourcecode was different switching your module on and off. different by this one no script message line. 

 

 

Link to comment
Share on other sites

6 minutes ago, Stephan Gebbers said:

yes, your module was working always. i just saw that it seems to have influenced the noscript message ht module output. the index or product page  sourcecode was different switching your module on and off. different by this one no script message line. 

I understood, but as I stated, I tried to reproduce this and for me it's stable. No way to get that line not to displayed.

Can you please post a list of all ht modules you are using and their sort order.

Then I'll try again.

Link to comment
Share on other sites

10 minutes ago, raiwa said:

I understood, but as I stated, I tried to reproduce this and for me it's stable. No way to get that line not to displayed.

Can you please post a list of all ht modules you are using and their sort order.

Then I'll try again.

see attached image

ht_modules.jpg

 

 

Link to comment
Share on other sites

I do no not have all of your third party ht modules. Could you just try to switch off all ht modules which are not standard oscommerce and check if it's then stable. If yes, then switch back one by one the other modules to find out which one interferes.

 

Another question: your includes/classes/osc_template.php is unmodified?

Link to comment
Share on other sites

18 minutes ago, raiwa said:

Another question: your includes/classes/osc_template.php is unmodified?

not modified, but i updatet it to the most recent version now (inlcuding hardcoded paths)

ok, it seems the noscript ht module has been updated compared to my version of the module. i got the version from github to overwrite my version now. That seems to fix the problem finally :)

it changed this line in the noscript module

$oscTemplate->addContent('<noscript><div class="no-script"><div class="no-script-inner">' . MODULE_HEADER_TAGS_NOSCRIPT_TEXT . '</div></div></noscript>', 'navigation');

to

$oscTemplate->addBlock('<noscript><div class="no-script"><div class="no-script-inner">' . tep_output_string(MODULE_HEADER_TAGS_NOSCRIPT_TEXT) . '</div></div></noscript>', $this->group);

 

 

 

Link to comment
Share on other sites

Ok, very good. That means I have to add the content var and content function to the class extension for compatibility with the older version and other third party ht modules.

Thank you and best regards

Rainer

Link to comment
Share on other sites

@Stephan Gebbers Hello Stephan,

I did an exhausted search through all ht modules I have available, 2.3.4 standard, all BS versions and all third party ht modules I have on my test and develop stores.

There isn't any which uses

$oscTemplate->addContent......

This is just wrong coded. Header Tags all use:

$oscTemplate->addBlock....

I do not know where you got your version, "addContent" was never used in the noscript ht module since the very first version.

https://github.com/gburton/Responsive-osCommerce/commits/master/includes/modules/header_tags/ht_noscript.php

"addContent" is only used by content modules.

 

rgds

Rainer

Edited by raiwa
Link to comment
Share on other sites

2 hours ago, raiwa said:

@Stephan Gebbers Hello Stephan,

I did an exhausted search through all ht modules I have available, 2.3.4 standard, all BS versions and all third party ht modules I have on my test and develop stores.

There isn't any which uses


$oscTemplate->addContent......

This is just wrong coded. Header Tags all use:


$oscTemplate->addBlock....

I do not know where you got your version, "addContent" was never used in the noscript ht module since the very first version.

https://github.com/gburton/Responsive-osCommerce/commits/master/includes/modules/header_tags/ht_noscript.php

"addContent" is only used by content modules.

 

rgds

Rainer

actually ht_noscript now is a content module he's got it in the wrong place - it should be in the content header group

(and maybe Gary should have renamed it when he moved it!)

Edited by BrockleyJohn

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

10 minutes ago, BrockleyJohn said:

actually ht_noscript now is a content module he's got it in the wrong place - it should be in the content header group

Sorry John @BrockleyJohn,

now I'm lost. In the last EDGE "no script" is still in header tags and there is no "no script" header content module:

https://github.com/gburton/Responsive-osCommerce/tree/master/includes/modules/content/header

https://github.com/gburton/Responsive-osCommerce/blob/master/includes/modules/header_tags/ht_noscript.php

 

or I miss something, please clarify.

 

Edited by raiwa
Link to comment
Share on other sites

8 minutes ago, raiwa said:

Sorry John @BrockleyJohn,

now I'm lost. In the last EDGE "no script" is still in header tags and there is no "no script" header content module:

or I miss something, please clarify.

Yes - at some point it has moved back again. The thing is the noscipt module gives you an html error if you use it because the tag noscript only belongs in the body. Thus it needs to be a content module (now I look back, a navbar one not a header one).

https://github.com/gburton/Responsive-osCommerce/pull/237

and

https://github.com/gburton/Responsive-osCommerce/issues/181

...it might be my fault - it's the sort of thing that might have happened in merging the php7 changes

Edited by BrockleyJohn

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

Link to comment
Share on other sites

5 minutes ago, raiwa said:

@BrockleyJohn,

OK, Thank you, but as far as I can see this has never been core. At least what is possible to see in the ht_noscript history:

https://github.com/gburton/Responsive-osCommerce/commits/master/includes/modules/header_tags/ht_noscript.php

Even if it had, I don't think you'd see it there, as the content module would be treated as a different file. I don't think git understands moving a file, it deletes one and creates another somewhere else. But you're right, I don't think it got merged (so it's not my fault after all ;)

I bet that's where his code came from, though.

Edited by BrockleyJohn

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

https://github.com/gburton/Responsive-osCommerce/pull/237

well, at least it would explain where the code is coming from. i try to keep up with all changes of 2.3.4BS as good as possible, but i dont use github directly but insert changes manually or with "beyond compare". maybe i did not realize that "closed" means its not going into the projects code. well, at least we found this error now. 

anyway, thanks again for the title fix @raiwa :)

 

 

Link to comment
Share on other sites

  • 10 months later...

Great Add-On @raiwa!!!

Very Well Done Sir!!!

I do seem to have a bug in my install...

When I install the module everything is good... If I go in and edit ( even if I do not change anything ) and click save...

The module does not save my settings and it clears out all of the settings leaving the modules content blank...

Any ideas here?

I have attached 3 screenshots which I hope help explain the problem I am encountering...

Slim Checkout Install.PNG

Slim Checkout Save Result.PNG

Slim Checkout Save.PNG

Link to comment
Share on other sites

hello @Bobber,

Whis is your exact OsCommerce version (if EDGE, aprox. download date) and PHP version, please. Please check also your error log if you see any related error.

Did you try to uninstall and reinstall the module.

Edited by raiwa
Link to comment
Share on other sites

27 minutes ago, raiwa said:

hello @Bobber,

Whis is your exact OsCommerce version (if EDGE, aprox. download date) and PHP version, please. Please check also your error log if you see any related error.

Did you try to uninstall and reinstall the module.

Thank you for your help @raiwa!!!

Yes... When I uninstall and reinstall I have the same issues... it does "reset" the module to the coded preferences in the module.

osCommerce Online Merchant v2.3.4.1 (Frozen CE Version)

HTTP Server:    Apache
PHP Version:    5.6.38 (Zend: 2.6.0)

I checked my "php_errorlog" and there are no error associated with this problem and no errors for this week in general...

below is my /includes/modules/header_tags/ht_slim_checkout.php file

<?php
/*
  $Id$
  Slim Checkout by @raiwa Rainer Schmied / [email protected]  / www.oscaddons.com
  
  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2017 osCommerce

  Released under the GNU General Public License
*/

  class ht_slim_checkout {
    var $code = 'ht_slim_checkout';
    var $group = 'header_tags';
    var $title;
    var $description;
    var $sort_order;
    var $enabled = false;

    function __construct() {
      $this->title = MODULE_HEADER_TAGS_SLIM_CHECKOUT_TITLE;
      $this->description = MODULE_HEADER_TAGS_SLIM_CHECKOUT_DESCRIPTION;

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

    function execute() {
      global $oscTemplate;

      $oscTemplate = new oscTemplateExt;

    }

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

    function check() {
      return defined('MODULE_HEADER_TAGS_SLIM_CHECKOUT_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 ('Current Version', 'MODULE_HEADER_TAGS_SLIM_CHECKOUT_VERSION', '1.1', 'Read only.', '6', '1', 'tep_version_readonly(', 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 ('Enable Slim Checkout', 'MODULE_HEADER_TAGS_SLIM_CHECKOUT_STATUS', 'True', 'Enable this module?', '6', '2', '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, use_function, set_function, date_added) values ('Hide Navbar', 'MODULE_HEADER_TAGS_SLIM_CHECKOUT_NAVBAR', '" . implode(';', $this->get_default_pages()) . "', 'Hide the Navabar module on Checkout Pages?', '6', '3', 'ht_slim_navbar_show_pages', 'ht_slim_navbar_edit_pages(', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Hide Header Area Modules', 'MODULE_HEADER_TAGS_SLIM_CHECKOUT_HEADER', '" . implode(';', $this->get_default_pages()) . "', 'Hide the modules in the Header Area on Checkout Pages?', '6', '4', 'ht_slim_header_show_pages', 'ht_slim_header_edit_pages(', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Hide Side Column Boxes', 'MODULE_HEADER_TAGS_SLIM_CHECKOUT_BOXES', '" . implode(';', $this->get_default_pages()) . "', 'Hide the Side Column Boxes on Checkout Pages?', '6', '5', 'ht_slim_boxes_show_pages', 'ht_slim_boxes_edit_pages(', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Hide Footer Modules', 'MODULE_HEADER_TAGS_SLIM_CHECKOUT_FOOTER', '" . implode(';', $this->get_default_pages()) . "', 'Hide the Footer Modules on Checkout Pages?', '6', '6', 'ht_slim_footer_show_pages', 'ht_slim_footer_edit_pages(', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Hide Footer Suffix Modules', 'MODULE_HEADER_TAGS_SLIM_CHECKOUT_FOOTER_SUFFIX', '" . implode(';', $this->get_default_pages()) . "', 'Hide the Footer Suffix Modules on Checkout Pages?', '6', '7', 'ht_slim_footer_suffix_show_pages', 'ht_slim_footer_suffix_edit_pages(', 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 ('Exclude Header Modules', 'MODULE_HEADER_TAGS_SLIM_CHECKOUT_EXCLUDE', 'cm_header_logo', 'List of modules to show always in the header area, even the header module area is hidden?<br>Comma separated list.<br>Only for header modules: \"cm_header_...\"', '6', '8', 'tep_textarea(', now())");
      tep_db_query("insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Content Width', 'MODULE_HEADER_TAGS_SLIM_CHECKOUT_CONTENT_WIDTH', '12', 'Content width if side columns are hidden.<br>Should be a pair value between the normal main content width (default = 8) => no content stretch, and the max width (12) => stretch content to full width.<br>Usual values: 8, 10 or 12', '6', '9', 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_HEADER_TAGS_SLIM_CHECKOUT_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '11', now())");
    }

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

    function keys() {
      return array('MODULE_HEADER_TAGS_SLIM_CHECKOUT_VERSION', 
                   'MODULE_HEADER_TAGS_SLIM_CHECKOUT_STATUS',
                   'MODULE_HEADER_TAGS_SLIM_CHECKOUT_NAVBAR',
                   'MODULE_HEADER_TAGS_SLIM_CHECKOUT_HEADER',
                   'MODULE_HEADER_TAGS_SLIM_CHECKOUT_BOXES',
                   'MODULE_HEADER_TAGS_SLIM_CHECKOUT_FOOTER',
                   'MODULE_HEADER_TAGS_SLIM_CHECKOUT_FOOTER_SUFFIX',
                   'MODULE_HEADER_TAGS_SLIM_CHECKOUT_EXCLUDE', 
                   'MODULE_HEADER_TAGS_SLIM_CHECKOUT_CONTENT_WIDTH', 
                   'MODULE_HEADER_TAGS_SLIM_CHECKOUT_SORT_ORDER');
    }
   
    function get_default_pages() {
      return array('login.php',
      		   'checkout_shipping.php',
      		   'checkout_shipping_address.php',
                   'checkout_payment.php',
                   'checkout_confirmation.php');
    }
  } // end class

  function ht_slim_navbar_show_pages($text) {
    return nl2br(implode("\n", explode(';', $text)));
  }

  function ht_slim_navbar_edit_pages($values, $key) {
    global $PHP_SELF;

    $files_array = get_controlled_pages();

    $values_array = explode(';', $values);

    $output = '';
    foreach ($files_array as $file) {
      $output .= tep_draw_checkbox_field('ht_slim_navbar_file[]', $file, in_array($file, $values_array)) . '&nbsp;' . tep_output_string($file) . '<br />';
    }

    if (!empty($output)) {
      $output = '<br />' . substr($output, 0, -6);
    }

    $output .= tep_draw_hidden_field('configuration[' . $key . ']', '', 'id="htrn_navbar_files"');

    $output .= '<script>
                function htrn_navbar_update_cfg_value() {
                  var htrn_navbar_selected_files = \'\';

                  if ($(\'input[name="ht_slim_navbar_file[]"]\').length > 0) {
                    $(\'input[name="ht_slim_navbar_file[]"]:checked\').each(function() {
                      htrn_navbar_selected_files += $(this).attr(\'value\') + \';\';
                    });

                    if (htrn_navbar_selected_files.length > 0) {
                      htrn_navbar_selected_files = htrn_navbar_selected_files.substring(0, htrn_navbar_selected_files.length - 1);
                    }
                  }

                  $(\'#htrn_navbar_files\').val(htrn_navbar_selected_files);
                }

                $(function() {
                  htrn_navbar_update_cfg_value();

                  if ($(\'input[name="ht_slim_navbar_file[]"]\').length > 0) {
                    $(\'input[name="ht_slim_navbar_file[]"]\').change(function() {
                      htrn_navbar_update_cfg_value();
                    });
                  }
                });
                </script>';

    return $output;
  }
  
  function ht_slim_header_show_pages($text) {
    return nl2br(implode("\n", explode(';', $text)));
  }

  function ht_slim_header_edit_pages($values, $key) {
    global $PHP_SELF;

    $files_array = get_controlled_pages();

    $values_array = explode(';', $values);

    $output = '';
    foreach ($files_array as $file) {
      $output .= tep_draw_checkbox_field('ht_slim_header_file[]', $file, in_array($file, $values_array)) . '&nbsp;' . tep_output_string($file) . '<br />';
    }

    if (!empty($output)) {
      $output = '<br />' . substr($output, 0, -6);
    }

    $output .= tep_draw_hidden_field('configuration[' . $key . ']', '', 'id="htrn_header_files"');

    $output .= '<script>
                function htrn_header_update_cfg_value() {
                  var htrn_header_selected_files = \'\';

                  if ($(\'input[name="ht_slim_header_file[]"]\').length > 0) {
                    $(\'input[name="ht_slim_header_file[]"]:checked\').each(function() {
                      htrn_header_selected_files += $(this).attr(\'value\') + \';\';
                    });

                    if (htrn_header_selected_files.length > 0) {
                      htrn_header_selected_files = htrn_header_selected_files.substring(0, htrn_header_selected_files.length - 1);
                    }
                  }

                  $(\'#htrn_header_files\').val(htrn_header_selected_files);
                }

                $(function() {
                  htrn_header_update_cfg_value();

                  if ($(\'input[name="ht_slim_header_file[]"]\').length > 0) {
                    $(\'input[name="ht_slim_header_file[]"]\').change(function() {
                      htrn_header_update_cfg_value();
                    });
                  }
                });
                </script>';

    return $output;
  }

  function ht_slim_boxes_show_pages($text) {
    return nl2br(implode("\n", explode(';', $text)));
  }

  function ht_slim_boxes_edit_pages($values, $key) {
    global $PHP_SELF;

    $files_array = get_controlled_pages();

    $values_array = explode(';', $values);

    $output = '';
    foreach ($files_array as $file) {
      $output .= tep_draw_checkbox_field('ht_slim_boxes_file[]', $file, in_array($file, $values_array)) . '&nbsp;' . tep_output_string($file) . '<br />';
    }

    if (!empty($output)) {
      $output = '<br />' . substr($output, 0, -6);
    }

    $output .= tep_draw_hidden_field('configuration[' . $key . ']', '', 'id="htrn_boxes_files"');

    $output .= '<script>
                function htrn_boxes_update_cfg_value() {
                  var htrn_boxes_selected_files = \'\';

                  if ($(\'input[name="ht_slim_boxes_file[]"]\').length > 0) {
                    $(\'input[name="ht_slim_boxes_file[]"]:checked\').each(function() {
                      htrn_boxes_selected_files += $(this).attr(\'value\') + \';\';
                    });

                    if (htrn_boxes_selected_files.length > 0) {
                      htrn_boxes_selected_files = htrn_boxes_selected_files.substring(0, htrn_boxes_selected_files.length - 1);
                    }
                  }

                  $(\'#htrn_boxes_files\').val(htrn_boxes_selected_files);
                }

                $(function() {
                  htrn_boxes_update_cfg_value();

                  if ($(\'input[name="ht_slim_boxes_file[]"]\').length > 0) {
                    $(\'input[name="ht_slim_boxes_file[]"]\').change(function() {
                      htrn_boxes_update_cfg_value();
                    });
                  }
                });
                </script>';

    return $output;
  }

  function ht_slim_footer_show_pages($text) {
    return nl2br(implode("\n", explode(';', $text)));
  }

  function ht_slim_footer_edit_pages($values, $key) {
    global $PHP_SELF;

    $files_array = get_controlled_pages();

    $values_array = explode(';', $values);

    $output = '';
    foreach ($files_array as $file) {
      $output .= tep_draw_checkbox_field('ht_slim_footer_file[]', $file, in_array($file, $values_array)) . '&nbsp;' . tep_output_string($file) . '<br />';
    }

    if (!empty($output)) {
      $output = '<br />' . substr($output, 0, -6);
    }

    $output .= tep_draw_hidden_field('configuration[' . $key . ']', '', 'id="htrn_footer_files"');

    $output .= '<script>
                function htrn_footer_update_cfg_value() {
                  var htrn_footer_selected_files = \'\';

                  if ($(\'input[name="ht_slim_footer_file[]"]\').length > 0) {
                    $(\'input[name="ht_slim_footer_file[]"]:checked\').each(function() {
                      htrn_footer_selected_files += $(this).attr(\'value\') + \';\';
                    });

                    if (htrn_footer_selected_files.length > 0) {
                      htrn_footer_selected_files = htrn_footer_selected_files.substring(0, htrn_footer_selected_files.length - 1);
                    }
                  }

                  $(\'#htrn_footer_files\').val(htrn_footer_selected_files);
                }

                $(function() {
                  htrn_footer_update_cfg_value();

                  if ($(\'input[name="ht_slim_footer_file[]"]\').length > 0) {
                    $(\'input[name="ht_slim_footer_file[]"]\').change(function() {
                      htrn_footer_update_cfg_value();
                    });
                  }
                });
                </script>';

    return $output;
  }

  function ht_slim_footer_suffix_show_pages($text) {
    return nl2br(implode("\n", explode(';', $text)));
  }

  function ht_slim_footer_suffix_edit_pages($values, $key) {
    global $PHP_SELF;

    $files_array = get_controlled_pages();
    
    $values_array = explode(';', $values);

    $output = '';
    foreach ($files_array as $file) {
      $output .= tep_draw_checkbox_field('ht_slim_footer_suffix_file[]', $file, in_array($file, $values_array)) . '&nbsp;' . tep_output_string($file) . '<br />';
    }

    if (!empty($output)) {
      $output = '<br />' . substr($output, 0, -6);
    }

    $output .= tep_draw_hidden_field('configuration[' . $key . ']', '', 'id="htrn_footer_suffix_files"');

    $output .= '<script>
                function htrn_footer_suffix_update_cfg_value() {
                  var htrn_footer_suffix_selected_files = \'\';

                  if ($(\'input[name="ht_slim_footer_suffix_file[]"]\').length > 0) {
                    $(\'input[name="ht_slim_footer_suffix_file[]"]:checked\').each(function() {
                      htrn_footer_suffix_selected_files += $(this).attr(\'value\') + \';\';
                    });

                    if (htrn_footer_suffix_selected_files.length > 0) {
                      htrn_footer_suffix_selected_files = htrn_footer_suffix_selected_files.substring(0, htrn_footer_suffix_selected_files.length - 1);
                    }
                  }

                  $(\'#htrn_footer_suffix_files\').val(htrn_footer_suffix_selected_files);
                }

                $(function() {
                  htrn_footer_suffix_update_cfg_value();

                  if ($(\'input[name="ht_slim_footer_suffix_file[]"]\').length > 0) {
                    $(\'input[name="ht_slim_footer_suffix_file[]"]\').change(function() {
                      htrn_footer_suffix_update_cfg_value();
                    });
                  }
                });
                </script>';

    return $output;
  }
  
  function get_controlled_pages() {
    $files_array = array('login.php',
                         'shopping_cart.php',
                         'checkout_shipping.php',
                         'checkout_shipping_address.php',
                         'checkout_payment.php',
                         'checkout_confirmation.php',
                         'checkout_success.php');    
    return $files_array;
  }

// Function to read in text area in admin
  if(!function_exists('tep_textarea')) {
    function tep_textarea($text, $key = '') {
      $name = (($key) ? 'configuration[' . $key . ']' : 'configuration_value');
      return tep_draw_textarea_field($name, false, 35, 5, $text, 'style="font: inherit;"');
    }
  }
  
// function show the version read only  
  if(!function_exists('tep_version_readonly')) {
  	function tep_version_readonly($value){
  		$version_text = '<br>Version ' . $value;
      return $version_text;
    }
  }

// Begin template class extension
  if (class_exists('oscTemplate')) {
    class oscTemplateExt extends oscTemplate {
      public $_title;
      public $_blocks = array();
      public $_hide_column = false;

      function __construct() {
        global $PHP_SELF, $oscTemplate;
        $this->_title = $oscTemplate->_title;
        $this->_blocks = $oscTemplate->_blocks;
      }

      function getGridContentWidth() {
        if ( $this->_hide_column == true ) {
          return MODULE_HEADER_TAGS_SLIM_CHECKOUT_CONTENT_WIDTH; // define main content width if side columns are hidden
        } else {
          return $this->_grid_content_width;
        }
      }

      function getGridColumnWidth() {
        if ( $this->_hide_column == true ) { // define columns width if side columns are hidden
          return (12 - MODULE_HEADER_TAGS_SLIM_CHECKOUT_CONTENT_WIDTH) / 2;
        } else {
          return (12 - BOOTSTRAP_CONTENT) / 2;
        }
      }

      function getBlocks($group) {
        global $PHP_SELF;
        if ( $this->hasBlocks($group) && ((strpos($group, 'boxes_column') === false) || !in_array(basename($PHP_SELF), $this->checkPages('bm_'))) ) { // hide side columns
          return implode("\n", $this->_blocks[$group]);
        }
      }

      function getContent($group) {
        global $PHP_SELF, $language;
  
        if ( !class_exists('tp_' . $group) && file_exists('includes/modules/pages/tp_' . $group . '.php') ) {
          include('includes/modules/pages/tp_' . $group . '.php');
        }
  
        if ( class_exists('tp_' . $group) ) {
          $template_page_class = 'tp_' . $group;
          $template_page = new $template_page_class();
          $template_page->prepare();
        }
  
        foreach ( $this->getContentModules($group) as $module ) {
          if ( !class_exists($module) ) {
            if ( file_exists('includes/modules/content/' . $group . '/' . $module . '.php') ) {
              if ( file_exists('includes/languages/' . $language . '/modules/content/' . $group . '/' . $module . '.php') ) {
                include('includes/languages/' . $language . '/modules/content/' . $group . '/' . $module . '.php');
              }
  
              include('includes/modules/content/' . $group . '/' . $module . '.php');
            }
          }
  
          if ( class_exists($module) ) {
            $mb = new $module();
             if ( $mb->isEnabled() && !in_array(basename($PHP_SELF), $this->checkPages($module))) { // check if module should be hidden, get hidden pages array
              $mb->execute();
            }
          }
        }
  
        if ( class_exists('tp_' . $group) ) {
          $template_page->build();
        }
  
        if ($this->hasContent($group)) {
          return implode("\n", $this->_content[$group]);
        }
      }

      function checkPages($module){ //$module what is called in the and content modules
        global $PHP_SELF;
          if (strtok($module, '_') == 'bm') {
            $module_group_prefix = strtok($module, '_');
          } elseif ((strpos($module, 'cm_footer_extra') !== false)) {
            $module_group_prefix = 'footer_extra';
          } elseif (strtok($module, '_') == 'cm') {
            $module_group_prefix = (strtok($module, '_'.strtok($module, '_')));
          }
          
          $hide_array[$module_group_prefix] = array();
          
          $hide_array['navbar'] =  explode(';', MODULE_HEADER_TAGS_SLIM_CHECKOUT_NAVBAR);
          if ( !in_array($module, explode(',', MODULE_HEADER_TAGS_SLIM_CHECKOUT_EXCLUDE)) ) {
            $hide_array['header'] =  explode(';', MODULE_HEADER_TAGS_SLIM_CHECKOUT_HEADER);
          }
          $hide_array['bm'] =  explode(';', MODULE_HEADER_TAGS_SLIM_CHECKOUT_BOXES);
          $hide_array['footer'] =  explode(';', MODULE_HEADER_TAGS_SLIM_CHECKOUT_FOOTER);
          $hide_array['footer_extra'] =  explode(';', MODULE_HEADER_TAGS_SLIM_CHECKOUT_FOOTER_SUFFIX);
  
          // check if side columns are hidden
          if (in_array(basename($PHP_SELF), $hide_array['bm'])) $this->_hide_column = true;          

          return $hide_array[$module_group_prefix];
      }

    } // end class
  } // end if class exists
// Begin template class extension

?>

 

Edited by Bobber
Update...
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...