Jump to content
thirty bees forum

312erik123

Members
  • Posts

    35
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by 312erik123

  1. Hello,

    Noticed something that might be considered a bug when having customizable products in a multistore environment - where the stores share products.

    With a customizable product, product.tpl will see that the product is customizable and try to add fields. However the the function getCustomizationFields() in Product.php checks in the table "customization_field_lang" where customizable entries exists only exists the original store. So the $field variable served to product.tpl is bool with the value false. Resulting in no fields...

  2. Yeah I guess.

    I’m experiencing some weird issues with module, so I had to disable it. For example when using Safari, if I press the add to cart button on a product page, I’m redirected to the cart, but the cart is empty…have you had similar issues?

  3. The exact same as me. I’ve sent them an email and they replied that a dev would look at it. Which I guess is far from a promise.

    I also get this error occasionally:

    Error: Call to a member function getParam() on string
     
    modules/litespeedcache/controllers/front/esi.php line 94

    which I also sent to them. But I see that you’ve already made a bug report on their GitHub about it!

  4. @the.rampage.rado Many thanks for your tips. My site was under a SPAM-attack for a couple of days. With that taken care of the newly generated file is not growing in size the same way. Also found a few bugs in my code with the "Collect PHP Logs" module. 

    Now it's mostly the litespeed module that generates "Deprecated" messages...maybe I'll send them an email and see if they want to update the module.

  5. 7 minutes ago, the.rampage.rado said:

    https://github.com/thirtybees/homeslider this home slider?

    If so could you push those changes? The community will definitely be grateful. 

    Well, more of a hack actually so maybe not a good idea to push into the codebase, but this is the code:

    Override with this method:

        protected function processImage($sourceFile, $sourceFileName)
        {
            $imageSize = getimagesize($sourceFile);
            if (! $imageSize) {
                throw new PrestaShopException($this->l("Failed to resolve image size"));
            }
            $mimeType = strtolower(substr(strrchr($imageSize['mime'], '/'), 1));
            if (! in_array($mimeType, static::ALLOWED_EXTENSIONS)) {
                throw new PrestaShopException(sprintf($this->l("Unsupported mime type  %s"), $mimeType));
            }
     
            // resize file to target destination
            $filename = md5(microtime()) . '_' . preg_replace('/[^a-zA-Z0-9._-]/', '', $sourceFileName);
            $filenameSmall = preg_replace('/(\.jpg)$/', 'small$1', $filename);
     
            $filenameWebp = preg_replace('/\.jpg$/', '.webp', $filename);
            $filenameWebpSmall = preg_replace('/\.jpg$/', '.webp', $filenameSmall);
           
            $filepath = static::getImageDir() . $filename;
            $filepathSmall = static::getImageDir() . $filenameSmall;
     
            $filepathWebp = static::getImageDir() . $filenameWebp;
            $filepathWebpSmall = static::getImageDir() . $filenameWebpSmall;
     
            if ($imageSize[0] > 1000) {
                $changeFactor = 0.5;
            } else {
                $changeFactor = 0.8;
            }
     
            if (! ImageManager::resize($sourceFile, $filepath, null, null, $mimeType)) {
                throw new PrestaShopException($this->l('An error occurred during the image resizing'));
            }
     
            if (! ImageManager::resize($sourceFile, $filepathSmall, $imageSize[0]*$changeFactor, $imageSize[1]*$changeFactor, $mimeType)) {
                throw new PrestaShopException($this->l('An error occurred during the image resizing'));
            }
     
            if (! ImageManager::resize($sourceFile, $filepathWebp, null, null, 'webp')) {
                throw new PrestaShopException($this->l('An error occurred during the image resizing'));
            }
     
            if (! ImageManager::resize($sourceFile, $filepathWebpSmall, $imageSize[0]*$changeFactor, $imageSize[1]*$changeFactor, 'webp')) {
                throw new PrestaShopException($this->l('An error occurred during the image resizing'));
            }
     
            return $filename;
        }

    And include this in the homeslider.tpl:

                  <picture>
                      {$imageUrl=$link->getMediaLink($slideImageUrl)|escape:'htmlall':'UTF-8'}
                      {$imageUrlsmall=preg_replace('/(\.jpg)$/', 'small$1', $imageUrl)}
                      {$filenameWebp = preg_replace('/\.jpg$/', '.webp', $imageUrl)}
                      {$filenameWebpSmall = preg_replace('/\.jpg$/', '.webp', $imageUrlsmall)}
     
                      <source media="(max-width: 600px)" srcset="{$filenameWebpSmall}" type="image/webp">
                      <source media="(min-width: 601px)" srcset="{$filenameWebp}" type="image/webp">
                      <source media="(max-width: 600px)" srcset="{$imageUrlsmall}" type="image/jpeg">
                      <source media="(min-width: 601px)" srcset="{$imageUrl}" type="image/jpeg">
                      <img class="img-responsive"
                            src="{$link->getMediaLink($slideImageUrl)|escape:'htmlall':'UTF-8'}"
                            alt="{$slide.legend|escape:'htmlall':'UTF-8'}"
                            {if isset($slide.size) && $slide.size} {$slide.size}{/if}
                      </picture>

    Maybe someone can do a proper implementation with this as a base? (and of course don't forget to remove ImageMagic 🙂 )

    • Like 1
  6. 5 minutes ago, the.rampage.rado said:

    Regarding modules and webp - you have to customize the module to be able to work with webp images.

    I did so for Warehouse's lightweight image slider and now it displays web images. Of course no jpeg fallback, etc as it uses the originals that are uploaded.

    Exactly, thats what i do with the Homeslider. I have overridden the "processImage" function to generate wepb and jpg images in 2 sizes and included a responsive scrset in the homeslider.tpl file. I guess you could do that for basically any module.

  7. Hello,

    Problem solved, or kind of solved... The overrides from ImageMagic remained eventhough i had disabled the module. With them removed I now get webp-images, most of them are quite a bit bigger than the jpgs...maybe a quality setting...

    And for anyone else looking to trouble shoot php code using Logger::addlog(""); works well!

  8. Hey!

    Thanks for you quick responses. @the.rampage.rado I'm not using ImageMagic.

    @datakick Tried to update to latest bleeding edge, same issue. When i generate thumbnails, they are generated as both jpg and webp, where the webp is significantly smaller. However when i try to do the same thing for the homeslider, the images are the exact same size. This is how I call ImageManager:Resize method

    ImageManager::resize($sourceFile, $filepathWebp, null, null, 'webp') -  where the sourceFile is a jpg file, the filepath is specified with a wepb extension...any ideas?

  9. Hello,

    Trying to reduce the footprint of some parts of my website by using webp images. So I've been trying ImageManager:resize to convert to webp, however, the size of the image is always exactly the same as the input jpg-file. Anyone know why that is the case? How can I use ImageManger to convert wepb and reduce the size of my images?

    Thanks Erik

  10. @datakick Hi, thanks for answering. In prestashop 1.6 i could use this structure:

    image.thumb.png.43cd54227c8b2c29eb6130548b51ce18.png

    The first combination would get an image assigned to position 2 from the url - and all following combinations with position 2 and no url would get the same image. 

    As thirty bees works today - how do I know which position is assigned to each image so that I can refer to that image? And where do I specify the image url?

    Thanks Erik

  11. On 5/1/2023 at 7:42 PM, Oncle said:

    Hello, I have done what is said:

    Change it to look like this:

    {assign var='free_ship' value=count($cart->getDeliveryAddressesWithoutCarriers(true))}

    But after a while I got this other error:

    Attempt to modify property "value" on null

    when rendering smarty template /themes/community-theme-default/./breadcrumb.tpl

    Any suggestions?

    Thanks

    Have the same issue - did you manage to solve it?

  12. Works! Perfect, many thanks!

    checked my backup site, it also hade 7.4 in the platform_check file before any changes/updates. So I guess settings.conf.php wasnt being updated, but the rest of the system was

    • Like 1
×
×
  • Create New...