Jump to content

Gyakutsuki

♥Ambassador
  • Content count

    726
  • Joined

  • Last visited

  • Days Won

    15

Everything posted by Gyakutsuki

  1. Look if the session is correct in confirmation echo $_SESSION['coupon']; exit; I you don't see the session,you have a pb. See the page above, I explain in details this pb.
  2. shoppingCart::attributes_price does'nt exist in 2.3.x and replace this elementpar the old. $_SESSION['cart']->attributes_price I think.
  3. I found a solution to remove product_sort_order than I inserted in order by clause but it's customization I think. !
  4. Hello, I want know if you have the same pb like me on mysql 5.7 and on the file advanced_search_result.php #1055 - Expression #66 of SELECT list is not in GROUP BY clause and contains nonaggregated column 's.status' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by My sql is more restricted and seems there is a problem on that ? tk
  5. 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.
  6. 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
  7. @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');
  8. ok, change osc_cfg_select_option by tep_cfg_select_option
  9. @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.
  10. @grandpaj . The config is in general administrationwher you found the store name.
  11. @grandpaj this code does'nt exist now; It was before, just apply the contribution in download, that's all. $oscTemplate->getContent('account') by by $oscTemplate->getMinifyTemplateBlockContent('account') $oscTemplate->getBlocks('account') by $oscTemplate->getMinifyTemplateBlockModule('account')
  12. Tk for correction. Like I said, Google propose in their criteria to minify html, css, js. After that the speed is for me a relative indicator and depends the contribution what do you have. For me the speed is increased.
  13. @burt done : http://addons.oscommerce.com/info/9480
  14. @burt Ok I will make it after the soccer :)
  15. burt The both normal or BS are the same,I think you talk about the code. One classe (see below) Just a little modification inside the template. It's not intrusive. For example, the addblock is change like this public function getBlocks($group) { if ($this->hasBlocks($group)) { if (CONFIGURATION_MINIFY_TEMPLATE == 'false') { $getblock = implode("\n", $this->_blocks[$group]); } else { require ('includes/classes/MinifyCode'); $minifyCode = new MinifyCode(); $str = implode("\n", $this->_blocks[$group]); $getblock = $minifyCode->minifyHtml($str); } return $getblock; } } You must just recopy the code for addcontent. No other modifications. After concerning the cache it's an another problem, don't include for the moment. the best way is to test.
  16. @burt The speed depends on your addon on you website, for example you insert a banner rotative in responsive, there is an influence on the speed, you don't minify the js, there is an influence. Depends on the server configuration, there also is an influence. I think the speed is not the best indicator to compare with your sytem but the code must respect the criterias by google. Concerning this code, I use only for html code but the code is also make for css and js. And it must developped with a cache system appropriate or with the cache developped inside Osc. That's I noted, my page is downloaded more fastest than before without cache. Note :You must adapte to content page the code.
  17. @GergelyYes it's better, you can optimise the code with only one modiification inside template and osc code. delete this line function getMinifyTemplateBlockContent($template_module) { if (CONFIGURATION_MINIFY_TEMPLATE == 'true') { // activate or not the minifycode $minifyCode = new MinifyCode(); $str = $this->getBlocks($template_module); $minify = $minifyCode->minifyHtml($str); // minify the only the html code } else { $minify = $this->getBlocks($template_module); } return $minify; } update this line public function getBlocks($group) { if ($this->hasBlocks($group)) { if (CONFIGURATION_MINIFY_TEMPLATE == 'false') { $getblock = implode("\n", $this->_blocks[$group]); } else { require ('includes/classes/MinifyCode'); $minifyCode = new MinifyCode(); $str = implode("\n", $this->_blocks[$group]); $getblock = $minifyCode->minifyHtml($str); } return $getblock; } } That's all.
  18. It's possible to include to minify the code like HTMl, js, css. For example : create a class call MinifyCode.php in Classes directory (catalog) Class MinifyCode { // HTML Minifier function minifyHtml($input) { if (trim($input) === "") return $input; // Remove extra white-space(s) between HTML attribute(s) $input = preg_replace_callback('#<([^\/\s<>!]+)(?:\s+([^<>]*?)\s*|\s*)(\/?)>#s', function ($matches) { return '<' . $matches[1] . preg_replace('#([^\s=]+)(\=([\'"]?)(.*?)\3)?(\s+|$)#s', ' $1$2', $matches[2]) . $matches[3] . '>'; }, str_replace("\r", "", $input)); // Minify inline CSS declaration(s) if (strpos($input, ' style=') !== false) { $input = preg_replace_callback('#<([^<]+?)\s+style=([\'"])(.*?)\2(?=[\/\s>])#s', function ($matches) { return '<' . $matches[1] . ' style=' . $matches[2] . $this->minifyCss($matches[3]) . $matches[2]; }, $input); } return preg_replace( array( // t = text // o = tag open // c = tag close // Keep important white-space(s) after self-closing HTML tag(s) '#<(img|input)(>| .*?>)#s', // Remove a line break and two or more white-space(s) between tag(s) '#(<!--.*?-->)|(>)(?:\n*|\s{2,})(<)|^\s*|\s*$#s', '#(<!--.*?-->)|(?<!\>)\s+(<\/.*?>)|(<[^\/]*?>)\s+(?!\<)#s', // t+c || o+t '#(<!--.*?-->)|(<[^\/]*?>)\s+(<[^\/]*?>)|(<\/.*?>)\s+(<\/.*?>)#s', // o+o || c+c '#(<!--.*?-->)|(<\/.*?>)\s+(\s)(?!\<)|(?<!\>)\s+(\s)(<[^\/]*?\/?>)|(<[^\/]*?\/?>)\s+(\s)(?!\<)#s', // c+t || t+o || o+t -- separated by long white-space(s) '#(<!--.*?-->)|(<[^\/]*?>)\s+(<\/.*?>)#s', // empty tag '#<(img|input)(>| .*?>)<\/\1\x1A>#s', // reset previous fix '#( ) (?![<\s])#', // clean up ... // Force line-break with ` ` or ` ` '#&\#(?:10|xa);#', // Force white-space with ` ` or ` ` '#&\#(?:32|x20);#', // Remove HTML comment(s) except IE comment(s) '#\s*<!--(?!\[if\s).*?-->\s*|(?<!\>)\n+(?=\<[^!])#s' ), array( "<$1$2</$1\x1A>", '$1$2$3', '$1$2$3', '$1$2$3$4$5', '$1$2$3$4$5$6$7', '$1$2$3', '<$1$2', '$1 ', "\n", ' ', "" ), $input); } // CSS Minifier => http://ideone.com/Q5USEF + improvement(s) function minifyCss($input) { if (trim($input) === "") return $input; // Force white-space(s) in `calc()` if (strpos($input, 'calc(') !== false) { $input = preg_replace_callback('#(?<=[\s:])calc\(\s*(.*?)\s*\)#', function ($matches) { return 'calc(' . preg_replace('#\s+#', "\x1A", $matches[1]) . ')'; }, $input); } return preg_replace( array( // Remove comment(s) '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')|\/\*(?!\!)(?>.*?\*\/)|^\s*|\s*$#s', // Remove unused white-space(s) '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/))|\s*+;\s*+(})\s*+|\s*+([*$~^|]?+=|[{};,>~+]|\s*+-(?![0-9\.])|!important\b)\s*+|([[(:])\s++|\s++([])])|\s++(:)\s*+(?!(?>[^{}"\']++|"(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')*+{)|^\s++|\s++\z|(\s)\s+#si', // Replace `0(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)` with `0` '#(?<=[\s:])(0)(cm|em|ex|in|mm|pc|pt|px|vh|vw|%)#si', // Replace `:0 0 0 0` with `:0` '#:(0\s+0|0\s+0\s+0\s+0)(?=[;\}]|\!important)#i', // Replace `background-position:0` with `background-position:0 0` '#(background-position):0(?=[;\}])#si', // Replace `0.6` with `.6`, but only when preceded by a white-space or `=`, `:`, `,`, `(`, `-` '#(?<=[\s=:,\(\-]|&\#32;)0+\.(\d+)#s', // Minify string value '#(\/\*(?>.*?\*\/))|(?<!content\:)([\'"])([a-z_][-\w]*?)\2(?=[\s\{\}\];,])#si', '#(\/\*(?>.*?\*\/))|(\burl\()([\'"])([^\s]+?)\3(\))#si', // Minify HEX color code '#(?<=[\s=:,\(]\#)([a-f0-6]+)\1([a-f0-6]+)\2([a-f0-6]+)\3#i', // Replace `(border|outline):none` with `(border|outline):0` '#(?<=[\{;])(border|outline):none(?=[;\}\!])#', // Remove empty selector(s) '#(\/\*(?>.*?\*\/))|(^|[\{\}])(?:[^\s\{\}]+)\{\}#s', '#\x1A#' ), array( '$1', '$1$2$3$4$5$6$7', '$1', ':0', '$1:0 0', '.$1', '$1$3', '$1$2$4$5', '$1$2$3', '$1:0', '$1$2', ' ' ), $input); } // JavaScript Minifier function minifyJs($input) { if (trim($input) === "") return $input; return preg_replace( array( // Remove comment(s) '#\s*("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\')\s*|\s*\/\*(?!\!|@[member='CC']_on)(?>[\s\S]*?\*\/)\s*|\s*(?<![\:\=])\/\/.*(?=[\n\r]|$)|^\s*|\s*$#', // Remove white-space(s) outside the string and regex '#("(?:[^"\\\]++|\\\.)*+"|\'(?:[^\'\\\\]++|\\\.)*+\'|\/\*(?>.*?\*\/)|\/(?!\/)[^\n\r]*?\/(?=[\s.,;]|[gimuy]|$))|\s*([!%&*\(\)\-=+\[\]\{\}|;:,.<>?\/])\s*#s', // Remove the last semicolon '#;+\}#', // Minify object attribute(s) except JSON attribute(s). From `{'foo':'bar'}` to `{foo:'bar'}` '#([\{,])([\'])(\d+|[a-z_]\w*)\2(?=\:)#i', // --ibid. From `foo['bar']` to `foo.bar` '#([\w\)\]])\[([\'"])([a-z_]\w*)\2\]#i', // Replace `true` with `!0` '#(?<=return |[=:,\(\[])true\b#', // Replace `false` with `!1` '#(?<=return |[=:,\(\[])false\b#', // Clean up ... '#\s*(\/\*|\*\/)\s*#' ), array( '$1', '$1$2', '}', '$1$3', '$1.$3', '!0', '!1', '$1' ), $input); } } In includes/classes/sosc_template.php Add at this end /* * Minify HTML code * * @[member='param'] string module name * @[member='Return'], return the minify code * @[member='access'] public */ function getMinifyTemplateBlockModule($template_module) { if (CONFIGURATION_MINIFY_TEMPLATE == 'true') { // activate or not the minifycode $minifyCode = new MinifyCode(); $str = $this->getBlocks($template_module); $minify = $minifyCode->minifyHtml($str); // minify the only the html code } else { $minify = $this->getBlocks($template_module); } return $minify; } function getMinifyTemplateBlockContent($template_module) { if (CONFIGURATION_MINIFY_TEMPLATE == 'true') { // activate or not the minifycode $minifyCode = new MinifyCode(); $str = $this->getBlocks($template_module); $minify = $minifyCode->minifyHtml($str); // minify the only the html code } else { $minify = $this->getBlocks($template_module); } return $minify; } } Database: 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()); Now change inside the code these elements in all files. $oscTemplate->getContent('account') by by $oscTemplate->getMinifyTemplateBlockContent('account') $oscTemplate->getBlocks('account') by $oscTemplate->getMinifyTemplateBlockModule('account') Must work.
  19. @@Dan Cole Ok, depends on your configuration in order total and coupon (the setup is very important and you can have at the end some difference, yes it's a bug no simple to resolve) you can have a difference between the shopping and the checkout process This configuration for canada work for me : Sort order in module total order Coupon réduction 1 Expédition 10 Sous-Total 8 Taxes 20 Total 50 and in Coupon : the most important display discount with coupon : true calcul the discount after the taxe :false display taxe applied : false sort order : 1 and for shop configuration display price with taxe : no In my cart not connected Code coupon test applique: -10.00CAD Sous-Total: 25.00CAD Livraison gratuite (livraison offerte dés 20.): 0.00CAD Zone TVH 9.975: 2.49CAD Zone TPS 5%: 1.25CAD Total: 28.74CAD in my cart connected : Code coupon test applique: -10.00CAD Sous-Total: 25.00CAD Livraison gratuite (livraison offerte dés 20.): 0.00CAD Zone TVH 9.975: 2.49CAD Zone TPS 5%: 1.25CAD Total: 28.74CAD in checkout confirmation Code coupon test applique: -10.00CAD Sous-Total: 25.00CAD Livraison gratuite (livraison offerte dés 20.): 0.00CAD Zone TVH 9.975: 2.49CAD Zone TPS 5%: 1.25CAD Total: 28.74CAD
  20. no work with on not taxe. see my email
  21. the system work when your are login or not
  22. $zone_country_id must be $country_id
  23. try with this, it work for me $products = $OSCOM_ShoppingCart->get_products(); for ($i=0, $n=sizeof($products); $i<$n; $i++) { $products_tax = Tax::getTaxRate($products[$i]['tax_class_id'], $OSCOM_Order->delivery['country_id'], $OSCOM_Order->delivery['zone_id']); $products_tax_description = Tax::getTaxRateDescription($products[$i]['tax_class_id'], $OSCOM_Order->delivery['country_id'], $OSCOM_Order->delivery['zone_id']); if ( DISPLAY_PRICE_WITH_TAX == 'true' ) { //Modified by Strider 42 to correct the tax calculation when a customer is not logged in $tax_val = (($products[$i]['final_price']/100)*$products_tax)*$products[$i]['quantity']; } else { $tax_val = (($products[$i]['final_price']*$products_tax)/100)*$products[$i]['quantity']; } if ( !empty($OSCOM_Order->info['tax']) ) { $OSCOM_Order->info['tax'] += $tax_val; } else { $OSCOM_Order->info['tax'] = $tax_val; } if (!empty($OSCOM_Order->info['tax_groups']) ) { $OSCOM_Order->info['tax_groups']['' . $products_tax_description . ''] += $tax_val; } else { $OSCOM_Order->info['tax_groups']['' . $products_tax_description . ''] = $tax_val; }
  24. The add must be deleted, not interested in this case. The contribution had a bug to zone id and country id, I just changed theses elements.
  25. @@Dan Cole Ok work like a charm just a modification 1/ Remove in ot_discount.php this or insert comment // $OSCOM_Order->info['total'] = $OSCOM_Order->info['total'] - $discount; // $OSCOM_Order->info['subtotal'] -= $discount; // unset($_SESSION['coupon']); 2/ in classe coupon discount add this two functions becarefull on that : $_GET['shopping_cart'] or if ($PHP_SELF == 'shopping_cart') in shopping_cart.php $_SESSION['shopping_cart'] i don't exactly remember is the name else change private by public and in getZoneCountryid() write var_dump($_SESSION). /* * Display the id of the country zone id * @[member='param'] * @[member='Return'] $zone_country_id, id country zone id * @[member='access'] private */ private function getZoneCountryid() { if (isset($_GET['shopping_cart'])) { //$tax_address['entry_zone_id'] $zone_country_id = $_SESSION['cart_zone']; } else { $zone_country_id = $_SESSION['shopping_cart']['shipping_address']['zone_id']; } return $zone_country_id; } /* * Display the id of the country * @[member='param'] * @[member='Return'] $zone_country_id, id country * @[member='access'] private */ private function getCountryid() { if (isset($_GET['shopping_cart'])) { // $tax_address['entry_country_id'] $country_id = $_SESSION['cart_country_id']; } else { $zone_country_id = $_SESSION['shopping_cart']['shipping_address']['country_id']; } return $country_id; } In this function total_valid_products change this line (sorry don't remember exactlythe synthax, it's mine. $this->getCountryid() and $this->getZoneCountryid() doesn't have any information, that's why the element does'nt display. The bug is here for( $i = 0; $i < count( $products ); $i++ ) { if (DISPLAY_PRICE_WITH_TAX == 'true'){ $product_tax = Tax::getTaxRate($products[$i]['tax_class_id'], $this->getCountryid(), $this->getZoneCountryid()); .... If you want a professionnal code program like phpstorm, you will see yours errors. That's all, I can send you the classe but I rewrite all and the code is different than the 2.3 (reverse ingeniring must be done) but with this element you have the solution, I think.
×