Exemplo n.º 1
0
 function uploadSingleProduct()
 {
     global $osC_Database, $toC_Json, $osC_Language, $osC_Currencies;
     require_once '../includes/classes/currencies.php';
     $osC_Currencies = new osC_Currencies();
     $products_id = $_POST['products_id'];
     if (!isset($_SESSION['gContentToken']) && empty($_SESSION['gContentToken'])) {
         osC_GoogleBase_Admin::clientLoginContentApi();
     }
     $upload_state = osC_GoogleBase_Admin::uploadSingleProduct($products_id);
     if ($upload_state == true) {
         $response = array('success' => true, 'feedback' => $osC_Language->get('ms_success_action_performed'));
     } else {
         $response = array('success' => false, 'feedback' => $osC_Language->get('ms_error_action_not_performed'));
     }
     echo $toC_Json->encode($response);
 }
Exemplo n.º 2
0
 function deleteProduct($item_id)
 {
     global $osC_Database;
     $Qselect = $osC_Database->query('select google_base_id, items_edit_link from :table_google_base_items where google_base_id = :google_base_id');
     $Qselect->bindTable(':table_google_base_items', TABLE_GOOGLE_BASE_ITEMS);
     $Qselect->bindInt(':google_base_id', $item_id);
     $Qselect->execute();
     $product_info = $Qselect->toArray();
     $product_link = $product_info['items_edit_link'];
     if (!isset($_SESSION['gContentToken']) && empty($_SESSION['gContentToken'])) {
         osC_GoogleBase_Admin::clientLoginContentApi();
     }
     $header = array('Authorization: GoogleLogin Auth=' . trim($_SESSION['gContentToken']));
     self::sendRequestToGoogleBase($product_link, '', $header, 'delete');
     $Qdel = $osC_Database->query('delete from :table_google_base_items where google_base_id = :google_base_id');
     $Qdel->bindTable(':table_google_base_items', TABLE_GOOGLE_BASE_ITEMS);
     $Qdel->bindInt(':google_base_id', $item_id);
     $Qdel->execute();
     if ($Qdel->affectedRows() > 0) {
         return true;
     } else {
         return false;
     }
 }