'; // $xml_output .= implode('', $xml_parts); // $xml_output .= ''; // $file_system = \Drupal::service('file_system'); // $directory = 'public://exports'; // // Prepare directory (create if doesn't exist) // $success = $file_system->prepareDirectory( // $directory, // FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS // ); // if (!$success) { // \Drupal::logger('custom_xml_export')->error('Failed to prepare directory: @dir', [ // '@dir' => $file_system->realpath($directory) ?: $directory, // ]); // return; // } // // Define full filename // $filename = $directory . '/products.xml'; // $real_path = $file_system->realpath($filename); // // Write XML to file // $result = @file_put_contents($real_path, $xml_output); // if ($result === false) { // \Drupal::logger('custom_xml_export')->error('Failed to write XML file to @path', ['@path' => $real_path]); // } else { // \Drupal::logger('custom_xml_export')->notice('XML export saved to @path with @bytes bytes', [ // '@path' => $real_path, // '@bytes' => $result, // ]); // } // } /** * Implements hook_preprocess_HOOK(). */ function custom_xml_export_preprocess_page(&$variables) { $account = \Drupal::currentUser(); if ($account->hasPermission('administer site configuration')) { $product_variation_ids = \Drupal::entityQuery('commerce_product_variation') ->condition('status', TRUE) ->condition('field_final_price', 0, '!=') ->accessCheck(FALSE) ->execute(); } $file_path = 'public://xml-exports/products.xml'; $xml_output = ''; $file_system = \Drupal::service('file_system')->prepareDirectory( 'public://xml-exports', FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS ); $real_path = $file_system->realpath($file_path); // Write XML to file $result = @file_put_contents($real_path, $xml_output); $chunks = array_chunk($product_variation_ids, 100); $queue = \Drupal::queue('product_export_queue'); foreach ($chunks as $chunk) { $queue->createItem(['product_variation_ids' => $chunk]); } $result = @file_put_contents($real_path, '', FILE_APPEND); } Βιομηχανικά | Σάββας Δ. Καραγεωργίου Α.Ε.Β.Ε.

Τηλεφωνικές Παραγγελίες καλέστε μας στο 2251022141

Προιόντα :
2
Tιμή
10 €
Αγόρασε το
Tιμή
19 €
Αγόρασε το

© 2021 karagewrgiou.gr
Κατασκευή ιστοσελίδας: Pelagus Creative Web