Products imported by the Shelf do not have good URLs.

This commit is contained in:
Colin Kuskie 2008-11-24 22:19:06 +00:00
parent 7027178762
commit e2101ad8d2
2 changed files with 5 additions and 2 deletions

View file

@ -232,6 +232,7 @@ sub importProducts {
my $newProduct = $node->addChild({className => 'WebGUI::Asset::Sku::Product'}); my $newProduct = $node->addChild({className => 'WebGUI::Asset::Sku::Product'});
$newProduct->update({ $newProduct->update({
title => $newProduct->fixTitle($productRow{title}), title => $newProduct->fixTitle($productRow{title}),
url => $newProduct->fixUrl($productRow{title}),
sku => $productRow{mastersku}, sku => $productRow{mastersku},
}); });
$newProduct->setCollateral('variantsJSON', 'variantId', 'new', \%productCollateral); $newProduct->setCollateral('variantsJSON', 'variantId', 'new', \%productCollateral);

View file

@ -33,7 +33,7 @@ my $session = WebGUI::Test->session;
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Tests # Tests
my $tests = 51; my $tests = 53;
plan tests => 1 + $tests; plan tests => 1 + $tests;
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
@ -148,6 +148,7 @@ SKIP: {
my $soda = WebGUI::Asset::Sku->newBySku($session, 'soda'); my $soda = WebGUI::Asset::Sku->newBySku($session, 'soda');
isa_ok($soda, 'WebGUI::Asset::Sku::Product'); isa_ok($soda, 'WebGUI::Asset::Sku::Product');
is($soda->getTitle(), 'Sweet Soda-bottled in Oregon', 'Title set correctly for soda'); is($soda->getTitle(), 'Sweet Soda-bottled in Oregon', 'Title set correctly for soda');
is($soda->get('url'), 'sweet-soda-bottled-in-oregon', 'URL for new product from the title');
my $sodaCollateral = $soda->getAllCollateral('variantsJSON'); my $sodaCollateral = $soda->getAllCollateral('variantsJSON');
cmp_deeply( cmp_deeply(
$sodaCollateral, $sodaCollateral,
@ -316,7 +317,8 @@ SKIP: {
is($count, 3, 'still have 3 products, nothing new added'); is($count, 3, 'still have 3 products, nothing new added');
$soda = WebGUI::Asset::Sku->newBySku($session, 'soda'); $soda = WebGUI::Asset::Sku->newBySku($session, 'soda');
is($soda->getTitle(), 'Sweet Soda-totally organic', 'Title updated correctly for soda'); is($soda->getTitle(), 'Sweet Soda-totally organic', 'Title updated correctly for soda');
is($soda->get('url'), 'sweet-soda-bottled-in-oregon', 'URL for updated product from the original title, not the updated title');
$shirt = WebGUI::Asset::Sku->newBySku($session, 't-shirt'); $shirt = WebGUI::Asset::Sku->newBySku($session, 't-shirt');
$shirtCollateral = $shirt->getAllCollateral('variantsJSON'); $shirtCollateral = $shirt->getAllCollateral('variantsJSON');
cmp_deeply( cmp_deeply(