Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I am trying to obtain a list of orders with over 250 contents #314

Open
aogg2023 opened this issue Jan 3, 2024 · 0 comments
Open

I am trying to obtain a list of orders with over 250 contents #314

aogg2023 opened this issue Jan 3, 2024 · 0 comments

Comments

@aogg2023
Copy link

aogg2023 commented Jan 3, 2024

namespace app\api\controller;
use commonfunctions\src\Commonfunctions;
use think\Controller;
use app\api\controller\Baiduimages;
use app\api\controller\Spapi;

use PHPShopify\ShopifySDK;

class Shopify extends Controller {

protected function _initialize(){

    $commonfunctions=	new Commonfunctions;
    $Baiduimages=	new Baiduimages;
    $Spapi=	new Spapi;
    
}

protected function shopinfo($admin_id){
    
    $shop=db("admin_extend")->where(array("admin_id"=>$admin_id))->find();
    
    $shopname = $shop["store_name"] . ".myshopify.com";
    $apiKey = $shop["api_key"];
    $apiPassword = $shop["password"];
    $apiVersion = '2023-10';
    
    $config = array(
        'ShopUrl' => $shopname,
        'ApiKey' => $apiKey,
        'Password' => $apiPassword,
        'ApiVersion' => $apiVersion,
        'isEmbeddedApp' => false,
        'isPrivateApp' => false,
        'Curl' => array(
            CURLOPT_SSL_VERIFYPEER => false,
            CURLOPT_SSL_VERIFYHOST => false
        )
    );

    $shopify = new ShopifySDK($config);
    
    return $shopify;
    
}


//获取订单
public function get_orders(){
    
    //$products = $shopify->Product->get();
    
    //$productsCount = $shopify->Order->count();
    
    
    $id="";
    if(isset($orderid)){
        $id=$orderid;
    }
    
    $shopify=$this->shopinfo(2395);
  
    $fields="id,total_price,subtotal_price,total_discounts,total_tax,total_weight,currency,".
            "financial_status,fulfillment_status,note,created_at,processed_at,closed_at,location_id,email,".
            "shipping_address,line_items,order_number,fulfillments,shipping_lines,customer,payment_gateway_names,tags";
    
    $params = array(
        'status' => 'any',
        'limit' => 250,
        'fields' => $fields
    );
    
    $orders = $shopify->Order($id)->get($params);
    
    return $orders;
    
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant