Is there a way to capitalize the product name when import from csv file? This is because some of my suppliers use upper case for the product name in their csv file and this looks ugly.
[quote name=‘rommy’]Is there a way to capitalize the product name when import from csv file? This is because some of my suppliers use upper case for the product name in their csv file and this looks ugly.[/quote]
You can easily change upper case in csv file.
To do it, you can use Calc a free spreadsheet software from Sun, editor of OpenOffice:
Thanks for your response. I am using Open Office at the moment but I don’t know how to change the upper case in csv file. Could you please show me what to do? I am such a n00b at this.
[quote name=‘rommy’]Thanks for your response. I am using Open Office at the moment but I don’t know how to change the upper case in csv file. Could you please show me what to do? I am such a n00b at this.
I just wanted to add that this needs to be placed elsewhere as well if you want your categories, pages, and forms to reflect the capitalization. This is for 1.3.5 (2.0.x is on the backburner until further notice) and the changes are in [COLOR=“Blue”]blue[/COLOR]. I haven’t looked at 2.0.x but it should be along the same lines.
// P R O D U C T
if ($object_type == 'p') {
// Categories path
if ($seo_types['seo_product_type'] == 'category') {
$cat_path = db_get_field("SELECT b.id_path FROM $db_tables[products_categories] as a LEFT JOIN $db_tables[categories] as b ON a.category_id=b.category_id WHERE a.product_id='$object_id' AND a.link_type='M'");
if (!empty($cat_path)) {
$cats = explode("/", $cat_path);
foreach ($cats as $v) {
$item_names[] = fn_get_seo_name($v, 'c');
}
}
}
[COLOR="Blue"]$seo_name = preg_replace('!((?:\b|-).)!e', 'strtoupper("$1");', $seo_name);[/COLOR]
$seo_name = $seo_name .'.html';
// C A T E G O R Y & T O P I C
} elseif (strpos(' ct', $object_type)) {
if ($object_type == 'c') {
$_path = db_get_field("SELECT id_path FROM $db_tables[categories] WHERE category_id='$object_id'");
} elseif ($object_type == 't') {
$_path = db_get_field("SELECT id_path FROM $db_tables[topics] WHERE topic_id='$object_id'");
}
if (!empty($_path)) {
$_path_i = explode("/", $_path);
array_pop($_path_i);
foreach ($_path_i as $v) {
$item_names[] = fn_get_seo_name($v, $object_type);
}
}
if ($seo_types['seo_category_type'] == 'file') {
// Add sortings
if (!empty($suffix['sort_by']) && !empty($suffix['sort_order'])) {
$_suffix = '?sort_by='.$suffix['sort_by'].'&sort_order='.$suffix['sort_order'];
}
// Add pagination
if (!empty($suffix['page']) && $suffix['page'] != '1') {
$seo_name .= $d.'page'.$d.$suffix['page'];
}
[COLOR="Red"]$seo_name = preg_replace('!((?:\b|-).)!e', 'strtoupper("$1");', $seo_name);[/COLOR]
$seo_name = $seo_name .'.html';
} else {
// Add sortings
if (!empty($suffix['sort_by']) && !empty($suffix['sort_order'])) {
$_suffix = '?sort_by='.$suffix['sort_by'].'&sort_order='.$suffix['sort_order'];
}
// Add pagination
if (!empty($suffix['page']) && $suffix['page'] != '1') {
$seo_name .= '/'.'page'.$d.$suffix['page'];
}
[COLOR="Red"]$seo_name = preg_replace('!((?:\b|-).)!e', 'strtoupper("$1");', $seo_name);[/COLOR]
$seo_name = $seo_name . '/';
}
// P A G E S
} elseif ($object_type == 'a') {
$top_path = db_get_field("SELECT id_path FROM $db_tables[topics] as a LEFT JOIN $db_tables[pages_topics] as b ON a.topic_id=b.topic_id LEFT JOIN $db_tables[pages] as c ON c.page_id=b.page_id WHERE c.page_inner_id='$object_id'");
if (!empty($top_path)) {
$topics = explode("/", $top_path);
foreach ($topics as $v) {
$item_names[] = fn_get_seo_name($v, 't');
}
}
[COLOR="Blue"]$seo_name = preg_replace('!((?:\b|-).)!e', 'strtoupper("$1");', $seo_name);[/COLOR]
$seo_name .= (($seo_types['seo_category_type'] == 'file') ? '.html' : '/');
// F O R M S
} elseif ($object_type == 'f') {
if (!empty($suffix['mode'])) {
$_suffix = "?$mode_name=sent";
}
[COLOR="Blue"]$seo_name = preg_replace('!((?:\b|-).)!e', 'strtoupper("$1");', $seo_name);[/COLOR]
$seo_name .= (($seo_types['seo_category_type'] == 'file') ? '.html' : '/');
}
EDIT: [COLOR=“Red”]This[/COLOR] didn’t work so well. Even though it capitalized the name, it was interfering with the pagination returning a 404.
Ok…I’m a total idiot when it comes to coding but I thought this would be pretty straightforward. I found the file and line of code but what I have tried doesn’t seem to work. Can this be explained in more simple instructions (if possible)? Forgive my ignorance but a “replace this with THIS” would help out a newb like me.