src/EventListener/DefaultValueProvider.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\EventListener;
  3. use Pimcore\Model\Asset;
  4. use Pimcore\Event\Model\ElementEventInterface;
  5. use Pimcore\Event\Model\DataObjectEvent;
  6. use Pimcore\Event\Model\AssetEvent;
  7. use Pimcore\Event\Model\DocumentEvent;
  8. use Pimcore\Event\Model\VersionEvent;
  9. use \Pimcore\Model\DataObject;
  10. use Symfony\Component\EventDispatcher\GenericEvent;
  11. use Pimcore\Model\Element\ValidationException;
  12. class DefaultValueProvider extends \Pimcore\Bundle\AdminBundle\Controller\AdminController {
  13.     public function onPostAdd(ElementEventInterface $e) {
  14.         if ($e instanceof DataObjectEvent) {
  15.             $objectData $e->getObject();
  16.             if($objectData->gettype() == 'object'){
  17.                 if($objectData->getClassName() == 'ProductCategory') {
  18.                     // $categoryAddUrl = "https://integration-5ojmyuq-23txbi6folvo6.ap-3.magentosite.cloud/rest/V1/bridge/catalog/category/add";
  19.                     $categoryAddUrl "http://local.itc.com/rest/V1/bridge/catalog/category/addToData";
  20.                     $data = array( 
  21.                         "category_id" => $objectData->getId(),
  22.                         "store_view_id" => "0"
  23.                     ); 
  24.                     $productSyncKey "qzgg1vbpgwk6pjctbv6ku2a65906ocpb";
  25.                     // $productSyncKey = "ah2zed4d9rcqgxc4ds16bh6wssdm8xni";
  26.                     $data_json json_encode(array("data" => $data)); 
  27.                     $curl curl_init(); curl_setopt($curlCURLOPT_CUSTOMREQUEST"PUT"); 
  28.                     curl_setopt($curlCURLOPT_POSTFIELDS$data_json); 
  29.                     curl_setopt($curlCURLOPT_URL$categoryAddUrl); 
  30.                     curl_setopt($curlCURLOPT_HTTPHEADER, array( 'Authorization: Bearer ' $productSyncKey'Accept: application/json''Content-Type:application/json', )); 
  31.                     curl_setopt($curlCURLOPT_RETURNTRANSFER1); 
  32.                     curl_setopt($curlCURLOPT_HTTPAUTHCURLAUTH_BASIC); 
  33.                     $result curl_exec($curl); 
  34.                     $resultArray json_decode($result); 
  35.                     curl_close($curl);
  36.                 }
  37.                 if($objectData->getClassName() == 'Products') {
  38.                     // $productSyncKey = "enlwq7pkg6t2od9blt93coomo7g6p9p0"; // Live Integration
  39.                     $productSyncKey "qzgg1vbpgwk6pjctbv6ku2a65906ocpb"// Local
  40.                     // $productUpdatedUrl = 'https://integration-5ojmyuq-23txbi6folvo6.ap-3.magentosite.cloud/rest/V1/bridge/catalog/product/add';
  41.                     $productUpdatedUrl 'http://local.itc.com/rest/V1/bridge/catalog/product/add';
  42.                     // echo $productUpdatedUrl.'<br>';
  43.                     // echo $productSyncKey;
  44.                     $data = array( "product_id" => $objectData->getId(),"store_view_id" => "0", );
  45.                     $data_json json_encode(array("data" => $data));
  46.                     $curl curl_init();
  47.                     curl_setopt($curlCURLOPT_CUSTOMREQUEST"PUT");
  48.                     curl_setopt($curlCURLOPT_POSTFIELDS$data_json);
  49.                     curl_setopt($curlCURLOPT_URL$productUpdatedUrl);
  50.                     curl_setopt($curlCURLOPT_HTTPHEADER, array( 'Authorization: Bearer ' $productSyncKey'Accept: application/json''Content-Type:application/json', ));
  51.                     curl_setopt($curlCURLOPT_RETURNTRANSFER1);
  52.                     curl_setopt($curlCURLOPT_HTTPAUTHCURLAUTH_BASIC);
  53.                     $result curl_exec($curl);
  54.                     $resultArray json_decode($result);
  55.                     curl_close($curl);
  56.                     // echo '<pre>'; print_r($resultArray); exit;
  57.                 }
  58.                 $productClasses = array(
  59.                     'Products' => 'SAP',
  60.                     'ProductITCStore' => 'ITC Store',
  61.                     'ProductAmazon' => 'Amazon',
  62.                     'ProductBigBasket' => 'Big Basket',
  63.                     'ProductBlinkit' => 'Blinkit',
  64.                     'ProductFlipkart' => 'Flipkart',
  65.                     'ProductJioMart' => 'JioMart',
  66.                     'ProductSwiggy' => 'Swiggy',
  67.                     'ProductZepto' => 'Zepto'
  68.                 );
  69.                 if (array_key_exists($objectData->getClassName(),$productClasses)) {
  70.                     $folder DataObject\Service::createFolderByPath('/Products/'.$productClasses[$objectData->getClassName()]);
  71.                     $folderId $folder->getId();
  72.                     $objectData->seto_parentId($folderId);
  73.                     $objectData->save();
  74.                 }
  75.                 if($objectData->getClassName() == 'Products') {
  76.                     // Create Objects
  77.                     // $productObj = DataObject\Products::getById($objectData->getId());
  78.                     // $this->createMarketPlaceProduct($productObj);
  79.                 }
  80.             } else if($objectData->gettype() == 'folder'){
  81.             }
  82.         }
  83.     }
  84.     public function createMarketPlaceProduct($productObj) {
  85.         $key $productObj->getkey();
  86.         $newObject = new DataObject\ProductAmazon();
  87.         $newObject->setKey(\Pimcore\Model\Element\Service::getValidKey('A_'.$key'object'));
  88.         $newObject->setstoreProduct($productObj);
  89.         $newObject->seto_parentId('1');
  90.         $newObject->save(["versionNote" => "Product created from SAP"]);
  91.         $newObject = new DataObject\ProductBigBasket();
  92.         $newObject->setKey(\Pimcore\Model\Element\Service::getValidKey('BB_'.$key'object'));
  93.         $newObject->seto_parentId('1');
  94.         $newObject->setstoreProduct($productObj);
  95.         $newObject->save(["versionNote" => "Product created from SAP"]);
  96.         $newObject = new DataObject\ProductBlinkit();
  97.         $newObject->setKey(\Pimcore\Model\Element\Service::getValidKey('BI_'.$key'object'));
  98.         $newObject->seto_parentId('1');
  99.         $newObject->setstoreProduct($productObj);
  100.         $newObject->save(["versionNote" => "Product created from SAP"]);
  101.         $newObject = new DataObject\ProductFlipkart();
  102.         $newObject->setKey(\Pimcore\Model\Element\Service::getValidKey('FK_'.$key'object'));
  103.         $newObject->seto_parentId('1');
  104.         $newObject->setstoreProduct($productObj);
  105.         $newObject->save(["versionNote" => "Product created from SAP"]);
  106.         $newObject = new DataObject\ProductJioMart();
  107.         $newObject->setKey(\Pimcore\Model\Element\Service::getValidKey('JM_'.$key'object'));
  108.         $newObject->seto_parentId('1');
  109.         $newObject->setstoreProduct($productObj);
  110.         $newObject->save(["versionNote" => "Product created from SAP"]);
  111.         $newObject = new DataObject\ProductSwiggy();
  112.         $newObject->setKey(\Pimcore\Model\Element\Service::getValidKey('SG_'.$key'object'));
  113.         $newObject->seto_parentId('1');
  114.         $newObject->setstoreProduct($productObj);
  115.         $newObject->save(["versionNote" => "Product created from SAP"]);
  116.         $newObject = new DataObject\ProductZepto();
  117.         $newObject->setKey(\Pimcore\Model\Element\Service::getValidKey('Zepto_'.$key'object'));
  118.         $newObject->seto_parentId('1');
  119.         $newObject->setstoreProduct($productObj);
  120.         $newObject->save(["versionNote" => "Product created from SAP"]);
  121.         $newObject = new DataObject\ProductITCStore();
  122.         $newObject->setKey(\Pimcore\Model\Element\Service::getValidKey('Store_'.$key'object'));
  123.         $newObject->seto_parentId('1');
  124.         $newObject->setstoreProduct($productObj);
  125.         $newObject->save(["versionNote" => "Product created from SAP"]);
  126.     }
  127.     function validateAlphanumeric($str) {
  128.         if (strlen($str) != 40) {
  129.             return false;
  130.         }
  131.         // Check the first 5 characters are numeric
  132.         if (!preg_match('/^\d{5}/'$str)) {
  133.             return false;
  134.         }
  135.     
  136.         // Check the sixth character is a space
  137.         if ($str[5] != ' ') {
  138.             return false;
  139.         }
  140.         // Check the remaining 34 characters are alphabetic
  141.         if (!preg_match('/^[a-zA-Z]{34}$/'substr($str6))) {
  142.             return false;
  143.         }
  144.     
  145.         // String passed all tests, so it's valid
  146.         return true;
  147.     }
  148.     function validateAlphabetsOnly($string) {
  149.         // The regular expression /^[A-Za-z]+$/ matches one or more alphabetical characters from A to Z (both uppercase and lowercase)
  150.         if (preg_match('/^[A-Za-z]+$/'$string)) {
  151.           return true// The string only contains alphabetic characters
  152.         } else {
  153.           return false// The string contains non-alphabetic characters
  154.         }
  155.     }
  156.     public function onPreUpdate(ElementEventInterface $e) {
  157.         if ($e instanceof DataObjectEvent) {
  158.             $objectData $e->getObject();
  159.             if($objectData->gettype() == 'object'){
  160.                 $productClasses = array(
  161.                     'Products' => 'SAP',
  162.                     'ProductITCStore' => 'ITC Store',
  163.                     'ProductAmazon' => 'Amazon',
  164.                     'ProductBigBasket' => 'Big Basket',
  165.                     'ProductBlinkit' => 'Blinkit',
  166.                     'ProductFlipkart' => 'Flipkart',
  167.                     'ProductJioMart' => 'JioMart',
  168.                     'ProductSwiggy' => 'Swiggy',
  169.                     'ProductZepto' => 'Zepto'
  170.                 );
  171.                 if (array_key_exists($objectData->getClassName(),$productClasses)) {
  172.                     $folder DataObject\Service::createFolderByPath('/Products/'.$productClasses[$objectData->getClassName()]);
  173.                     $folderId $folder->getId();
  174.                     $objectData->seto_parentId($folderId);
  175.                 }
  176.                 if($objectData->getClassName() == 'ProductFlipkart') {
  177.                     $manufacturing_address trim($objectData->getmanufacturing_address());
  178.                     $packer_details trim($objectData->getpacker_details());
  179.                     $errors = array();
  180.                     if(strlen($manufacturing_address) > 120) {
  181.                         $errors[] = '<b>Manufacturing address : </b> should be 120 characters only';
  182.                     }
  183.                     if(strlen($packer_details) > 120) {
  184.                         $errors[] = '<b>Packer details : </b> should be 120 characters only';
  185.                     }
  186.                     if(count($errors)) {
  187.                         $message implode('<br/> ',$errors);
  188.                         throw new \Pimcore\Model\Element\ValidationException($message);
  189.                     }
  190.                 }
  191.                 if($objectData->getClassName() == 'Products') {
  192.                     $objectId $objectData->getId();
  193.                         // Swiggy
  194.                     //  $sku_name = $objectData->getsku_name();
  195.                     //  $weight = $objectData->getweight();
  196.                     //  $swiggyProduct = new DataObject\ProductSwiggy\Listing();
  197.                     //  $swiggyProduct->setCondition(" storeProduct__id = '$objectId' ");
  198.                      
  199.                     //  if(!empty($swiggyProduct->getData()) && count($swiggyProduct->getData())) {
  200.                     //      $swiggyProduct->getData()[0]->setsku_name($sku_name);
  201.                     //      $swiggyProduct->getData()[0]->setweight($weight);
  202.                     //      $swiggyProduct->getData()[0]->setPublished(true);
  203.                     //      $swiggyProduct->getData()[0]->save();
  204.                      //  }
  205.                       // Zepto
  206.                     //  $hsn_code = $objectData->gethsncode();
  207.                     //  $zeptoProduct = new DataObject\ProductZepto\Listing();
  208.                     //  $zeptoProduct->setCondition(" storeProduct__id = '$objectId' ");
  209.                      
  210.                     //  if(!empty($zeptoProduct->getData()) && count($zeptoProduct->getData())) {
  211.                     //      $zeptoProduct->getData()[0]->sethsn_code($hsn_code);
  212.                     //      $zeptoProduct->getData()[0]->setPublished(true);
  213.                     //      $zeptoProduct->getData()[0]->save();
  214.                      //  }
  215.   
  216.                       // JioMart
  217.                     // $hsn_code = $objectData->gethsncode();
  218.                     // $how_to_use = $objectData->gethow_to_use();
  219.                     // $product_type = $objectData->getproduct_type();
  220.                     // $ingredients = $objectData->getingredients();
  221.                     // $size = $objectData->getsize();
  222.                     // $food_type = $objectData->getfood_type();
  223.                     //  $jioMartProduct = new DataObject\ProductJioMart\Listing();
  224.                     //  $jioMartProduct->setCondition(" storeProduct__id = '$objectId' ");
  225.                      
  226.                     //  if(!empty($jioMartProduct->getData()) && count($jioMartProduct->getData())) {
  227.                     //      $jioMartProduct->getData()[0]->sethsn_code($hsn_code);
  228.                     //      $jioMartProduct->getData()[0]->sethow_to_use($how_to_use);
  229.                     //      $jioMartProduct->getData()[0]->setproduct_type($product_type);
  230.                     //      $jioMartProduct->getData()[0]->setingredients($ingredients);
  231.                     //      $jioMartProduct->getData()[0]->setsize($size);
  232.                     //      $jioMartProduct->getData()[0]->setfood_type($food_type);
  233.                     //      $jioMartProduct->getData()[0]->setPublished(true);
  234.                     //      $jioMartProduct->getData()[0]->save();
  235.                     // }
  236.                     // Big Basket
  237.                     //  $how_to_use = $objectData->gethow_to_use();
  238.                     //  $product_description = $objectData->getproduct_description();
  239.                     //  $hsn_code = $objectData->gethsncode();
  240.                     //  $bbProduct = new DataObject\ProductBigBasket\Listing();
  241.                     //  $bbProduct->setCondition(" storeProduct__id = '$objectId' ");
  242.                      
  243.                     //  if(!empty($bbProduct->getData()) && count($bbProduct->getData())) {
  244.                     //      $bbProduct->getData()[0]->sethow_to_use($how_to_use);
  245.                     //      $bbProduct->getData()[0]->setproduct_description($product_description);
  246.                     //      $bbProduct->getData()[0]->sethsn_code($hsn_code);
  247.                     //      $bbProduct->getData()[0]->setPublished(true);
  248.                     //      $bbProduct->getData()[0]->save();
  249.                      //  }
  250.                      //Blinkit
  251.                     // $key_features = $objectData->getkey_features();
  252.                     // $product_type = $objectData->getproduct_type();
  253.                     // $price = $objectData->getprice();
  254.                     // $ingredients = $objectData->getingredients();
  255.                     //  $blinkitProduct = new DataObject\ProductBlinkit\Listing();
  256.                     //  $blinkitProduct->setCondition(" storeProduct__id = '$objectId' ");
  257.                      
  258.                     //  if(!empty($blinkitProduct->getData()) && count($blinkitProduct->getData())) {
  259.                     //      $blinkitProduct->getData()[0]->setkey_features($key_features);
  260.                     //      $blinkitProduct->getData()[0]->setproduct_type($product_type);
  261.                     //      $blinkitProduct->getData()[0]->setprice($price);
  262.                     //      $blinkitProduct->getData()[0]->setingredients($ingredients);
  263.                     //      $blinkitProduct->getData()[0]->setPublished(true);
  264.                     //      $blinkitProduct->getData()[0]->save();
  265.                      //  }
  266.                     //Amazon
  267.                     //  $size = $objectData->getsize();
  268.                     //  $product_type = $objectData->getproduct_type();
  269.                     //  $amazonProduct = new DataObject\ProductAmazon\Listing();
  270.                     //  $amazonProduct->setCondition(" storeProduct__id = '$objectId' ");
  271.                      
  272.                     //  if(!empty($amazonProduct->getData()) && count($amazonProduct->getData())) {
  273.                     //      $amazonProduct->getData()[0]->setproduct_type($size);
  274.                     //      $amazonProduct->getData()[0]->setsize($product_type);
  275.                     //      $amazonProduct->getData()[0]->setPublished(true);
  276.                     //      $amazonProduct->getData()[0]->save();
  277.                      //  }
  278.                     $errors = array();
  279.                     // if(!$this->validateAlphanumeric($objectData->getsku())) {
  280.                     //     $errors[] = '<b>SKU : </b> Please enter valid sku code';
  281.                     // }
  282.                     // if(!$this->validateAlphabetsOnly($objectData->getname())) {
  283.                     //     $errors[] = '<b>Product name : </b> Please enter valid product name';
  284.                     // }
  285.                     // if(!empty($objectData->getprice())) {
  286.                     //     if (!preg_match('/^[0-9\s]+$/', $objectData->getprice())) {
  287.                     //         // The input contains only numeric characters and spaces
  288.                     //         $errors[] = '<b>Price : </b> Only numeric value is allowed';
  289.                     //     }
  290.                     // }
  291.                     if(!empty($objectData->getpack_weight()) && !empty($objectData->getno_packs())) {
  292.                         $objectData->setcfcweight($objectData->getpack_weight() * $objectData->getno_packs());
  293.                     }
  294.                     // if(!empty($objectData->getmaterial_number()) && !$this->validateAlphabetsOnly($objectData->getmaterial_number())) {
  295.                     //     $errors[] = '<b>SAP SKU Code : </b> Please enter valid SAP sku code (Alphanumeric)';
  296.                     // }
  297.                     if(!empty($objectData->gettax_category()) && !$this->validateAlphabetsOnly($objectData->gettax_category())) {
  298.                         $errors[] = '<b>Tax category : </b> Please enter valid tax category';
  299.                     }
  300.                     if(!empty($objectData->getbatch_management()) && !$this->validateAlphabetsOnly($objectData->getbatch_management())) {
  301.                         $errors[] = '<b>Batch management : </b> Please enter valid batch management';
  302.                     }
  303.                     // if(empty($objectData->getdivision())) {
  304.                     //     $errors[] = '<b>Division : </b> Please select a division';
  305.                     // }
  306.                     if(count($errors)) {
  307.                         $message implode('<br/> ',$errors);
  308.                         throw new \Pimcore\Model\Element\ValidationException($message);
  309.                     } else {
  310.                         $productId $objectData->getId();
  311.                         $dbConnection \Pimcore\Db::get();
  312.                         $workflowInfo $dbConnection->fetchRow("
  313.                             SELECT *
  314.                             FROM `element_workflow_state`
  315.                             WHERE `cid` = '$productId'
  316.                             LIMIT 1
  317.                         ");
  318.                         if(!empty($workflowInfo['place'])) {
  319.                             $previousWorkflowPlace $objectData->getpreviousWorkflowPlace();
  320.                         }
  321.                     }
  322.                 }
  323.             }
  324.         }
  325.     }
  326.     public function onPostUpdate(ElementEventInterface $e) {
  327.         if ($e instanceof DataObjectEvent) {
  328.             $objectData $e->getObject();
  329.             if($objectData->gettype() == 'object'){
  330.                 if($objectData->getClassName() == 'ProductCategory') {
  331.                     // $categoryAddUrl = "https://integration-5ojmyuq-23txbi6folvo6.ap-3.magentosite.cloud/rest/V1/bridge/catalog/category/add";
  332.                     $categoryAddUrl "http://local.itc.com/rest/V1/bridge/catalog/category/add";
  333.                     $data = array( 
  334.                         "category_id" => $objectData->getId(),
  335.                         "store_view_id" => "0"
  336.                     ); 
  337.                     $productSyncKey "qzgg1vbpgwk6pjctbv6ku2a65906ocpb";
  338.                     // $productSyncKey = "ah2zed4d9rcqgxc4ds16bh6wssdm8xni";
  339.                     $data_json json_encode(array("data" => $data)); 
  340.                     $curl curl_init(); curl_setopt($curlCURLOPT_CUSTOMREQUEST"PUT"); 
  341.                     curl_setopt($curlCURLOPT_POSTFIELDS$data_json); 
  342.                     curl_setopt($curlCURLOPT_URL$categoryAddUrl); 
  343.                     curl_setopt($curlCURLOPT_HTTPHEADER, array( 'Authorization: Bearer ' $productSyncKey'Accept: application/json''Content-Type:application/json', )); 
  344.                     curl_setopt($curlCURLOPT_RETURNTRANSFER1); 
  345.                     curl_setopt($curlCURLOPT_HTTPAUTHCURLAUTH_BASIC); 
  346.                     $result curl_exec($curl); 
  347.                     $resultArray json_decode($result); 
  348.                     curl_close($curl);
  349.                 }
  350.                 if($objectData->getClassName() == 'Products') {
  351.                     $productId $objectData->getId();
  352.                     $dbConnection \Pimcore\Db::get();
  353.                     $workflowInfo $dbConnection->fetchRow("
  354.                         SELECT *
  355.                         FROM `element_workflow_state`
  356.                         WHERE `cid` = '$productId'
  357.                         LIMIT 1
  358.                     ");
  359.                     if(!empty($workflowInfo['place']) && $workflowInfo['place'] == 'approved') {
  360.                         // $productSyncKey = "enlwq7pkg6t2od9blt93coomo7g6p9p0"; // Live Integration
  361.                         $productSyncKey "qzgg1vbpgwk6pjctbv6ku2a65906ocpb"// Local
  362.                         // $productUpdatedUrl = 'https://integration-5ojmyuq-23txbi6folvo6.ap-3.magentosite.cloud/rest/V1/bridge/catalog/product/add';
  363.                         $productUpdatedUrl 'http://local.itc.com/rest/V1/bridge/catalog/product/add';
  364.                         // echo $productUpdatedUrl.'<br>';
  365.                         // echo $productSyncKey;
  366.                         $data = array( "product_id" => $productId,"store_view_id" => "0", );
  367.                         $data_json json_encode(array("data" => $data));
  368.                         $curl curl_init();
  369.                         curl_setopt($curlCURLOPT_CUSTOMREQUEST"PUT");
  370.                         curl_setopt($curlCURLOPT_POSTFIELDS$data_json);
  371.                         curl_setopt($curlCURLOPT_URL$productUpdatedUrl);
  372.                         curl_setopt($curlCURLOPT_HTTPHEADER, array( 'Authorization: Bearer ' $productSyncKey'Accept: application/json''Content-Type:application/json', ));
  373.                         curl_setopt($curlCURLOPT_RETURNTRANSFER1);
  374.                         curl_setopt($curlCURLOPT_HTTPAUTHCURLAUTH_BASIC);
  375.                         $result curl_exec($curl);
  376.                         $resultArray json_decode($result);
  377.                         curl_close($curl);
  378.                         // echo '<pre>'; print_r($resultArray); exit;
  379.                     }
  380.                 }
  381.             } else if($objectData->gettype() == 'folder'){
  382.             }
  383.         }
  384.     }
  385.     public function onAssetPostAdd(\Pimcore\Event\Model\AssetEvent $event) {
  386.         $data false;
  387.         if($event instanceof AssetEvent) {
  388.             $data $event->getAsset(); 
  389.         } else if ($event instanceof DocumentEvent) {
  390.             $data $event->getDocument(); 
  391.         } else if ($event instanceof DataObjectEvent) {
  392.             $data $event->getObject(); 
  393.         }
  394.         if ($data) {
  395.             $id $data->getId();
  396.             // $productSyncKey = "enlwq7pkg6t2od9blt93coomo7g6p9p0"; // Live Integration
  397.             $productSyncKey "qzgg1vbpgwk6pjctbv6ku2a65906ocpb"// Local
  398.             // $productUpdatedUrl = 'https://integration-5ojmyuq-23txbi6folvo6.ap-3.magentosite.cloud/rest/V1/bridge/catalog/product/add';
  399.             $productUpdatedUrl 'http://local.itc.com/rest/V1/bridge/asset/add';
  400.             // echo $productUpdatedUrl.'<br>';
  401.             // echo $productSyncKey;
  402.             $data = array( "asset_id" => $id,"store_view_id" => "0", );
  403.             $data_json json_encode(array("data" => $data));
  404.             $curl curl_init();
  405.             curl_setopt($curlCURLOPT_CUSTOMREQUEST"PUT");
  406.             curl_setopt($curlCURLOPT_POSTFIELDS$data_json);
  407.             curl_setopt($curlCURLOPT_URL$productUpdatedUrl);
  408.             curl_setopt($curlCURLOPT_HTTPHEADER, array( 'Authorization: Bearer ' $productSyncKey'Accept: application/json''Content-Type:application/json', ));
  409.             curl_setopt($curlCURLOPT_RETURNTRANSFER1);
  410.             curl_setopt($curlCURLOPT_HTTPAUTHCURLAUTH_BASIC);
  411.             $result curl_exec($curl);
  412.             $resultArray json_decode($result);
  413.             curl_close($curl);
  414.         }
  415.     }
  416. }