Plugin Directory

Changeset 2972309


Ignore:
Timestamp:
09/27/2023 03:37:27 PM (2 years ago)
Author:
loystarapp
Message:

Fix Bug with incomplete product syncing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • loystar-woocommerce-loyalty-program/trunk/includes/api/class-api.php

    r2237449 r2972309  
    1212     * @var string
    1313     */
    14     protected $base_url = 'https://api.loystar.co/api/v2/';
     14    // protected $base_url = 'https://api.loystar.co/api/v2/';
     15    protected $base_url = 'https://api0.loystar.co/api/v2/';
    1516
    1617    /**
     
    519520     */
    520521    public function get_merchant_products($id = 0,$single_data_index_arr_form = false,$include_deleted = false){
    521         $url = $this->base_url.'get_latest_merchant_products';
     522        $url = $this->base_url.'get_latest_merchant_products?page[size]=50000';
     523        // $url = $this->base_url.'get_latest_merchant_products';
    522524        $data = array('data' => array('time_stamp'=>0) );
    523525        if(!$this->get_endpoint($url, $this->remote_args(['body' => json_encode($data)] )) ){
     
    729731            "business_branch_id" => $branch,
    730732            "user_id" => $customer['user_id'],
     733            "payment_reference" => "woo_comm_".$order_id,
     734            "reference_code" => time(),
    731735            "transactions" => array()         
    732736            ]);
    733737        $transaction_data = array();//for product
    734        
    735738        $transaction_data_array = array(
    736739                "points"=> 0,
     
    780783                }
    781784            }
     785            //quantity of item
     786            $transaction_data_array['quantity'] = $item_data->get_quantity();
     787            //timestamp
     788            $transaction_data_array['created_at'] = time();
     789            //product type
     790            $transaction_data_array['product_type'] = "product";
     791
    782792            //update transaction_data_array
    783793            if(strtolower($loyalty_program['program_type']) == 'simplepoints')
     
    790800        }
    791801        $send_data['sale']['transactions'] = $transaction_data;
     802        // var_dump($send_data); die;
    792803        //check if there was error 500 while adding product to branch error
    793804        if($add_p_to_branch_500_error){//record
     
    796807        $url = $this->base_url.'sales';
    797808        $send_data_json = json_encode($send_data);
     809        // print_r($send_data_json); die;
    798810        $remote_args =  $this->remote_args(['body' => $send_data_json]);
    799811        if(!$this->get_endpoint($url, $remote_args)){
Note: See TracChangeset for help on using the changeset viewer.