Greetings, we are using an older version of CS-Cart (4.7.3), and the Product Export Option Variant "Status" field is not included in the CSV ([A]ctive or [D]isabled), so I was hoping to get that field to export. The CSV Import for the status works just fine if you add "///status=D within the Option Variant, but we need to know which ones are disabled to begin with, otherwise the import will activate all of the Option Variants.
Here is what I tried - and thought it would be simple - code changes at // area:
FILE: \app\schemas\exim\products.functions.php
if (floatval($v['modifier']) != 0) {
$variant .= $features_delimiter . 'modifier=' . $v['modifier'];
$variant .= $features_delimiter . 'modifier_type=' . $v['modifier_type'];
}
if (floatval($v['weight_modifier']) != 0) {
$variant .= $features_delimiter . 'weight_modifier=' . $v['weight_modifier'];
$variant .= $features_delimiter . 'weight_modifier_type=' . $v['weight_modifier_type'];
}
// START - Add Variant Status
// I TRIED ADDING THIS - did not work - blank value ---> $variant .= $features_delimiter . 'status=' . $v['status'];
// ALSO ADDED THIS and it works fine ---> $variant .= $features_delimiter . 'position=' . $v['position'];
// END - Add Variant Status
if (!empty($v['image_pair']['image_id'])) {
$variant .= $features_delimiter . 'image=' . fn_exim_export_image($v['image_pair']['image_id'], 'variant_image', '', false);
}
I thought that would do the trick, but $v['status'] apparently has no value there, and I'm having a bit of trouble finding how to get that value if it isn't already set somewhere else - I'm trying to keep the code quick and clean since I want it to be monsterously scalable if the cart has tons of products with options.
Any information would be greatly appreciated!! Thanks!
Here is what the Exported CSV Product Option cell looks like with the "position" field also added in:
(CS-CART) OPTION-1: S[OP-1-Variant-1///position=10,OP-1-Variant-2///modifier=25.000///modifier_type=A///position=20]///inventory=N///missing_variants_handling=M///multiupload=N///required=Y///status=A; (CS-CART) OPTION-2: S[OP-1-Variant-1///position=10,OP-1-Variant-2///modifier=50.400///modifier_type=A///position=20,OP-1-Variant-3///modifier=17.100///modifier_type=A///position=30]///inventory=N///missing_variants_handling=M///multiupload=N///required=Y///status=A
Side note - if you add ///status=D to the OP-1-Variant-2 section (see below), it will Disable that Variant if you Import the CSV file - otherwise if status is not set, all Variants seem to be set to Active (I just noticed this recently since we never really Disabled a Option Variant (usually just deleted it), the Option "status" is all we ever used and that works fine on Export and Import. Option "status" and Option Variant "status" are two different things (just FYI)
(CS-CART) OPTION-1: S[OP-1-Variant-1///position=10,OP-1-Variant-2///modifier=25.000///modifier_type=A///position=20///status=D]///inventory=N///missing_variants_handling=M///multiupload=N///required=Y///status=A; (CS-CART) OPTION-2: S[OP-1-Variant-1///position=10,OP-1-Variant-2///modifier=50.400///modifier_type=A///position=20,OP-1-Variant-3///modifier=17.100///modifier_type=A///position=30]///inventory=N///missing_variants_handling=M///multiupload=N///required=Y///status=A