Jump to content
thirty bees forum

musicmaster

Trusted Members
  • Posts

    691
  • Joined

  • Last visited

  • Days Won

    47

Posts posted by musicmaster

  1. I have in Prestools a function with which you can reduce the server error log so that each error message only is listed once (the most recent version). Maybe such a thing is an idea for Thirty Bees too?

  2. I was wrong. There is always just one product in the cookie. So there is no problem there.

    However, in the meantime I caught a cookie that is problematic. It looks like this:

    date_add|2021-12-27 17:40:23¤id_lang|1¤id_currency|1¤viewed|2005,1292,563,341,7534,414,2262,1974,1380,7041,409,3875,367,475,244,6043,3342,3573,1930,5861,367,6383,7668,6156,287,250,5899,3449,1316,3391,7386,370,2272,7526,732,1683,5917,5641,2151,384,1352,3330,7744,490,282,5847,1683,7380,7567,418,4312,4311,563,4520,1974,363,7663,336,5867,7666,184,879,3425,266,4353,7018,468,5966,6341,6367,2005,5528,490,2800,3330,7388,5561,2272,6374,3075,528,4385,2272,7383,7727,5917,3079,3622,3293,5867,3429,7679,7640,1683,3931,370,6486,303,1683,6067,3486,6485,7630,7881,6488,6414,3130,7630,6485,2005,6352,490,5918,7862,463,4462,2339,3342,7731,7431,5612,2339,4089,2800,328,7679,3130,7641,1683,384,382,1345,4321,5445,2367,401,329,6135,3109,302,357,6482,7427,5454,786,3477,2271,7384,4328,4317,4379,1694,3330,6134,543,2005,418,1683,6958,543,148,143,6344,4318,1153,4089,3198,7383,7630,6383,7017,7882,1329,5654,498,2266,3162,3028,3790,3671,1609,3429,382,367,397,6129,7017,414,1928,6041,4161,1991,3338,368,2005,4161,6041,397,1928,1961,2310,7897,4367,6488,4374,6390,5844,1860,543,6035,2257,5612,3942,6107,3520,3028,6096,6906,7879,7873,6131,2738,1351,6149,3155,427,6131,440,543,306,435,6058,7344,7383,1927,7231,145,7534,1341,2955,3276,3851,7872,5235,310,6043,6211,6119,543,1683,7643,3260,1860,3360,4405,1292,2005,610,1963,6140,6368,1108,7525,7888,692,5372,4399,2279,7525,7388,1694,7734,3939,1108,7679,578,692,514,3254,154,3342,3332,5507,3461,1683,6165,239,7872,7861,7635,3400,7886,3376,7111,1683,7731,543,5854,3380,7860,6180,7866,2299,2563,890,5612,7871,495,7872,7012,6134,6375,7871,214,606,2005,218,5836,3547,2256,7388,4129,1694,1868,156,6165,521,414,7640,2903,4386,1974,7004,7528,4129,4128¤nav_last_visited_category|150¤id_guest|7789982¤id_connections|6882358¤st_category_columns_nbr|2¤last_visited_category|34¤gaClientId|4Avfdcimq5uO¤id_cart|54602¤ga_cart|{"4129":{"id":"4129-1496","name":"chocoletter-deco-melk-220-gram","category":"chocoladeletters","brand":"","variant":"a","type":"typical","position":"0","quantity":1,"list":"cart","url":"","price":"6.38"}}¤checksum|3699172910
     

    When encrypted this cookie takes 4168 bytes and causes the error message.

     

     

  3. I had a short look at the content of a cookie and I was flabbergasted. Is it really necessary to story so much information? Here is my cookie (with some changes for privacy that don't change the length):

    date_add|2022-11-09 19:51:08¤id_lang|1¤id_currency|1¤id_guest|8484987¤id_connections|6812336¤viewed|4128,2595,4130,7073,4127,4074,4075,2686,2691,7513,4127,4126,4129,4128¤nav_last_visited_category|150¤id_compare|0¤id_customer|2422¤customer_lastname|Johnsson¤customer_firstname|Angel¤logged|1¤is_guest|¤passwd|$2y$10$rFACEsbXQnL.ysUP33X3k.TpGCvVuSJ2zxyRbABCDkl7VLsIpixvS¤email|[email protected]¤check_cgv|¤last_visited_category|150¤st_category_columns_nbr|2¤id_cart|53951¤checkedTOS|0¤ga_cart|{"4128":{"id":"4128-3893","name":"chocoletter-deco-puur-220-gram","category":"chocoladeletters","brand":"","variant":"a","type":"typical","position":"0","quantity":1,"list":"cart","url":"","price":"6.38"}}¤checksum|1611188096

    This cookie is 716 positions long. After encryption that is 1481. 

    This cookie contains just one product. That product takes nearly 200 positions. That would double with encryption and that would mean that with 13 more products I would cross the 4096 border. 

    I am not sure whether this is my problem. But i find it puzzling.

  4. When I look at my cookies with a cookie editor I see two cookies whose name starts with "thirtybees". One is 777 long and the other 1049. There are 6 other cookies but they are small. Yet when I look in Chrome's cookie overview it sees 9 cookies with a total size of 178 kb. 

    However, this is in the main shop that has no problems. It is my php script that generates the error and I have no idea why.

    Is there some way to debug this?

  5. I have a big problem that this year happens for the first time although the code is several years old. So it may be related to the TB update.

    I have an application where on the product page there is a button. When it is pressed it calls a php script in an iframe. The scripts adds one or more products in the desired way to the cart and then refreshes the page so that the updated cart is shown.

    The script is not particularly complicated. First it calls the TB with 'require("index.php");' and then it adds products to the cart with calls to '$cart->updateQty('.

    Previously this worked perfectly. Now it doesn't work for many people and when you look in the browser console why you see this error:

    set-cookie header is ignored in response from url https:/www.shop.com/addprod.php.
    The combined size of name and value must be less than or equal 4096 characters.

    The script doesn't contain code that interacts with the cookie. So it must happen somewhere in the Thirty Bees code - probably when a a product is added to the cart.

    What causes this error and how can I fix it?

     

  6. 1 hour ago, AndyC said:

    I may have found a small error with the basket.. If you try and remove a item it just says unable to delete. But when you refresh error item has gone .

    Screenshot 2022-11-27 175940.png

    Did you look in the server's error log?

  7. If things are more stable under PHP 8.0, try working there to fix the problems before going to 8.1. When you can fix problems by just looking in the error log your webshop can keep running. 

  8. 5 hours ago, datakick said:

    Then there is a question how existing documents are impacted by adding new products to order (I mean invoice, delivery slip, etc).

    In some countries there are strict laws that prohibit modifying existing invoices once they were delivered to end customer (my country is one of them). In thirty bees, we should consider invoice to be delivered upon creation -- even if email is not sent to customer, they can still download it from their account. 

    Maybe thirty bees is smart and generates new amendment invoice automatically. But maybe it's stupid and it modifies existing one, which could cause you a trouble.

    In small companies without stock management it is common that a delivery slip is printed, someone goes out to collect the order, finds that something is missing and then calls the customer to adapt the order.

    Some customers almost make a habit of calling with changes to an order they already placed.

    Those are quite major functionalities to delete. So I am in favor of at least keeping this functionality as a backoffice option that can be switched on.

     

     

  9. 1. Make sure you have the latest version of Thirty Bees and the modules

    Why bother with error messages that are solved in later versions?

    2. Make the fixes under PHP 7.4

    The show-stopping errors under PHP 8.1 are warnings under PHP 7.4. So it is much easier to fix them there. You just need to take the trouble to look in the error log of the server. Don't be lazy and fix all the problems that you find here.

    The worst that can happen this way is that your site is one minute offline when you upload a fix with a syntax error. And that can always be fixed quickly by going back to the original.

    Even PHP 8.0 is less strict than 8.1. So use that if you aren't allowed to go back to 7.4.

    After you switch to a lower PHP version you should empty the cache. 

    3. Smarty compiled files can be read

    Smarty "compiles" the template (".tpl") files into a kind of php files that can be found under the /cache/smarty/compile directory. The errors happen in this compiled version. For example:

    /cache/smarty/compile/fe/8c/6b/fe1_0.file.breadcrumb.tpl.php

    When you open such files in a text editor you will see that they are rather lightly processed versions of the original (in this case breadcrumb.tpl). At the top of such a file you will find a link to the original file. In this case the original is rather obvious, but note that their is no path in the compiled file name. So when you have an error in for example "view.tpl" you really need to look at the top of this compiled file to see the source.

    Next there is the line number. The line number in this compiled file is not the same as that in the original tpl file. Often it works to subtract 2 from the number (the compiled files have an extra header of two lines). If not you will have to use your creativity. search for variable names and other characteristic text to find the problematic line.

    4. Look what Thirty Bees did

    Themes are very similar. So there is a good chance that Thirty Bees encountered the same problems that you see with your theme and solved them. So if you are not sure how to solve a bug you can have a look at the same file in the Niara or the Community Theme theme and look how it was solved there.

    5. Look how I solved it for Panda

    In this post you will find how I solved it for Panda. It provides some explanation about what the problems are and how they are solved.

    • Like 1
    • Thanks 1
  10. 22 hours ago, wakabayashi said:

    It's not shipped, but when the delivery-slip was generated. I personally don't like this much. Shipped would be more logical imo. But we learnt to live with it ^^

    For me that will be another code customization.

  11. In a recently updated shop I don't see the "add a product" button below the product list of an order. What could cause this?

    The other button ("add a discount") is present.

  12. 26 minutes ago, AndyC said:

    Is anyone having issues with Panda when upgrading ... breadcrumb.tpl is causing everything to be 500 server error.. I may download a fresh copy of it on teh weekend and try again

    Did you read my post from 10 days ago? 

    I have a shop now running under 8.1 without problems and wrote some of my experiences down. I may have forgotten some issues but it should be a start. If anyone has additions they are welcome.

     

    • Like 1
  13. The Panda theme produces quite a lot of warnings for the error log. Usually they are harmless. In this post I will list the warnings and the fixes. As the Panda theme hasn't been upgraded for some time this will enable you to do it yourself.

    Make sure to update your modules and Thirty Bees to the last version. Make also sure that you have the latest version of Panda: older versions are quite different and with them the line numbers won't match.

    I haven't enabled all modules and tested them in all corners. So there may still be hidden problems. If you encounter a problem and find a solution, please report it here so that I can add it to the list. If you aren't able to solve it I will be happy to help you.

    SunnyToo has promised that they will release a new version.

     

    blockcart-json.tpl

    Warning:  Creating default object from empty value in
    /home/public/sites/www.shop.com/cache/smarty/compile/11/2b/10.file.blockcart-json.tpl.php on line 218 

    /themes/panda/modules/blockcart-json.tpl

    The offending line is line 81. It looks so:

    "free_ship": {(!$shipping_cost_float && !count($cart->getDeliveryAddressesWithoutCarriers(true, $errors_back)))|json_encode},

    To fix it it should be changed to by deleting the $errors_back argument

    "free_ship": {(!$shipping_cost_float && !count($cart->getDeliveryAddressesWithoutCarriers(true)))|json_encode},

    If you have another template that overrides the blockcart template you are likely to encounter the same issue. A very similar fix was made to the blockcart module. That fix provides also three other fixes that should be implemented. These are in the more remote parts of the code so you won't see the errors often:

    /themes/panda/modules/blockcart/includes/dropdown.tpl line 113

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

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

    /themes/panda/order-carrier-advanced.tpl  line 264 and 

    /themes/panda/order-carrier-opc-advanced.tpl  line 250

    change: {assign var='errors' value=' '|explode:''}

    to: {assign var='errors' value=[]}

     

    blockviewed

    There is a fix for the TB version of this module that you can also apply to your blockviewed_mod. It is discussed here and you can find the code here. As it concerns quite a lot of code I haven't copied it here. 

    Note that this concerns a possible problem and it doesn't produce error messages - except for the browser console when the rare problem really happens.

     

    blockwishlist

    [] PHP Warning:  count(): Parameter must be an array or an object that implements Countable in
    /home/public/sites/www.webshop.com/cache/smarty/compile/ba/cb/c4/bacbc7.file.blockwishlist-extra.tpl.php on line 25

    /themes/panda/modules/blockwishlist/blockwishlist-extra.tpl

    Line 28 looks like this:

    {if isset($wishlists) && count($wishlists) > 1}

    This should be changed to 

    {if isset($wishlists) && is_array($wishlists) && count($wishlists) > 1}

     

    breadcrumb.tpl

    [] PHP Warning:  Creating default object from empty value in 
    /home/public/sites/www.webshop.com/cache/smarty/compile/fe/8c/6b/fe1_0.file.breadcrumb.tpl.php on line 32

    The offending line is:

    {$matchCount = preg_match_all('/<a.+?href="(.+?)"[^>]*>([^<]*)<\/a>/', $path, $matches)}

    The problem is that $matches is not defined. So you need to add a line before this line:

    {$matches = []} 

     

    guest.php

    [] PHP Notice:  Trying to access array offset on value of type bool in 
    /home/public/sites/www.webshop.com/classes/Guest.php on line 207

    This error can happen in older shops. It happens because some entries are lacking in the ps_operating_systems entries for more recent OS's are missing. If you scroll a bit up from line 207 you will see which OS's are defined in the software.

     

    paypal.php and stnewsletter

    Array and string offset access syntax with curly braces is no longer supported
    in file /home/public/www.website.com/modules/paypal/paypal.php at line 2729

    This type of error is quite common and happens also with other modules.

    It has to with the syntax for arrays. Normally you write something like "$myarray[8]". However, there is an old type of syntax that uses curly brackets instead of the square brackets. In that case the same declaration looks like "$myarray{8}". In PHP 8 the latter syntax is no longer allowed. So you need to replace the curly brackets with square brackets.

    So

    if ((int) $num1{$i} > (int) $num2{$i})

    will be replaced by

    if ((int) $num1[$i] > (int) $num2[$i])

    stnewsletter has a similar problem on line 122.

     

    stgadwordsconversion.php

    [] PHP Warning:  Undefined array key "total" in
    /home/public/sites/www.webshop.com/cache/smarty/compile/53/63/eb/5363eb.file.front.tpl.php on line 32
    [] PHP Warning:  Undefined array key "iso_code" in
    /home/public/sites/www.webshop.com/cache/smarty/compile/53/63/eb/5363e.file.front.tpl.php on line 34
    [] PHP Warning:  Undefined array key "total" in 
    /home/public/sites/www.webshop.com/cache/smarty/compile/53/63/eb/5363.file.front.tpl.php on line 32
    [] PHP Warning:  Undefined array key "iso_code" in 
    /home/public/sites/www..webshop.com/cache/smarty/compile/53/63/eb/5363.file.front.tpl.php on line 34

    /modules/stgadwordsconversion/stgadwordsconversion.php

    This error always comes in fourfold when an order is made. Two times before the payment is made and two times in the callback from the payment provider.

    This is a module that used to be provided by SunnyToo. However, it is no longer supported and for me that was a reason to stop using it.

     

    stmegamenu.php

    [] PHP Warning:  "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? 
    in /home/public/sites/www.webshop.com/modules/stmegamenu/stmegamenu.php on line 3724
    [] PHP Warning:  "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? 
    in /home/public/sites/www.webshop.com/modules/stmegamenu/stmegamenu.php on line 3739

    /modules/stmegamenu/stmegamenu.php

    As "continue" is the old version and it works so I have replaced "continue" here with "break".

     

    stnewsletter

    Error message in the browser console from php-debug.js

    Deprecation: Array and string offset access syntax with curly braces is deprecated 
    in modules/stnewsletter/stnewsletter.php at line 123 php-debug.js:53:39

    Change in /modules/stnewsletter/stnewsletter.php on line 123

    if ($this->_cookie_path{0} != '/')

    into 

    if ($this->_cookie_path[0] != '/')

     

    stthemeeditor

    Symptom: when in the backoffice you want to configure this module it your modules page the call keeps hanging until you get some kind of timeout (for example a 504 error). When you look in the browser console under Network you see that the status of the call is "pending". When you look under Timing you see "call is not finished yet".

    This happens when some SunnyToo webpage is down. Just waiting will solve the problem. But if you want to access your theme-editor immediately here is a fix.

    The problem is in the function getVerInfo in the file /modules/stthemeeditor/ThemeLicense.php

    	public function getVerInfo()
    	{
    		if (!isset($_SESSION['st_version_info']) || !$_SESSION['st_version_info']) {
    			$api_url = 'http://biz236.inmotionhosting.com/~sunnyt7/version.php';
    			$theme = $this->getTheme();
    			$param = array(
    				'theme' => $theme,
    				'ver_only' => false,
    			);
    			if ($data = $this->makeCall($param, $api_url)) {
    				$_SESSION['st_version_info'] = $data;
    			} else {
    				$_SESSION['st_version_info'] = '';
    			}
    		}
    		return $_SESSION['st_version_info'];
    	}

    The link to inmotionhosting no longer works. Unfortunately that makes the function makeCall hang rather than return false.

    So a solution is to replace 

    			if ($data = $this->makeCall($param, $api_url)) {
    				$_SESSION['st_version_info'] = $data;
    			} else {
    				$_SESSION['st_version_info'] = '';
    			}

    with just the line

    $_SESSION['st_version_info'] = '';

    Possibly this is a temporary problem and SunnyToo will fix it.

     

    The themeconfigurator module

    After I had upgraded PHP to version 8.1 I found that I couldn't access my backoffice. It had an error in the themeconfigurator module. 

    This module was not active. Yet it was somewhere accessed by the theme. 

    The problem here is that Thirty Bees doesn't upgrade modules that are not active. So in this shop - a migrated Prestashop - I still had the old Prestashop version. 

    The solution was to delete this old version and copy a new version of this module from a recent Thirty Bees installation.

    Here an update file that fixes some of the issues.

     

    yotpo.php

    The Yotpo module produced the following warning:

    Warning:  count(): Parameter must be an array or an object that implements Countable in
    /home/public/sites/www.webshop.com/modules/yotpo/yotpo.php on line 268

    The relevant code was:

    $id_image = Product::getCover($id_product);
    if (count($id_image) > 0)

    Obviously this was a programming error on the side of Yotpo. $id_image is just a variable, not an array. So the corrected code became:

    $id_image = Product::getCover($id_product);
    if ($id_image > 0)

     

    The backoffice Modules page

    Under PHP 8.1 you will see in the backoffice Modules page warnings like the following:

    Deprecated: Optional parameter $type declared before required parameter $id_lang is implicitly treated
    as a required parameter in StMultiLinkGroup.php on line 127

    The offending code in this case is:

    public static function getLinkGroup($identify,$type=1,$id_lang)

    You can solve this by stripping "=1" from the "$type=1" part. The same applies to other function declarations with the same problem.

     

    Optional parameter $nbr declared before required parameter

    You will see a lot of these warnings when you open the Modules page in the backoffice. 

    Guilty are function declarations like this

    public static function getByCustomer($id_customer, $p = 1, $n = 0, $id_lang, $id_shop, $get_total = false)

    The problem are those definitions like "$p = 1". You can leave the values out.

    So the above function would become:

    public static function getByCustomer($id_customer, $p, $n, $id_lang, $id_shop, $get_total = false)

    As these are harmless I haven't changed them myself.

    • Like 5
  14. UPDATED

    After an upgrade to the latest bleeding edge I got the attached error. The error happens on the orders page in the backoffice and is obviously caused by the Whatsapp module. What puzzles me is that these function declarations and calls were the same under the old version where they didn't give a problem. The error message seems correct. Yet under the old version I didn't get an error.

    After some search I found that the GetAdminLink function in Link.php had been changed.

    The old version was:

        public function getAdminLink($controller, $withToken = true)
        {   $idLang = Context::getContext()->language->id;
            $params = $withToken ? ['token' => Tools::getAdminTokenLite($controller)] : [];
            return Dispatcher::getInstance()->createUrl($controller, $idLang, $params, false);
        }

    The new version is:

        public function getAdminLink($controller, $withToken = true, $params = [])
        {   $idLang = Context::getContext()->language->id;
            if ($withToken) {
                $params['token'] = Tools::getAdminTokenLite($controller);
            }
            return Dispatcher::getInstance()->createUrl($controller, $idLang, $params, false);
        }

    The puzzling thing is that the whatsappchat module calls it thus:

                $this->context->smarty->assign(array(
                    'action' => $this->l('WhatsApp'),
                    'action_whatsappchat' => $this->l('WhatsApp with this customer'),
                    'admin_base_dir' => $this->currentPageURL(),
                    'this_path_bo' => $this->_path,
                    'iso_code' => $this->context->language->iso_code,
                    'whatsappchat_admincontroller' => $this->context->link->getAdminLink('AdminWhatsappChat', true, $this->context->language->id),
                    'url' => false,
                    'show_button' => true,
                    'token' => Tools::getValue('token')
                ));

    So here the third argument is an integer.

    coreupdate.jpg.thumb.jpg.b62f981a6987112237ebe4bc400e348a.jpg

     

  15. On 10/5/2022 at 12:22 PM, coconutswan said:

    Hello everyone! I'm new to the group, but I'm very enthusiastic about this endeavor. I own a web hosting firm and would want to contribute monetarily and ultimately with development time to this project. Who is presently receiving contributions, and what are they used for? There seems to be a schism between this site and github.five nights at freddy's

    After the project had been floating around for some time last year it was taken over (bought) by @Smile who employed @datakick - who already was the biggest contributor - as programmer/developer. 

    I don't see the schism between the forum and Github. The forum is for general discussion and problems. Github is about bug reports and development. Usually a problem first appears on the forum. You are supposed to only make a bug report when you are rather sure that it is caused by the Thirty Bees software and not something that is specific to your shop - like a buggy module or a database inconsistency. Of course wishes for new features can be found at both locations.

    • Like 1
×
×
  • Create New...