Jump to content

How to get all attributes combinations from Attribute Wizard Pro


Zudjo

Recommended Posts

Hello everybody,

I have a website using the module Attribute Wizard Pro, and I need to export in some way all the product-attribute combinations. Ideally in a csv or json format.

 

In the database the only table created by the module is named awp_attribute_wizard_pro, it has only one row and one column named awp_details, which content is a string over 200.000 characters long, formatted like this:

a:25:{i:0;a:34:{s:18:"id_attribute_group";i:13;s:10:"group_name";s:6:"Taglia";s:8:"filename";s:0:"";s:10:"group_type";s:8:"dropdown";s:17:"public_group_name";s:6:"Taglia";s:10:"attributes";a:11:{i:0;a:5:{s:12:"id_attribute";i:333;s:16:"layered_filename";b:0;s:14:"attribute_name";s:3:"000"; (and so on...)

I couldn't find anywhere what format type is this, and I couldn't figure it out myself.

Checking in the module code, I couldn't find any reference to the awp_details table, just to the awp_details attributes added by the module.

 

Can anybody help me here?

 

Thanks for the attention,

G.

Link to comment
Share on other sites

Hi,

To export this data into CSV or JSON format, you will need to write a custom script in PHP that:

  • Retrieves the serialized data from the awp_attribute_wizard_pro table.
  • Unserializes the data to convert it into a PHP array.
  • Processes the array to extract the information you need.
  • Converts this information into either CSV or JSON format.

Here's a high-level outline of how you can do this:

<?php
// Connect to your database
$pdo = new PDO("mysql:host=your_host;dbname=your_database", "username", "password");

// Query the serialized data
$query = "SELECT awp_details FROM awp_attribute_wizard_pro";
$result = $pdo->query($query);

// Fetch the serialized data
$data = $result->fetchColumn();

// Unserialize the data
$unserializedData = unserialize($data);

// Process and extract the information you need
$productAttributeCombinations = [];

foreach ($unserializedData as $item) {
    // Extract relevant information from $item and add it to $productAttributeCombinations array
    $combination = [
        'id_attribute_group' => $item['id_attribute_group'],
        'group_name' => $item['group_name'],
        // Add more attributes as needed
    ];

    $productAttributeCombinations[] = $combination;
}

// Convert the extracted data to CSV or JSON format
// For CSV:
$csvFileName = 'product_attribute_combinations.csv';
$csvFile = fopen($csvFileName, 'w');

foreach ($productAttributeCombinations as $combination) {
    fputcsv($csvFile, $combination);
}

fclose($csvFile);

// For JSON:
$jsonFileName = 'product_attribute_combinations.json';
$jsonData = json_encode($productAttributeCombinations, JSON_PRETTY_PRINT);
file_put_contents($jsonFileName, $jsonData);
?>

Let me know If it helps!

Thanks!

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...