Jump to content
thirty bees forum

Coachonko

Members
  • Posts

    21
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Coachonko

  1. My shipping partner fetches thirty bees data using the web service to create shipments on their website,

    Their website doesn't fail to fetch any data (no errors in the logs) but it fails to create shipments for guest orders.

    At the moment I have to manually create shipments on their website for all guest orders. I can't change their software and they refuse to change it, how can I "fix" this issue on my end? (without disabling guest checkouts)

  2. In the process of debugging the paypal module I have upgraded a staging environment to bleeding edge,

    I know for certain that the webservice worked fine before the upgrade, now the shipping company can't get the orders from the webservice. Is the webservice broken on bleeding edge?

  3. Make thirty bees read-only and start a new project called thirtythree bees, this time as a RESTful API instead of monolithic. 

    No more legacy code, everybody does whatever they want with the front-end. Provide a templating engine as a module for those who want server-rendered.

    I might just do this myself actually.

    • Like 1
  4. 2 hours ago, datakick said:

    Try to downgrade paypal module, for example use version 5.4.5 - https://github.com/thirtybees/paypal/releases/tag/5.4.5. If that help, we know that the issue is new injection is 5.5 version.

    If that does not help, try updating your store to bleeding edge / 1.4 -- a lot of issues were fixed there. Might help. Might not. 

    I have just tested with 5.4.5 and I get the same error.

    I should also mention that I am using the one-page checkout, if you'd like to try to reproduce the issue

    Upgrading to bleeding-edge / 1.4 is not ideal, as the production environment does have a theme already developed and some overrides (though still no third party modules). But I will attempt the upgrade to fix the paypal module, I need the guest checkouts working.

    UPDATE: I have tested bleeding edge and the error happens there too.

    To recap: this happens on a clean install of tb, bleeding edge, no overrides, many default modules disabled, niara theme, one page checkout. It also happens on 1.3.0 and with PayPal module version 5.4.5.

    UPDATE2: provided screenshot of modules enabled

    screencapture-obfuscated.png

      

    2 hours ago, datakick said:

    PayPal module tries to convert cart to an order.

    I believe the module does something to the cart because the cart is gone, but it is not successfully transformed into an order.

  5. 8 minutes ago, datakick said:

    It might be. It might not. 

    PayPal module tries to convert cart to an order. To do that it uses standard core functionality - PaymentModule::validateOrder method. This method triggers a lot of hooks that other modules can subscribe to. It's quite likely that some of these modules throws an exception that causes the validation process to fail. For example, there can be some module that synchronize data, sends an email, or whatnot. 

    And I'm not even talking about overrides.

    Without error message we don't know what is wrong, and we can't even assign blame to a specific module (paypal). I know it's frustrating, but that's the way it is.

    Ok, I am testing this on a clean tb install without any overrides. So you can take those out of the equation.

    As for modules, I am also not using any third party modules. Many of the ones that come with a clean install have been disabled too, as an attempt to isolate the problem.

    The log directory does not get any update, and the system logs in /var/log/php-fpm only report those notices. I don't know where this error is logged, if it is at all. Can you please help me?

  6. On module version 5.5.0 and tb 1.3.0, PHP 7.4

    Logged-in customers can checkout fine, guest checkouts always fail, resulting in the message

    An error occurred during the payment


    Trying to debug the problem, all I can find in the logs is the following 3 notices from PHP-FPM.

    [14-Oct-2022 07:34:48 Europe/Rome] PHP Notice:  Undefined index: order_reference in /var/www/domain.com/html/cache/smarty/compile/8c/ef/52/8cef52e10da76c532f10ad5be9c7a51c761cc3ee_0.file.order-confirmation-plus.tpl.php on line 119
    [14-Oct-2022 07:34:48 Europe/Rome] PHP Notice:  Trying to get property 'value' of non-object in /var/www/domain.com/html/cache/smarty/compile/8c/ef/52/8cef52e10da76c532f10ad5be9c7a51c761cc3ee_0.file.order-confirmation-plus.tpl.php on line 119
    [14-Oct-2022 07:34:51 Europe/Rome] PHP Notice:  Undefined variable: process in /var/www/domain.com/html/modules/paypal/paypal.php on line 935

    The last undefined variable error was fixed here.

    order_reference is used to create a link for the user to follow the order. The fact that it is undefined makes me think that the order id is not created.

    In the backoffice, I can confirm that the guest user is created correctly, with all of the information. To me it is clearly an issue is with the module.

     

    This is a serious problem, please help.

  7. The paypal module, when using the payments plus option, (slowly) loads login/cc options in an iframe.

    This iframe seems to be in english only, there does not seem to be a language selection within the iframe. How does it select the correct language?

    Why does it ignore the selected front-office language?

  8. While I was trying to solve this problem I found the following errors in the php-fpm logs

    [08-Oct-2022 08:30:59 Europe/Brussels] PHP Notice:  Undefined variable: process in /var/www/domain.com/html/modules/paypal/paypal.php on line 935

    This is filling the /var/log/php-fpm/www-error.log file

    I am on Euro Linux 8.6, PHP 7.4, thirty bees 1.3 stable

    Update: I have opened a github issue on the paypal repository about this.

  9. 7 hours ago, datakick said:

    it can be... a lot if things. I dont think this is application issue, looks like env misconfiguration problem. For example:

    https://hpduy17.wordpress.com/2019/01/29/deal-with-swift-transportexception-when-sending-gmail-from-laravel-application/

    O my god... I had completely forgotten about the selinux booleans. And that was the problem. `sudo setsebool -P httpd_can_network_connect on` fixed it.

    This is not the first time it happened. They're always too far in the back of my mind. Thank you for reminding me

  10. On stable 1.3.0

    I want to move away from using PHP's mail function, I want to connect to a SMTP server using port 465 with TLS.

    I enter SMTP server, username, password, encryption and port according to the mail server requirements, but when I test the configuration I get the following

    Connection could not be established with host mail.domain.com [Permission denied #13]

    Note: mail.domain.com is a placeholder to ask for help here, the configuration I entered is correct but it does not seem to work.

    The mail server is not blocking my thirty bees server, my thirty bees server does not have any ports blocked. I believe this problem is specific to thirty bees. Where can I find more information about this error? I don't see it in the logs in the logs directory and it does not even appear in the php-fpm logs.

    What can the problem be?

  11. Thanks! This can be very useful when there is a large amount of these links, dynamically getting title is much faster than editing translations.

    6 hours ago, datakick said:

    It's doable, but not very friendly. Look what static methods are available in Meta class. You could you getMetaByPage, or getCategoryMetas or getCmsMetas

    
    {assign var='contactMeta' value=Meta::getMetaByPage('contact', $lang_id)}
    {assign var='categoryMeta' value=Meta::getCategoryMetas(4, $lang_id, 'category')}
    {assign var='cmsMeta' value=Meta::getCmsMetas(9, $lang_id, 'cms')}
    <pre>
      contact title = {$contactMeta.title}
      category title = {$categoryMeta.meta_title}
      cms title = {$cmsMeta.meta_title}
    </pre>

     

    contactMeta works perfectly

    categoryMeta works but it seems like thirty bees appends the name of the website to the title, so the output should be processed.

    The cmsMeta doesn't seem to work.

    If how do you fetch the name of the page instead of the meta title?

  12. I can get links to pages with the following smarty tags 

    {$link->getPageLink('contact')|escape:'html':'UTF-8'}
    {$link->getCategoryLink(4)|escape:'html':'UTF-8'}
    {$link->getCmsLink(9)|escape:'html':'UTF-8'}

    Is there a way to get page titles instead of having to use the {l s='title'} tags?

  13. 32 minutes ago, datakick said:

    Personally, I would create new database table `tb_postcode_zone_map` with two columns `postcode` and `id_zone`, and use this db table to map from postcode to zone id. 

    Again, better to do with module

    Is the need of setting different rates for different ZIP codes something unique to Italy? Should this feature be in the core of thirty bees? wakabayashi also assumed it would be a core feature that had to do with zones.

    Adding a database table does make sense but managing a database is a bit more complex than editing cleartext. With a GUI I can see shop owners manage it fine though.

  14. 18 minutes ago, datakick said:

    My 2 cents:

    Overrides should always be the last resort. They are quite brittle, and it might prevent future updates of your store.

    In this case, you can use hook actionGetIDZoneByAddressID instead of override. That would require to implement very simple module that registers this hook and implements handler function. Overall, it would not be more complex than your override.

    If you insist on using override, you should at least implement it in a way that utilize the parent method. Instead of

    
    public function someMethod() 
    {
       // my custom code
       ...
       // copied and pasted code from core class
       ...
    }

    you should use

    
    public function someMethod() 
    {
       // my custom code
       ...
       // call parent someMethod implementation
       return parent::someMethod();
    }

    That way, it's more likely that the override will work if method 'someMethod' is changed in core in the future 

    Thanks, those are interesting suggestions.

    I really have no idea why I can't get any module I write to work, I wish I could find more information on how to do this. The modules I write just simply do not show up in the modules list in the backoffice, so I can't actually install them

    Do you have any example of the *correct way* to override? I followed PS documentation and it was very lackluster.

    Should mention that I primarily code in swift and I am not experienced with PHP.

  15. 1 hour ago, wakabayashi said:

    I am not sure about it. But isn't it possible without an override? 

    I mean you can use different shipping costs for different zones. Can't you just create new zone for this zip codes?

    I don't think it is possible to assign zip codes to zones without overrides no, I haven't seen that anywhere

  16. I've seen some posts about doing this on PS 1.4 and 1.5 so I did what I could:

    1. created override in override/classes/Address.php

    <?php
    class Address extends AddressCore
    {
        // New function to get the postcode from the given address
        public static function getPostcodeByAddress($idAddress){
            $pc = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(
                (new DbQuery())
                    ->select('postcode')
                    ->from('address', 'a')
                    ->where('a.`id_address` = '.(int) $idAddress)
            );
            return $pc['postcode'];
        }
        public static function getZoneById($idAddress)
        {
            if (!isset($idAddress) || empty($idAddress)) {
                return false;
            }
    
            // Use the new function
            $postcode=self::getPostcodeByAddress($idAddress);
            // Minor islands and Venice
            if (in_array($postcode,array(
                "04027", // Ponza
                "80073", // Capri
                "09014", // Carloforte
                "98000", // Eolie, Salina
                "91023", // Favignana
                "58012", // Giglio
                "80070", // Ischia
                "07024", // La Maddalena
                "92010", // Lampedusa, Linosa
                "98055", // Lipari
                "91017", // Pantelleria
                "80079", // Procida
                "71040", // Tremiti
                "90010", // Ustica
                // Venezia begin
                "30121", "30122", "30123", "30124", "30125", "30126", "30127", "30128", "30129", "30130", "30131", "30132", "30133", "30134", "30135", "30136", "30137", "30138", "30139", "30140", "30141", "30142", "30143", "30144", "30145", "30146", "30147", "30148", "30149", "30150", "30151", "30152", "30153", "30154", "30155", "30156", "30157", "30158", "30159", "30160", "30161", "30162", "30163", "30164", "30165", "30166", "30167", "30168", "30169", "30170", "30171", "30172", "30173", "30174", "30175", "30176", 
                // Venezia end
                "57031", "57032", "57033", "57036", "57037", "57038", "57039" // Elba
                ))) {
                return 10; // ID of the zone for these zip codes
            }
            // Livigno is even more expensive
            if (in_array($postcode,array("23030"))) { // Array because maybe more zip codes will be added in the future
                return 11; // ID of the zone for these zip codes
            }
    
            if (isset(static::$_idZones[$idAddress])) {
                return static::$_idZones[$idAddress];
            }
    
            $idZone = Hook::exec('actionGetIDZoneByAddressID', ['id_address' => $idAddress]);
    
            if (is_numeric($idZone)) {
                static::$_idZones[$idAddress] = (int) $idZone;
    
                return static::$_idZones[$idAddress];
            }
    
            $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(
                (new DbQuery())
                    ->select('s.`id_zone` AS `id_zone_state`, c.`id_zone`')
                    ->from('address', 'a')
                    ->leftJoin('country', 'c', 'c.`id_country` = a.`id_country`')
                    ->leftJoin('state', 's', 's.`id_state` = a.`id_state` AND c.`contains_states` = 1')
                    ->where('a.`id_address` = '.(int) $idAddress)
            );
    
            static::$_idZones[$idAddress] = (int) ((int) $result['id_zone_state'] ? $result['id_zone_state'] : $result['id_zone']);
    
            return static::$_idZones[$idAddress];
        }
    }

     2. tested

    It seems to work properly on checkout. More testing should be done. Does anything look off to you?

     

    UPDATE: I still want feedback on this override. From my testing it seems to work as intended both for registered and guest customers. I'll mark it as best answer so others may use this information for their shop

  17. I am working for a shop based in Italy. In italy there are "remote areas" within municipalities (states) that cost more money to deliver to. The shipping partner provided a list of ZIP codes of these locations.

    I want to override TB to assign these zip codes to a zone that isn't the default state zone, so that when a customer provides the mandatory zip code at checkout (guest or registered), the carrier rates of the correct zone are applied.

    What controller handles this behavior?

    UPDATE: please look at the override below

×
×
  • Create New...