Forum Replies Created

Viewing 15 replies - 1 through 15 (of 45 total)
  • Plugin Author headplus

    (@headplus)

    Thank you! ??

    Thread Starter headplus

    (@headplus)

    Σα? παραθ?τω 2 βελτιωμ?νε? αντικαταστ?σει? σε 2 functions του κ?δικα σα? που πιθαν?ν να βρε?τε χρ?σιμα:

    public function get_order_weight()
    {
        $chosen_methods = WC()->session->get('chosen_shipping_methods');
        $weight = 0;
    
        foreach (WC()->cart->get_cart() as $cart_item_key => $cart_item) {
            $_product = $cart_item['data'];
    
            if (is_numeric($_product->get_weight())) {
                $weight += $_product->get_weight() * $cart_item['quantity'];
            }
        }
    
        return $weight;
    }
    public function calculate_shipping($packages = array())
    {
        $settings = AcsPointsPlugin::getSettings();
        $baseCost = $settings['baseCost'];
        $baseCostKgLimit = $settings['baseCostKgLimit'] ?? 0;
        $costPerKg = $settings['costPerKg'] ?? 0;
    
        $freeShippingLimit = $settings['freeShippingUpperLimit'];
        $optionCost = 0;
    
        $orderTotalCost = 0;
        $weightTotal = 0;
    
        foreach (WC()->cart->get_cart() as $cart_item_key => $cart_item) {
            $_product = $cart_item['data'];
            $qty = $cart_item['quantity'] ?? 1;
            $tempWeight = (float) $_product->get_weight(); // Changed to float for decimal weights
            $weightTotal += $qty * $tempWeight;
            $orderTotalCost += $qty * $_product->get_price();
        }
    
        if ($freeShippingLimit != '' && $orderTotalCost < $freeShippingLimit) {
            $optionCost = $baseCost;
            if ($weightTotal > $baseCostKgLimit) {
                $optionCost += $costPerKg * ($weightTotal - $baseCostKgLimit);
            }
        }
    

    Στον 1ο ενημερωμ?νο κ?δικα, η συν?ρτηση επαναλαμβ?νεται π?νω απ? τα ε?δη καλαθιο? χρησιμοποι?ντα? WC()->cart->get_cart() και υπολογ?ζει το β?ρο? με β?ση το β?ρο? κ?θε προ??ντο? πολλαπλασιασμ?νο με την ποσ?τητα του. Η μ?θοδο? get_cart_contents_weight() που παρ?χεται απ? το WooCommerce υπολογ?ζει το συνολικ? β?ρο? των περιεχομ?νων του καλαθιο?, γεγον?? που καθιστ? τον κ?δικα πιο συνοπτικ? και εξαλε?φει την αν?γκη αν?κτηση? πακ?των απ? την κατηγορ?α αποστολ??.

    Στον 2ο ενημερωμ?νο κ?δικα, η συν?ρτηση χρησιμοποιε? WC()->cart->get_cart() για να επαναλ?βει τα ε?δη του καλαθιο? και υπολογ?ζει το συνολικ? β?ρο? και το συνολικ? κ?στο? παραγγελ?α? με β?ση την ποσ?τητα και το β?ρο? κ?θε προ??ντο?. Πολλαπλασι?ζοντα? το $tempWeight με το $qty στη γραμμ? $weightTotal += $qty * $tempWeight;, ο υπολογισμ?? λαμβ?νει σωστ? υπ?ψη την ποσ?τητα κ?θε προ??ντο? και συσσωρε?ει το συνολικ? β?ρο? αν?λογα. Η αν?γκη πρ?σβαση? στα $packages[‘contents’] εξαλε?φεται.

    ?σοι αντιμ?τωπ?ζουν προβλ?ματα υπολογισμο? (δοκιμασμ?να με την ?κδοση 6.0.5 ) προτ?ινω να προχωρ?σουν σε αντικατ?σταση με των ?νω Functions.

    Ευελπιστ? οι προτ?σει? μου να φανο?ν χρ?σιμε?.

    Σα? ευχαριστ? για την αν?γνωση

    • This reply was modified 1 year, 5 months ago by headplus.
    • This reply was modified 1 year, 5 months ago by headplus.
    Thread Starter headplus

    (@headplus)

    Θα ?θελα συμπληρωματικ? να σα? προτε?νω αν μου επιτρ?πετε, ?πειτα απο μι? γρ?γορη ματι? στον κ?δικα σα?, να επαναδιατυπ?σετε τον κ?δικα στο τρ?πο υπολογισμο? σε ολε? στι? περιπτ?σει? β?ρου? χρησιμοποι?ντα? πιο απλ? στα functions το WC()->cart->get_cart_contents_weight(); ?ναντι αυτ?ν χρ?ζουν δι?ρθωσει?.

    Thread Starter headplus

    (@headplus)

    Τα points εμφαν?ζονται κανονικ?. ?ταν γ?νεται προσπ?θεια κ?ποια? επιλογ?? point ?μω? δεν ανο?γει κ?ποιο παρ?θυρο για την επιλογ? του, ο?τε φυσικ? απομνημονευεται με κ?ποιο τροπο ?στε να προχωρ?σει το checkout με την επιλογ? του point.

    Tα console errors που βλ?πω ε?ναι :

    1.You have included the Google Maps JavaScript API multiple times on this page. This may cause unexpected errors.

    2.invalidValueError: setCenter: not a LatLng or LatLngLiteral with finite coordinates: in property lng: not a number

    3.InfoWindow.open() was called without an associated Map or StreetViewPanorama instance.

    Thread Starter headplus

    (@headplus)

    hello! @wfjoshc Thank you for your reply!

    firstly I would like to mention that the function “bot fight” is able to be disabled very easily in Cloudflare and as you can imagine i tried it (with bot fight disabled). But never the scan worked!

    But i have GOOD NEWS and I solved my problems!!!

    I threw Wordfence in the trash and i replaced it with another valuable plugin that does not cause me any problems either with my local server or with Cloudflare etc.


    I hope in the future the tech team of WF manage to solve the problems that plugin has either in friendliness with Cloudflare or any other Firewall, either regarding the newer php etc.

    So…becouse time is money, (and please believe me, i have offer lot on Wordfence,)

    if someone has same problems mustn’t forget that he can use the Trush!


    Thank you again for your replies and for your time!

    Thread Starter headplus

    (@headplus)

    hello! @wfjoshc

    instructions that we use for Cloudflare with Central here: https://www.wordfence.com/help/central/connect/

    I Think that the wordfense team has to update the instructions for Cloudflare because cloudlfare has changed some setting.

    This might be “bot fight” mode.

    You can take a look at my settings about that:

    https://ibb.co/ftSZbRf

    https://ibb.co/VHjFhF3

    So as you can see i think that with these settings wordfence scan would must work..but it doesnt….

    so now what do you think that is going wrong after the email that i sent and screenshoots here?

    Thread Starter headplus

    (@headplus)

    @wfjoshc I just sent it!

    Thread Starter headplus

    (@headplus)

    Hi @wfjoshc,

    On Cloudflare settings Rate limiting rules section. shows: “No data”

    On Firewall rules i have 2 rules. the first is for my ip (and there are activities with some events from my site’s cronjob), and the second has the Wordfence’s servers ips as “allow” that there is no any avtivity(means no data on log).

    Thread Starter headplus

    (@headplus)

    Thank you for your reply.

    As you know cloudflare has many options and setting. Would you like to be more detailed about that?

    Thread Starter headplus

    (@headplus)

    hi again!
    i tried the new version 1.0.5 and it seems that works perfect now!
    Good job!!!!

    Thread Starter headplus

    (@headplus)

    sure! here is a screenshoot:

    https://ibb.co/FBWFN1M

    Thread Starter headplus

    (@headplus)

    it sounds nice! Good job!

    i updated and i tried it but i think that there is a coonflict with the plugin woocomerce cost of goods on columns. Please cheack it , becouse i dont know if it is my problem or generally .

    Thread Starter headplus

    (@headplus)

    Hi! thank you for your reply!
    I thought that the plugin supported the possibility to calculate with the total (vat+cost) for all the pieces for the line and not for one piece only.
    Despite this, I think it would be more convenient to have the total(inc vat)for 2 or more pieces and not just for 1 piece.

    Regarding the “Kοστο? Αγορ??” column, this refers to the purchase price from the supplier, but it concerns the total number of pieces and not just for 1 piece.

    Thread Starter headplus

    (@headplus)

    Screenshoot:

    https://ibb.co/jkrDCLN

    Thread Starter headplus

    (@headplus)

    Everything works perfect now! Congratulations for your instant reply!??

Viewing 15 replies - 1 through 15 (of 45 total)