app/Http/Controllers/ShopifyController.php
// Function to create/update shopify orders recored in app's database
Function to create/update shopify orders recored in app's database
Function to create / update shopify orders recored in app ' s database
public function createUpdateShopifyProducts($row,$org_id)
		{
			$product_id = @$row['id'];
			if(count($row['variants']) > 0){
				foreach($row['variants'] as $rline){
					$product_variant_id = @$rline['id'];
					$arrlineitems = array();
					$arrlineitems['organization_id'] = $org_id;
					$arrlineitems['product_id'] = $product_id;
					$arrlineitems['product_variant_id'] = $product_variant_id;
					$arrlineitems['title'] = @$rline['title'];
					$arrlineitems['sku'] = @$rline['sku'];
					$arrlineitems['barcode'] = @$rline['barcode'];
					$arrlineitems['option1'] = @$rline['option1'];
					$arrlineitems['option2'] = @$rline['option2'];
					$arrlineitems['option3'] = @$rline['option3'];
					$arrlineitems['api_created_at'] = @$rline['created_at'];
					$arrlineitems['api_updated_at'] = @$rline['updated_at'];
					$existing = $this->obj->getFirstResultByConditions('shopify_product',
								[ 'organization_id'=>$org_id, 'product_id'=>$product_id, 'product_variant_id'=>$product_variant_id ],
								[ 'id' ]); 
					if($existing){
						$this->obj->makeUpdate('shopify_product', ['id'=>$existing->id], $arrlineitems);
					}else{
						$this->obj->makeInsert('shopify_product', $arrlineitems);
					}
				}
			}
		}
public function createUpdateShopifyProducts ( $ row , $ org_id ) { $ product_id = @ $ row [ 'id' ] ; if ( count ( $ row [ 'variants' ] ) > 0 ) { foreach ( $ row [ 'variants' ] as $ rline ) { $ product_variant_id = @ $ rline [ 'id' ] ; $ arrlineitems = array ( ) ; $ arrlineitems [ 'organization_id' ] = $ org_id ; $ arrlineitems [ 'product_id' ] = $ product_id ; $ arrlineitems [ 'product_variant_id' ] = $ product_variant_id ; $ arrlineitems [ 'title' ] = @ $ rline [ 'title' ] ; $ arrlineitems [ 'sku' ] = @ $ rline [ 'sku' ] ; $ arrlineitems [ 'barcode' ] = @ $ rline [ 'barcode' ] ; $ arrlineitems [ 'option1' ] = @ $ rline [ 'option1' ] ; $ arrlineitems [ 'option2' ] = @ $ rline [ 'option2' ] ; $ arrlineitems [ 'option3' ] = @ $ rline [ 'option3' ] ; $ arrlineitems [ 'api_created_at' ] = @ $ rline [ 'created_at' ] ; $ arrlineitems [ 'api_updated_at' ] = @ $ rline [ 'updated_at' ] ; $ existing = $ this -> obj -> getFirstResultByConditions ( 'shopify_product' , [ 'organization_id' => $ org_id , 'product_id' => $ product_id , 'product_variant_id' => $ product_variant_id ] , [ 'id' ] ) ; if ( $ existing ) { $ this -> obj -> makeUpdate ( 'shopify_product' , [ 'id' => $ existing -> id ] , $ arrlineitems ) ; } else { $ this -> obj -> makeInsert ( 'shopify_product' , $ arrlineitems ) ; } } } }
Function to create/update shopify orders recored in app's database
Function to create / update shopify orders recored in app ' s database
// Check whether all uri are processed or not. Status 0 means not processed.