Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

vmn

Members
  • Posts

    204
  • Joined

  • Last visited

  • Days Won

    5

Reputation Activity

  1. Thanks
    vmn got a reaction from raiwa in Store Mode BS   
    Hello,
    I just installed the version 1.4.0 (in Phoenix 1.0.7.14) and found a bug preventing adding 'Required ip':
    in includes/modules/store/st_store_mode.php
    in the function htaccess_backup the line:
          if ( defined('MODULE_STORE_MODE_ALLOWED_IPS ') && tep_not_null(MODULE_STORE_MODE_ALLOWED_IPS) ) {
          
    contains an extra space before the closing apostrophe and should be
          if ( defined('MODULE_STORE_MODE_ALLOWED_IPS') && tep_not_null(MODULE_STORE_MODE_ALLOWED_IPS) ) {
     
  2. Thanks
    vmn got a reaction from Denzel in AJAX Attribute Manager support   
    In 1.0.7.14 the following functions are deprecated in admin:
    tep_session_id
    tep_session_name
    tep_session_register
    tep_session_is_registered
    tep_session_unregister
    It seems to be working with fixes for
    admin/attributeManager/includes/attributeManagerHeader.inc.php
    admin/attributeManager/includes/attributeManagerSessionFunctions.inc.php
    included in the zip.
           
    fixes.for.1.0.7.14.zip
  3. Thanks
    vmn got a reaction from kgtee in AJAX Attribute Manager support   
    In 1.0.7.14 the following functions are deprecated in admin:
    tep_session_id
    tep_session_name
    tep_session_register
    tep_session_is_registered
    tep_session_unregister
    It seems to be working with fixes for
    admin/attributeManager/includes/attributeManagerHeader.inc.php
    admin/attributeManager/includes/attributeManagerSessionFunctions.inc.php
    included in the zip.
           
    fixes.for.1.0.7.14.zip
  4. Thanks
    vmn got a reaction from raiwa in AJAX Attribute Manager support   
    In 1.0.7.14 the following functions are deprecated in admin:
    tep_session_id
    tep_session_name
    tep_session_register
    tep_session_is_registered
    tep_session_unregister
    It seems to be working with fixes for
    admin/attributeManager/includes/attributeManagerHeader.inc.php
    admin/attributeManager/includes/attributeManagerSessionFunctions.inc.php
    included in the zip.
           
    fixes.for.1.0.7.14.zip
  5. Thanks
    vmn got a reaction from raiwa in KissIT Image Thumbnailer Support   
    Hello @raiwa and thanks again for your great addon.
    I wanted to have language specific default images. To achieve this I made the following change to kiss_it_image.php:
        if (defined('DEFAULT_IMAGE') && tep_not_null(DEFAULT_IMAGE) && !is_file(DIR_FS_CATALOG . $src)) {
          //VMN$src = DEFAULT_IMAGE;
          $src = 'includes/languages/' . $_SESSION['language'] . '/images/' . DEFAULT_IMAGE;
        } elseif ( (empty($src) || ($src == 'images/')) && (IMAGE_REQUIRED == 'false') ) {
          return false;
        }
    I wonder whether you would like to include this change into a future version of the addon:).
  6. Thanks
    vmn got a reaction from raiwa in KissIT Image Thumbnailer Support   
    Hi,
    I'm using Phoenix 1.0.7.11 and KissIT 3.4.2 and noticed that it creates empty folders for gallery images.
    I verified this using stock versions of 1.0.7.11 and KissIT.
    The function tep_image in kiss_it_image.php first creates a folder and the function _generateThumbnail in Image_Helper.php
    does not need it, because thumbs are not used for gallery images.
    This fix works for me. No empty folders will be created after applying it.
    In kiss_it_image.php tep_image replace the lines between
    // Create thumbs sub dirs and .htaccess.
    and
    // End create subdirectory and .htaccess.
    as follows
    //VMN NOT NEEDED Create thumbs sub dirs and .htaccess.    
    //VMN build thumbs sub dir path, in case it's needed
    $thumbs_dir_path = str_replace('images/', 'images/' . KISSIT_THUMBS_MAIN_DIR . $width .'_'.$height.'/', dirname($src) . '/');
    //VMN MOVED TO Image_Helper _generateThumbnail if(!is_dir($thumbs_dir_path)) {
    //VMN MOVED TO Image_Helper _generateThumbnail  mkdir($thumbs_dir_path,0775,true);
    //VMN MOVED TO Image_Helper _generateThumbnail }
    //VMN NOT NEEDED because sub dirs are created using mkdir('path',mode,true)
    //VMN NOT NEEDED $thumbs_dir = '';
    //VMN NOT NEEDED $thumbs_dir_paths = explode("/",$thumbs_dir_path);
    //VMN NOT NEEDED for ($i=0, $n=sizeof($thumbs_dir_paths); $i<$n; $i++) {
    //VMN NOT NEEDED $thumbs_dir .= $thumbs_dir_paths[$i] . '/';
    //VMN NOT NEEDED if(!is_dir($thumbs_dir)) {
    //VMN NOT NEEDED    mkdir($thumbs_dir, 0775);
    //VMN NOT NEEDED }
    //VMN NOT NEEDED create .htacces protection like in main image dir
    //VMN NOT NEEDED if (($i==$n-1) && (!is_file($thumbs_dir . '.htaccess')) ) {
    //VMN NOT NEEDED   $hpname = $thumbs_dir . '.htaccess';
    //VMN NOT NEEDED   if ($hp = fopen($hpname,'w')) {
    //VMN NOT NEEDED     fwrite($hp,$htacces);
    //VMN NOT NEEDED     fclose($hp);
    //VMN NOT NEEDED   }
    //VMN NOT NEEDED }
    //VMN NOT NEEDED} // end for
    //VMN NOT NEEDED End create subdirectory and .htaccess.
    There is no unnecessary creation of thumbs subfolders and htaccess files.
    The main thumbs folder htaccess will protect supbfolders as well.
    The only reference of $thumbs_dir_path is in $image = new Image_Helper(...).
    ================
    in Image_Helper.php  _generateThumbnail below the line:
    //make sure the thumbnail directory exists.
    1. comment out/remove the lines
     
    //VMN NOT NEEDED if ( !is_writable ( $this->thumbs_dir_path ) ) {
    //VMN NOT NEEDED    trigger_error ( 'Cannot detect a writable thumbs directory!', E_USER_NOTICE );
    //VMN NOT NEEDED }
    //VMN            The check below is already done in _checkImage returning 'no_thumb_required'
    //VMN NOT NEEDED if ( is_readable ( $this->_thumb_src ) ) {
    //VMN NOT NEEDED    $this->_calculated_width =  (int)$this->attributes['width'];
    //VMN NOT NEEDED    $this->_calculated_height = (int)$this->attributes['height'];
    //VMN NOT NEEDED    return $this->src = $this->_thumb_src;  
    //VMN NOT NEEDED }
    2. add
          //VMN moved from kiss_it_image.php
          if(!is_dir($this->thumbs_dir_path)) {      
             mkdir($this->thumbs_dir_path,0775,true); // true ->Allows the creation of nested directories specified in the pathname
          }

    Do you see any problems with this approach?
     
  7. Thanks
    vmn got a reaction from raiwa in KissIT Image Thumbnailer Support   
    Hi,
    I've upgraded Phoenix from 1.0.7.9->1.0.7.10->1.0.7.11 and noticed that the Gallery Kissit setup stopped working.
    I think I managed to upgrade pi_gallery_kissit.php to be compatible with 1.0.7.11. Maybe you already have done that. Here's my stuff.
     
    pi_gallery_kissit.zip
  8. Thanks
    vmn got a reaction from raiwa in Store Mode BS   
    Hi,
    I noticed that my fix for commenting out the ExpiresDefault line in .htaccess does not check whether the line is already commented out. This happens if I switch between offline and offline-test without switching to online in between. Also someone may have intentionally commented it out.
    So, in includes/modules/header_tags/ht_store_mode.php:
    find:
            $file = preg_replace('@ExpiresDefault@','#ExpiresDefault',$file);   //VMN
    replace the line with:
            //Is ExpiresDefault already commented out by us?                                                                      //VMN
            if ( strpos($file, '#Store Mode comment:ExpiresDefault') === false ) {                                     //VMN
                $file = preg_replace('@ExpiresDefault@','#Store Mode comment:ExpiresDefault',$file);   //VMN
            }                                                                                                                                                             //VMN
    find:
            $file = preg_replace('@#ExpiresDefault@','ExpiresDefault',$file);   //VMN
    replace the line with:
            $file = preg_replace('@#Store Mode comment:ExpiresDefault@','ExpiresDefault',$file);     //VMN
     
     
  9. Like
    vmn got a reaction from Smoky Barnable in Store Mode BS   
    Hi Rainer and thanks again for a very useful addon.
    I've got some comments.
    For Php 7.x:
    in includes/modules/header_tags/ht_store_mode.php
    -replace
          while (list($id, $value) = each($lng->catalog_languages)) {
    -with
          foreach($lng->catalog_languages as $key => $value) {

    I noticed that the folder htaccess_backups is browsable.
    This is what I did in includes/modules/header_tags/ht_store_mode.php.
    I replaced the function htaccess_backup with this code:
      // function create htaccess backup  
      function htaccess_backup($bkup_name) {
        $separator = ((substr(DIR_FS_CATALOG, -1) != '/') ? '/' : '');
        $backupDir = DIR_FS_CATALOG . $separator . 'htaccess_backups';
        $backupDir .= '/';
        // create backup dir
        if(!is_dir($backupDir)) mkdir($backupDir, 0755);
        // create .htaccess protection containing allowed ip's
        $htaccessfile = $backupDir . '.htaccess';
        $allowed_ips_array = explode(',', MODULE_HEADER_TAGS_STORE_MODE_ALLOWED_IPS);
        $htaccess = '';
        foreach ($allowed_ips_array as $ip) {
            $htaccess .= 'Require ip ' . $ip . "\n";
        }
        file_put_contents($htaccessfile, $htaccess);
        $htaccessfileOrig = DIR_FS_CATALOG . $separator . '.htaccess';
        $htaccessfileBkup = $backupDir . $bkup_name;
        $result = copy($htaccessfileOrig, $htaccessfileBkup);
    }
     
    I also wanted to add a button to check the shop availability status, as follows:
    In maintenance.php
    - find
      define('TEXT_MAINTENANCE_CONTACT_ENGLISH', '<br><br><a href="mailto: %s ?Subject=Store Offline" target="_top">Contact</a>');
    - add after
      define('TEXT_MAINTENANCE_STATUS_ENGLISH', '<br><br>To verify the site status ... Click Continue<br><br>');
    - find
    </style>
    - add before
    .button {
        background-color: #4CAF50; /* Green */
        border: none;
        color: white;
        padding: 10px 22px;
        text-align: center;
        text-decoration: none;
        display: inline-block;
        font-size: 16px;
        border-radius: 8px;    
    }

    - find
        if ( defined('TEXT_MAINTENANCE_CONTACT_ENGLISH') && TEXT_MAINTENANCE_CONTACT_ENGLISH != '' && $store_mail != '' ) {
          echo  sprintf(TEXT_MAINTENANCE_CONTACT_ENGLISH, $store_mail);
        }
    - add after
        if ( defined('TEXT_MAINTENANCE_STATUS_ENGLISH') && TEXT_MAINTENANCE_STATUS_ENGLISH ) {
          echo  TEXT_MAINTENANCE_STATUS_ENGLISH;
        ?>
         <form>
            <input type="button"  class="button" value="Continue" onclick="window.location.href='<?php echo dirname($_SERVER["REQUEST_URI"])."/index.php?language=en";?>'" />
        </form>
        <?php
        }
    After putting the shop online again this seems to work pretty well in Chrome and Edge, but not always in Firefox, especially with Firefox with multiple tabs/windows open. Firefox keeps cacheing pages very stubbornly.
    All comments are welcome!
  10. Like
    vmn got a reaction from raiwa in State Selector for BS   
    Hi,
    thanks for this great contribution.
    Has anybody tried to translate the standard browser error message 'Please fill out this field'?
    The language of the message seems be the same as the browser language.
    This is what I did.
    in includes/functions/html_output.php and in the function  tep_draw_input_field
    check if the 'required' is in the parameters:
    ..
        if (tep_not_null($parameters)) {
            if (strpos($parameters, 'required') !== false) {
               $parameters .= ' oninvalid="this.setCustomValidity(\'' . FORM_INPUT_VALUE_MISSING. '!\')" onchange="this.setCustomValidity(\'\')"';
            }
            $field .= ' ' . $parameters;
        }
    ..
    in includes/languages/english.php
    add
    //customized form input error message
    define('FORM_INPUT_VALUE_MISSING','This field is required');
    in includes/languages/finnish.php
    //customizedform input error messages
    define('FORM_INPUT_VALUE_MISSING','Tämä on pakollinen tieto');
    This seems to work both in latest Firefox and Chromium.
    Any comments?
  11. Like
    vmn got a reaction from raiwa in NEW! Complete Order Editing Tool!   
    We only use flat shipping with minimum shipping fee. The shipping fee can be changed in the order editor, if needed.
    The discount coupon cannot be changed, only removed, in the order editor. In case of other discounts, we simply change the product price in the order editor.
    I have also added order language. Admin interface language is automatically changed based on the order. Our shop supports Finnish and English.
    See my attached modifications. The files belong to folders admin and admin/order_editor.
    I hope this helps somebody to develop the order editor NG.
    vmn.order.editor.zip
×
×
  • Create New...