New Field ed esportazione db
Inviato: 07/07/2005, 14:54
Ho installato Easy Populate e ins eguito la contribute che permette di aggiungere un campo agli attributi del prodotto. Quest'ultima modifica anche il file easypopulate.php in modo che sia predisposto ad esportare e importare anche questo nuovo campo.
Con l'esportazione completa non mi dà problemi, ma con quella che mi interessa, ovvero Price/Quantity non c'è traccia del nuovo campo.
Il nuovo campo è "products_code", un codice identificativo, insomma.
Vi lascio qui il codice del file easypopulate.php che interess ai due casi, ribadendo che nel secondo caso non funziona e nel primo sì. Qualcuno mi sa dire dove sbaglio?
Vi ringrazio
case 'full':
// The file layout is dynamically made depending on the number of languages
$iii = 0;
$filelayout = array(
'v_products_model' => $iii++,
'v_products_image' => $iii++,
);
foreach ($langcode as $key => $lang){
$l_id = $lang['id'];
// uncomment the head_title, head_desc, and head_keywords to use
// Linda's Header Tag Controller 2.0
//echo $langcode['id'] . $langcode['code'];
$filelayout = array_merge($filelayout , array(
'v_products_name_' . $l_id => $iii++,
'v_products_description_' . $l_id => $iii++,
'v_products_url_' . $l_id => $iii++,
// 'v_products_head_title_tag_'.$l_id => $iii++,
// 'v_products_head_desc_tag_'.$l_id => $iii++,
// 'v_products_head_keywords_tag_'.$l_id => $iii++,
));
}
// uncomment the customer_price and customer_group to support multi-price per product contrib
// VJ product attribs begin
$header_array = array(
'v_products_price' => $iii++,
'v_products_weight' => $iii++,
'v_date_avail' => $iii++,
'v_date_added' => $iii++,
'v_products_quantity' => $iii++,
);
$languages = tep_get_languages();
global $attribute_options_array;
$attribute_options_count = 1;
foreach ($attribute_options_array as $attribute_options_values) {
$key1 = 'v_attribute_options_id_' . $attribute_options_count;
$header_array[$key1] = $iii++;
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
$l_id = $languages[$i]['id'];
$key2 = 'v_attribute_options_name_' . $attribute_options_count . '_' . $l_id;
$header_array[$key2] = $iii++;
}
$attribute_values_query = "select products_options_values_id from " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$attribute_options_values['products_options_id'] . "' order by products_options_values_id";
$attribute_values_values = tep_db_query($attribute_values_query);
$attribute_values_count = 1;
while ($attribute_values = tep_db_fetch_array($attribute_values_values)) {
$key3 = 'v_attribute_values_id_' . $attribute_options_count . '_' . $attribute_values_count;
$header_array[$key3] = $iii++;
$key4 = 'v_attribute_values_price_' . $attribute_options_count . '_' . $attribute_values_count;
$header_array[$key4] = $iii++;
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
$l_id = $languages[$i]['id'];
$key5 = 'v_attribute_values_name_' . $attribute_options_count . '_' . $attribute_values_count . '_' . $l_id;
$header_array[$key5] = $iii++;
}
$attribute_values_count++;
}
$attribute_options_count++;
}
$header_array['v_manufacturers_name'] = $iii++;
$filelayout = array_merge($filelayout, $header_array);
// VJ product attribs end
// build the categories name section of the array based on the number of categores the user wants to have
for($i=1;$i<$max_categories+1;$i++){
$filelayout = array_merge($filelayout, array('v_categories_name_' . $i => $iii++));
}
$filelayout = array_merge($filelayout, array(
'v_tax_class_title' => $iii++,
'v_status' => $iii++,
'v_products_code' => $iii++,
));
$filelayout_sql = "SELECT
p.products_code as v_products_code,
p.products_id as v_products_id,
p.products_model as v_products_model,
p.products_image as v_products_image,
p.products_price as v_products_price,
p.products_weight as v_products_weight,
p.products_date_available as v_date_avail,
p.products_date_added as v_date_added,
p.products_tax_class_id as v_tax_class_id,
p.products_quantity as v_products_quantity,
p.manufacturers_id as v_manufacturers_id,
subc.categories_id as v_categories_id,
p.products_status as v_status
FROM
".TABLE_PRODUCTS." as p,
".TABLE_CATEGORIES." as subc,
".TABLE_PRODUCTS_TO_CATEGORIES." as ptoc
WHERE
p.products_id = ptoc.products_id AND
ptoc.categories_id = subc.categories_id
";
break;
case 'priceqty':
$iii = 0;
// uncomment the customer_price and customer_group to support multi-price per product contrib
$filelayout = array(
'v_products_code' => $iii++,
'v_products_model' => $iii++,
'v_products_price' => $iii++,
'v_products_quantity' => $iii++,
#'v_customer_group_id_1' => $iii++,
#'v_customer_price_2' => $iii++,
#'v_customer_group_id_2' => $iii++,
#'v_customer_price_3' => $iii++,
#'v_customer_group_id_3' => $iii++,
#'v_customer_price_4' => $iii++,
#'v_customer_group_id_4' => $iii++,
);
$filelayout_sql = "SELECT
p.products_code as v_products_code,
p.products_id as v_products_id,
p.products_model as v_products_model,
p.products_price as v_products_price,
p.products_tax_class_id as v_tax_class_id,
p.products_quantity as v_products_quantity
FROM
".TABLE_PRODUCTS." as p
";
break;
Con l'esportazione completa non mi dà problemi, ma con quella che mi interessa, ovvero Price/Quantity non c'è traccia del nuovo campo.
Il nuovo campo è "products_code", un codice identificativo, insomma.
Vi lascio qui il codice del file easypopulate.php che interess ai due casi, ribadendo che nel secondo caso non funziona e nel primo sì. Qualcuno mi sa dire dove sbaglio?
Vi ringrazio
case 'full':
// The file layout is dynamically made depending on the number of languages
$iii = 0;
$filelayout = array(
'v_products_model' => $iii++,
'v_products_image' => $iii++,
);
foreach ($langcode as $key => $lang){
$l_id = $lang['id'];
// uncomment the head_title, head_desc, and head_keywords to use
// Linda's Header Tag Controller 2.0
//echo $langcode['id'] . $langcode['code'];
$filelayout = array_merge($filelayout , array(
'v_products_name_' . $l_id => $iii++,
'v_products_description_' . $l_id => $iii++,
'v_products_url_' . $l_id => $iii++,
// 'v_products_head_title_tag_'.$l_id => $iii++,
// 'v_products_head_desc_tag_'.$l_id => $iii++,
// 'v_products_head_keywords_tag_'.$l_id => $iii++,
));
}
// uncomment the customer_price and customer_group to support multi-price per product contrib
// VJ product attribs begin
$header_array = array(
'v_products_price' => $iii++,
'v_products_weight' => $iii++,
'v_date_avail' => $iii++,
'v_date_added' => $iii++,
'v_products_quantity' => $iii++,
);
$languages = tep_get_languages();
global $attribute_options_array;
$attribute_options_count = 1;
foreach ($attribute_options_array as $attribute_options_values) {
$key1 = 'v_attribute_options_id_' . $attribute_options_count;
$header_array[$key1] = $iii++;
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
$l_id = $languages[$i]['id'];
$key2 = 'v_attribute_options_name_' . $attribute_options_count . '_' . $l_id;
$header_array[$key2] = $iii++;
}
$attribute_values_query = "select products_options_values_id from " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$attribute_options_values['products_options_id'] . "' order by products_options_values_id";
$attribute_values_values = tep_db_query($attribute_values_query);
$attribute_values_count = 1;
while ($attribute_values = tep_db_fetch_array($attribute_values_values)) {
$key3 = 'v_attribute_values_id_' . $attribute_options_count . '_' . $attribute_values_count;
$header_array[$key3] = $iii++;
$key4 = 'v_attribute_values_price_' . $attribute_options_count . '_' . $attribute_values_count;
$header_array[$key4] = $iii++;
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
$l_id = $languages[$i]['id'];
$key5 = 'v_attribute_values_name_' . $attribute_options_count . '_' . $attribute_values_count . '_' . $l_id;
$header_array[$key5] = $iii++;
}
$attribute_values_count++;
}
$attribute_options_count++;
}
$header_array['v_manufacturers_name'] = $iii++;
$filelayout = array_merge($filelayout, $header_array);
// VJ product attribs end
// build the categories name section of the array based on the number of categores the user wants to have
for($i=1;$i<$max_categories+1;$i++){
$filelayout = array_merge($filelayout, array('v_categories_name_' . $i => $iii++));
}
$filelayout = array_merge($filelayout, array(
'v_tax_class_title' => $iii++,
'v_status' => $iii++,
'v_products_code' => $iii++,
));
$filelayout_sql = "SELECT
p.products_code as v_products_code,
p.products_id as v_products_id,
p.products_model as v_products_model,
p.products_image as v_products_image,
p.products_price as v_products_price,
p.products_weight as v_products_weight,
p.products_date_available as v_date_avail,
p.products_date_added as v_date_added,
p.products_tax_class_id as v_tax_class_id,
p.products_quantity as v_products_quantity,
p.manufacturers_id as v_manufacturers_id,
subc.categories_id as v_categories_id,
p.products_status as v_status
FROM
".TABLE_PRODUCTS." as p,
".TABLE_CATEGORIES." as subc,
".TABLE_PRODUCTS_TO_CATEGORIES." as ptoc
WHERE
p.products_id = ptoc.products_id AND
ptoc.categories_id = subc.categories_id
";
break;
case 'priceqty':
$iii = 0;
// uncomment the customer_price and customer_group to support multi-price per product contrib
$filelayout = array(
'v_products_code' => $iii++,
'v_products_model' => $iii++,
'v_products_price' => $iii++,
'v_products_quantity' => $iii++,
#'v_customer_group_id_1' => $iii++,
#'v_customer_price_2' => $iii++,
#'v_customer_group_id_2' => $iii++,
#'v_customer_price_3' => $iii++,
#'v_customer_group_id_3' => $iii++,
#'v_customer_price_4' => $iii++,
#'v_customer_group_id_4' => $iii++,
);
$filelayout_sql = "SELECT
p.products_code as v_products_code,
p.products_id as v_products_id,
p.products_model as v_products_model,
p.products_price as v_products_price,
p.products_tax_class_id as v_tax_class_id,
p.products_quantity as v_products_quantity
FROM
".TABLE_PRODUCTS." as p
";
break;