yedek feed

PHOTO EMBED

Sat Aug 31 2024 20:58:19 GMT+0000 (Coordinated Universal Time)

Saved by @ECY

<?php
              
              require_once("secure/baglan/baglan.php");
require_once("secure/func.php");

             
                $turlar=$db->prepare("SELECT * FROM turlar");
                $turlar->execute();
                $turlarData = $turlar->fetchAll(PDO::FETCH_ASSOC);

               
$feed_metadata = [
    "shard_id" => 0,
    "total_shards_count" => 1,
    "processing_instruction" => "PROCESS_AS_SNAPSHOT",
    "nonce" => 202113041501
];

$products = [];

foreach ($turlarData as $tur) {
    $products[] = [
        "id" => $tur['id'],
        "title" => [
            "localized_texts" => [
                ["language_code" => "en", "text" => $tur['baslik']],
                ["language_code" => "es", "text" => $tur['isbaslik']],
            ]
        ],
        "description" => [
            "localized_texts" => [
                ["language_code" => "en", "text" => $tur['detay']],
                ["language_code" => "es", "text" => $tur['isdetay']],
            ]
        ],
        "rating" => [
            "average_value" => $tur['puan'],
            "rating_count" => $tur['puan']
        ],
        "product_features" => [
            [
                "feature_type" => "TEXT_FEATURE_INCLUSION",
                "value" => [
                    "localized_texts" => [
                        ["language_code" => "en", "text" => $tur['dahil']],
                        ["language_code" => "es", "text" => $tur['isdahil']],
                    ]
                ]
            ],
            [
                "feature_type" => "TEXT_FEATURE_HIGHLIGHT",
                "value" => [
                    "localized_texts" => [
                        ["language_code" => "en", "text" => $tur['ziyaret']],
                        ["language_code" => "es", "text" => $tur['isziyaret']],
                    ]
                ]
            ],
            [
                "feature_type" => "TEXT_FEATURE_MUST_KNOW",
                "value" => [
                    "localized_texts" => [
                        ["language_code" => "en", "text" => $tur['sss']],
                        ["language_code" => "es", "text" => $tur['issss']],
                    ]
                ]
            ]
        ],
        "options" => [
            [
                "id" => $tur['id'],
                "title" => [
                    "localized_texts" => [
                        ["language_code" => "en", "text" => $tur['baslik']],
                        ["language_code" => "es", "text" => $tur['isbaslik']],
                    ]
                ],
                "landing_page" => [
                    "url" => "https://turcotravel.com/tours/"+$tur['landing_page_url']
                ],
                "landing_page_list_view" => [
                    "url" => "https://turcotravel.com/tours/"+$tur['landing_page_url']
                ],
               "duration_sec" => $tur['gun'] +"Day",
                "cancellation_policy" => [
                    "localized_texts" => [
                        ["language_code" => "en", "text" => $tur['politika']],
                        ["language_code" => "es", "text" => $tur['ispolitika']],
                ],
                    "refund_conditions" => [
                        [
                            "min_duration_before_start_time_sec" => "7 Days",
                            "refund_percent" => $tur['refund_percent']
                        ]
                    ]
                ],
                "option_categories" => [
                    ["label" => $tur['tag_id']],
                    ["label" => $tur['isyer']]
                ],
                "related_locations" => [
                    [
                        "location" => [
                            "place_id" => $tur['ulke']
                        ],
                        "relation_type" => "RELATION_TYPE_RELATED_NO_ADMISSION"
                    ],
                    [
                        "location" => [
                            "place_info" => [
                                "name" => $tur['ulke'],
                                "coordinates" => [
                                    "latitude" => "",
                                    "longitude" => ""
                                ]
                            ]
                        ],
                        "relation_type" => "RELATION_TYPE_RELATED_NO_ADMISSION"
                    ]
                ],
                "price_options" => [
                    [
                        "id" => $tur['id'],
                        "title" => $tur['baslik'],
                        "price" => [
                            "currency_code" => "usdt",
                            "units" => $tur['fiyat'],
                            "nanos" => 0
                        ],
                        "fees_and_taxes" => [
                            "per_ticket_fee" => [
                                "currency_code" => "usdt",
                                "units" => $tur['fiyat']
                            ],
                            "per_ticket_tax" => [
                                "currency_code" => "usdt",
                                "units" => 0
                            ]
                        ]
                    ]
                ],
                "meeting_point" => [
                    "location" => [
                        "place_id" => $tur['ulke']
                    ],
                    "description" => [
                        "localized_texts" => [
                            ["language_code" => "en", "text" => $tur['yer']],
                            ["language_code" => "es", "text" => $tur['isyer']],
                        ]
                    ]
                ]
            ]
        ],
        "related_media" => [
            
            [
                "url" => "https://turcotravel.com/"+$tur['image'],
                "type" => "MEDIA_TYPE_PHOTO",
                "attribution" => [
                    "localized_texts" => [
                        ["language_code" => "en", "text" => $tur['detay']],
                        ["language_code" => "es", "text" => $tur['isdetay']]

                    ]
                ]
            ]
        ],
        "operator" => [
            "google_business_profile_name" => [
                "localized_texts" => [
                    ["language_code" => "en", "text" => "Turco Travel"]
                ]
            ],
            "locations" => [
                [
                    "location" => [
                        "place_info" => [
                            "name" => $tur['yer'],
                            "phone_number" => "+90(543) 442 80 69",
                            "website_url" => "https://turcotravel.com/",
                            "unstructured_address" => "Turkey - Istanbul"
                        ]
                    ]
                ]
            ]
        ],
        "inventory_type" => "INVENTORY_TYPE_DEFAULT",
        "confirmation_type" => "CONFIRMATION_TYPE_INSTANT",
        "fulfillment_type" => [
            "mobile" => true,
            "print_at_home" => false,
            "pickup" => true
        ]
    ];
}

$output = [
    "feed_metadata" => $feed_metadata,
    "products" => $products
];

// JSON çıktısını oluşturma
header('Content-Type: application/json');
echo json_encode($output, JSON_PRETTY_PRINT);
?>
content_copyCOPY