• Resolved scriptandgo

    (@scriptandgo)


    Hello, I have two questions

    The first one is that I need to have the seconds in my order date, is there a way to add this, so I have this date’s format : “yyyy_mm_dd hh:mm:ss”

    And the second one is that I export my data in .csv format but I need a line break at some point in the middle of my data, how can I do that ?

    Thanks in advance

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Author algol.plus

    (@algolplus)

    hello

    please, go to section “Format”,
    set Date = Custom, enter Y_m_d
    set Time = Custom, enter H:i:s

    open “CSV” and set “Product rows start at new line”

    thanks, Alex

    Thread Starter scriptandgo

    (@scriptandgo)

    Ok, it’s good for the Date Time Format
    But for the line breaker, it’s not exactly that

    I create 2 columns one “Identifiant de ligne” with the values “E” and another one “Identifiant de ligne” with the values “L” and i want to go to the line for the value “L”
    like in this exemple

    ligne 1 with all the column’s name

    ligne 2″(E)/3976/”2023-10-20 09:43:11″//0/20//Gantois2/Emilien2/Test&Go2/”54 Square de la Mettrie”//35700/Rennes/FR/0611225344/[email protected]/Gantois2/Emilien2/”54 Square de la Mettrie”//35700/Rennes/FR/”

    ligne 3 “(L)//ART161432/”MathEOS – Logiciel de mathématiques”/1/29.9//”

    Plugin Author algol.plus

    (@algolplus)

    It requires a bit of programming.

    Please, visit https://docs.algolplus.com/algol_order_export/sample-addons/
    Download and install CSV plugin ( via >Plugins>Add New>Upload)
    Go back to export – you should mark checkbox at bottom (just above buttons)
    Use FileZilla to edit file /wp-content/plugins/woe-custom-csv/woe-custom-csv.php


    Thread Starter scriptandgo

    (@scriptandgo)

    I found a way I just create a static field in product section and use  “Product rows start at new line”

    Thanks

    Plugin Author algol.plus

    (@algolplus)

    ok, got it

    Thread Starter scriptandgo

    (@scriptandgo)

    I’m very close to the goog result that OpenSi ask me i just got one problem
    like i said i needed to go at the line at some point and i use “Product rows start at new line” and it works but i need that the “Coupon Amout” to be with the Fields of Product is there a way to do that ?

    Exemple of what a i get

    E;13179;1;[email protected];3817;”2024-01-25 09:06:48″;0;;;”Paiement CB”;0.00;20;0.00;0.00;0.00;0.00;”Carte bancaire avec SIPS/”;;2;Machin;Truc;;”1 rue de l’église”;”Appt 408″;;33150;Paris;FR;0611111111;;[email protected];;;;;;;;;;;;;;;;;;;;;;;;;;
    L;ART229577;”Le Robert Correcteur – 1 activation (Pros/Institutions/Particuliers)”;1;57.75;20;;;
    30

    And what i want is

    E;13179;1;[email protected];3817;”2024-01-25 09:06:48″;0;;;”Paiement CB”;0.00;20;0.00;0.00;0.00;0.00;”Carte bancaire avec SIPS/”;;2;Machin;Truc;;”1 rue de l’église”;”Appt 408″;;33150;Paris;FR;0611111111;;[email protected];;;;;;;;;;;;;;;;;;;;;;;;;;
    L;ART229577;”Le Robert Correcteur – 1 activation (Pros/Institutions/Particuliers)”;1;57.75;30;20;;;

    Plugin Author algol.plus

    (@algolplus)

    try >Setup Fields>Product Order Items>Item Discount Amount

    Thread Starter scriptandgo

    (@scriptandgo)

    It doesn’t work because when i have a Coupon = 30 i have a Item Discount Amount a 24.75

    Plugin Author algol.plus

    (@algolplus)

    Thread Starter scriptandgo

    (@scriptandgo)

    I’m not exactly sure what i’m supposed to do
    I created a new product column with the name “item_coupon”

    and after that, I don’t really know what code should I put in the “custom PHP code”

    How should I use this “public get_discount_total([string $context = ‘view’ ]) : string”

    Do you have an example ?

    Plugin Author algol.plus

    (@algolplus)

    if you added product (green!) field “item_coupon” — use code

    add_filter('woe_get_order_product_value_item_coupon', function ($value, $order, $item, $product,$item_meta) {
    return $order->get_discount_total();
    }, 10, 5);

    Thread Starter scriptandgo

    (@scriptandgo)

    Ok the code you gave me work but it giving me the the amount but what i need is the % of reduction

    Plugin Author algol.plus

    (@algolplus)

    You get order coupons and get %% from the WC_Coupon

    just read https://stackoverflow.com/questions/44977174/get-coupon-data-from-woocommerce-orders

    Thread Starter scriptandgo

    (@scriptandgo)

    So something like that :
    “add_filter(‘woe_get_order_product_value_item_coupon’, function ($value, $order, $item, $product,$item_meta) {
    $order = wc_get_order( $order_id );
    $order_items = $order->get_items(‘coupon’);
    return $order_items->get_amount();
    }, 10, 5);”

    Thread Starter scriptandgo

    (@scriptandgo)

    
    ok i found 
    
    
    add_filter('woe_get_order_product_value_item_coupon', function ($value, $order, $item, $product, $item_meta) {
    
        foreach ($order->get_used_coupons() as $coupon_code) {
    
            $coupon_post_obj = get_page_by_title($coupon_code, OBJECT, 'shop_coupon');
    
            $coupon_id = $coupon_post_obj->ID;
    
            $coupon = new WC_Coupon($coupon_id);
    
            $coupon_amount1 = $coupon->get_amount();
    
        }
    
        return $coupon_amount1
    
        ;
    
    }, 10, 5);
Viewing 15 replies - 1 through 15 (of 18 total)

The topic ‘Order date second & Line break’ is closed to new replies.