You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue: Cannot update the product class id through product import export feature.
Fix : Updated the product products_import_export.php class file to add the feature.
in function getProducts($pfilter, $pgtype, $pgformat) to export the class id in txt file.
search for
$columns[] = 'categories';
$columns[] = 'parent_categories';
$columns[] = 'base_image';
Add just below,
// Add product class fields here
$columns[] = 'product_class';
// get product class
$Qclass = $lC_Database->query('select id from :table_templates_boxes where modules_group = :modules_group and code = :code');
$Qclass->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
$Qclass->bindValue(':modules_group', 'product_attributes');
$Qclass->bindValue(':code', 'product_classes');
$Qclass->execute();
// eod
search for $content .= $Qimage->value('image') . $delim;
add the following code below,
// add class_id
$QclassValue = $lC_Database->query('select pc.name from :table_product_attributes pa, :table_product_classes pc where pa.products_id = :products_id and pa.id = :id and pa.value = pc.id and languages_id in (0, :languages_id)');
$QclassValue->bindTable(':table_product_attributes', TABLE_PRODUCT_ATTRIBUTES);
$QclassValue->bindTable(':table_product_classes', TABLE_PRODUCT_CLASSES);
$QclassValue->bindInt(':products_id', $product['products_id']);
$QclassValue->bindInt(':id', $Qclass->valueInt('id'));
$QclassValue->bindInt(':languages_id', $product['language_id']);
$QclassValue->execute();
$Pclass = ($QclassValue->numberOfRows() === 1)?$QclassValue->value('name'):$lC_Language->get('text_common');
$content .= $Pclass . $delim;
Update function importProducts()
Search for $insert_count = 0; add below,
//Class ID get template box id for attribute
$Qclass = $lC_Database->query('select id from :table_templates_boxes where modules_group = :modules_group and code = :code');
$Qclass->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
$Qclass->bindValue(':modules_group', 'product_attributes');
$Qclass->bindValue(':code', 'product_classes');
$Qclass->execute();
//EOD Class ID
search for $products_id = $product['id']; add below,
$PclassID = 0;
$QclassValue = $lC_Database->query('select pc.name, pc.id from :table_product_attributes pa, :table_product_classes pc where pa.id = :id and pa.value = pc.id and languages_id in (0, :languages_id) and pc.name = :name LIMIT 0 , 1');
$QclassValue->bindTable(':table_product_attributes', TABLE_PRODUCT_ATTRIBUTES);
$QclassValue->bindTable(':table_product_classes', TABLE_PRODUCT_CLASSES);
$QclassValue->bindInt(':id', $Qclass->valueInt('id'));
$QclassValue->bindInt(':languages_id', $product['language_id']);
$QclassValue->bindValue(':name', $product['product_class']);
$QclassValue->execute();
$PclassID = ($QclassValue->numberOfRows() === 1)?$QclassValue->value('id'):DEFAULT_PRODUCT_CLASSES_ID;
Search for $Qcheck = $lC_Database->query("SELECT * FROM :table_products WHERE products_id = :products_id"); and add before,
// Product class update
$QcheckPA = $lC_Database->query('select pa.id from :table_product_attributes pa, :table_products p WHERE p.products_id = pa.products_id and pa.products_id = :products_id and id = :id and languages_id = :languages_id');
$QcheckPA->bindTable(':table_products', TABLE_PRODUCTS);
$QcheckPA->bindTable(':table_product_attributes', TABLE_PRODUCT_ATTRIBUTES);
$QcheckPA->bindInt(':products_id', $products_id);
$QcheckPA->bindInt(':id', $Qclass->valueInt('id'));
$QcheckPA->bindInt(':languages_id', $product['language_id']);
$QcheckPA->execute();
if($QcheckPA->numberOfRows() > 0){
$QProductAttribute = $lC_Database->query('update :table_product_attributes set value = :value WHERE products_id = :products_id and id = :id and languages_id = :languages_id');
}else{
$QProductAttribute = $lC_Database->query('insert into :table_product_attributes (id, products_id, languages_id, value, value2) values (:id, :products_id, :languages_id, :value, :value2)');
$QProductAttribute->bindInt(':value2', '0');
}
$QProductAttribute->bindTable(':table_product_attributes', TABLE_PRODUCT_ATTRIBUTES);
$QProductAttribute->bindInt(':products_id', $products_id);
$QProductAttribute->bindInt(':id', $Qclass->valueInt('id'));
$QProductAttribute->bindInt(':languages_id', $product['language_id']);
$QProductAttribute->bindInt(':value', $PclassID);
$QProductAttribute->execute();
// eod product class
---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/27775867-loaded7-product-class-id-import-export-issue?utm_campaign=plugin&utm_content=tracker%2F40949&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F40949&utm_medium=issues&utm_source=github).
The text was updated successfully, but these errors were encountered:
Issue: Cannot update the product class id through product import export feature.
Fix : Updated the product products_import_export.php class file to add the feature.
File updated : admin\includes\applications\products_import_export\classes\products_import_export.php
Updated the below code,
in function getProducts($pfilter, $pgtype, $pgformat) to export the class id in txt file.
search for
$columns[] = 'categories';
$columns[] = 'parent_categories';
$columns[] = 'base_image';
Add just below,
// Add product class fields here
$columns[] = 'product_class';
// get product class
$Qclass = $lC_Database->query('select id from :table_templates_boxes where modules_group = :modules_group and code = :code');
$Qclass->bindTable(':table_templates_boxes', TABLE_TEMPLATES_BOXES);
$Qclass->bindValue(':modules_group', 'product_attributes');
$Qclass->bindValue(':code', 'product_classes');
$Qclass->execute();
// eod
search for $content .= $Qimage->value('image') . $delim;
add the following code below,
Update function importProducts()
Search for $insert_count = 0; add below,
search for $products_id = $product['id']; add below,
Search for $Qcheck = $lC_Database->query("SELECT * FROM :table_products WHERE products_id = :products_id"); and add before,
The class column after import will be the last column in the exported sheet.
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/27775867-loaded7-product-class-id-import-export-issue?utm_campaign=plugin&utm_content=tracker%2F40949&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F40949&utm_medium=issues&utm_source=github).http://grabilla.com/05a19-2e38b6d6-7ffd-4ce7-9059-088eb1dcce9d.html#update
The text was updated successfully, but these errors were encountered: