Fix product exporting and importing through the Shelf.

Note that sku entries in the import and export file are now varSku.
This commit is contained in:
Colin Kuskie 2008-09-28 23:59:26 +00:00
parent 1c2993dd86
commit 79c5425bcf
8 changed files with 40 additions and 21 deletions

View file

@ -60,6 +60,7 @@
- fixed: Utility script skeleton now more complete and less annoying
- rfe: Teach Thingy to be a Web Service (SDH Consulting Group)
- fixed: ~~~ showing up on my site.
- fixed: Shelf/Product import export does not work
7.5.21
- fixed: purchase detail screen shows incorrectly in Safari

View file

@ -20,6 +20,7 @@ use Getopt::Long;
use WebGUI::Session;
use WebGUI::Storage;
use WebGUI::Asset;
use WebGUI::Asset::Sku::Product;
my $toVersion = '7.6.0';
@ -41,6 +42,7 @@ addAdHocMailGroups( $session );
makeAdminConsolePluggable( $session );
migrateAssetsToNewConfigFormat($session);
deleteAdminBarTemplates($session);
repairBrokenProductSkus($session);
finish($session); # this line required
@ -58,6 +60,22 @@ sub deleteAdminBarTemplates {
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
sub repairBrokenProductSkus {
my $session = shift;
print "\tRepairing broken Products that were imported... " unless $quiet;
my $getAProduct = WebGUI::Asset::Sku::Product->getIsa($session);
while (my $product = $getAProduct->()) {
COLLATERAL: foreach my $collateral ($product->getAllCollateral('variantsJSON')) {
next COLLATERAL unless exists $collateral->{sku};
$collateral->{varSku} = $collateral->{sku};
delete $collateral->{sku};
$product->setCollateral('variantsJSON', 'variantId', $collateral->{variantId}, $collateral);
}
}
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
sub migrateAssetsToNewConfigFormat {
my $session = shift;