• Resolved nzfade

    (@nzfade)


    Everything works, until i get to the Import List. The product is there where I can edit categories, tags etc, the data is all in it, images etc as well

    When I click Import Now

    it comes up with a red box above the product saying ‘error’

    Have I done something wrong?

    The imported list is empty, and nothing in woocommerce products etc …… it’s like this is the step that we have to do to make sure everythings right before importing the product, and all I get is error.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter nzfade

    (@nzfade)

    I’ve encountered a PHP fatal error related to the woo-alidropship plugin on my WordPress site. The issue arises when attempting to use a function tied to freight data handling within the plugin. Below is the relevant error message:

    vbnetCopy code

    PHP Fatal error: Uncaught Error: Cannot use object of type WP_Error as array in wp-content/plugins/woo-alidropship/includes/data.php on line 2655

    This error is triggered during an operation in the admin area, specifically when trying to access freight information through the plugin’s import list functionality.

    Could you provide guidance on resolving this issue or inform me if a patch is available? The error significantly impacts the plugin’s functionality and my site’s operations.

    Thank you for your assistance.

    Plugin Support angelagrey

    (@angelagrey)

    Hi,

    Thank you for reaching out to us.

    I’ve checked on my site and didn’t encounter this problem: https://prnt.sc/WOQ_OJ9_vnAF

    I think it may be a conflict. You might consider conducting a full test following these instructions: https://docs.woocommerce.com/document/how-to-test-for-conflicts/

    Best regards.

    Plugin Support angelagrey

    (@angelagrey)

    Thread Starter nzfade

    (@nzfade)

    Here’s the fix, in the data.php file this fixed the importing of the file.

    public static function new_get_freight( $args, $freight_ext ) {
    $response = array(
    ‘status’ => ‘error’,
    ‘freight’ => array(),
    ‘code’ => ”,
    ‘from’ => ”,
    );

    try {
        $_m_h5_tk     = get_option( 'ald_token_m_h5_tk', 'xxxxxxxxxxxxxxxxxxxxxxxxxx' );
        $_m_h5_tk_enc = get_option( 'ald_token_m_h5_tk_enc', 'xxxxxxxxxxxxxxxxxxxx' );
    
        $args['ext']        = $freight_ext;
        $args['quantity']   = $args['count'];
        $args['clientType'] = 'pc';
        $args['userScene'] = 'PC_DETAIL';
    
        $freight = [];
    
        $token = explode( '_', $_m_h5_tk )[0] ?? '';
        $data  = wp_json_encode( $args );
    
        $sign_response = wp_remote_post( 'https://ald.villatheme.com/villatheme-ald-get-signature', [
            'body' => [
                'data'  => $data,
                'token' => $token,
            ]
        ] );
    
        if ( is_wp_error( $sign_response ) ) {
            error_log( 'Sign response error: ' . $sign_response->get_error_message() );
            return $response;
        }
    
        $sign_response_body = wp_remote_retrieve_body( $sign_response );
        $sign_response = json_decode( $sign_response_body, true );
    
        if ( !is_array( $sign_response ) || empty( $sign_response['sign'] ) || empty( $sign_response['time'] ) ) {
            error_log( 'Invalid sign response format or missing data.' );
            return $response;
        }
    
        $sign = $sign_response['sign'];
        $time = $sign_response['time'];
    
        $url = "https://acs.aliexpress.com/h5/mtop.aliexpress.itemdetail.queryexpression/1.0/?jsv=2.5.1&appKey=12574478&t={$time}&sign={$sign}&api=mtop.aliexpress.itemdetail.queryExpression&v=1.0&type=originaljson&dataType=jsonp";
    
        $cookies = [new WP_Http_Cookie( array( 'name' => '_m_h5_tk', 'value' => $_m_h5_tk ) ),
                    new WP_Http_Cookie( array( 'name' => '_m_h5_tk_enc', 'value' => $_m_h5_tk_enc ) )];
    
        $request = wp_remote_post( $url, [
            'user-agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36',
            'headers'    => array(
                'Content-Type' => 'application/x-www-form-urlencoded',
                "Accept"       => 'application/json',
            ),
            'body'       => [ 'data' => $data ],
            'cookies'    => $cookies,
        ] );
    
        if ( is_wp_error( $request ) ) {
            error_log( 'Request error: ' . $request->get_error_message() );
            return $response;
        }
    
        $body = wp_remote_retrieve_body( $request );
        if ( is_wp_error( $body ) ) {
            error_log( 'Body retrieval error: ' . $body->get_error_message() );
            return $response;
        }
    
        $body = json_decode( $body, true );
        if ( !is_array( $body ) || empty( $body['data'] ) ) {
            error_log( 'Invalid response body format or missing data.' );
            return $response;
        }
    
        $data = $body['data'] ?? [];
        // Continue with your logic after ensuring $data is properly set...
    
        // Your existing logic for processing $data...
    
    } catch ( \Exception $e ) {
        error_log( print_r( $e->getMessage(), true ) );
    }
    
    return $response;

    }

    • This reply was modified 8 months ago by nzfade.
    Plugin Support angelagrey

    (@angelagrey)

    Thank you for sharing your insights.

    I’m having the same issue. How were you able to fix it please?

    Plugin Support angelagrey

    (@angelagrey)

    I received your ticket. Please keep me updated there instead

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.