Jump to content
Latest News: (loading..)

Recommended Posts

@grandpaj .

The config is in general administrationwher you found the store name.



Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

Tuto for 2.4 :
- How to Display a new page with app
- How to make Header Tags under app APP
- How to make a
boostrap modal with external element
 

 

Share this post


Link to post
Share on other sites

@@Gyakutsuki

 

Hi Loic

 

Thanks for your response, however the problem still exists.

I don't have anything showing under admin>config.I have checked that both files in the download  have been uploaded and  are in their correct place, and the addition to DB is in fact under configuration.(my site is probably moderately modified)

I was wanting to see if this addon made any dif to page load times  GTMetrix shows at 96/81

 

I did find the following in the error log, don't know whether it may help or hinder.

[16-Jun-2016 08:42:56 Pacific/Auckland] PHP Warning:  require(includes/classes/osc_template.php): failed to open stream: No such file or directory in /home/XXXXX/public_html/includes/application_top.php on line 465
[16-Jun-2016 08:42:56 Pacific/Auckland] PHP Warning:  require(includes/classes/osc_template.php): failed to open stream: No such file or directory in /home/XXXXX/public_html/includes/application_top.php on line 465
[

Cheers

Grandpa

Edited by grandpaj

Share this post


Link to post
Share on other sites
@

Compare the class with this:

<?php
/*
  $Id$

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2014 osCommerce

  Released under the GNU General Public License
*/

  class oscTemplate {
    var $_title;
    var $_blocks = array();
    var $_content = array();
    var $_grid_container_width = 12;
    var $_grid_content_width = BOOTSTRAP_CONTENT;
    var $_grid_column_width = 0; // deprecated
    var $_data = array();

    function __constrcut() {
      $this->_title = TITLE;
    }

    function setGridContainerWidth($width) {
      $this->_grid_container_width = $width;
    }

    function getGridContainerWidth() {
      return $this->_grid_container_width;
    }

    function setGridContentWidth($width) {
      $this->_grid_content_width = $width;
    }

    function getGridContentWidth() {
      return $this->_grid_content_width;
    }

    function setGridColumnWidth($width) {
      $this->_grid_column_width = $width;
    }

    function getGridColumnWidth() {
      return (12 - BOOTSTRAP_CONTENT) / 2;
    }

    function setTitle($title) {
      $this->_title = $title;
    }

    function getTitle() {
      return $this->_title;
    }

    function addBlock($block, $group) {
      $this->_blocks[$group][] = $block;
    }

    function hasBlocks($group) {
      return (isset($this->_blocks[$group]) && !empty($this->_blocks[$group]));
    }

    function getBlocks($group) {
/*
      if ($this->hasBlocks($group)) {
        return implode("\n", $this->_blocks[$group]);
      }
*/
      if ($this->hasBlocks($group))  {

        if (CONFIGURATION_MINIFY_TEMPLATE == 'false') {
          $getblock = implode("\n", $this->_blocks[$group]);
        } else {
          require_once(DIR_WS_CLASSES . '/MinifyCode.php');

          $minifyCode = new MinifyCode();
          $str = implode("\n", $this->_blocks[$group]);
          $getblock = $minifyCode->minifyHtml($str);
        }
        return $getblock;
      }
    }

    function buildBlocks() {
      global $language;

      if ( defined('TEMPLATE_BLOCK_GROUPS') && tep_not_null(TEMPLATE_BLOCK_GROUPS) ) {
        $tbgroups_array = explode(';', TEMPLATE_BLOCK_GROUPS);

        foreach ($tbgroups_array as $group) {
          $module_key = 'MODULE_' . strtoupper($group) . '_INSTALLED';

          if ( defined($module_key) && tep_not_null(constant($module_key)) ) {
            $modules_array = explode(';', constant($module_key));

            foreach ( $modules_array as $module ) {
              $class = basename($module, '.php');

              if ( !class_exists($class) ) {
                if ( file_exists(DIR_WS_LANGUAGES . $language . '/modules/' . $group . '/' . $module) ) {
                  include(DIR_WS_LANGUAGES . $language . '/modules/' . $group . '/' . $module);
                }

                if ( file_exists(DIR_WS_MODULES . $group . '/' . $module) ) {
                  include(DIR_WS_MODULES . $group . '/' . $module);
                }
              }

              if ( class_exists($class) ) {
                $mb = new $class();

                if ( $mb->isEnabled() ) {
                  $mb->execute();
                }
              }
            }
          }
        }
      }
    }

    function addContent($content, $group) {
      $this->_content[$group][] = $content;
    }

    function hasContent($group) {
      return (isset($this->_content[$group]) && !empty($this->_content[$group]));
    }

    function getContent($group) {
      global $language;

      if ( !class_exists('tp_' . $group) && file_exists(DIR_WS_MODULES . 'pages/tp_' . $group . '.php') ) {
        include(DIR_WS_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(DIR_WS_MODULES . 'content/' . $group . '/' . $module . '.php') ) {
            if ( file_exists(DIR_WS_LANGUAGES . $language . '/modules/content/' . $group . '/' . $module . '.php') ) {
              include(DIR_WS_LANGUAGES . $language . '/modules/content/' . $group . '/' . $module . '.php');
            }

            include(DIR_WS_MODULES . 'content/' . $group . '/' . $module . '.php');
          }
        }

        if ( class_exists($module) ) {
          $mb = new $module();

          if ( $mb->isEnabled() ) {
            $mb->execute();
          }
        }
      }

      if ( class_exists('tp_' . $group) ) {
        $template_page->build();
      }


      if ($this->hasContent($group))  {

        if (CONFIGURATION_MINIFY_TEMPLATE == 'false') {
          $contentblock = implode("\n", $this->_content[$group]);
        } else {
          require_once(DIR_WS_CLASSES . '/MinifyCode.php');

          $minifyCode = new MinifyCode();
          $str = implode("\n", $this->_content[$group]);
          $contentblock = $minifyCode->minifyHtml($str);
        }
        return $contentblock;
      }

    }

    function getContentModules($group) {
      $result = array();

      foreach ( explode(';', MODULE_CONTENT_INSTALLED) as $m ) {
        $module = explode('/', $m, 2);

        if ( $module[0] == $group ) {
          $result[] = $module[1];
        }
      }

      return $result;
    }
  }

look : My configuration / mystore . You must see this element : Do you want to minify the html code in the shop catalog

If not insert the request below.

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Do you want to minify the html code in the shop catalog', 'CONFIGURATION_MINIFY_TEMPLATE', 'false', 'Minify the HTML code to improve site speed' , '1', '5', 'osc_cfg_select_option(array(\'true\', \'false\'), ', now());

Don't forget to include the class files inside class directory.

 

After you can test and activate the option or not.



Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

Tuto for 2.4 :
- How to Display a new page with app
- How to make Header Tags under app APP
- How to make a
boostrap modal with external element
 

 

Share this post


Link to post
Share on other sites

@@Gyakutsuki

Hi Loic

 

Making progress.

Have installed but get this message when I try to Edit in My Store

Fatal error: Call to undefined function osc_cfg_select_option() in /home/XXXX/public_html/ADMIN/configuration.php(106) : eval()'d code on line 1

Not sure what .."Don't forget to include the class files inside class directory." means.

 

Cheers

Grandp

Edited by grandpaj

Share this post


Link to post
Share on other sites

ok, change osc_cfg_select_option by tep_cfg_select_option



Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

Tuto for 2.4 :
- How to Display a new page with app
- How to make Header Tags under app APP
- How to make a
boostrap modal with external element
 

 

Share this post


Link to post
Share on other sites

Google ad tag is a :poop: for speed..

 

//www.googleadservices.com/pagead/conversion.js

Mobile site page speed decrease approx 20% by google codes. Assyncron mode dosnt work.

 

Any .js scripts (especially those from external src) will slow down the page a lot.

As a test I just installed all the Social Bookmark modules, and this added over two seconds to the product page load!


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

@@grandpaj

Speed increase wont work without file cache but we have less problems.


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

Any .js scripts (especially those from external src) will slow down the page a lot.

As a test I just installed all the Social Bookmark modules, and this added over two seconds to the product page load!

Any social feature loding time is not as critical but google tracking codes is awfull. Social buttons could be loading with ajax codes or asyncr mode where one like button is not as important.

CDN loading could be the same when no response and breaks all scripts. Async loading is critical for page speed.


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

@Gergely

 

There a cache system for this.

 

create a directory in Cache/Files inside icludes/work

 

 

include theses elements in includes/functions/general at the end.

    function getUrl () {
      if (!isset($_SERVER['REQUEST_URI'])) {
        $url = $_SERVER['REQUEST_URI'];
      } else {
        $url = $_SERVER['SCRIPT_NAME'];
        $url .= (!empty($_SERVER['QUERY_STRING']))? '?' . $_SERVER[ 'QUERY_STRING' ] : '';

      }
      return $url;
    }

//getUrl gets the queried page with query string
    function cache ($buffer) { //page's content is $buffer

      $url = $this->getUrl();
      $filename = md5($url) . '.cache';
      $data = time() . '¦' . $buffer;
      $filew = fopen(DIR_FS_CATALOG . 'includes/work/Cache/Files/' . $filename, 'w');
      fwrite($filew, $data);
      fclose($filew);
      return $buffer;
    }

    function getDisplayCache() {

      $url = $this->getUrl();
      $filename = md5($url) . '.cache';

      if (!file_exists(DIR_FS_CATALOG . 'includes/work/Cache/Files/' . $filename)) {
        return false;
      }

      $filer = fopen(DIR_FS_CATALOG . 'includes/work/Cache/Files/' . $filename, 'r');

      $data = fread($filer, filesize(DIR_FS_CATALOG . 'includes/work/Cache/Files/' . $filename));
      fclose($filer);
      $content = explode('¦', $data, 2);
      if (count($content)!= 2 OR !is_numeric($content['0'])) {
        return false;
      }
      if (time()-(100) > $content['0']) { // 100 is the cache time here!!!
        return false;
      }
      echo $content['1'];
      die();
    }

Now in template_bootom

 

at the end include this


// Display cache (if any)
getDisplayCache(); // if it is displayed, die function will end the program here.

// if no cache, callback cache
ob_start ('cache');
Edited by Gyakutsuki


Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

Tuto for 2.4 :
- How to Display a new page with app
- How to make Header Tags under app APP
- How to make a
boostrap modal with external element
 

 

Share this post


Link to post
Share on other sites

@@Gyakutsuki

Hi Loic

template_bottom.php when the above code is included in template_bottom.php should it look like this

<?php echo $oscTemplate->getBlocks('footer_scripts'); ?>
// Display cache (if any)
getDisplayCache(); // if it is displayed, die function will end the program here.

// if no cache, callback cache
ob_start ('cache');
</body>
</html>

Cheers

Grandpa

Share this post


Link to post
Share on other sites

no like this

<?php
// Display cache (if any)
getDisplayCache(); // if it is displayed, die function will end the program here.

// if no cache, callback cache
 ob_start ('cache');
?>

It's for only test.

 

Look also in ftp the if the cache is created or not

Edited by Gyakutsuki


Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

Tuto for 2.4 :
- How to Display a new page with app
- How to make Header Tags under app APP
- How to make a
boostrap modal with external element
 

 

Share this post


Link to post
Share on other sites

The only pb with my contribution is some script can doesn't work and they need to be improve and you need to do becarefull on that.



Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

Tuto for 2.4 :
- How to Display a new page with app
- How to make Header Tags under app APP
- How to make a
boostrap modal with external element
 

 

Share this post


Link to post
Share on other sites

@@Gyakutsuki

 

Hi Loic

 

Just reviviting this.

 

Where on earth do I find

ok, change osc_cfg_select_option by tep_cfg_select_option (post #31)

please.

 

Can't for the life of me find it.

 

Cheers

 

Grandp

Edited by grandpaj

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

Hi,

Just a question, about the HT access part. I have the following :

Htaccess in root with redirect to a directory where the shop is. 

in the catalog directory alos a htaccess file. 

In which of the files is it best to put the optimization in.

Greetings, Anne

Share this post


Link to post
Share on other sites
23 hours ago, DjViper said:

Hi,

Just a question, about the HT access part. I have the following :

Htaccess in root with redirect to a directory where the shop is. 

in the catalog directory alos a htaccess file. 

In which of the files is it best to put the optimization in.

Greetings, Anne

Hi Anne, htaccess works hierarchically. You can put it in either but if the top one it needs to be before the redirect.


For a new install or if your store isn't mobile-friendly, get the community-supported responsive osCommerce (2.3.4.1 CE) here: https://github.com/gburton/Responsive-osCommerce/archive/2341-Frozen.zip

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×