Project:
UbercartCategory:
bug reportVersion:
Ubercart 1.0Priority:
minorAssigned:
UnassignedStatus:
fixedProducts imported from an XML file with the uc_importer module do not have their teasers set. Not sure if this is a bug or a feature (it is easy to fix with the retease module) but it is an inconvenience IMHO.



Re: Imported products have no teaser
yeh I just noticed that too, considering u made this post less than a month ago and no1 fixed it, I'ma just fix it myself
but don't expect me to post a nice .patch, coz I have no idea how to make those, but I'll document the changes I made
[edit]
was rather easy to fix this, even though I only fixed it for new products (won't work if u try to import products that r already in the database)
on line 1029 of the uc_importer.module u will find the following line:
<?php$product->body = html_entity_decode((string)$product_data->description[0]->data(), ENT_QUOTES, "UTF-8");
?>
I just added a line for the teaser, using a simple substr() under that like this:
<?php$product->body = html_entity_decode((string)$product_data->description[0]->data(), ENT_QUOTES, "UTF-8");
$product->teaser = substr(html_entity_decode((string)$product_data->description[0]->data(), ENT_QUOTES, "UTF-8"), 0, 100);
?>
(using Importer 5.x-1.0)
[/edit]
use node_teaser
This hardcodes a specific teaser setting (first 100 characters) into the module, and might result in invalid characters (substr is not UTF-8 safe). You should use node_teaser:
<?php$product->body = html_entity_decode((string)$product_data->description[0]->data(), ENT_QUOTES, "UTF-8");
$product->teaser = node_teaser($product->body);
?>
which will use the system-wide teaser length setting, respect delimiters and do a lot of other clever stuff.
Re: use node_teaser
Aha, I'm glad to see that's an easy fix. One thing I'm going to add is the addition of the format parameter. Imported products use whatever the default format is, but if this happens to be the PHP filter (don't do this, it's dangerous), the teaser should just be the whole body. The format for imported products might change in the future, so this will keep the code safe from anything that might come along.
<?php$product->teaser = node_teaser($product->body, $product->format);
?>
awesome, u guys rock now
awesome, u guys rock
now make it into a .patch, chop chop
jk