Syntax Error, Unexpected ':' - Can You help Me?

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
FrancescoDionisi
New php-forum User
New php-forum User
Posts: 1
Joined: Mon Oct 16, 2017 10:25 am

Mon Oct 16, 2017 10:31 am

Hi guys; with my friends, we write a plugin to sync BigBuy with woocommerce; but we have some error; like on line 33 - Syntax Error, Unexpected ':' ; line 70 the same, we don't understand What could it be...

Can you help me?

<?php

/*
Plugin Name: Sincronizzazione BigBuy
Description: Plugin per importare tramite le API di BigBuy il catalogo, gli ordini, i costi di spedizione e il tracking delle spedizioni
Version: 1.1
Author: Lavinia Mosut-Guglielmo - Rev Visual-art.it
*/

/* INIZIO CODICE */
$data = date('Y-m-d H:i:s');
$ch = curl_init('http://api.bigbuy.eu/?apikey=xxxxxxxxxx ... xxxxxxxxxx');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);

function getProducts($id)
{
WooCommerce.get('ht tp://api.bigbuy.eu/rest/catalog/products/' + $id, function ($err, $data, $res) {
debug('res', res);
});
}

function getAttributes($id)
{
WooCommerce.get('ht tp://api.bigbuy.eu/rest/catalog/attributes/' + $id, function ($err, $data, $res) {
debug('res', res);
});
}


function ProductsVariations() {

"default_attributes": [{
"id": 0,
"attributeGroup": "",
"name":"+1,00",
"isoCode": ""
}],
"variations":
{
"manufacturer":"",
"sku": "VARIATION-SKU",
"ean":"",
"weight": "",
"height": "",
"width": "",
"depth": "",
"dateUpd": $data,
"category": "",
"categories": true,
"dateUpdDescription": $data,
"dateUpdImages": $data,
"dateUpdStock": $data,
"wholesalePrice": "",
"retailPrice": "",
"dateAdd": $data,
"video": "",
"active": "",
"images": true,
"attributes": false,
"tags": true,
"taxRate": "",
"taxId": ""
}
]
}

function addVariation($id) {
WooCommerce.put('ht tp://api.bigbuy.eu/rest/catalog/products/' + $id, function ($err, $data, $res) {
"variations": [
{
"manufacturer":"",
"sku": "VARIATION-SKU",
"ean":"",
"weight": "",
"height": "",
"width": "",
"depth": "",
"dateUpd": $data,
"category": "",
"categories": true,
"dateUpdDescription": $data,
"dateUpdImages": $data,
"dateUpdStock": $data,
"wholesalePrice": "",
"retailPrice": "",
"dateAdd": $data,
"video": "",
"active": "",
"images": true,
"attributes": false,
"tags": true,
"taxRate": "",
"taxId": ""
}
]
}, function ($err, $data, $res) {
debug('err', format(err));
debug('data', format(data));
debug('res', format(res));
});
}


function addAttribute($id) {
WooCommerce.get('ht tp://api.bigbuy.eu/rest/catalog/products/' + $id {
"attributes": [
{
"id": 0,
"attributeGroup": "",
"name":"+1,00",
"isoCode": ""
"position": 0,
"visible": true,
"variation": true,
}
]
}, function ($err, $data, $res) {
debug('err', format(err));
debug('data', format(data));
debug('res', format(res));
});
}

function CreateOrder($internalReference){
WooCommerce.post('http://api.bigbuy.eu/rest/order/create/' + $internalReference, {
"order":
{
"internalReference": "",
"cashOnDelivery": 0,
"language": "",
"paymentMethod": "",
"carriers": [
"name": ""
],
"shippingAddress":
{
"firstName": "",
"lastName": "",
"country": "",
"postcode": "",
"town": "",
"address": "",
"phone": "",
"email": "",
"comment": ""
},
"products": [
"reference": "",
"quantity": ""
]
"dateAdd": $data,
});
}


function NewOrder($internalReference){
WooCommerce.get('http://api.bigbuy.eu/rest/order/new/' + $internalReference, {
"order":
{
"internalReference": "",
"cashOnDelivery": 0,
"language": "",
"paymentMethod": "",
"carriers": [
"name": ""
],
"shippingAddress":
{
"firstName": "",
"lastName": "",
"country": "",
"postcode": "",
"town": "",
"address": "",
"phone": "",
"email": "",
"comment": ""
},
"products": [
"reference": "",
"quantity": ""
]
"dateAdd": $data;
}
}
}

function Spedizione($order){
WooCommerce.post('http://api.bigbuy.eu/rest/shippingcosts/orders/' + $order, {
"order":{
"delivery":
{
"isoCountry":"",
"postcode":""
},
"products":[
"reference": "",
"quantity": ""
]
}
});
}

function TrackingOrder($idOrder){
WooCommerce.post('http://api.bigbuy.eu/rest/tracking/order/' + $idOrder);
}

function Tracking($id,$reference){
WooCommerce.post('http://api.bigbuy.eu/rest/tracking/orders/' + $id + $reference, {
"track":{
"orders":[
"id": "",
]
}
});
}
}
?>

User avatar
hyper
php-forum Fan User
php-forum Fan User
Posts: 500
Joined: Mon Feb 22, 2016 5:52 pm

Mon Oct 16, 2017 11:28 am

You have way too many errors in that code, most of it doesn't even look like it's php?

Your opening and closing brackets, braces and parenthesis are wrong.

As the error states, you cannot use colons where you have put them, including the ones it hasn't pulled you up on yet.

There is no simple answer as to how to fix your code except to say start learning php, I'm not trying to sound harsh but what you have is completely wrong.

User avatar
hyper
php-forum Fan User
php-forum Fan User
Posts: 500
Joined: Mon Feb 22, 2016 5:52 pm

Mon Oct 16, 2017 11:29 am

And use code tags when listing code, the </> button in the post reply box.

Post Reply